com.stripe.model.LineItem Maven / Gradle / Ivy
// File generated from our OpenAPI spec
package com.stripe.model;
import com.google.gson.annotations.SerializedName;
import com.stripe.net.ApiResource;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/** A line item. */
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public class LineItem extends StripeObject implements HasId {
/** Total discount amount applied. If no discounts were applied, defaults to 0. */
@SerializedName("amount_discount")
Long amountDiscount;
/** Total before any discounts or taxes are applied. */
@SerializedName("amount_subtotal")
Long amountSubtotal;
/** Total tax amount applied. If no tax was applied, defaults to 0. */
@SerializedName("amount_tax")
Long amountTax;
/** Total after discounts and taxes. */
@SerializedName("amount_total")
Long amountTotal;
/**
* Three-letter ISO currency code,
* in lowercase. Must be a supported currency.
*/
@SerializedName("currency")
String currency;
/**
* An arbitrary string attached to the object. Often useful for displaying to users. Defaults to
* product name.
*/
@SerializedName("description")
String description;
/** The discounts applied to the line item. */
@SerializedName("discounts")
List discounts;
/** Unique identifier for the object. */
@Getter(onMethod_ = {@Override})
@SerializedName("id")
String id;
/**
* String representing the object's type. Objects of the same type share the same value.
*
* Equal to {@code item}.
*/
@SerializedName("object")
String object;
/** The price used to generate the line item. */
@SerializedName("price")
Price price;
/**
* The ID of the product for this line item.
*
*
This will always be the same as {@code price.product}.
*/
@SerializedName("product")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField product;
/** The quantity of products being purchased. */
@SerializedName("quantity")
Long quantity;
/** The taxes applied to the line item. */
@SerializedName("taxes")
List taxes;
/** Get ID of expandable {@code product} object. */
public String getProduct() {
return (this.product != null) ? this.product.getId() : null;
}
public void setProduct(String id) {
this.product = ApiResource.setExpandableFieldId(id, this.product);
}
/** Get expanded {@code product}. */
public Product getProductObject() {
return (this.product != null) ? this.product.getExpanded() : null;
}
public void setProductObject(Product expandableObject) {
this.product = new ExpandableField(expandableObject.getId(), expandableObject);
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Discount extends StripeObject {
/** The amount discounted. */
@SerializedName("amount")
Long amount;
/**
* A discount represents the actual application of a coupon or promotion code. It contains
* information about when the discount began, when it will end, and what it is applied to.
*
* Related guide: Applying
* discounts to subscriptions
*/
@SerializedName("discount")
com.stripe.model.Discount discount;
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Tax extends StripeObject {
/** Amount of tax applied for this rate. */
@SerializedName("amount")
Long amount;
/**
* Tax rates can be applied to invoices, subscriptions and Checkout
* Sessions to collect tax.
*
*
Related guide: Tax rates
*/
@SerializedName("rate")
TaxRate rate;
/**
* The reasoning behind this tax, for example, if the product is tax exempt. The possible values
* for this field may be extended as new tax rules are supported.
*
*
One of {@code customer_exempt}, {@code not_collecting}, {@code not_subject_to_tax}, {@code
* not_supported}, {@code portion_product_exempt}, {@code portion_reduced_rated}, {@code
* portion_standard_rated}, {@code product_exempt}, {@code product_exempt_holiday}, {@code
* proportionally_rated}, {@code reduced_rated}, {@code reverse_charge}, {@code standard_rated},
* {@code taxable_basis_reduced}, or {@code zero_rated}.
*/
@SerializedName("taxability_reason")
String taxabilityReason;
/** The amount on which tax is calculated, in cents (or local equivalent). */
@SerializedName("taxable_amount")
Long taxableAmount;
}
}