All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.stripe.model.InvoiceLineItem Maven / Gradle / Ivy

There is a newer version: 28.2.0
Show newest version
// File generated from our OpenAPI spec
package com.stripe.model;

import com.google.gson.annotations.SerializedName;
import com.stripe.net.ApiResource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public class InvoiceLineItem extends StripeObject implements HasId {
  /** The amount, in %s. */
  @SerializedName("amount")
  Long amount;

  /**
   * The integer amount in %s representing the amount for this line item, excluding all tax and
   * discounts.
   */
  @SerializedName("amount_excluding_tax")
  Long amountExcludingTax;

  /**
   * 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. */
  @SerializedName("description")
  String description;

  /** The amount of discount calculated per discount for this line item. */
  @SerializedName("discount_amounts")
  List discountAmounts;

  /** If true, discounts will apply to this line item. Always false for prorations. */
  @SerializedName("discountable")
  Boolean discountable;

  /**
   * The discounts applied to the invoice line item. Line item discounts are applied before invoice
   * discounts. Use {@code expand[]=discounts} to expand each discount.
   */
  @SerializedName("discounts")
  List> discounts;

  /** Unique identifier for the object. */
  @Getter(onMethod_ = {@Override})
  @SerializedName("id")
  String id;

  /**
   * The ID of the invoice item associated
   * with this line item if any.
   */
  @SerializedName("invoice_item")
  String invoiceItem;

  /**
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
   * object exists in test mode.
   */
  @SerializedName("livemode")
  Boolean livemode;

  /**
   * Set of key-value pairs that you can attach
   * to an object. This can be useful for storing additional information about the object in a
   * structured format. Note that for line items with {@code type=subscription} this will reflect
   * the metadata of the subscription that caused the line item to be created.
   */
  @SerializedName("metadata")
  Map metadata;

  /**
   * String representing the object's type. Objects of the same type share the same value.
   *
   * 

Equal to {@code line_item}. */ @SerializedName("object") String object; @SerializedName("period") Period period; /** The plan of the subscription, if the line item is a subscription or a proration. */ @SerializedName("plan") Plan plan; /** The price of the line item. */ @SerializedName("price") Price price; /** Whether this is a proration. */ @SerializedName("proration") Boolean proration; /** Additional details for proration line items. */ @SerializedName("proration_details") ProrationDetails prorationDetails; /** The quantity of the subscription, if the line item is a subscription or a proration. */ @SerializedName("quantity") Long quantity; /** The subscription that the invoice item pertains to, if any. */ @SerializedName("subscription") String subscription; /** * The subscription item that generated this line item. Left empty if the line item is not an * explicit result of a subscription. */ @SerializedName("subscription_item") String subscriptionItem; /** The amount of tax calculated per tax rate for this line item. */ @SerializedName("tax_amounts") List taxAmounts; /** The tax rates which apply to the line item. */ @SerializedName("tax_rates") List taxRates; /** * A string identifying the type of the source of this line item, either an {@code invoiceitem} or * a {@code subscription}. * *

One of {@code invoiceitem}, or {@code subscription}. */ @SerializedName("type") String type; /** * The amount in %s representing the unit amount for this line item, excluding all tax and * discounts. */ @SerializedName("unit_amount_excluding_tax") BigDecimal unitAmountExcludingTax; /** Get IDs of expandable {@code discounts} object list. */ public List getDiscounts() { return (this.discounts != null) ? this.discounts.stream().map(x -> x.getId()).collect(Collectors.toList()) : null; } public void setDiscounts(List ids) { if (ids == null) { this.discounts = null; return; } if (this.discounts != null && this.discounts.stream().map(x -> x.getId()).collect(Collectors.toList()).equals(ids)) { // noop if the ids are equal to what are already present return; } this.discounts = (ids != null) ? ids.stream() .map(id -> new ExpandableField(id, null)) .collect(Collectors.toList()) : null; } /** Get expanded {@code discounts}. */ public List getDiscountObjects() { return (this.discounts != null) ? this.discounts.stream().map(x -> x.getExpanded()).collect(Collectors.toList()) : null; } public void setDiscountObjects(List objs) { this.discounts = objs != null ? objs.stream() .map(x -> new ExpandableField(x.getId(), x)) .collect(Collectors.toList()) : null; } @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class DiscountAmount extends StripeObject { /** The amount, in %s, of the discount. */ @SerializedName("amount") Long amount; /** The discount that was applied to get this discount amount. */ @SerializedName("discount") @Getter(lombok.AccessLevel.NONE) @Setter(lombok.AccessLevel.NONE) ExpandableField discount; /** Get ID of expandable {@code discount} object. */ public String getDiscount() { return (this.discount != null) ? this.discount.getId() : null; } public void setDiscount(String id) { this.discount = ApiResource.setExpandableFieldId(id, this.discount); } /** Get expanded {@code discount}. */ public Discount getDiscountObject() { return (this.discount != null) ? this.discount.getExpanded() : null; } public void setDiscountObject(Discount expandableObject) { this.discount = new ExpandableField(expandableObject.getId(), expandableObject); } } @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class Period extends StripeObject { /** * The end of the period, which must be greater than or equal to the start. This value is * inclusive. */ @SerializedName("end") Long end; /** The start of the period. This value is inclusive. */ @SerializedName("start") Long start; } @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class ProrationDetails extends StripeObject { /** * For a credit proration {@code line_item}, the original debit line_items to which the credit * proration applies. */ @SerializedName("credited_items") CreditedItems creditedItems; @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class CreditedItems extends StripeObject { /** Invoice containing the credited invoice line items. */ @SerializedName("invoice") String invoice; /** Credited invoice line items. */ @SerializedName("invoice_line_items") List invoiceLineItems; } } @Getter @Setter @EqualsAndHashCode(callSuper = false) public static class TaxAmount extends StripeObject { /** The amount, in %s, of the tax. */ @SerializedName("amount") Long amount; /** Whether this tax amount is inclusive or exclusive. */ @SerializedName("inclusive") Boolean inclusive; /** The tax rate that was applied to get this tax amount. */ @SerializedName("tax_rate") @Getter(lombok.AccessLevel.NONE) @Setter(lombok.AccessLevel.NONE) ExpandableField taxRate; /** * 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 %s. */ @SerializedName("taxable_amount") Long taxableAmount; /** Get ID of expandable {@code taxRate} object. */ public String getTaxRate() { return (this.taxRate != null) ? this.taxRate.getId() : null; } public void setTaxRate(String id) { this.taxRate = ApiResource.setExpandableFieldId(id, this.taxRate); } /** Get expanded {@code taxRate}. */ public TaxRate getTaxRateObject() { return (this.taxRate != null) ? this.taxRate.getExpanded() : null; } public void setTaxRateObject(TaxRate expandableObject) { this.taxRate = new ExpandableField(expandableObject.getId(), expandableObject); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy