Skip to content

Commit

Permalink
Codegen for openapi v223
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe committed Feb 2, 2023
1 parent 188cee7 commit 5e8a36f
Show file tree
Hide file tree
Showing 22 changed files with 5,216 additions and 28 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v221
v223
75 changes: 75 additions & 0 deletions src/main/java/com/stripe/model/CreditNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public class CreditNote extends ApiResource implements HasId, MetadataStore<Cred
@SerializedName("amount")
Long amount;

/** This is the sum of all the shipping amounts. */
@SerializedName("amount_shipping")
Long amountShipping;

/** Time at which the object was created. Measured in seconds since the Unix epoch. */
@SerializedName("created")
Long created;
Expand Down Expand Up @@ -134,6 +138,10 @@ public class CreditNote extends ApiResource implements HasId, MetadataStore<Cred
@Setter(lombok.AccessLevel.NONE)
ExpandableField<Refund> refund;

/** The details of the cost of shipping, including the ShippingRate applied to the invoice. */
@SerializedName("shipping_cost")
ShippingCost shippingCost;

/**
* Status of this credit note, one of {@code issued} or {@code void}. Learn more about <a
* href="https://stripe.com/docs/billing/invoices/credit-notes#voiding">voiding credit notes</a>.
Expand Down Expand Up @@ -592,6 +600,73 @@ public void setDiscountObject(Discount expandableObject) {
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class ShippingCost extends StripeObject {
/** Total shipping cost before any taxes are applied. */
@SerializedName("amount_subtotal")
Long amountSubtotal;

/** Total tax amount applied due to shipping costs. If no tax was applied, defaults to 0. */
@SerializedName("amount_tax")
Long amountTax;

/** Total shipping cost after taxes are applied. */
@SerializedName("amount_total")
Long amountTotal;

/** The ID of the ShippingRate for this invoice. */
@SerializedName("shipping_rate")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<ShippingRate> shippingRate;

/** The taxes applied to the shipping rate. */
@SerializedName("taxes")
List<CreditNote.ShippingCost.Tax> taxes;

/** Get ID of expandable {@code shippingRate} object. */
public String getShippingRate() {
return (this.shippingRate != null) ? this.shippingRate.getId() : null;
}

public void setShippingRate(String id) {
this.shippingRate = ApiResource.setExpandableFieldId(id, this.shippingRate);
}

/** Get expanded {@code shippingRate}. */
public ShippingRate getShippingRateObject() {
return (this.shippingRate != null) ? this.shippingRate.getExpanded() : null;
}

public void setShippingRateObject(ShippingRate expandableObject) {
this.shippingRate =
new ExpandableField<ShippingRate>(expandableObject.getId(), expandableObject);
}

@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 <a
* href="https://stripe.com/docs/billing/invoices/tax-rates">invoices</a>, <a
* href="https://stripe.com/docs/billing/subscriptions/taxes">subscriptions</a> and <a
* href="https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates">Checkout
* Sessions</a> to collect tax.
*
* <p>Related guide: <a href="https://stripe.com/docs/billing/taxes/tax-rates">Tax Rates</a>.
*/
@SerializedName("rate")
TaxRate rate;
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
Expand Down
82 changes: 82 additions & 0 deletions src/main/java/com/stripe/model/Invoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ public class Invoice extends ApiResource implements HasId, MetadataStore<Invoice
@SerializedName("amount_remaining")
Long amountRemaining;

/** This is the sum of all the shipping amounts. */
@SerializedName("amount_shipping")
Long amountShipping;

/** ID of the Connect Application that created the invoice. */
@SerializedName("application")
@Getter(lombok.AccessLevel.NONE)
Expand Down Expand Up @@ -474,6 +478,17 @@ public class Invoice extends ApiResource implements HasId, MetadataStore<Invoice
@SerializedName("rendering_options")
RenderingOptions renderingOptions;

/** The details of the cost of shipping, including the ShippingRate applied on the invoice. */
@SerializedName("shipping_cost")
ShippingCost shippingCost;

/**
* Shipping details for the invoice. The Invoice PDF will use the {@code shipping_details} value
* if it is set, otherwise the PDF will render the shipping address from the customer.
*/
@SerializedName("shipping_details")
ShippingDetails shippingDetails;

/**
* Starting customer balance before the invoice is finalized. If the invoice has not been
* finalized yet, this will be the current customer balance. For revision invoices, this also
Expand Down Expand Up @@ -2001,6 +2016,73 @@ public static class RenderingOptions extends StripeObject {
String amountTaxDisplay;
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class ShippingCost extends StripeObject {
/** Total shipping cost before any taxes are applied. */
@SerializedName("amount_subtotal")
Long amountSubtotal;

/** Total tax amount applied due to shipping costs. If no tax was applied, defaults to 0. */
@SerializedName("amount_tax")
Long amountTax;

/** Total shipping cost after taxes are applied. */
@SerializedName("amount_total")
Long amountTotal;

/** The ID of the ShippingRate for this invoice. */
@SerializedName("shipping_rate")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<ShippingRate> shippingRate;

/** The taxes applied to the shipping rate. */
@SerializedName("taxes")
List<Invoice.ShippingCost.Tax> taxes;

/** Get ID of expandable {@code shippingRate} object. */
public String getShippingRate() {
return (this.shippingRate != null) ? this.shippingRate.getId() : null;
}

public void setShippingRate(String id) {
this.shippingRate = ApiResource.setExpandableFieldId(id, this.shippingRate);
}

/** Get expanded {@code shippingRate}. */
public ShippingRate getShippingRateObject() {
return (this.shippingRate != null) ? this.shippingRate.getExpanded() : null;
}

public void setShippingRateObject(ShippingRate expandableObject) {
this.shippingRate =
new ExpandableField<ShippingRate>(expandableObject.getId(), expandableObject);
}

@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 <a
* href="https://stripe.com/docs/billing/invoices/tax-rates">invoices</a>, <a
* href="https://stripe.com/docs/billing/subscriptions/taxes">subscriptions</a> and <a
* href="https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates">Checkout
* Sessions</a> to collect tax.
*
* <p>Related guide: <a href="https://stripe.com/docs/billing/taxes/tax-rates">Tax Rates</a>.
*/
@SerializedName("rate")
TaxRate rate;
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
Expand Down
119 changes: 119 additions & 0 deletions src/main/java/com/stripe/model/PaymentLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
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;
Expand Down Expand Up @@ -101,6 +102,10 @@ public class PaymentLink extends ApiResource implements HasId, MetadataStore<Pay
@SerializedName("id")
String id;

/** Configuration for creating invoice for payment mode payment links. */
@SerializedName("invoice_creation")
InvoiceCreation invoiceCreation;

/** The line items representing what is being sold. */
@SerializedName("line_items")
LineItemCollection lineItems;
Expand Down Expand Up @@ -502,6 +507,120 @@ public static class Submit extends StripeObject {
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class InvoiceCreation extends StripeObject {
/** Enable creating an invoice on successful payment. */
@SerializedName("enabled")
Boolean enabled;

/** Configuration for the invoice. Default invoice values will be used if unspecified. */
@SerializedName("invoice_data")
InvoiceData invoiceData;

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class InvoiceData extends StripeObject {
/** The account tax IDs associated with the invoice. */
@SerializedName("account_tax_ids")
List<ExpandableField<TaxId>> accountTaxIds;

/** A list of up to 4 custom fields to be displayed on the invoice. */
@SerializedName("custom_fields")
List<PaymentLink.InvoiceCreation.InvoiceData.CustomField> customFields;

/** An arbitrary string attached to the object. Often useful for displaying to users. */
@SerializedName("description")
String description;

/** Footer to be displayed on the invoice. */
@SerializedName("footer")
String footer;

/**
* Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
* attach to an object. This can be useful for storing additional information about the object
* in a structured format.
*/
@SerializedName("metadata")
Map<String, String> metadata;

/** Options for invoice PDF rendering. */
@SerializedName("rendering_options")
RenderingOptions renderingOptions;

/** Get IDs of expandable {@code accountTaxIds} object list. */
public List<String> getAccountTaxIds() {
return (this.accountTaxIds != null)
? this.accountTaxIds.stream().map(x -> x.getId()).collect(Collectors.toList())
: null;
}

public void setAccountTaxIds(List<String> ids) {
if (ids == null) {
this.accountTaxIds = null;
return;
}
if (this.accountTaxIds != null
&& this.accountTaxIds.stream()
.map(x -> x.getId())
.collect(Collectors.toList())
.equals(ids)) {
// noop if the ids are equal to what are already present
return;
}
this.accountTaxIds =
(ids != null)
? ids.stream()
.map(id -> new ExpandableField<TaxId>(id, null))
.collect(Collectors.toList())
: null;
}

/** Get expanded {@code accountTaxIds}. */
public List<TaxId> getAccountTaxIdObjects() {
return (this.accountTaxIds != null)
? this.accountTaxIds.stream().map(x -> x.getExpanded()).collect(Collectors.toList())
: null;
}

public void setAccountTaxIdObjects(List<TaxId> objs) {
this.accountTaxIds =
objs != null
? objs.stream()
.map(x -> new ExpandableField<TaxId>(x.getId(), x))
.collect(Collectors.toList())
: null;
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class CustomField extends StripeObject {
/** The name of the custom field. */
@SerializedName("name")
String name;

/** The value of the custom field. */
@SerializedName("value")
String value;
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class RenderingOptions extends StripeObject {
/**
* How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
*/
@SerializedName("amount_tax_display")
String amountTaxDisplay;
}
}
}

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
Expand Down
Loading

0 comments on commit 5e8a36f

Please sign in to comment.