From 9ff621a2d7d351c7a264d6e9af1bafe88419c6cf Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:16:55 +0000 Subject: [PATCH 01/15] Update generated code for v656 --- OPENAPI_VERSION | 2 +- .../param/AccountSessionCreateParams.java | 321 ++++++++++++++++++ 2 files changed, 322 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 341fbefcb59..bd17f87fde7 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v655 \ No newline at end of file +v656 \ No newline at end of file diff --git a/src/main/java/com/stripe/param/AccountSessionCreateParams.java b/src/main/java/com/stripe/param/AccountSessionCreateParams.java index 70e29c045da..a0e22704316 100644 --- a/src/main/java/com/stripe/param/AccountSessionCreateParams.java +++ b/src/main/java/com/stripe/param/AccountSessionCreateParams.java @@ -147,6 +147,14 @@ public static class Components { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; + /** Configuration for the issuing card component. */ + @SerializedName("issuing_card") + IssuingCard issuingCard; + + /** Configuration for the issuing cards list component. */ + @SerializedName("issuing_cards_list") + IssuingCardsList issuingCardsList; + /** Configuration for the payment details embedded component. */ @SerializedName("payment_details") PaymentDetails paymentDetails; @@ -162,11 +170,15 @@ public static class Components { private Components( AccountOnboarding accountOnboarding, Map extraParams, + IssuingCard issuingCard, + IssuingCardsList issuingCardsList, PaymentDetails paymentDetails, Payments payments, Payouts payouts) { this.accountOnboarding = accountOnboarding; this.extraParams = extraParams; + this.issuingCard = issuingCard; + this.issuingCardsList = issuingCardsList; this.paymentDetails = paymentDetails; this.payments = payments; this.payouts = payouts; @@ -181,6 +193,10 @@ public static class Builder { private Map extraParams; + private IssuingCard issuingCard; + + private IssuingCardsList issuingCardsList; + private PaymentDetails paymentDetails; private Payments payments; @@ -192,6 +208,8 @@ public AccountSessionCreateParams.Components build() { return new AccountSessionCreateParams.Components( this.accountOnboarding, this.extraParams, + this.issuingCard, + this.issuingCardsList, this.paymentDetails, this.payments, this.payouts); @@ -230,6 +248,19 @@ public Builder putAllExtraParam(Map map) { return this; } + /** Configuration for the issuing card component. */ + public Builder setIssuingCard(AccountSessionCreateParams.Components.IssuingCard issuingCard) { + this.issuingCard = issuingCard; + return this; + } + + /** Configuration for the issuing cards list component. */ + public Builder setIssuingCardsList( + AccountSessionCreateParams.Components.IssuingCardsList issuingCardsList) { + this.issuingCardsList = issuingCardsList; + return this; + } + /** Configuration for the payment details embedded component. */ public Builder setPaymentDetails( AccountSessionCreateParams.Components.PaymentDetails paymentDetails) { @@ -397,6 +428,296 @@ public Builder putAllExtraParam(Map map) { } } + @Getter + public static class IssuingCard { + /** Required. Whether the embedded component is enabled. */ + @SerializedName("enabled") + Boolean enabled; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** The list of features enabled in the embedded component. */ + @SerializedName("features") + Features features; + + private IssuingCard(Boolean enabled, Map extraParams, Features features) { + this.enabled = enabled; + this.extraParams = extraParams; + this.features = features; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Boolean enabled; + + private Map extraParams; + + private Features features; + + /** Finalize and obtain parameter instance from this builder. */ + public AccountSessionCreateParams.Components.IssuingCard build() { + return new AccountSessionCreateParams.Components.IssuingCard( + this.enabled, this.extraParams, this.features); + } + + /** Required. Whether the embedded component is enabled. */ + public Builder setEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountSessionCreateParams.Components.IssuingCard#extraParams} for the + * field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountSessionCreateParams.Components.IssuingCard#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** The list of features enabled in the embedded component. */ + public Builder setFeatures( + AccountSessionCreateParams.Components.IssuingCard.Features features) { + this.features = features; + return this; + } + } + + @Getter + public static class Features { + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field + * (serialized) name in this param object. Effectively, this map is flattened to its parent + * instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private Features(Map extraParams) { + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public AccountSessionCreateParams.Components.IssuingCard.Features build() { + return new AccountSessionCreateParams.Components.IssuingCard.Features(this.extraParams); + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountSessionCreateParams.Components.IssuingCard.Features#extraParams} + * for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountSessionCreateParams.Components.IssuingCard.Features#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } + } + + @Getter + public static class IssuingCardsList { + /** Required. Whether the embedded component is enabled. */ + @SerializedName("enabled") + Boolean enabled; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** The list of features enabled in the embedded component. */ + @SerializedName("features") + Features features; + + private IssuingCardsList( + Boolean enabled, Map extraParams, Features features) { + this.enabled = enabled; + this.extraParams = extraParams; + this.features = features; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Boolean enabled; + + private Map extraParams; + + private Features features; + + /** Finalize and obtain parameter instance from this builder. */ + public AccountSessionCreateParams.Components.IssuingCardsList build() { + return new AccountSessionCreateParams.Components.IssuingCardsList( + this.enabled, this.extraParams, this.features); + } + + /** Required. Whether the embedded component is enabled. */ + public Builder setEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountSessionCreateParams.Components.IssuingCardsList#extraParams} for + * the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountSessionCreateParams.Components.IssuingCardsList#extraParams} for + * the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** The list of features enabled in the embedded component. */ + public Builder setFeatures( + AccountSessionCreateParams.Components.IssuingCardsList.Features features) { + this.features = features; + return this; + } + } + + @Getter + public static class Features { + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field + * (serialized) name in this param object. Effectively, this map is flattened to its parent + * instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private Features(Map extraParams) { + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public AccountSessionCreateParams.Components.IssuingCardsList.Features build() { + return new AccountSessionCreateParams.Components.IssuingCardsList.Features( + this.extraParams); + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link + * AccountSessionCreateParams.Components.IssuingCardsList.Features#extraParams} for the + * field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link + * AccountSessionCreateParams.Components.IssuingCardsList.Features#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } + } + @Getter public static class PaymentDetails { /** Required. Whether the embedded component is enabled. */ From 784783add0334f66783f85920a1589ae88181c89 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 10:21:31 +0000 Subject: [PATCH 02/15] Update generated code for v657 --- OPENAPI_VERSION | 2 +- .../com/stripe/model/checkout/Session.java | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index bd17f87fde7..26c2426487d 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v656 \ No newline at end of file +v657 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/checkout/Session.java b/src/main/java/com/stripe/model/checkout/Session.java index 2d053e2d705..ec28e628d4f 100644 --- a/src/main/java/com/stripe/model/checkout/Session.java +++ b/src/main/java/com/stripe/model/checkout/Session.java @@ -1420,6 +1420,9 @@ public static class PaymentMethodOptions extends StripeObject { @SerializedName("paynow") Paynow paynow; + @SerializedName("paypal") + Paypal paypal; + @SerializedName("pix") Pix pix; @@ -2155,6 +2158,60 @@ public static class Paynow extends StripeObject { String setupFutureUsage; } + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Paypal extends StripeObject { + /** + * Controls when the funds will be captured from the customer's account. + * + *

Equal to {@code manual}. + */ + @SerializedName("capture_method") + String captureMethod; + + /** Preferred locale of the PayPal checkout page that the customer is redirected to. */ + @SerializedName("preferred_locale") + String preferredLocale; + + /** + * A reference of the PayPal transaction visible to customer which is mapped to PayPal's + * invoice ID. This must be a globally unique ID if you have configured in your PayPal + * settings to block multiple payments per invoice ID. + */ + @SerializedName("reference") + String reference; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + *

Providing this parameter will attach the payment method + * to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any + * required actions from the user are complete. If no Customer was provided, the payment + * method can still be attached to a Customer after + * the transaction completes. + * + *

When processing card payments, Stripe also uses {@code setup_future_usage} to + * dynamically optimize your payment flow and comply with regional legislation and network + * rules, such as SCA. + * + *

One of {@code none}, or {@code off_session}. + */ + @SerializedName("setup_future_usage") + String setupFutureUsage; + + /** + * The Stripe connected account IDs of the sellers on the platform for this transaction + * (optional). Only allowed when separate charges and + * transfers are used. + */ + @SerializedName("subsellers") + List subsellers; + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) From ef144bafefc4dd248e3e7f0b91167ddb1119bffe Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 19:17:05 +0000 Subject: [PATCH 03/15] Update generated code for v658 --- OPENAPI_VERSION | 2 +- src/main/java/com/stripe/model/Topup.java | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 26c2426487d..eee8847d6e5 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v657 \ No newline at end of file +v658 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/Topup.java b/src/main/java/com/stripe/model/Topup.java index 1522100bfb2..682e3606e49 100644 --- a/src/main/java/com/stripe/model/Topup.java +++ b/src/main/java/com/stripe/model/Topup.java @@ -105,11 +105,7 @@ public class Topup extends ApiResource implements MetadataStore, BalanceT @SerializedName("object") String object; - /** - * For most Stripe users, the source of every top-up is a bank account. This hash is then the source object describing that bank - * account. - */ + /** The source field is deprecated. It might not always be present in the API response. */ @SerializedName("source") Source source; From 24485673199077f5a9be882ab41931b323a8a92a Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:47:58 +0000 Subject: [PATCH 04/15] Update generated code for v659 --- OPENAPI_VERSION | 2 +- src/main/java/com/stripe/model/Price.java | 20 +++++++++++++++---- .../java/com/stripe/service/PriceService.java | 20 +++++++++++++++---- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index eee8847d6e5..50bdb862e31 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v658 \ No newline at end of file +v659 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/Price.java b/src/main/java/com/stripe/model/Price.java index cc3365d83d3..96efdc445cf 100644 --- a/src/main/java/com/stripe/model/Price.java +++ b/src/main/java/com/stripe/model/Price.java @@ -258,12 +258,18 @@ public static Price create(PriceCreateParams params, RequestOptions options) ApiMode.V1); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public static PriceCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public static PriceCollection list(Map params, RequestOptions options) throws StripeException { String path = "/v1/prices"; @@ -278,12 +284,18 @@ public static PriceCollection list(Map params, RequestOptions op ApiMode.V1); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public static PriceCollection list(PriceListParams params) throws StripeException { return list(params, (RequestOptions) null); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public static PriceCollection list(PriceListParams params, RequestOptions options) throws StripeException { String path = "/v1/prices"; diff --git a/src/main/java/com/stripe/service/PriceService.java b/src/main/java/com/stripe/service/PriceService.java index ba9a518bc1d..074e0829c8b 100644 --- a/src/main/java/com/stripe/service/PriceService.java +++ b/src/main/java/com/stripe/service/PriceService.java @@ -56,19 +56,31 @@ public StripeSearchResult search(PriceSearchParams params, RequestOptions options, ApiMode.V1); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public StripeCollection list(PriceListParams params) throws StripeException { return list(params, (RequestOptions) null); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public StripeCollection list(RequestOptions options) throws StripeException { return list((PriceListParams) null, options); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public StripeCollection list() throws StripeException { return list((PriceListParams) null, (RequestOptions) null); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public StripeCollection list(PriceListParams params, RequestOptions options) throws StripeException { String path = "/v1/prices"; From 6f836896a3bcfcb30e82f9a58281d73601c25477 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 17:54:42 +0000 Subject: [PATCH 05/15] Update generated code for v661 --- OPENAPI_VERSION | 2 +- src/main/java/com/stripe/model/Charge.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 50bdb862e31..af292e6247f 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v659 \ No newline at end of file +v661 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/Charge.java b/src/main/java/com/stripe/model/Charge.java index 9986f8de0bd..527d0ed9582 100644 --- a/src/main/java/com/stripe/model/Charge.java +++ b/src/main/java/com/stripe/model/Charge.java @@ -1578,6 +1578,13 @@ public static class Card extends StripeObject { @SerializedName("brand") String brand; + /** + * When using manual capture, a future timestamp at which the charge will be automatically + * refunded if uncaptured. + */ + @SerializedName("capture_before") + Long captureBefore; + /** Check results by Card networks on Card address and CVC at time of payment. */ @SerializedName("checks") Checks checks; From 1bed1367a2d76792d89faee28604010d6d3a9437 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 18:40:27 +0000 Subject: [PATCH 06/15] Update generated code for v662 --- OPENAPI_VERSION | 2 +- .../com/stripe/model/InvoiceLineItem.java | 95 +- .../stripe/param/CreditNoteCreateParams.java | 174 +- .../CreditNotePreviewLinesListParams.java | 176 +- .../stripe/param/CreditNotePreviewParams.java | 174 +- .../param/InvoiceLineItemUpdateParams.java | 1901 +++++++++++++++++ .../service/InvoiceLineItemService.java | 58 + 7 files changed, 2569 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/stripe/param/InvoiceLineItemUpdateParams.java diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index af292e6247f..4d1efaa339c 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v661 \ No newline at end of file +v662 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/InvoiceLineItem.java b/src/main/java/com/stripe/model/InvoiceLineItem.java index 3c8bed74bca..d495c7fa4f2 100644 --- a/src/main/java/com/stripe/model/InvoiceLineItem.java +++ b/src/main/java/com/stripe/model/InvoiceLineItem.java @@ -2,7 +2,14 @@ package com.stripe.model; import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.net.ApiMode; +import com.stripe.net.ApiRequestParams; import com.stripe.net.ApiResource; +import com.stripe.net.BaseAddress; +import com.stripe.net.RequestOptions; +import com.stripe.net.StripeResponseGetter; +import com.stripe.param.InvoiceLineItemUpdateParams; import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -14,7 +21,7 @@ @Getter @Setter @EqualsAndHashCode(callSuper = false) -public class InvoiceLineItem extends StripeObject implements HasId { +public class InvoiceLineItem extends ApiResource implements HasId, MetadataStore { /** The amount, in cents (or local equivalent). */ @SerializedName("amount") Long amount; @@ -90,6 +97,7 @@ public class InvoiceLineItem extends StripeObject implements HasId { * 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. */ + @Getter(onMethod_ = {@Override}) @SerializedName("metadata") Map metadata; @@ -301,6 +309,79 @@ public void setMarginObjects(List objs) { : null; } + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update(String invoice, Map params) throws StripeException { + return update(invoice, params, (RequestOptions) null); + } + + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update(String invoice, Map params, RequestOptions options) + throws StripeException { + String path = + String.format( + "/v1/invoices/%s/lines/%s", + ApiResource.urlEncodeId(invoice), ApiResource.urlEncodeId(this.getId())); + return getResponseGetter() + .request( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + params, + InvoiceLineItem.class, + options, + ApiMode.V1); + } + + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update(String invoice, InvoiceLineItemUpdateParams params) + throws StripeException { + return update(invoice, params, (RequestOptions) null); + } + + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update( + String invoice, InvoiceLineItemUpdateParams params, RequestOptions options) + throws StripeException { + String path = + String.format( + "/v1/invoices/%s/lines/%s", + ApiResource.urlEncodeId(invoice), ApiResource.urlEncodeId(this.getId())); + ApiResource.checkNullTypedParams(path, params); + return getResponseGetter() + .request( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + InvoiceLineItem.class, + options, + ApiMode.V1); + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -461,4 +542,16 @@ public void setTaxRateObject(TaxRate expandableObject) { this.taxRate = new ExpandableField(expandableObject.getId(), expandableObject); } } + + @Override + public void setResponseGetter(StripeResponseGetter responseGetter) { + super.setResponseGetter(responseGetter); + trySetResponseGetter(invoiceItem, responseGetter); + trySetResponseGetter(period, responseGetter); + trySetResponseGetter(plan, responseGetter); + trySetResponseGetter(price, responseGetter); + trySetResponseGetter(prorationDetails, responseGetter); + trySetResponseGetter(subscription, responseGetter); + trySetResponseGetter(subscriptionItem, responseGetter); + } } diff --git a/src/main/java/com/stripe/param/CreditNoteCreateParams.java b/src/main/java/com/stripe/param/CreditNoteCreateParams.java index 1dec40613ab..b3b6b4d80f0 100644 --- a/src/main/java/com/stripe/param/CreditNoteCreateParams.java +++ b/src/main/java/com/stripe/param/CreditNoteCreateParams.java @@ -441,9 +441,16 @@ public static class Line { @SerializedName("quantity") Long quantity; + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + @SerializedName("tax_amounts") + Object taxAmounts; + /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ @SerializedName("tax_rates") Object taxRates; @@ -477,6 +484,7 @@ private Line( Map extraParams, String invoiceLineItem, Long quantity, + Object taxAmounts, Object taxRates, Type type, Long unitAmount, @@ -486,6 +494,7 @@ private Line( this.extraParams = extraParams; this.invoiceLineItem = invoiceLineItem; this.quantity = quantity; + this.taxAmounts = taxAmounts; this.taxRates = taxRates; this.type = type; this.unitAmount = unitAmount; @@ -507,6 +516,8 @@ public static class Builder { private Long quantity; + private Object taxAmounts; + private Object taxRates; private Type type; @@ -523,6 +534,7 @@ public CreditNoteCreateParams.Line build() { this.extraParams, this.invoiceLineItem, this.quantity, + this.taxAmounts, this.taxRates, this.type, this.unitAmount, @@ -587,6 +599,52 @@ public Builder setQuantity(Long quantity) { return this; } + /** + * Add an element to `taxAmounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * CreditNoteCreateParams.Line#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addTaxAmount(CreditNoteCreateParams.Line.TaxAmount element) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).add(element); + return this; + } + + /** + * Add all elements to `taxAmounts` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * CreditNoteCreateParams.Line#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllTaxAmount(List elements) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).addAll(elements); + return this; + } + + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + public Builder setTaxAmounts(EmptyParam taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + public Builder setTaxAmounts(List taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + /** * Add an element to `taxRates` list. A list is initialized for the first `add/addAll` call, * and subsequent calls adds additional elements to the original list. See {@link @@ -617,7 +675,7 @@ public Builder addAllTaxRate(List elements) { /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ public Builder setTaxRates(EmptyParam taxRates) { this.taxRates = taxRates; @@ -626,7 +684,7 @@ public Builder setTaxRates(EmptyParam taxRates) { /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ public Builder setTaxRates(List taxRates) { this.taxRates = taxRates; @@ -663,6 +721,116 @@ public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) { } } + @Getter + public static class TaxAmount { + /** Required. The amount, in cents (or local equivalent), of the tax. */ + @SerializedName("amount") + Long amount; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. The id of the tax rate for this tax amount. The tax rate must + * have been automatically created by Stripe. + */ + @SerializedName("tax_rate") + String taxRate; + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + @SerializedName("taxable_amount") + Long taxableAmount; + + private TaxAmount( + Long amount, Map extraParams, String taxRate, Long taxableAmount) { + this.amount = amount; + this.extraParams = extraParams; + this.taxRate = taxRate; + this.taxableAmount = taxableAmount; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long amount; + + private Map extraParams; + + private String taxRate; + + private Long taxableAmount; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditNoteCreateParams.Line.TaxAmount build() { + return new CreditNoteCreateParams.Line.TaxAmount( + this.amount, this.extraParams, this.taxRate, this.taxableAmount); + } + + /** Required. The amount, in cents (or local equivalent), of the tax. */ + public Builder setAmount(Long amount) { + this.amount = amount; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CreditNoteCreateParams.Line.TaxAmount#extraParams} for the field + * documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CreditNoteCreateParams.Line.TaxAmount#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Required. The id of the tax rate for this tax amount. The tax rate must + * have been automatically created by Stripe. + */ + public Builder setTaxRate(String taxRate) { + this.taxRate = taxRate; + return this; + } + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + public Builder setTaxableAmount(Long taxableAmount) { + this.taxableAmount = taxableAmount; + return this; + } + } + } + public enum Type implements ApiRequestParams.EnumParam { @SerializedName("custom_line_item") CUSTOM_LINE_ITEM("custom_line_item"), diff --git a/src/main/java/com/stripe/param/CreditNotePreviewLinesListParams.java b/src/main/java/com/stripe/param/CreditNotePreviewLinesListParams.java index b591ac86735..aab971ec491 100644 --- a/src/main/java/com/stripe/param/CreditNotePreviewLinesListParams.java +++ b/src/main/java/com/stripe/param/CreditNotePreviewLinesListParams.java @@ -512,9 +512,16 @@ public static class Line { @SerializedName("quantity") Long quantity; + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + @SerializedName("tax_amounts") + Object taxAmounts; + /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ @SerializedName("tax_rates") Object taxRates; @@ -548,6 +555,7 @@ private Line( Map extraParams, String invoiceLineItem, Long quantity, + Object taxAmounts, Object taxRates, Type type, Long unitAmount, @@ -557,6 +565,7 @@ private Line( this.extraParams = extraParams; this.invoiceLineItem = invoiceLineItem; this.quantity = quantity; + this.taxAmounts = taxAmounts; this.taxRates = taxRates; this.type = type; this.unitAmount = unitAmount; @@ -578,6 +587,8 @@ public static class Builder { private Long quantity; + private Object taxAmounts; + private Object taxRates; private Type type; @@ -594,6 +605,7 @@ public CreditNotePreviewLinesListParams.Line build() { this.extraParams, this.invoiceLineItem, this.quantity, + this.taxAmounts, this.taxRates, this.type, this.unitAmount, @@ -658,6 +670,54 @@ public Builder setQuantity(Long quantity) { return this; } + /** + * Add an element to `taxAmounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * CreditNotePreviewLinesListParams.Line#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addTaxAmount(CreditNotePreviewLinesListParams.Line.TaxAmount element) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).add(element); + return this; + } + + /** + * Add all elements to `taxAmounts` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * CreditNotePreviewLinesListParams.Line#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllTaxAmount( + List elements) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).addAll(elements); + return this; + } + + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + public Builder setTaxAmounts(EmptyParam taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + public Builder setTaxAmounts( + List taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + /** * Add an element to `taxRates` list. A list is initialized for the first `add/addAll` call, * and subsequent calls adds additional elements to the original list. See {@link @@ -688,7 +748,7 @@ public Builder addAllTaxRate(List elements) { /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ public Builder setTaxRates(EmptyParam taxRates) { this.taxRates = taxRates; @@ -697,7 +757,7 @@ public Builder setTaxRates(EmptyParam taxRates) { /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ public Builder setTaxRates(List taxRates) { this.taxRates = taxRates; @@ -734,6 +794,116 @@ public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) { } } + @Getter + public static class TaxAmount { + /** Required. The amount, in cents (or local equivalent), of the tax. */ + @SerializedName("amount") + Long amount; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. The id of the tax rate for this tax amount. The tax rate must + * have been automatically created by Stripe. + */ + @SerializedName("tax_rate") + String taxRate; + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + @SerializedName("taxable_amount") + Long taxableAmount; + + private TaxAmount( + Long amount, Map extraParams, String taxRate, Long taxableAmount) { + this.amount = amount; + this.extraParams = extraParams; + this.taxRate = taxRate; + this.taxableAmount = taxableAmount; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long amount; + + private Map extraParams; + + private String taxRate; + + private Long taxableAmount; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditNotePreviewLinesListParams.Line.TaxAmount build() { + return new CreditNotePreviewLinesListParams.Line.TaxAmount( + this.amount, this.extraParams, this.taxRate, this.taxableAmount); + } + + /** Required. The amount, in cents (or local equivalent), of the tax. */ + public Builder setAmount(Long amount) { + this.amount = amount; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CreditNotePreviewLinesListParams.Line.TaxAmount#extraParams} for the + * field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CreditNotePreviewLinesListParams.Line.TaxAmount#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Required. The id of the tax rate for this tax amount. The tax rate must + * have been automatically created by Stripe. + */ + public Builder setTaxRate(String taxRate) { + this.taxRate = taxRate; + return this; + } + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + public Builder setTaxableAmount(Long taxableAmount) { + this.taxableAmount = taxableAmount; + return this; + } + } + } + public enum Type implements ApiRequestParams.EnumParam { @SerializedName("custom_line_item") CUSTOM_LINE_ITEM("custom_line_item"), diff --git a/src/main/java/com/stripe/param/CreditNotePreviewParams.java b/src/main/java/com/stripe/param/CreditNotePreviewParams.java index ae2a25b6e89..b49083fce59 100644 --- a/src/main/java/com/stripe/param/CreditNotePreviewParams.java +++ b/src/main/java/com/stripe/param/CreditNotePreviewParams.java @@ -441,9 +441,16 @@ public static class Line { @SerializedName("quantity") Long quantity; + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + @SerializedName("tax_amounts") + Object taxAmounts; + /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ @SerializedName("tax_rates") Object taxRates; @@ -477,6 +484,7 @@ private Line( Map extraParams, String invoiceLineItem, Long quantity, + Object taxAmounts, Object taxRates, Type type, Long unitAmount, @@ -486,6 +494,7 @@ private Line( this.extraParams = extraParams; this.invoiceLineItem = invoiceLineItem; this.quantity = quantity; + this.taxAmounts = taxAmounts; this.taxRates = taxRates; this.type = type; this.unitAmount = unitAmount; @@ -507,6 +516,8 @@ public static class Builder { private Long quantity; + private Object taxAmounts; + private Object taxRates; private Type type; @@ -523,6 +534,7 @@ public CreditNotePreviewParams.Line build() { this.extraParams, this.invoiceLineItem, this.quantity, + this.taxAmounts, this.taxRates, this.type, this.unitAmount, @@ -587,6 +599,52 @@ public Builder setQuantity(Long quantity) { return this; } + /** + * Add an element to `taxAmounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * CreditNotePreviewParams.Line#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addTaxAmount(CreditNotePreviewParams.Line.TaxAmount element) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).add(element); + return this; + } + + /** + * Add all elements to `taxAmounts` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * CreditNotePreviewParams.Line#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllTaxAmount(List elements) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).addAll(elements); + return this; + } + + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + public Builder setTaxAmounts(EmptyParam taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + public Builder setTaxAmounts(List taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + /** * Add an element to `taxRates` list. A list is initialized for the first `add/addAll` call, * and subsequent calls adds additional elements to the original list. See {@link @@ -617,7 +675,7 @@ public Builder addAllTaxRate(List elements) { /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ public Builder setTaxRates(EmptyParam taxRates) { this.taxRates = taxRates; @@ -626,7 +684,7 @@ public Builder setTaxRates(EmptyParam taxRates) { /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ public Builder setTaxRates(List taxRates) { this.taxRates = taxRates; @@ -663,6 +721,116 @@ public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) { } } + @Getter + public static class TaxAmount { + /** Required. The amount, in cents (or local equivalent), of the tax. */ + @SerializedName("amount") + Long amount; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. The id of the tax rate for this tax amount. The tax rate must + * have been automatically created by Stripe. + */ + @SerializedName("tax_rate") + String taxRate; + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + @SerializedName("taxable_amount") + Long taxableAmount; + + private TaxAmount( + Long amount, Map extraParams, String taxRate, Long taxableAmount) { + this.amount = amount; + this.extraParams = extraParams; + this.taxRate = taxRate; + this.taxableAmount = taxableAmount; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long amount; + + private Map extraParams; + + private String taxRate; + + private Long taxableAmount; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditNotePreviewParams.Line.TaxAmount build() { + return new CreditNotePreviewParams.Line.TaxAmount( + this.amount, this.extraParams, this.taxRate, this.taxableAmount); + } + + /** Required. The amount, in cents (or local equivalent), of the tax. */ + public Builder setAmount(Long amount) { + this.amount = amount; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CreditNotePreviewParams.Line.TaxAmount#extraParams} for the field + * documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CreditNotePreviewParams.Line.TaxAmount#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Required. The id of the tax rate for this tax amount. The tax rate must + * have been automatically created by Stripe. + */ + public Builder setTaxRate(String taxRate) { + this.taxRate = taxRate; + return this; + } + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + public Builder setTaxableAmount(Long taxableAmount) { + this.taxableAmount = taxableAmount; + return this; + } + } + } + public enum Type implements ApiRequestParams.EnumParam { @SerializedName("custom_line_item") CUSTOM_LINE_ITEM("custom_line_item"), diff --git a/src/main/java/com/stripe/param/InvoiceLineItemUpdateParams.java b/src/main/java/com/stripe/param/InvoiceLineItemUpdateParams.java new file mode 100644 index 00000000000..d0dd15a8850 --- /dev/null +++ b/src/main/java/com/stripe/param/InvoiceLineItemUpdateParams.java @@ -0,0 +1,1901 @@ +// File generated from our OpenAPI spec +package com.stripe.param; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import com.stripe.param.common.EmptyParam; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class InvoiceLineItemUpdateParams extends ApiRequestParams { + /** + * The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming + * invoice. If you want to apply a credit to the customer's account, pass a negative amount. + */ + @SerializedName("amount") + Long amount; + + /** + * An arbitrary string which you can attach to the invoice item. The description is displayed in + * the invoice for easy tracking. + */ + @SerializedName("description") + Object description; + + /** + * Controls whether discounts apply to this line item. Defaults to false for prorations or + * negative line items, and true for all other line items. Cannot be set to true for prorations. + */ + @SerializedName("discountable") + Boolean discountable; + + /** + * The coupons & existing discounts which apply to the line item. Item discounts are applied + * before invoice discounts. Pass an empty string to remove previously-defined discounts. + */ + @SerializedName("discounts") + Object discounts; + + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * The IDs of the margins to apply to the line item. When set, the {@code default_margins} on the + * invoice do not apply to this line item. + */ + @SerializedName("margins") + Object margins; + + /** + * 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. Individual keys can be unset by posting an empty value to them. All keys can + * be unset by posting an empty value to {@code metadata}. + */ + @SerializedName("metadata") + Object metadata; + + /** + * The period associated with this invoice item. When set to different values, the period will be + * rendered on the invoice. If you have Stripe Revenue Recognition enabled, the + * period will be used to recognize and defer revenue. See the Revenue + * Recognition documentation for details. + */ + @SerializedName("period") + Period period; + + /** The ID of the price object. */ + @SerializedName("price") + Object price; + + /** + * Data used to generate a new Price object + * inline. + */ + @SerializedName("price_data") + PriceData priceData; + + /** Non-negative integer. The quantity of units for the line item. */ + @SerializedName("quantity") + Long quantity; + + /** + * A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes on + * your own or use a third-party to calculate them. You cannot set tax amounts if any line item + * has tax_rates + * or if the invoice has default_tax_rates + * or uses automatic tax. Pass an empty string + * to remove previously defined tax amounts. + */ + @SerializedName("tax_amounts") + Object taxAmounts; + + /** + * The tax rates which apply to the line item. When set, the {@code default_tax_rates} on the + * invoice do not apply to this line item. Pass an empty string to remove previously-defined tax + * rates. + */ + @SerializedName("tax_rates") + Object taxRates; + + private InvoiceLineItemUpdateParams( + Long amount, + Object description, + Boolean discountable, + Object discounts, + List expand, + Map extraParams, + Object margins, + Object metadata, + Period period, + Object price, + PriceData priceData, + Long quantity, + Object taxAmounts, + Object taxRates) { + this.amount = amount; + this.description = description; + this.discountable = discountable; + this.discounts = discounts; + this.expand = expand; + this.extraParams = extraParams; + this.margins = margins; + this.metadata = metadata; + this.period = period; + this.price = price; + this.priceData = priceData; + this.quantity = quantity; + this.taxAmounts = taxAmounts; + this.taxRates = taxRates; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long amount; + + private Object description; + + private Boolean discountable; + + private Object discounts; + + private List expand; + + private Map extraParams; + + private Object margins; + + private Object metadata; + + private Period period; + + private Object price; + + private PriceData priceData; + + private Long quantity; + + private Object taxAmounts; + + private Object taxRates; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams build() { + return new InvoiceLineItemUpdateParams( + this.amount, + this.description, + this.discountable, + this.discounts, + this.expand, + this.extraParams, + this.margins, + this.metadata, + this.period, + this.price, + this.priceData, + this.quantity, + this.taxAmounts, + this.taxRates); + } + + /** + * The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming + * invoice. If you want to apply a credit to the customer's account, pass a negative amount. + */ + public Builder setAmount(Long amount) { + this.amount = amount; + return this; + } + + /** + * An arbitrary string which you can attach to the invoice item. The description is displayed in + * the invoice for easy tracking. + */ + public Builder setDescription(String description) { + this.description = description; + return this; + } + + /** + * An arbitrary string which you can attach to the invoice item. The description is displayed in + * the invoice for easy tracking. + */ + public Builder setDescription(EmptyParam description) { + this.description = description; + return this; + } + + /** + * Controls whether discounts apply to this line item. Defaults to false for prorations or + * negative line items, and true for all other line items. Cannot be set to true for prorations. + */ + public Builder setDiscountable(Boolean discountable) { + this.discountable = discountable; + return this; + } + + /** + * Add an element to `discounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#discounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addDiscount(InvoiceLineItemUpdateParams.Discount element) { + if (this.discounts == null || this.discounts instanceof EmptyParam) { + this.discounts = new ArrayList(); + } + ((List) this.discounts).add(element); + return this; + } + + /** + * Add all elements to `discounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#discounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllDiscount(List elements) { + if (this.discounts == null || this.discounts instanceof EmptyParam) { + this.discounts = new ArrayList(); + } + ((List) this.discounts).addAll(elements); + return this; + } + + /** + * The coupons & existing discounts which apply to the line item. Item discounts are applied + * before invoice discounts. Pass an empty string to remove previously-defined discounts. + */ + public Builder setDiscounts(EmptyParam discounts) { + this.discounts = discounts; + return this; + } + + /** + * The coupons & existing discounts which apply to the line item. Item discounts are applied + * before invoice discounts. Pass an empty string to remove previously-defined discounts. + */ + public Builder setDiscounts(List discounts) { + this.discounts = discounts; + return this; + } + + /** + * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#expand} for the field documentation. + */ + public Builder addExpand(String element) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.add(element); + return this; + } + + /** + * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#expand} for the field documentation. + */ + public Builder addAllExpand(List elements) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.addAll(elements); + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link InvoiceLineItemUpdateParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Add an element to `margins` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#margins} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addMargin(String element) { + if (this.margins == null || this.margins instanceof EmptyParam) { + this.margins = new ArrayList(); + } + ((List) this.margins).add(element); + return this; + } + + /** + * Add all elements to `margins` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#margins} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllMargin(List elements) { + if (this.margins == null || this.margins instanceof EmptyParam) { + this.margins = new ArrayList(); + } + ((List) this.margins).addAll(elements); + return this; + } + + /** + * The IDs of the margins to apply to the line item. When set, the {@code default_margins} on + * the invoice do not apply to this line item. + */ + public Builder setMargins(EmptyParam margins) { + this.margins = margins; + return this; + } + + /** + * The IDs of the margins to apply to the line item. When set, the {@code default_margins} on + * the invoice do not apply to this line item. + */ + public Builder setMargins(List margins) { + this.margins = margins; + return this; + } + + /** + * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll` call, + * and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams#metadata} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder putMetadata(String key, String value) { + if (this.metadata == null || this.metadata instanceof EmptyParam) { + this.metadata = new HashMap(); + } + ((Map) this.metadata).put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `metadata` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link InvoiceLineItemUpdateParams#metadata} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder putAllMetadata(Map map) { + if (this.metadata == null || this.metadata instanceof EmptyParam) { + this.metadata = new HashMap(); + } + ((Map) this.metadata).putAll(map); + return this; + } + + /** + * 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. Individual keys can be unset by posting an empty value to them. All keys + * can be unset by posting an empty value to {@code metadata}. + */ + public Builder setMetadata(EmptyParam metadata) { + this.metadata = metadata; + return this; + } + + /** + * 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. Individual keys can be unset by posting an empty value to them. All keys + * can be unset by posting an empty value to {@code metadata}. + */ + public Builder setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * The period associated with this invoice item. When set to different values, the period will + * be rendered on the invoice. If you have Stripe Revenue Recognition enabled, + * the period will be used to recognize and defer revenue. See the Revenue + * Recognition documentation for details. + */ + public Builder setPeriod(InvoiceLineItemUpdateParams.Period period) { + this.period = period; + return this; + } + + /** The ID of the price object. */ + public Builder setPrice(String price) { + this.price = price; + return this; + } + + /** The ID of the price object. */ + public Builder setPrice(EmptyParam price) { + this.price = price; + return this; + } + + /** + * Data used to generate a new Price object + * inline. + */ + public Builder setPriceData(InvoiceLineItemUpdateParams.PriceData priceData) { + this.priceData = priceData; + return this; + } + + /** Non-negative integer. The quantity of units for the line item. */ + public Builder setQuantity(Long quantity) { + this.quantity = quantity; + return this; + } + + /** + * Add an element to `taxAmounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addTaxAmount(InvoiceLineItemUpdateParams.TaxAmount element) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).add(element); + return this; + } + + /** + * Add all elements to `taxAmounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllTaxAmount(List elements) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).addAll(elements); + return this; + } + + /** + * A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes + * on your own or use a third-party to calculate them. You cannot set tax amounts if any line + * item has tax_rates + * or if the invoice has default_tax_rates + * or uses automatic tax. Pass an empty + * string to remove previously defined tax amounts. + */ + public Builder setTaxAmounts(EmptyParam taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + + /** + * A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes + * on your own or use a third-party to calculate them. You cannot set tax amounts if any line + * item has tax_rates + * or if the invoice has default_tax_rates + * or uses automatic tax. Pass an empty + * string to remove previously defined tax amounts. + */ + public Builder setTaxAmounts(List taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + + /** + * Add an element to `taxRates` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#taxRates} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addTaxRate(String element) { + if (this.taxRates == null || this.taxRates instanceof EmptyParam) { + this.taxRates = new ArrayList(); + } + ((List) this.taxRates).add(element); + return this; + } + + /** + * Add all elements to `taxRates` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#taxRates} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllTaxRate(List elements) { + if (this.taxRates == null || this.taxRates instanceof EmptyParam) { + this.taxRates = new ArrayList(); + } + ((List) this.taxRates).addAll(elements); + return this; + } + + /** + * The tax rates which apply to the line item. When set, the {@code default_tax_rates} on the + * invoice do not apply to this line item. Pass an empty string to remove previously-defined tax + * rates. + */ + public Builder setTaxRates(EmptyParam taxRates) { + this.taxRates = taxRates; + return this; + } + + /** + * The tax rates which apply to the line item. When set, the {@code default_tax_rates} on the + * invoice do not apply to this line item. Pass an empty string to remove previously-defined tax + * rates. + */ + public Builder setTaxRates(List taxRates) { + this.taxRates = taxRates; + return this; + } + } + + @Getter + public static class Discount { + /** ID of the coupon to create a new discount for. */ + @SerializedName("coupon") + Object coupon; + + /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ + @SerializedName("discount") + Object discount; + + /** Details to determine how long the discount should be applied for. */ + @SerializedName("discount_end") + DiscountEnd discountEnd; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private Discount( + Object coupon, Object discount, DiscountEnd discountEnd, Map extraParams) { + this.coupon = coupon; + this.discount = discount; + this.discountEnd = discountEnd; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object coupon; + + private Object discount; + + private DiscountEnd discountEnd; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.Discount build() { + return new InvoiceLineItemUpdateParams.Discount( + this.coupon, this.discount, this.discountEnd, this.extraParams); + } + + /** ID of the coupon to create a new discount for. */ + public Builder setCoupon(String coupon) { + this.coupon = coupon; + return this; + } + + /** ID of the coupon to create a new discount for. */ + public Builder setCoupon(EmptyParam coupon) { + this.coupon = coupon; + return this; + } + + /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ + public Builder setDiscount(String discount) { + this.discount = discount; + return this; + } + + /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ + public Builder setDiscount(EmptyParam discount) { + this.discount = discount; + return this; + } + + /** Details to determine how long the discount should be applied for. */ + public Builder setDiscountEnd(InvoiceLineItemUpdateParams.Discount.DiscountEnd discountEnd) { + this.discountEnd = discountEnd; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams.Discount#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link InvoiceLineItemUpdateParams.Discount#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + + @Getter + public static class DiscountEnd { + /** Time span for the redeemed discount. */ + @SerializedName("duration") + Duration duration; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** A precise Unix timestamp for the discount to end. Must be in the future. */ + @SerializedName("timestamp") + Long timestamp; + + /** + * Required. The type of calculation made to determine when the discount + * ends. + */ + @SerializedName("type") + Type type; + + private DiscountEnd( + Duration duration, Map extraParams, Long timestamp, Type type) { + this.duration = duration; + this.extraParams = extraParams; + this.timestamp = timestamp; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Duration duration; + + private Map extraParams; + + private Long timestamp; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.Discount.DiscountEnd build() { + return new InvoiceLineItemUpdateParams.Discount.DiscountEnd( + this.duration, this.extraParams, this.timestamp, this.type); + } + + /** Time span for the redeemed discount. */ + public Builder setDuration( + InvoiceLineItemUpdateParams.Discount.DiscountEnd.Duration duration) { + this.duration = duration; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.Discount.DiscountEnd#extraParams} for the + * field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.Discount.DiscountEnd#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** A precise Unix timestamp for the discount to end. Must be in the future. */ + public Builder setTimestamp(Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Required. The type of calculation made to determine when the discount + * ends. + */ + public Builder setType(InvoiceLineItemUpdateParams.Discount.DiscountEnd.Type type) { + this.type = type; + return this; + } + } + + @Getter + public static class Duration { + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field + * (serialized) name in this param object. Effectively, this map is flattened to its parent + * instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. Specifies a type of interval unit. Either {@code day}, {@code + * week}, {@code month} or {@code year}. + */ + @SerializedName("interval") + Interval interval; + + /** + * Required. The number of intervals, as an whole number greater than 0. + * Stripe multiplies this by the interval type to get the overall duration. + */ + @SerializedName("interval_count") + Long intervalCount; + + private Duration(Map extraParams, Interval interval, Long intervalCount) { + this.extraParams = extraParams; + this.interval = interval; + this.intervalCount = intervalCount; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Interval interval; + + private Long intervalCount; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.Discount.DiscountEnd.Duration build() { + return new InvoiceLineItemUpdateParams.Discount.DiscountEnd.Duration( + this.extraParams, this.interval, this.intervalCount); + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.Discount.DiscountEnd.Duration#extraParams} + * for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.Discount.DiscountEnd.Duration#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Required. Specifies a type of interval unit. Either {@code day}, + * {@code week}, {@code month} or {@code year}. + */ + public Builder setInterval( + InvoiceLineItemUpdateParams.Discount.DiscountEnd.Duration.Interval interval) { + this.interval = interval; + return this; + } + + /** + * Required. The number of intervals, as an whole number greater than 0. + * Stripe multiplies this by the interval type to get the overall duration. + */ + public Builder setIntervalCount(Long intervalCount) { + this.intervalCount = intervalCount; + return this; + } + } + + public enum Interval implements ApiRequestParams.EnumParam { + @SerializedName("day") + DAY("day"), + + @SerializedName("month") + MONTH("month"), + + @SerializedName("week") + WEEK("week"), + + @SerializedName("year") + YEAR("year"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Interval(String value) { + this.value = value; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("duration") + DURATION("duration"), + + @SerializedName("timestamp") + TIMESTAMP("timestamp"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + } + + @Getter + public static class Period { + /** + * Required. The end of the period, which must be greater than or equal to the + * start. This value is inclusive. + */ + @SerializedName("end") + Long end; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** Required. The start of the period. This value is inclusive. */ + @SerializedName("start") + Long start; + + private Period(Long end, Map extraParams, Long start) { + this.end = end; + this.extraParams = extraParams; + this.start = start; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long end; + + private Map extraParams; + + private Long start; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.Period build() { + return new InvoiceLineItemUpdateParams.Period(this.end, this.extraParams, this.start); + } + + /** + * Required. The end of the period, which must be greater than or equal to + * the start. This value is inclusive. + */ + public Builder setEnd(Long end) { + this.end = end; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams.Period#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link InvoiceLineItemUpdateParams.Period#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Required. The start of the period. This value is inclusive. */ + public Builder setStart(Long start) { + this.start = start; + return this; + } + } + } + + @Getter + public static class PriceData { + /** + * Required. Three-letter ISO currency code, in lowercase. + * Must be a supported currency. + */ + @SerializedName("currency") + Object currency; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * The ID of the product that this price will belong to. One of {@code product} or {@code + * product_data} is required. + */ + @SerializedName("product") + Object product; + + /** + * Data used to generate a new product object inline. One of {@code product} or {@code + * product_data} is required. + */ + @SerializedName("product_data") + ProductData productData; + + /** + * Only required if a default + * tax behavior was not provided in the Stripe Tax settings. Specifies whether the price is + * considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code + * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code + * exclusive}, it cannot be changed. + */ + @SerializedName("tax_behavior") + TaxBehavior taxBehavior; + + /** + * A non-negative integer in cents (or local equivalent) representing how much to charge. One of + * {@code unit_amount} or {@code unit_amount_decimal} is required. + */ + @SerializedName("unit_amount") + Long unitAmount; + + /** + * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent) with + * at most 12 decimal places. Only one of {@code unit_amount} and {@code unit_amount_decimal} + * can be set. + */ + @SerializedName("unit_amount_decimal") + Object unitAmountDecimal; + + private PriceData( + Object currency, + Map extraParams, + Object product, + ProductData productData, + TaxBehavior taxBehavior, + Long unitAmount, + Object unitAmountDecimal) { + this.currency = currency; + this.extraParams = extraParams; + this.product = product; + this.productData = productData; + this.taxBehavior = taxBehavior; + this.unitAmount = unitAmount; + this.unitAmountDecimal = unitAmountDecimal; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object currency; + + private Map extraParams; + + private Object product; + + private ProductData productData; + + private TaxBehavior taxBehavior; + + private Long unitAmount; + + private Object unitAmountDecimal; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.PriceData build() { + return new InvoiceLineItemUpdateParams.PriceData( + this.currency, + this.extraParams, + this.product, + this.productData, + this.taxBehavior, + this.unitAmount, + this.unitAmountDecimal); + } + + /** + * Required. Three-letter ISO currency code, in + * lowercase. Must be a supported currency. + */ + public Builder setCurrency(String currency) { + this.currency = currency; + return this; + } + + /** + * Required. Three-letter ISO currency code, in + * lowercase. Must be a supported currency. + */ + public Builder setCurrency(EmptyParam currency) { + this.currency = currency; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams.PriceData#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link InvoiceLineItemUpdateParams.PriceData#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * The ID of the product that this price will belong to. One of {@code product} or {@code + * product_data} is required. + */ + public Builder setProduct(String product) { + this.product = product; + return this; + } + + /** + * The ID of the product that this price will belong to. One of {@code product} or {@code + * product_data} is required. + */ + public Builder setProduct(EmptyParam product) { + this.product = product; + return this; + } + + /** + * Data used to generate a new product object inline. One of {@code product} or {@code + * product_data} is required. + */ + public Builder setProductData(InvoiceLineItemUpdateParams.PriceData.ProductData productData) { + this.productData = productData; + return this; + } + + /** + * Only required if a default + * tax behavior was not provided in the Stripe Tax settings. Specifies whether the price + * is considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code + * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code + * exclusive}, it cannot be changed. + */ + public Builder setTaxBehavior(InvoiceLineItemUpdateParams.PriceData.TaxBehavior taxBehavior) { + this.taxBehavior = taxBehavior; + return this; + } + + /** + * A non-negative integer in cents (or local equivalent) representing how much to charge. One + * of {@code unit_amount} or {@code unit_amount_decimal} is required. + */ + public Builder setUnitAmount(Long unitAmount) { + this.unitAmount = unitAmount; + return this; + } + + /** + * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent) + * with at most 12 decimal places. Only one of {@code unit_amount} and {@code + * unit_amount_decimal} can be set. + */ + public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) { + this.unitAmountDecimal = unitAmountDecimal; + return this; + } + + /** + * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent) + * with at most 12 decimal places. Only one of {@code unit_amount} and {@code + * unit_amount_decimal} can be set. + */ + public Builder setUnitAmountDecimal(EmptyParam unitAmountDecimal) { + this.unitAmountDecimal = unitAmountDecimal; + return this; + } + } + + @Getter + public static class ProductData { + /** + * The product's description, meant to be displayable to the customer. Use this field to + * optionally store a long form explanation of the product being sold for your own rendering + * purposes. + */ + @SerializedName("description") + Object description; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. + */ + @SerializedName("images") + List images; + + /** + * 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. Individual keys can be unset by posting an empty value to them. All + * keys can be unset by posting an empty value to {@code metadata}. + */ + @SerializedName("metadata") + Map metadata; + + /** Required. The product's name, meant to be displayable to the customer. */ + @SerializedName("name") + Object name; + + /** A tax code ID. */ + @SerializedName("tax_code") + Object taxCode; + + private ProductData( + Object description, + Map extraParams, + List images, + Map metadata, + Object name, + Object taxCode) { + this.description = description; + this.extraParams = extraParams; + this.images = images; + this.metadata = metadata; + this.name = name; + this.taxCode = taxCode; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object description; + + private Map extraParams; + + private List images; + + private Map metadata; + + private Object name; + + private Object taxCode; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.PriceData.ProductData build() { + return new InvoiceLineItemUpdateParams.PriceData.ProductData( + this.description, + this.extraParams, + this.images, + this.metadata, + this.name, + this.taxCode); + } + + /** + * The product's description, meant to be displayable to the customer. Use this field to + * optionally store a long form explanation of the product being sold for your own rendering + * purposes. + */ + public Builder setDescription(String description) { + this.description = description; + return this; + } + + /** + * The product's description, meant to be displayable to the customer. Use this field to + * optionally store a long form explanation of the product being sold for your own rendering + * purposes. + */ + public Builder setDescription(EmptyParam description) { + this.description = description; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.PriceData.ProductData#extraParams} for the + * field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.PriceData.ProductData#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Add an element to `images` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams.PriceData.ProductData#images} for the field documentation. + */ + public Builder addImage(String element) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(element); + return this; + } + + /** + * Add all elements to `images` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams.PriceData.ProductData#images} for the field documentation. + */ + public Builder addAllImage(List elements) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.addAll(elements); + return this; + } + + /** + * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams.PriceData.ProductData#metadata} for the field documentation. + */ + public Builder putMetadata(String key, String value) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `metadata` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.PriceData.ProductData#metadata} for the field + * documentation. + */ + public Builder putAllMetadata(Map map) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.putAll(map); + return this; + } + + /** + * Required. The product's name, meant to be displayable to the customer. + */ + public Builder setName(String name) { + this.name = name; + return this; + } + + /** + * Required. The product's name, meant to be displayable to the customer. + */ + public Builder setName(EmptyParam name) { + this.name = name; + return this; + } + + /** A tax code ID. */ + public Builder setTaxCode(String taxCode) { + this.taxCode = taxCode; + return this; + } + + /** A tax code ID. */ + public Builder setTaxCode(EmptyParam taxCode) { + this.taxCode = taxCode; + return this; + } + } + } + + public enum TaxBehavior implements ApiRequestParams.EnumParam { + @SerializedName("exclusive") + EXCLUSIVE("exclusive"), + + @SerializedName("inclusive") + INCLUSIVE("inclusive"), + + @SerializedName("unspecified") + UNSPECIFIED("unspecified"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + TaxBehavior(String value) { + this.value = value; + } + } + } + + @Getter + public static class TaxAmount { + /** Required. The amount, in cents (or local equivalent), of the tax. */ + @SerializedName("amount") + Long amount; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. Data to find or create a TaxRate object. + * + *

Stripe automatically creates or reuses a TaxRate object for each tax amount. If the {@code + * tax_rate_data} exactly matches a previous value, Stripe will reuse the TaxRate object. + * TaxRate objects created automatically by Stripe are immediately archived, do not appear in + * the line item’s {@code tax_rates}, and cannot be directly added to invoices, payments, or + * line items. + */ + @SerializedName("tax_rate_data") + TaxRateData taxRateData; + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + @SerializedName("taxable_amount") + Long taxableAmount; + + private TaxAmount( + Long amount, Map extraParams, TaxRateData taxRateData, Long taxableAmount) { + this.amount = amount; + this.extraParams = extraParams; + this.taxRateData = taxRateData; + this.taxableAmount = taxableAmount; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long amount; + + private Map extraParams; + + private TaxRateData taxRateData; + + private Long taxableAmount; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.TaxAmount build() { + return new InvoiceLineItemUpdateParams.TaxAmount( + this.amount, this.extraParams, this.taxRateData, this.taxableAmount); + } + + /** Required. The amount, in cents (or local equivalent), of the tax. */ + public Builder setAmount(Long amount) { + this.amount = amount; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams.TaxAmount#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link InvoiceLineItemUpdateParams.TaxAmount#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Required. Data to find or create a TaxRate object. + * + *

Stripe automatically creates or reuses a TaxRate object for each tax amount. If the + * {@code tax_rate_data} exactly matches a previous value, Stripe will reuse the TaxRate + * object. TaxRate objects created automatically by Stripe are immediately archived, do not + * appear in the line item’s {@code tax_rates}, and cannot be directly added to invoices, + * payments, or line items. + */ + public Builder setTaxRateData(InvoiceLineItemUpdateParams.TaxAmount.TaxRateData taxRateData) { + this.taxRateData = taxRateData; + return this; + } + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + public Builder setTaxableAmount(Long taxableAmount) { + this.taxableAmount = taxableAmount; + return this; + } + } + + @Getter + public static class TaxRateData { + /** + * Two-letter country code (ISO + * 3166-1 alpha-2). + */ + @SerializedName("country") + Object country; + + /** + * An arbitrary string attached to the tax rate for your internal use only. It will not be + * visible to your customers. + */ + @SerializedName("description") + Object description; + + /** + * Required. The display name of the tax rate, which will be shown to users. + */ + @SerializedName("display_name") + Object displayName; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** Required. This specifies if the tax rate is inclusive or exclusive. */ + @SerializedName("inclusive") + Boolean inclusive; + + /** + * The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. + * It also appears on your customer’s invoice. + */ + @SerializedName("jurisdiction") + Object jurisdiction; + + /** + * Required. The statutory tax rate percent. This field accepts decimal + * values between 0 and 100 inclusive with at most 4 decimal places. To accommodate + * fixed-amount taxes, set the percentage to zero. Stripe will not display zero percentages on + * the invoice unless the {@code amount} of the tax is also zero. + */ + @SerializedName("percentage") + BigDecimal percentage; + + /** + * ISO 3166-2 subdivision code, + * without country prefix. For example, "NY" for New York, United States. + */ + @SerializedName("state") + Object state; + + /** The high-level tax type, such as {@code vat} or {@code sales_tax}. */ + @SerializedName("tax_type") + TaxType taxType; + + private TaxRateData( + Object country, + Object description, + Object displayName, + Map extraParams, + Boolean inclusive, + Object jurisdiction, + BigDecimal percentage, + Object state, + TaxType taxType) { + this.country = country; + this.description = description; + this.displayName = displayName; + this.extraParams = extraParams; + this.inclusive = inclusive; + this.jurisdiction = jurisdiction; + this.percentage = percentage; + this.state = state; + this.taxType = taxType; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object country; + + private Object description; + + private Object displayName; + + private Map extraParams; + + private Boolean inclusive; + + private Object jurisdiction; + + private BigDecimal percentage; + + private Object state; + + private TaxType taxType; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.TaxAmount.TaxRateData build() { + return new InvoiceLineItemUpdateParams.TaxAmount.TaxRateData( + this.country, + this.description, + this.displayName, + this.extraParams, + this.inclusive, + this.jurisdiction, + this.percentage, + this.state, + this.taxType); + } + + /** + * Two-letter country code (ISO + * 3166-1 alpha-2). + */ + public Builder setCountry(String country) { + this.country = country; + return this; + } + + /** + * Two-letter country code (ISO + * 3166-1 alpha-2). + */ + public Builder setCountry(EmptyParam country) { + this.country = country; + return this; + } + + /** + * An arbitrary string attached to the tax rate for your internal use only. It will not be + * visible to your customers. + */ + public Builder setDescription(String description) { + this.description = description; + return this; + } + + /** + * An arbitrary string attached to the tax rate for your internal use only. It will not be + * visible to your customers. + */ + public Builder setDescription(EmptyParam description) { + this.description = description; + return this; + } + + /** + * Required. The display name of the tax rate, which will be shown to + * users. + */ + public Builder setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Required. The display name of the tax rate, which will be shown to + * users. + */ + public Builder setDisplayName(EmptyParam displayName) { + this.displayName = displayName; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.TaxAmount.TaxRateData#extraParams} for the + * field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.TaxAmount.TaxRateData#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Required. This specifies if the tax rate is inclusive or exclusive. */ + public Builder setInclusive(Boolean inclusive) { + this.inclusive = inclusive; + return this; + } + + /** + * The jurisdiction for the tax rate. You can use this label field for tax reporting + * purposes. It also appears on your customer’s invoice. + */ + public Builder setJurisdiction(String jurisdiction) { + this.jurisdiction = jurisdiction; + return this; + } + + /** + * The jurisdiction for the tax rate. You can use this label field for tax reporting + * purposes. It also appears on your customer’s invoice. + */ + public Builder setJurisdiction(EmptyParam jurisdiction) { + this.jurisdiction = jurisdiction; + return this; + } + + /** + * Required. The statutory tax rate percent. This field accepts decimal + * values between 0 and 100 inclusive with at most 4 decimal places. To accommodate + * fixed-amount taxes, set the percentage to zero. Stripe will not display zero percentages + * on the invoice unless the {@code amount} of the tax is also zero. + */ + public Builder setPercentage(BigDecimal percentage) { + this.percentage = percentage; + return this; + } + + /** + * ISO 3166-2 subdivision code, + * without country prefix. For example, "NY" for New York, United States. + */ + public Builder setState(String state) { + this.state = state; + return this; + } + + /** + * ISO 3166-2 subdivision code, + * without country prefix. For example, "NY" for New York, United States. + */ + public Builder setState(EmptyParam state) { + this.state = state; + return this; + } + + /** The high-level tax type, such as {@code vat} or {@code sales_tax}. */ + public Builder setTaxType( + InvoiceLineItemUpdateParams.TaxAmount.TaxRateData.TaxType taxType) { + this.taxType = taxType; + return this; + } + } + + public enum TaxType implements ApiRequestParams.EnumParam { + @SerializedName("amusement_tax") + AMUSEMENT_TAX("amusement_tax"), + + @SerializedName("communications_tax") + COMMUNICATIONS_TAX("communications_tax"), + + @SerializedName("gst") + GST("gst"), + + @SerializedName("hst") + HST("hst"), + + @SerializedName("igst") + IGST("igst"), + + @SerializedName("jct") + JCT("jct"), + + @SerializedName("lease_tax") + LEASE_TAX("lease_tax"), + + @SerializedName("pst") + PST("pst"), + + @SerializedName("qst") + QST("qst"), + + @SerializedName("rst") + RST("rst"), + + @SerializedName("sales_tax") + SALES_TAX("sales_tax"), + + @SerializedName("service_tax") + SERVICE_TAX("service_tax"), + + @SerializedName("vat") + VAT("vat"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + TaxType(String value) { + this.value = value; + } + } + } + } +} diff --git a/src/main/java/com/stripe/service/InvoiceLineItemService.java b/src/main/java/com/stripe/service/InvoiceLineItemService.java index b1dc41dd745..6e3b149c6f4 100644 --- a/src/main/java/com/stripe/service/InvoiceLineItemService.java +++ b/src/main/java/com/stripe/service/InvoiceLineItemService.java @@ -13,6 +13,7 @@ import com.stripe.net.RequestOptions; import com.stripe.net.StripeResponseGetter; import com.stripe.param.InvoiceLineItemListParams; +import com.stripe.param.InvoiceLineItemUpdateParams; public final class InvoiceLineItemService extends ApiService { public InvoiceLineItemService(StripeResponseGetter responseGetter) { @@ -64,4 +65,61 @@ public StripeCollection list( options, ApiMode.V1); } + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update( + String invoice, String lineItemId, InvoiceLineItemUpdateParams params) + throws StripeException { + return update(invoice, lineItemId, params, (RequestOptions) null); + } + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update(String invoice, String lineItemId, RequestOptions options) + throws StripeException { + return update(invoice, lineItemId, (InvoiceLineItemUpdateParams) null, options); + } + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update(String invoice, String lineItemId) throws StripeException { + return update(invoice, lineItemId, (InvoiceLineItemUpdateParams) null, (RequestOptions) null); + } + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update( + String invoice, String lineItemId, InvoiceLineItemUpdateParams params, RequestOptions options) + throws StripeException { + String path = + String.format( + "/v1/invoices/%s/lines/%s", + ApiResource.urlEncodeId(invoice), ApiResource.urlEncodeId(lineItemId)); + return getResponseGetter() + .request( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + InvoiceLineItem.class, + options, + ApiMode.V1); + } } From 1bc7d2c61ba51eca38b57263860c9791f4b7e83e Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 20:46:58 +0000 Subject: [PATCH 07/15] Update generated code for v663 --- OPENAPI_VERSION | 2 +- .../com/stripe/model/CustomerSession.java | 73 +++ .../param/CustomerSessionCreateParams.java | 426 +++++++++++++++++- 3 files changed, 498 insertions(+), 3 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 4d1efaa339c..0e45f37f051 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v662 \ No newline at end of file +v663 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/CustomerSession.java b/src/main/java/com/stripe/model/CustomerSession.java index 0f187ff4a3c..9e0beaabdaf 100644 --- a/src/main/java/com/stripe/model/CustomerSession.java +++ b/src/main/java/com/stripe/model/CustomerSession.java @@ -34,6 +34,10 @@ public class CustomerSession extends ApiResource { @SerializedName("client_secret") String clientSecret; + /** Configuration for the components supported by this customer session. */ + @SerializedName("components") + Components components; + /** The customer the customer session was created for. */ @SerializedName("customer") @Getter(lombok.AccessLevel.NONE) @@ -130,9 +134,78 @@ public static CustomerSession create(CustomerSessionCreateParams params, Request ApiMode.V1); } + /** Configuration for the components supported by this customer session. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Components extends StripeObject { + /** This hash contains whether the payment element is enabled and the features it supports. */ + @SerializedName("payment_element") + PaymentElement paymentElement; + + /** This hash contains whether the pricing table is enabled. */ + @SerializedName("pricing_table") + PricingTable pricingTable; + + /** This hash contains whether the payment element is enabled and the features it supports. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class PaymentElement extends StripeObject { + /** Whether the payment element is enabled. */ + @SerializedName("enabled") + Boolean enabled; + + /** This hash contains the features the Payment Element supports. */ + @SerializedName("features") + Features features; + + /** This hash contains the features the Payment Element supports. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Features extends StripeObject { + /** + * Whether the payment element supports detaching payment methods. + * + *

One of {@code auto}, or {@code never}. + */ + @SerializedName("payment_method_detach") + String paymentMethodDetach; + + /** + * Whether the payment element supports setting payment methods as the customer's default. + * + *

One of {@code auto}, or {@code never}. + */ + @SerializedName("payment_method_set_as_customer_default") + String paymentMethodSetAsCustomerDefault; + + /** + * Whether the payment element supports updating payment methods. + * + *

One of {@code auto}, or {@code never}. + */ + @SerializedName("payment_method_update") + String paymentMethodUpdate; + } + } + + /** This hash contains whether the pricing table is enabled. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class PricingTable extends StripeObject { + /** Whether the pricing table is enabled. */ + @SerializedName("enabled") + Boolean enabled; + } + } + @Override public void setResponseGetter(StripeResponseGetter responseGetter) { super.setResponseGetter(responseGetter); + trySetResponseGetter(components, responseGetter); trySetResponseGetter(customer, responseGetter); } } diff --git a/src/main/java/com/stripe/param/CustomerSessionCreateParams.java b/src/main/java/com/stripe/param/CustomerSessionCreateParams.java index f786e5f2541..90919e03cab 100644 --- a/src/main/java/com/stripe/param/CustomerSessionCreateParams.java +++ b/src/main/java/com/stripe/param/CustomerSessionCreateParams.java @@ -11,6 +11,10 @@ @Getter public class CustomerSessionCreateParams extends ApiRequestParams { + /** Required. Configuration for each component. */ + @SerializedName("components") + Components components; + /** * Required. The ID of an existing customer for which to create the customer * session. @@ -32,7 +36,11 @@ public class CustomerSessionCreateParams extends ApiRequestParams { Map extraParams; private CustomerSessionCreateParams( - String customer, List expand, Map extraParams) { + Components components, + String customer, + List expand, + Map extraParams) { + this.components = components; this.customer = customer; this.expand = expand; this.extraParams = extraParams; @@ -43,6 +51,8 @@ public static Builder builder() { } public static class Builder { + private Components components; + private String customer; private List expand; @@ -51,7 +61,14 @@ public static class Builder { /** Finalize and obtain parameter instance from this builder. */ public CustomerSessionCreateParams build() { - return new CustomerSessionCreateParams(this.customer, this.expand, this.extraParams); + return new CustomerSessionCreateParams( + this.components, this.customer, this.expand, this.extraParams); + } + + /** Required. Configuration for each component. */ + public Builder setComponents(CustomerSessionCreateParams.Components components) { + this.components = components; + return this; } /** @@ -115,4 +132,409 @@ public Builder putAllExtraParam(Map map) { return this; } } + + @Getter + public static class Components { + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** Configuration for the payment element. */ + @SerializedName("payment_element") + PaymentElement paymentElement; + + /** Configuration for the pricing table. */ + @SerializedName("pricing_table") + PricingTable pricingTable; + + private Components( + Map extraParams, PaymentElement paymentElement, PricingTable pricingTable) { + this.extraParams = extraParams; + this.paymentElement = paymentElement; + this.pricingTable = pricingTable; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private PaymentElement paymentElement; + + private PricingTable pricingTable; + + /** Finalize and obtain parameter instance from this builder. */ + public CustomerSessionCreateParams.Components build() { + return new CustomerSessionCreateParams.Components( + this.extraParams, this.paymentElement, this.pricingTable); + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * CustomerSessionCreateParams.Components#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link CustomerSessionCreateParams.Components#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configuration for the payment element. */ + public Builder setPaymentElement( + CustomerSessionCreateParams.Components.PaymentElement paymentElement) { + this.paymentElement = paymentElement; + return this; + } + + /** Configuration for the pricing table. */ + public Builder setPricingTable( + CustomerSessionCreateParams.Components.PricingTable pricingTable) { + this.pricingTable = pricingTable; + return this; + } + } + + @Getter + public static class PaymentElement { + /** Required. Whether the payment element is enabled. */ + @SerializedName("enabled") + Boolean enabled; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** This hash defines whether the payment element supports certain features. */ + @SerializedName("features") + Features features; + + private PaymentElement(Boolean enabled, Map extraParams, Features features) { + this.enabled = enabled; + this.extraParams = extraParams; + this.features = features; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Boolean enabled; + + private Map extraParams; + + private Features features; + + /** Finalize and obtain parameter instance from this builder. */ + public CustomerSessionCreateParams.Components.PaymentElement build() { + return new CustomerSessionCreateParams.Components.PaymentElement( + this.enabled, this.extraParams, this.features); + } + + /** Required. Whether the payment element is enabled. */ + public Builder setEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CustomerSessionCreateParams.Components.PaymentElement#extraParams} for + * the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CustomerSessionCreateParams.Components.PaymentElement#extraParams} for + * the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** This hash defines whether the payment element supports certain features. */ + public Builder setFeatures( + CustomerSessionCreateParams.Components.PaymentElement.Features features) { + this.features = features; + return this; + } + } + + @Getter + public static class Features { + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field + * (serialized) name in this param object. Effectively, this map is flattened to its parent + * instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** Whether the payment element supports detaching a payment method. */ + @SerializedName("payment_method_detach") + PaymentMethodDetach paymentMethodDetach; + + /** + * Whether the payment element supports setting a payment method as the customer's default. + */ + @SerializedName("payment_method_set_as_customer_default") + PaymentMethodSetAsCustomerDefault paymentMethodSetAsCustomerDefault; + + /** Whether the payment element supports updating a payment method. */ + @SerializedName("payment_method_update") + PaymentMethodUpdate paymentMethodUpdate; + + private Features( + Map extraParams, + PaymentMethodDetach paymentMethodDetach, + PaymentMethodSetAsCustomerDefault paymentMethodSetAsCustomerDefault, + PaymentMethodUpdate paymentMethodUpdate) { + this.extraParams = extraParams; + this.paymentMethodDetach = paymentMethodDetach; + this.paymentMethodSetAsCustomerDefault = paymentMethodSetAsCustomerDefault; + this.paymentMethodUpdate = paymentMethodUpdate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private PaymentMethodDetach paymentMethodDetach; + + private PaymentMethodSetAsCustomerDefault paymentMethodSetAsCustomerDefault; + + private PaymentMethodUpdate paymentMethodUpdate; + + /** Finalize and obtain parameter instance from this builder. */ + public CustomerSessionCreateParams.Components.PaymentElement.Features build() { + return new CustomerSessionCreateParams.Components.PaymentElement.Features( + this.extraParams, + this.paymentMethodDetach, + this.paymentMethodSetAsCustomerDefault, + this.paymentMethodUpdate); + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link + * CustomerSessionCreateParams.Components.PaymentElement.Features#extraParams} for the + * field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link + * CustomerSessionCreateParams.Components.PaymentElement.Features#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Whether the payment element supports detaching a payment method. */ + public Builder setPaymentMethodDetach( + CustomerSessionCreateParams.Components.PaymentElement.Features.PaymentMethodDetach + paymentMethodDetach) { + this.paymentMethodDetach = paymentMethodDetach; + return this; + } + + /** + * Whether the payment element supports setting a payment method as the customer's + * default. + */ + public Builder setPaymentMethodSetAsCustomerDefault( + CustomerSessionCreateParams.Components.PaymentElement.Features + .PaymentMethodSetAsCustomerDefault + paymentMethodSetAsCustomerDefault) { + this.paymentMethodSetAsCustomerDefault = paymentMethodSetAsCustomerDefault; + return this; + } + + /** Whether the payment element supports updating a payment method. */ + public Builder setPaymentMethodUpdate( + CustomerSessionCreateParams.Components.PaymentElement.Features.PaymentMethodUpdate + paymentMethodUpdate) { + this.paymentMethodUpdate = paymentMethodUpdate; + return this; + } + } + + public enum PaymentMethodDetach implements ApiRequestParams.EnumParam { + @SerializedName("auto") + AUTO("auto"), + + @SerializedName("never") + NEVER("never"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + PaymentMethodDetach(String value) { + this.value = value; + } + } + + public enum PaymentMethodSetAsCustomerDefault implements ApiRequestParams.EnumParam { + @SerializedName("auto") + AUTO("auto"), + + @SerializedName("never") + NEVER("never"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + PaymentMethodSetAsCustomerDefault(String value) { + this.value = value; + } + } + + public enum PaymentMethodUpdate implements ApiRequestParams.EnumParam { + @SerializedName("auto") + AUTO("auto"), + + @SerializedName("never") + NEVER("never"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + PaymentMethodUpdate(String value) { + this.value = value; + } + } + } + } + + @Getter + public static class PricingTable { + /** Required. Whether pricing table is enabled. */ + @SerializedName("enabled") + Boolean enabled; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private PricingTable(Boolean enabled, Map extraParams) { + this.enabled = enabled; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Boolean enabled; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public CustomerSessionCreateParams.Components.PricingTable build() { + return new CustomerSessionCreateParams.Components.PricingTable( + this.enabled, this.extraParams); + } + + /** Required. Whether pricing table is enabled. */ + public Builder setEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CustomerSessionCreateParams.Components.PricingTable#extraParams} for the + * field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CustomerSessionCreateParams.Components.PricingTable#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } + } } From 10a1484412f81955e0fd59beea762023b54a369d Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 22:54:51 +0000 Subject: [PATCH 08/15] Update generated code for v665 --- OPENAPI_VERSION | 2 +- .../com/stripe/model/CustomerSession.java | 73 --- .../param/CustomerSessionCreateParams.java | 426 +----------------- 3 files changed, 3 insertions(+), 498 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 0e45f37f051..eb137252199 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v663 \ No newline at end of file +v665 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/CustomerSession.java b/src/main/java/com/stripe/model/CustomerSession.java index 9e0beaabdaf..0f187ff4a3c 100644 --- a/src/main/java/com/stripe/model/CustomerSession.java +++ b/src/main/java/com/stripe/model/CustomerSession.java @@ -34,10 +34,6 @@ public class CustomerSession extends ApiResource { @SerializedName("client_secret") String clientSecret; - /** Configuration for the components supported by this customer session. */ - @SerializedName("components") - Components components; - /** The customer the customer session was created for. */ @SerializedName("customer") @Getter(lombok.AccessLevel.NONE) @@ -134,78 +130,9 @@ public static CustomerSession create(CustomerSessionCreateParams params, Request ApiMode.V1); } - /** Configuration for the components supported by this customer session. */ - @Getter - @Setter - @EqualsAndHashCode(callSuper = false) - public static class Components extends StripeObject { - /** This hash contains whether the payment element is enabled and the features it supports. */ - @SerializedName("payment_element") - PaymentElement paymentElement; - - /** This hash contains whether the pricing table is enabled. */ - @SerializedName("pricing_table") - PricingTable pricingTable; - - /** This hash contains whether the payment element is enabled and the features it supports. */ - @Getter - @Setter - @EqualsAndHashCode(callSuper = false) - public static class PaymentElement extends StripeObject { - /** Whether the payment element is enabled. */ - @SerializedName("enabled") - Boolean enabled; - - /** This hash contains the features the Payment Element supports. */ - @SerializedName("features") - Features features; - - /** This hash contains the features the Payment Element supports. */ - @Getter - @Setter - @EqualsAndHashCode(callSuper = false) - public static class Features extends StripeObject { - /** - * Whether the payment element supports detaching payment methods. - * - *

One of {@code auto}, or {@code never}. - */ - @SerializedName("payment_method_detach") - String paymentMethodDetach; - - /** - * Whether the payment element supports setting payment methods as the customer's default. - * - *

One of {@code auto}, or {@code never}. - */ - @SerializedName("payment_method_set_as_customer_default") - String paymentMethodSetAsCustomerDefault; - - /** - * Whether the payment element supports updating payment methods. - * - *

One of {@code auto}, or {@code never}. - */ - @SerializedName("payment_method_update") - String paymentMethodUpdate; - } - } - - /** This hash contains whether the pricing table is enabled. */ - @Getter - @Setter - @EqualsAndHashCode(callSuper = false) - public static class PricingTable extends StripeObject { - /** Whether the pricing table is enabled. */ - @SerializedName("enabled") - Boolean enabled; - } - } - @Override public void setResponseGetter(StripeResponseGetter responseGetter) { super.setResponseGetter(responseGetter); - trySetResponseGetter(components, responseGetter); trySetResponseGetter(customer, responseGetter); } } diff --git a/src/main/java/com/stripe/param/CustomerSessionCreateParams.java b/src/main/java/com/stripe/param/CustomerSessionCreateParams.java index 90919e03cab..f786e5f2541 100644 --- a/src/main/java/com/stripe/param/CustomerSessionCreateParams.java +++ b/src/main/java/com/stripe/param/CustomerSessionCreateParams.java @@ -11,10 +11,6 @@ @Getter public class CustomerSessionCreateParams extends ApiRequestParams { - /** Required. Configuration for each component. */ - @SerializedName("components") - Components components; - /** * Required. The ID of an existing customer for which to create the customer * session. @@ -36,11 +32,7 @@ public class CustomerSessionCreateParams extends ApiRequestParams { Map extraParams; private CustomerSessionCreateParams( - Components components, - String customer, - List expand, - Map extraParams) { - this.components = components; + String customer, List expand, Map extraParams) { this.customer = customer; this.expand = expand; this.extraParams = extraParams; @@ -51,8 +43,6 @@ public static Builder builder() { } public static class Builder { - private Components components; - private String customer; private List expand; @@ -61,14 +51,7 @@ public static class Builder { /** Finalize and obtain parameter instance from this builder. */ public CustomerSessionCreateParams build() { - return new CustomerSessionCreateParams( - this.components, this.customer, this.expand, this.extraParams); - } - - /** Required. Configuration for each component. */ - public Builder setComponents(CustomerSessionCreateParams.Components components) { - this.components = components; - return this; + return new CustomerSessionCreateParams(this.customer, this.expand, this.extraParams); } /** @@ -132,409 +115,4 @@ public Builder putAllExtraParam(Map map) { return this; } } - - @Getter - public static class Components { - /** - * Map of extra parameters for custom features not available in this client library. The content - * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each - * key/value pair is serialized as if the key is a root-level field (serialized) name in this - * param object. Effectively, this map is flattened to its parent instance. - */ - @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) - Map extraParams; - - /** Configuration for the payment element. */ - @SerializedName("payment_element") - PaymentElement paymentElement; - - /** Configuration for the pricing table. */ - @SerializedName("pricing_table") - PricingTable pricingTable; - - private Components( - Map extraParams, PaymentElement paymentElement, PricingTable pricingTable) { - this.extraParams = extraParams; - this.paymentElement = paymentElement; - this.pricingTable = pricingTable; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Map extraParams; - - private PaymentElement paymentElement; - - private PricingTable pricingTable; - - /** Finalize and obtain parameter instance from this builder. */ - public CustomerSessionCreateParams.Components build() { - return new CustomerSessionCreateParams.Components( - this.extraParams, this.paymentElement, this.pricingTable); - } - - /** - * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` - * call, and subsequent calls add additional key/value pairs to the original map. See {@link - * CustomerSessionCreateParams.Components#extraParams} for the field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. - * See {@link CustomerSessionCreateParams.Components#extraParams} for the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - - /** Configuration for the payment element. */ - public Builder setPaymentElement( - CustomerSessionCreateParams.Components.PaymentElement paymentElement) { - this.paymentElement = paymentElement; - return this; - } - - /** Configuration for the pricing table. */ - public Builder setPricingTable( - CustomerSessionCreateParams.Components.PricingTable pricingTable) { - this.pricingTable = pricingTable; - return this; - } - } - - @Getter - public static class PaymentElement { - /** Required. Whether the payment element is enabled. */ - @SerializedName("enabled") - Boolean enabled; - - /** - * Map of extra parameters for custom features not available in this client library. The - * content in this map is not serialized under this field's {@code @SerializedName} value. - * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) - * name in this param object. Effectively, this map is flattened to its parent instance. - */ - @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) - Map extraParams; - - /** This hash defines whether the payment element supports certain features. */ - @SerializedName("features") - Features features; - - private PaymentElement(Boolean enabled, Map extraParams, Features features) { - this.enabled = enabled; - this.extraParams = extraParams; - this.features = features; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Boolean enabled; - - private Map extraParams; - - private Features features; - - /** Finalize and obtain parameter instance from this builder. */ - public CustomerSessionCreateParams.Components.PaymentElement build() { - return new CustomerSessionCreateParams.Components.PaymentElement( - this.enabled, this.extraParams, this.features); - } - - /** Required. Whether the payment element is enabled. */ - public Builder setEnabled(Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Add a key/value pair to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original - * map. See {@link CustomerSessionCreateParams.Components.PaymentElement#extraParams} for - * the field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original - * map. See {@link CustomerSessionCreateParams.Components.PaymentElement#extraParams} for - * the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - - /** This hash defines whether the payment element supports certain features. */ - public Builder setFeatures( - CustomerSessionCreateParams.Components.PaymentElement.Features features) { - this.features = features; - return this; - } - } - - @Getter - public static class Features { - /** - * Map of extra parameters for custom features not available in this client library. The - * content in this map is not serialized under this field's {@code @SerializedName} value. - * Instead, each key/value pair is serialized as if the key is a root-level field - * (serialized) name in this param object. Effectively, this map is flattened to its parent - * instance. - */ - @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) - Map extraParams; - - /** Whether the payment element supports detaching a payment method. */ - @SerializedName("payment_method_detach") - PaymentMethodDetach paymentMethodDetach; - - /** - * Whether the payment element supports setting a payment method as the customer's default. - */ - @SerializedName("payment_method_set_as_customer_default") - PaymentMethodSetAsCustomerDefault paymentMethodSetAsCustomerDefault; - - /** Whether the payment element supports updating a payment method. */ - @SerializedName("payment_method_update") - PaymentMethodUpdate paymentMethodUpdate; - - private Features( - Map extraParams, - PaymentMethodDetach paymentMethodDetach, - PaymentMethodSetAsCustomerDefault paymentMethodSetAsCustomerDefault, - PaymentMethodUpdate paymentMethodUpdate) { - this.extraParams = extraParams; - this.paymentMethodDetach = paymentMethodDetach; - this.paymentMethodSetAsCustomerDefault = paymentMethodSetAsCustomerDefault; - this.paymentMethodUpdate = paymentMethodUpdate; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Map extraParams; - - private PaymentMethodDetach paymentMethodDetach; - - private PaymentMethodSetAsCustomerDefault paymentMethodSetAsCustomerDefault; - - private PaymentMethodUpdate paymentMethodUpdate; - - /** Finalize and obtain parameter instance from this builder. */ - public CustomerSessionCreateParams.Components.PaymentElement.Features build() { - return new CustomerSessionCreateParams.Components.PaymentElement.Features( - this.extraParams, - this.paymentMethodDetach, - this.paymentMethodSetAsCustomerDefault, - this.paymentMethodUpdate); - } - - /** - * Add a key/value pair to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original - * map. See {@link - * CustomerSessionCreateParams.Components.PaymentElement.Features#extraParams} for the - * field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original - * map. See {@link - * CustomerSessionCreateParams.Components.PaymentElement.Features#extraParams} for the - * field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - - /** Whether the payment element supports detaching a payment method. */ - public Builder setPaymentMethodDetach( - CustomerSessionCreateParams.Components.PaymentElement.Features.PaymentMethodDetach - paymentMethodDetach) { - this.paymentMethodDetach = paymentMethodDetach; - return this; - } - - /** - * Whether the payment element supports setting a payment method as the customer's - * default. - */ - public Builder setPaymentMethodSetAsCustomerDefault( - CustomerSessionCreateParams.Components.PaymentElement.Features - .PaymentMethodSetAsCustomerDefault - paymentMethodSetAsCustomerDefault) { - this.paymentMethodSetAsCustomerDefault = paymentMethodSetAsCustomerDefault; - return this; - } - - /** Whether the payment element supports updating a payment method. */ - public Builder setPaymentMethodUpdate( - CustomerSessionCreateParams.Components.PaymentElement.Features.PaymentMethodUpdate - paymentMethodUpdate) { - this.paymentMethodUpdate = paymentMethodUpdate; - return this; - } - } - - public enum PaymentMethodDetach implements ApiRequestParams.EnumParam { - @SerializedName("auto") - AUTO("auto"), - - @SerializedName("never") - NEVER("never"); - - @Getter(onMethod_ = {@Override}) - private final String value; - - PaymentMethodDetach(String value) { - this.value = value; - } - } - - public enum PaymentMethodSetAsCustomerDefault implements ApiRequestParams.EnumParam { - @SerializedName("auto") - AUTO("auto"), - - @SerializedName("never") - NEVER("never"); - - @Getter(onMethod_ = {@Override}) - private final String value; - - PaymentMethodSetAsCustomerDefault(String value) { - this.value = value; - } - } - - public enum PaymentMethodUpdate implements ApiRequestParams.EnumParam { - @SerializedName("auto") - AUTO("auto"), - - @SerializedName("never") - NEVER("never"); - - @Getter(onMethod_ = {@Override}) - private final String value; - - PaymentMethodUpdate(String value) { - this.value = value; - } - } - } - } - - @Getter - public static class PricingTable { - /** Required. Whether pricing table is enabled. */ - @SerializedName("enabled") - Boolean enabled; - - /** - * Map of extra parameters for custom features not available in this client library. The - * content in this map is not serialized under this field's {@code @SerializedName} value. - * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) - * name in this param object. Effectively, this map is flattened to its parent instance. - */ - @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) - Map extraParams; - - private PricingTable(Boolean enabled, Map extraParams) { - this.enabled = enabled; - this.extraParams = extraParams; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Boolean enabled; - - private Map extraParams; - - /** Finalize and obtain parameter instance from this builder. */ - public CustomerSessionCreateParams.Components.PricingTable build() { - return new CustomerSessionCreateParams.Components.PricingTable( - this.enabled, this.extraParams); - } - - /** Required. Whether pricing table is enabled. */ - public Builder setEnabled(Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Add a key/value pair to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original - * map. See {@link CustomerSessionCreateParams.Components.PricingTable#extraParams} for the - * field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original - * map. See {@link CustomerSessionCreateParams.Components.PricingTable#extraParams} for the - * field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - } - } - } } From ba2300cc092e738815d664cbc8f3ee6af87539a8 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 16 Nov 2023 09:09:31 +0000 Subject: [PATCH 09/15] Update generated code for v666 --- OPENAPI_VERSION | 2 +- src/main/java/com/stripe/model/Account.java | 16 ++- .../com/stripe/param/AccountCreateParams.java | 103 +++++++++++++++ .../com/stripe/param/AccountUpdateParams.java | 117 ++++++++++++++++++ 4 files changed, 235 insertions(+), 3 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index eb137252199..13e06c1ee91 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v665 \ No newline at end of file +v666 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/Account.java b/src/main/java/com/stripe/model/Account.java index 5275552cfe7..398ec9bab10 100644 --- a/src/main/java/com/stripe/model/Account.java +++ b/src/main/java/com/stripe/model/Account.java @@ -1857,11 +1857,23 @@ public static class Settings extends StripeObject { @EqualsAndHashCode(callSuper = false) public static class BacsDebitPayments extends StripeObject { /** - * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct - * Debit, this will appear on the mandate, and as the statement descriptor. + * The Bacs Direct Debit display name for this account. For payments made with Bacs Direct + * Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps + * display it as the name of the business. To use custom branding, set the Bacs Direct Debit + * Display Name during or right after creation. Custom branding incurs an additional monthly + * fee for the platform. The fee appears 5 business days after requesting Bacs. If you don't + * set the display name before requesting Bacs capability, it's automatically set as + * "Stripe" and the account is onboarded to Stripe branding, which is free. */ @SerializedName("display_name") String displayName; + + /** + * The Bacs Direct Debit Service user number for this account. For payments made with Bacs + * Direct Debit, this number is a unique identifier of the account with our banking partners. + */ + @SerializedName("service_user_number") + String serviceUserNumber; } @Getter diff --git a/src/main/java/com/stripe/param/AccountCreateParams.java b/src/main/java/com/stripe/param/AccountCreateParams.java index faf2093472b..b565911489c 100644 --- a/src/main/java/com/stripe/param/AccountCreateParams.java +++ b/src/main/java/com/stripe/param/AccountCreateParams.java @@ -8635,6 +8635,10 @@ public enum PoliticalExposure implements ApiRequestParams.EnumParam { @Getter public static class Settings { + /** Settings specific to Bacs Direct Debit. */ + @SerializedName("bacs_debit_payments") + BacsDebitPayments bacsDebitPayments; + /** * Settings used to apply the account's branding to email receipts, invoices, Checkout, and * other products. @@ -8676,6 +8680,7 @@ public static class Settings { Treasury treasury; private Settings( + BacsDebitPayments bacsDebitPayments, Branding branding, CardIssuing cardIssuing, CardPayments cardPayments, @@ -8684,6 +8689,7 @@ private Settings( Payouts payouts, TaxForms taxForms, Treasury treasury) { + this.bacsDebitPayments = bacsDebitPayments; this.branding = branding; this.cardIssuing = cardIssuing; this.cardPayments = cardPayments; @@ -8699,6 +8705,8 @@ public static Builder builder() { } public static class Builder { + private BacsDebitPayments bacsDebitPayments; + private Branding branding; private CardIssuing cardIssuing; @@ -8718,6 +8726,7 @@ public static class Builder { /** Finalize and obtain parameter instance from this builder. */ public AccountCreateParams.Settings build() { return new AccountCreateParams.Settings( + this.bacsDebitPayments, this.branding, this.cardIssuing, this.cardPayments, @@ -8728,6 +8737,13 @@ public AccountCreateParams.Settings build() { this.treasury); } + /** Settings specific to Bacs Direct Debit. */ + public Builder setBacsDebitPayments( + AccountCreateParams.Settings.BacsDebitPayments bacsDebitPayments) { + this.bacsDebitPayments = bacsDebitPayments; + return this; + } + /** * Settings used to apply the account's branding to email receipts, invoices, Checkout, and * other products. @@ -8800,6 +8816,93 @@ public Builder setTreasury(AccountCreateParams.Settings.Treasury treasury) { } } + @Getter + public static class BacsDebitPayments { + /** + * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct + * Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps + * display it as the name of the business. To use custom branding, set the Bacs Direct Debit + * Display Name during or right after creation. Custom branding incurs an additional monthly + * fee for the platform. If you don't set the display name before requesting Bacs capability, + * it's automatically set as "Stripe" and the account is onboarded to Stripe + * branding, which is free. + */ + @SerializedName("display_name") + String displayName; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private BacsDebitPayments(String displayName, Map extraParams) { + this.displayName = displayName; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String displayName; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public AccountCreateParams.Settings.BacsDebitPayments build() { + return new AccountCreateParams.Settings.BacsDebitPayments( + this.displayName, this.extraParams); + } + + /** + * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct + * Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps + * display it as the name of the business. To use custom branding, set the Bacs Direct Debit + * Display Name during or right after creation. Custom branding incurs an additional monthly + * fee for the platform. If you don't set the display name before requesting Bacs + * capability, it's automatically set as "Stripe" and the account is onboarded to + * Stripe branding, which is free. + */ + public Builder setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountCreateParams.Settings.BacsDebitPayments#extraParams} for the field + * documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountCreateParams.Settings.BacsDebitPayments#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } + @Getter public static class Branding { /** diff --git a/src/main/java/com/stripe/param/AccountUpdateParams.java b/src/main/java/com/stripe/param/AccountUpdateParams.java index ab4c3343dd6..5bf3fc49601 100644 --- a/src/main/java/com/stripe/param/AccountUpdateParams.java +++ b/src/main/java/com/stripe/param/AccountUpdateParams.java @@ -8965,6 +8965,10 @@ public enum PoliticalExposure implements ApiRequestParams.EnumParam { @Getter public static class Settings { + /** Settings specific to Bacs Direct Debit payments. */ + @SerializedName("bacs_debit_payments") + BacsDebitPayments bacsDebitPayments; + /** * Settings used to apply the account's branding to email receipts, invoices, Checkout, and * other products. @@ -9006,6 +9010,7 @@ public static class Settings { Treasury treasury; private Settings( + BacsDebitPayments bacsDebitPayments, Branding branding, CardIssuing cardIssuing, CardPayments cardPayments, @@ -9014,6 +9019,7 @@ private Settings( Payouts payouts, TaxForms taxForms, Treasury treasury) { + this.bacsDebitPayments = bacsDebitPayments; this.branding = branding; this.cardIssuing = cardIssuing; this.cardPayments = cardPayments; @@ -9029,6 +9035,8 @@ public static Builder builder() { } public static class Builder { + private BacsDebitPayments bacsDebitPayments; + private Branding branding; private CardIssuing cardIssuing; @@ -9048,6 +9056,7 @@ public static class Builder { /** Finalize and obtain parameter instance from this builder. */ public AccountUpdateParams.Settings build() { return new AccountUpdateParams.Settings( + this.bacsDebitPayments, this.branding, this.cardIssuing, this.cardPayments, @@ -9058,6 +9067,13 @@ public AccountUpdateParams.Settings build() { this.treasury); } + /** Settings specific to Bacs Direct Debit payments. */ + public Builder setBacsDebitPayments( + AccountUpdateParams.Settings.BacsDebitPayments bacsDebitPayments) { + this.bacsDebitPayments = bacsDebitPayments; + return this; + } + /** * Settings used to apply the account's branding to email receipts, invoices, Checkout, and * other products. @@ -9130,6 +9146,107 @@ public Builder setTreasury(AccountUpdateParams.Settings.Treasury treasury) { } } + @Getter + public static class BacsDebitPayments { + /** + * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct + * Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps + * display it as the name of the business. To use custom branding, set the Bacs Direct Debit + * Display Name during or right after creation. Custom branding incurs an additional monthly + * fee for the platform. If you don't set the display name before requesting Bacs capability, + * it's automatically set as "Stripe" and the account is onboarded to Stripe + * branding, which is free. + */ + @SerializedName("display_name") + Object displayName; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private BacsDebitPayments(Object displayName, Map extraParams) { + this.displayName = displayName; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object displayName; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public AccountUpdateParams.Settings.BacsDebitPayments build() { + return new AccountUpdateParams.Settings.BacsDebitPayments( + this.displayName, this.extraParams); + } + + /** + * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct + * Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps + * display it as the name of the business. To use custom branding, set the Bacs Direct Debit + * Display Name during or right after creation. Custom branding incurs an additional monthly + * fee for the platform. If you don't set the display name before requesting Bacs + * capability, it's automatically set as "Stripe" and the account is onboarded to + * Stripe branding, which is free. + */ + public Builder setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct + * Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps + * display it as the name of the business. To use custom branding, set the Bacs Direct Debit + * Display Name during or right after creation. Custom branding incurs an additional monthly + * fee for the platform. If you don't set the display name before requesting Bacs + * capability, it's automatically set as "Stripe" and the account is onboarded to + * Stripe branding, which is free. + */ + public Builder setDisplayName(EmptyParam displayName) { + this.displayName = displayName; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountUpdateParams.Settings.BacsDebitPayments#extraParams} for the field + * documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountUpdateParams.Settings.BacsDebitPayments#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } + @Getter public static class Branding { /** From b9116c54dc6185cb396b0f9b8c49e514ebd69142 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 16 Nov 2023 16:52:45 +0000 Subject: [PATCH 10/15] Update generated code for v667 --- OPENAPI_VERSION | 2 +- src/main/java/com/stripe/model/CustomerSession.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 13e06c1ee91..4f79f809489 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v666 \ No newline at end of file +v667 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/CustomerSession.java b/src/main/java/com/stripe/model/CustomerSession.java index 0f187ff4a3c..2dc4ca16e69 100644 --- a/src/main/java/com/stripe/model/CustomerSession.java +++ b/src/main/java/com/stripe/model/CustomerSession.java @@ -34,6 +34,10 @@ public class CustomerSession extends ApiResource { @SerializedName("client_secret") String clientSecret; + /** Time at which the object was created. Measured in seconds since the Unix epoch. */ + @SerializedName("created") + Long created; + /** The customer the customer session was created for. */ @SerializedName("customer") @Getter(lombok.AccessLevel.NONE) From 759871b807e150acdc321b5da404000cda884039 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 16 Nov 2023 17:04:58 +0000 Subject: [PATCH 11/15] Update generated code for v667 --- src/main/java/com/stripe/model/InvoiceLineItem.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/stripe/model/InvoiceLineItem.java b/src/main/java/com/stripe/model/InvoiceLineItem.java index d495c7fa4f2..716866f01d3 100644 --- a/src/main/java/com/stripe/model/InvoiceLineItem.java +++ b/src/main/java/com/stripe/model/InvoiceLineItem.java @@ -21,7 +21,7 @@ @Getter @Setter @EqualsAndHashCode(callSuper = false) -public class InvoiceLineItem extends ApiResource implements HasId, MetadataStore { +public class InvoiceLineItem extends ApiResource implements HasId { /** The amount, in cents (or local equivalent). */ @SerializedName("amount") Long amount; @@ -97,7 +97,6 @@ public class InvoiceLineItem extends ApiResource implements HasId, MetadataStore * 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. */ - @Getter(onMethod_ = {@Override}) @SerializedName("metadata") Map metadata; From 99f7bd722f1681f286964ce0a83b44667efaea15 Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 16 Nov 2023 18:05:54 +0000 Subject: [PATCH 12/15] Update generated code (#1683) * Update generated code for v657 * Update generated code for v658 * Update generated code for v659 * Update generated code for v660 * Update generated code for v661 * Update generated code for v662 * Update generated code for v666 * Update generated code for v667 * Handle InvoiceLineItem update case in test (#1684) --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Co-authored-by: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com> --- OPENAPI_VERSION | 2 +- src/main/java/com/stripe/model/Account.java | 16 +- src/main/java/com/stripe/model/Charge.java | 7 + .../com/stripe/model/InvoiceLineItem.java | 94 +- src/main/java/com/stripe/model/Price.java | 20 +- src/main/java/com/stripe/model/Topup.java | 6 +- .../com/stripe/model/checkout/Session.java | 48 + .../com/stripe/model/issuing/Transaction.java | 18 + .../com/stripe/param/AccountCreateParams.java | 103 ++ .../com/stripe/param/AccountUpdateParams.java | 117 ++ .../stripe/param/CreditNoteCreateParams.java | 174 +- .../CreditNotePreviewLinesListParams.java | 176 +- .../stripe/param/CreditNotePreviewParams.java | 174 +- .../param/InvoiceLineItemUpdateParams.java | 1590 +++++++++++++++++ .../service/InvoiceLineItemService.java | 58 + .../java/com/stripe/service/PriceService.java | 20 +- .../com/stripe/model/StandardizationTest.java | 8 + 17 files changed, 2605 insertions(+), 26 deletions(-) create mode 100644 src/main/java/com/stripe/param/InvoiceLineItemUpdateParams.java diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 341fbefcb59..4f79f809489 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v655 \ No newline at end of file +v667 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/Account.java b/src/main/java/com/stripe/model/Account.java index 9bc91c3287f..bb9ac0f64fa 100644 --- a/src/main/java/com/stripe/model/Account.java +++ b/src/main/java/com/stripe/model/Account.java @@ -1802,11 +1802,23 @@ public static class Settings extends StripeObject { @EqualsAndHashCode(callSuper = false) public static class BacsDebitPayments extends StripeObject { /** - * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct - * Debit, this will appear on the mandate, and as the statement descriptor. + * The Bacs Direct Debit display name for this account. For payments made with Bacs Direct + * Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps + * display it as the name of the business. To use custom branding, set the Bacs Direct Debit + * Display Name during or right after creation. Custom branding incurs an additional monthly + * fee for the platform. The fee appears 5 business days after requesting Bacs. If you don't + * set the display name before requesting Bacs capability, it's automatically set as + * "Stripe" and the account is onboarded to Stripe branding, which is free. */ @SerializedName("display_name") String displayName; + + /** + * The Bacs Direct Debit Service user number for this account. For payments made with Bacs + * Direct Debit, this number is a unique identifier of the account with our banking partners. + */ + @SerializedName("service_user_number") + String serviceUserNumber; } @Getter diff --git a/src/main/java/com/stripe/model/Charge.java b/src/main/java/com/stripe/model/Charge.java index c60bcd93f35..0e2732e0fc5 100644 --- a/src/main/java/com/stripe/model/Charge.java +++ b/src/main/java/com/stripe/model/Charge.java @@ -1578,6 +1578,13 @@ public static class Card extends StripeObject { @SerializedName("brand") String brand; + /** + * When using manual capture, a future timestamp at which the charge will be automatically + * refunded if uncaptured. + */ + @SerializedName("capture_before") + Long captureBefore; + /** Check results by Card networks on Card address and CVC at time of payment. */ @SerializedName("checks") Checks checks; diff --git a/src/main/java/com/stripe/model/InvoiceLineItem.java b/src/main/java/com/stripe/model/InvoiceLineItem.java index 011e4b30a70..0f27aa961b8 100644 --- a/src/main/java/com/stripe/model/InvoiceLineItem.java +++ b/src/main/java/com/stripe/model/InvoiceLineItem.java @@ -2,7 +2,14 @@ package com.stripe.model; import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.net.ApiMode; +import com.stripe.net.ApiRequestParams; import com.stripe.net.ApiResource; +import com.stripe.net.BaseAddress; +import com.stripe.net.RequestOptions; +import com.stripe.net.StripeResponseGetter; +import com.stripe.param.InvoiceLineItemUpdateParams; import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -14,7 +21,7 @@ @Getter @Setter @EqualsAndHashCode(callSuper = false) -public class InvoiceLineItem extends StripeObject implements HasId { +public class InvoiceLineItem extends ApiResource implements HasId { /** The amount, in cents (or local equivalent). */ @SerializedName("amount") Long amount; @@ -249,6 +256,79 @@ public void setDiscountObjects(List objs) { : null; } + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update(String invoice, Map params) throws StripeException { + return update(invoice, params, (RequestOptions) null); + } + + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update(String invoice, Map params, RequestOptions options) + throws StripeException { + String path = + String.format( + "/v1/invoices/%s/lines/%s", + ApiResource.urlEncodeId(invoice), ApiResource.urlEncodeId(this.getId())); + return getResponseGetter() + .request( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + params, + InvoiceLineItem.class, + options, + ApiMode.V1); + } + + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update(String invoice, InvoiceLineItemUpdateParams params) + throws StripeException { + return update(invoice, params, (RequestOptions) null); + } + + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update( + String invoice, InvoiceLineItemUpdateParams params, RequestOptions options) + throws StripeException { + String path = + String.format( + "/v1/invoices/%s/lines/%s", + ApiResource.urlEncodeId(invoice), ApiResource.urlEncodeId(this.getId())); + ApiResource.checkNullTypedParams(path, params); + return getResponseGetter() + .request( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + InvoiceLineItem.class, + options, + ApiMode.V1); + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -376,4 +456,16 @@ public void setTaxRateObject(TaxRate expandableObject) { this.taxRate = new ExpandableField(expandableObject.getId(), expandableObject); } } + + @Override + public void setResponseGetter(StripeResponseGetter responseGetter) { + super.setResponseGetter(responseGetter); + trySetResponseGetter(invoiceItem, responseGetter); + trySetResponseGetter(period, responseGetter); + trySetResponseGetter(plan, responseGetter); + trySetResponseGetter(price, responseGetter); + trySetResponseGetter(prorationDetails, responseGetter); + trySetResponseGetter(subscription, responseGetter); + trySetResponseGetter(subscriptionItem, responseGetter); + } } diff --git a/src/main/java/com/stripe/model/Price.java b/src/main/java/com/stripe/model/Price.java index 86271eefcd3..f987d44fbaa 100644 --- a/src/main/java/com/stripe/model/Price.java +++ b/src/main/java/com/stripe/model/Price.java @@ -254,12 +254,18 @@ public static Price create(PriceCreateParams params, RequestOptions options) ApiMode.V1); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public static PriceCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public static PriceCollection list(Map params, RequestOptions options) throws StripeException { String path = "/v1/prices"; @@ -274,12 +280,18 @@ public static PriceCollection list(Map params, RequestOptions op ApiMode.V1); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public static PriceCollection list(PriceListParams params) throws StripeException { return list(params, (RequestOptions) null); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public static PriceCollection list(PriceListParams params, RequestOptions options) throws StripeException { String path = "/v1/prices"; diff --git a/src/main/java/com/stripe/model/Topup.java b/src/main/java/com/stripe/model/Topup.java index 1522100bfb2..682e3606e49 100644 --- a/src/main/java/com/stripe/model/Topup.java +++ b/src/main/java/com/stripe/model/Topup.java @@ -105,11 +105,7 @@ public class Topup extends ApiResource implements MetadataStore, BalanceT @SerializedName("object") String object; - /** - * For most Stripe users, the source of every top-up is a bank account. This hash is then the source object describing that bank - * account. - */ + /** The source field is deprecated. It might not always be present in the API response. */ @SerializedName("source") Source source; diff --git a/src/main/java/com/stripe/model/checkout/Session.java b/src/main/java/com/stripe/model/checkout/Session.java index 99a7114b072..c89724c7268 100644 --- a/src/main/java/com/stripe/model/checkout/Session.java +++ b/src/main/java/com/stripe/model/checkout/Session.java @@ -1330,6 +1330,9 @@ public static class PaymentMethodOptions extends StripeObject { @SerializedName("paynow") Paynow paynow; + @SerializedName("paypal") + Paypal paypal; + @SerializedName("pix") Pix pix; @@ -2065,6 +2068,51 @@ public static class Paynow extends StripeObject { String setupFutureUsage; } + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Paypal extends StripeObject { + /** + * Controls when the funds will be captured from the customer's account. + * + *

Equal to {@code manual}. + */ + @SerializedName("capture_method") + String captureMethod; + + /** Preferred locale of the PayPal checkout page that the customer is redirected to. */ + @SerializedName("preferred_locale") + String preferredLocale; + + /** + * A reference of the PayPal transaction visible to customer which is mapped to PayPal's + * invoice ID. This must be a globally unique ID if you have configured in your PayPal + * settings to block multiple payments per invoice ID. + */ + @SerializedName("reference") + String reference; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + *

Providing this parameter will attach the payment method + * to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any + * required actions from the user are complete. If no Customer was provided, the payment + * method can still be attached to a Customer after + * the transaction completes. + * + *

When processing card payments, Stripe also uses {@code setup_future_usage} to + * dynamically optimize your payment flow and comply with regional legislation and network + * rules, such as SCA. + * + *

One of {@code none}, or {@code off_session}. + */ + @SerializedName("setup_future_usage") + String setupFutureUsage; + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/issuing/Transaction.java b/src/main/java/com/stripe/model/issuing/Transaction.java index 01ae7717b84..83173069467 100644 --- a/src/main/java/com/stripe/model/issuing/Transaction.java +++ b/src/main/java/com/stripe/model/issuing/Transaction.java @@ -135,6 +135,10 @@ public class Transaction extends ApiResource @SerializedName("metadata") Map metadata; + /** Details about the transaction, such as processing dates, set by the card network. */ + @SerializedName("network_data") + NetworkData networkData; + /** * String representing the object's type. Objects of the same type share the same value. * @@ -509,6 +513,19 @@ public static class MerchantData extends StripeObject { String url; } + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class NetworkData extends StripeObject { + /** + * The date the transaction was processed by the card network. This can be different from the + * date the seller recorded the transaction depending on when the acquirer submits the + * transaction to the network. + */ + @SerializedName("processing_date") + String processingDate; + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -840,6 +857,7 @@ public void setResponseGetter(StripeResponseGetter responseGetter) { trySetResponseGetter(cardholder, responseGetter); trySetResponseGetter(dispute, responseGetter); trySetResponseGetter(merchantData, responseGetter); + trySetResponseGetter(networkData, responseGetter); trySetResponseGetter(purchaseDetails, responseGetter); trySetResponseGetter(token, responseGetter); trySetResponseGetter(treasury, responseGetter); diff --git a/src/main/java/com/stripe/param/AccountCreateParams.java b/src/main/java/com/stripe/param/AccountCreateParams.java index 0249ac1de2f..1487508459f 100644 --- a/src/main/java/com/stripe/param/AccountCreateParams.java +++ b/src/main/java/com/stripe/param/AccountCreateParams.java @@ -8239,6 +8239,10 @@ public enum PoliticalExposure implements ApiRequestParams.EnumParam { @Getter public static class Settings { + /** Settings specific to Bacs Direct Debit. */ + @SerializedName("bacs_debit_payments") + BacsDebitPayments bacsDebitPayments; + /** * Settings used to apply the account's branding to email receipts, invoices, Checkout, and * other products. @@ -8276,6 +8280,7 @@ public static class Settings { Treasury treasury; private Settings( + BacsDebitPayments bacsDebitPayments, Branding branding, CardIssuing cardIssuing, CardPayments cardPayments, @@ -8283,6 +8288,7 @@ private Settings( Payments payments, Payouts payouts, Treasury treasury) { + this.bacsDebitPayments = bacsDebitPayments; this.branding = branding; this.cardIssuing = cardIssuing; this.cardPayments = cardPayments; @@ -8297,6 +8303,8 @@ public static Builder builder() { } public static class Builder { + private BacsDebitPayments bacsDebitPayments; + private Branding branding; private CardIssuing cardIssuing; @@ -8314,6 +8322,7 @@ public static class Builder { /** Finalize and obtain parameter instance from this builder. */ public AccountCreateParams.Settings build() { return new AccountCreateParams.Settings( + this.bacsDebitPayments, this.branding, this.cardIssuing, this.cardPayments, @@ -8323,6 +8332,13 @@ public AccountCreateParams.Settings build() { this.treasury); } + /** Settings specific to Bacs Direct Debit. */ + public Builder setBacsDebitPayments( + AccountCreateParams.Settings.BacsDebitPayments bacsDebitPayments) { + this.bacsDebitPayments = bacsDebitPayments; + return this; + } + /** * Settings used to apply the account's branding to email receipts, invoices, Checkout, and * other products. @@ -8389,6 +8405,93 @@ public Builder setTreasury(AccountCreateParams.Settings.Treasury treasury) { } } + @Getter + public static class BacsDebitPayments { + /** + * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct + * Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps + * display it as the name of the business. To use custom branding, set the Bacs Direct Debit + * Display Name during or right after creation. Custom branding incurs an additional monthly + * fee for the platform. If you don't set the display name before requesting Bacs capability, + * it's automatically set as "Stripe" and the account is onboarded to Stripe + * branding, which is free. + */ + @SerializedName("display_name") + String displayName; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private BacsDebitPayments(String displayName, Map extraParams) { + this.displayName = displayName; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String displayName; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public AccountCreateParams.Settings.BacsDebitPayments build() { + return new AccountCreateParams.Settings.BacsDebitPayments( + this.displayName, this.extraParams); + } + + /** + * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct + * Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps + * display it as the name of the business. To use custom branding, set the Bacs Direct Debit + * Display Name during or right after creation. Custom branding incurs an additional monthly + * fee for the platform. If you don't set the display name before requesting Bacs + * capability, it's automatically set as "Stripe" and the account is onboarded to + * Stripe branding, which is free. + */ + public Builder setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountCreateParams.Settings.BacsDebitPayments#extraParams} for the field + * documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountCreateParams.Settings.BacsDebitPayments#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } + @Getter public static class Branding { /** diff --git a/src/main/java/com/stripe/param/AccountUpdateParams.java b/src/main/java/com/stripe/param/AccountUpdateParams.java index 147bf42a4d1..19e2c391ad0 100644 --- a/src/main/java/com/stripe/param/AccountUpdateParams.java +++ b/src/main/java/com/stripe/param/AccountUpdateParams.java @@ -8870,6 +8870,10 @@ public enum PoliticalExposure implements ApiRequestParams.EnumParam { @Getter public static class Settings { + /** Settings specific to Bacs Direct Debit payments. */ + @SerializedName("bacs_debit_payments") + BacsDebitPayments bacsDebitPayments; + /** * Settings used to apply the account's branding to email receipts, invoices, Checkout, and * other products. @@ -8907,6 +8911,7 @@ public static class Settings { Treasury treasury; private Settings( + BacsDebitPayments bacsDebitPayments, Branding branding, CardIssuing cardIssuing, CardPayments cardPayments, @@ -8914,6 +8919,7 @@ private Settings( Payments payments, Payouts payouts, Treasury treasury) { + this.bacsDebitPayments = bacsDebitPayments; this.branding = branding; this.cardIssuing = cardIssuing; this.cardPayments = cardPayments; @@ -8928,6 +8934,8 @@ public static Builder builder() { } public static class Builder { + private BacsDebitPayments bacsDebitPayments; + private Branding branding; private CardIssuing cardIssuing; @@ -8945,6 +8953,7 @@ public static class Builder { /** Finalize and obtain parameter instance from this builder. */ public AccountUpdateParams.Settings build() { return new AccountUpdateParams.Settings( + this.bacsDebitPayments, this.branding, this.cardIssuing, this.cardPayments, @@ -8954,6 +8963,13 @@ public AccountUpdateParams.Settings build() { this.treasury); } + /** Settings specific to Bacs Direct Debit payments. */ + public Builder setBacsDebitPayments( + AccountUpdateParams.Settings.BacsDebitPayments bacsDebitPayments) { + this.bacsDebitPayments = bacsDebitPayments; + return this; + } + /** * Settings used to apply the account's branding to email receipts, invoices, Checkout, and * other products. @@ -9020,6 +9036,107 @@ public Builder setTreasury(AccountUpdateParams.Settings.Treasury treasury) { } } + @Getter + public static class BacsDebitPayments { + /** + * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct + * Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps + * display it as the name of the business. To use custom branding, set the Bacs Direct Debit + * Display Name during or right after creation. Custom branding incurs an additional monthly + * fee for the platform. If you don't set the display name before requesting Bacs capability, + * it's automatically set as "Stripe" and the account is onboarded to Stripe + * branding, which is free. + */ + @SerializedName("display_name") + Object displayName; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private BacsDebitPayments(Object displayName, Map extraParams) { + this.displayName = displayName; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object displayName; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public AccountUpdateParams.Settings.BacsDebitPayments build() { + return new AccountUpdateParams.Settings.BacsDebitPayments( + this.displayName, this.extraParams); + } + + /** + * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct + * Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps + * display it as the name of the business. To use custom branding, set the Bacs Direct Debit + * Display Name during or right after creation. Custom branding incurs an additional monthly + * fee for the platform. If you don't set the display name before requesting Bacs + * capability, it's automatically set as "Stripe" and the account is onboarded to + * Stripe branding, which is free. + */ + public Builder setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct + * Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps + * display it as the name of the business. To use custom branding, set the Bacs Direct Debit + * Display Name during or right after creation. Custom branding incurs an additional monthly + * fee for the platform. If you don't set the display name before requesting Bacs + * capability, it's automatically set as "Stripe" and the account is onboarded to + * Stripe branding, which is free. + */ + public Builder setDisplayName(EmptyParam displayName) { + this.displayName = displayName; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountUpdateParams.Settings.BacsDebitPayments#extraParams} for the field + * documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountUpdateParams.Settings.BacsDebitPayments#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } + @Getter public static class Branding { /** diff --git a/src/main/java/com/stripe/param/CreditNoteCreateParams.java b/src/main/java/com/stripe/param/CreditNoteCreateParams.java index 5a3d314a804..5532fce990d 100644 --- a/src/main/java/com/stripe/param/CreditNoteCreateParams.java +++ b/src/main/java/com/stripe/param/CreditNoteCreateParams.java @@ -406,9 +406,16 @@ public static class Line { @SerializedName("quantity") Long quantity; + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + @SerializedName("tax_amounts") + Object taxAmounts; + /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ @SerializedName("tax_rates") Object taxRates; @@ -442,6 +449,7 @@ private Line( Map extraParams, String invoiceLineItem, Long quantity, + Object taxAmounts, Object taxRates, Type type, Long unitAmount, @@ -451,6 +459,7 @@ private Line( this.extraParams = extraParams; this.invoiceLineItem = invoiceLineItem; this.quantity = quantity; + this.taxAmounts = taxAmounts; this.taxRates = taxRates; this.type = type; this.unitAmount = unitAmount; @@ -472,6 +481,8 @@ public static class Builder { private Long quantity; + private Object taxAmounts; + private Object taxRates; private Type type; @@ -488,6 +499,7 @@ public CreditNoteCreateParams.Line build() { this.extraParams, this.invoiceLineItem, this.quantity, + this.taxAmounts, this.taxRates, this.type, this.unitAmount, @@ -552,6 +564,52 @@ public Builder setQuantity(Long quantity) { return this; } + /** + * Add an element to `taxAmounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * CreditNoteCreateParams.Line#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addTaxAmount(CreditNoteCreateParams.Line.TaxAmount element) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).add(element); + return this; + } + + /** + * Add all elements to `taxAmounts` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * CreditNoteCreateParams.Line#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllTaxAmount(List elements) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).addAll(elements); + return this; + } + + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + public Builder setTaxAmounts(EmptyParam taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + public Builder setTaxAmounts(List taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + /** * Add an element to `taxRates` list. A list is initialized for the first `add/addAll` call, * and subsequent calls adds additional elements to the original list. See {@link @@ -582,7 +640,7 @@ public Builder addAllTaxRate(List elements) { /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ public Builder setTaxRates(EmptyParam taxRates) { this.taxRates = taxRates; @@ -591,7 +649,7 @@ public Builder setTaxRates(EmptyParam taxRates) { /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ public Builder setTaxRates(List taxRates) { this.taxRates = taxRates; @@ -628,6 +686,116 @@ public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) { } } + @Getter + public static class TaxAmount { + /** Required. The amount, in cents (or local equivalent), of the tax. */ + @SerializedName("amount") + Long amount; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. The id of the tax rate for this tax amount. The tax rate must + * have been automatically created by Stripe. + */ + @SerializedName("tax_rate") + String taxRate; + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + @SerializedName("taxable_amount") + Long taxableAmount; + + private TaxAmount( + Long amount, Map extraParams, String taxRate, Long taxableAmount) { + this.amount = amount; + this.extraParams = extraParams; + this.taxRate = taxRate; + this.taxableAmount = taxableAmount; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long amount; + + private Map extraParams; + + private String taxRate; + + private Long taxableAmount; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditNoteCreateParams.Line.TaxAmount build() { + return new CreditNoteCreateParams.Line.TaxAmount( + this.amount, this.extraParams, this.taxRate, this.taxableAmount); + } + + /** Required. The amount, in cents (or local equivalent), of the tax. */ + public Builder setAmount(Long amount) { + this.amount = amount; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CreditNoteCreateParams.Line.TaxAmount#extraParams} for the field + * documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CreditNoteCreateParams.Line.TaxAmount#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Required. The id of the tax rate for this tax amount. The tax rate must + * have been automatically created by Stripe. + */ + public Builder setTaxRate(String taxRate) { + this.taxRate = taxRate; + return this; + } + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + public Builder setTaxableAmount(Long taxableAmount) { + this.taxableAmount = taxableAmount; + return this; + } + } + } + public enum Type implements ApiRequestParams.EnumParam { @SerializedName("custom_line_item") CUSTOM_LINE_ITEM("custom_line_item"), diff --git a/src/main/java/com/stripe/param/CreditNotePreviewLinesListParams.java b/src/main/java/com/stripe/param/CreditNotePreviewLinesListParams.java index a5664180357..88deb153882 100644 --- a/src/main/java/com/stripe/param/CreditNotePreviewLinesListParams.java +++ b/src/main/java/com/stripe/param/CreditNotePreviewLinesListParams.java @@ -477,9 +477,16 @@ public static class Line { @SerializedName("quantity") Long quantity; + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + @SerializedName("tax_amounts") + Object taxAmounts; + /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ @SerializedName("tax_rates") Object taxRates; @@ -513,6 +520,7 @@ private Line( Map extraParams, String invoiceLineItem, Long quantity, + Object taxAmounts, Object taxRates, Type type, Long unitAmount, @@ -522,6 +530,7 @@ private Line( this.extraParams = extraParams; this.invoiceLineItem = invoiceLineItem; this.quantity = quantity; + this.taxAmounts = taxAmounts; this.taxRates = taxRates; this.type = type; this.unitAmount = unitAmount; @@ -543,6 +552,8 @@ public static class Builder { private Long quantity; + private Object taxAmounts; + private Object taxRates; private Type type; @@ -559,6 +570,7 @@ public CreditNotePreviewLinesListParams.Line build() { this.extraParams, this.invoiceLineItem, this.quantity, + this.taxAmounts, this.taxRates, this.type, this.unitAmount, @@ -623,6 +635,54 @@ public Builder setQuantity(Long quantity) { return this; } + /** + * Add an element to `taxAmounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * CreditNotePreviewLinesListParams.Line#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addTaxAmount(CreditNotePreviewLinesListParams.Line.TaxAmount element) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).add(element); + return this; + } + + /** + * Add all elements to `taxAmounts` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * CreditNotePreviewLinesListParams.Line#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllTaxAmount( + List elements) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).addAll(elements); + return this; + } + + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + public Builder setTaxAmounts(EmptyParam taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + public Builder setTaxAmounts( + List taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + /** * Add an element to `taxRates` list. A list is initialized for the first `add/addAll` call, * and subsequent calls adds additional elements to the original list. See {@link @@ -653,7 +713,7 @@ public Builder addAllTaxRate(List elements) { /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ public Builder setTaxRates(EmptyParam taxRates) { this.taxRates = taxRates; @@ -662,7 +722,7 @@ public Builder setTaxRates(EmptyParam taxRates) { /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ public Builder setTaxRates(List taxRates) { this.taxRates = taxRates; @@ -699,6 +759,116 @@ public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) { } } + @Getter + public static class TaxAmount { + /** Required. The amount, in cents (or local equivalent), of the tax. */ + @SerializedName("amount") + Long amount; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. The id of the tax rate for this tax amount. The tax rate must + * have been automatically created by Stripe. + */ + @SerializedName("tax_rate") + String taxRate; + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + @SerializedName("taxable_amount") + Long taxableAmount; + + private TaxAmount( + Long amount, Map extraParams, String taxRate, Long taxableAmount) { + this.amount = amount; + this.extraParams = extraParams; + this.taxRate = taxRate; + this.taxableAmount = taxableAmount; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long amount; + + private Map extraParams; + + private String taxRate; + + private Long taxableAmount; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditNotePreviewLinesListParams.Line.TaxAmount build() { + return new CreditNotePreviewLinesListParams.Line.TaxAmount( + this.amount, this.extraParams, this.taxRate, this.taxableAmount); + } + + /** Required. The amount, in cents (or local equivalent), of the tax. */ + public Builder setAmount(Long amount) { + this.amount = amount; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CreditNotePreviewLinesListParams.Line.TaxAmount#extraParams} for the + * field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CreditNotePreviewLinesListParams.Line.TaxAmount#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Required. The id of the tax rate for this tax amount. The tax rate must + * have been automatically created by Stripe. + */ + public Builder setTaxRate(String taxRate) { + this.taxRate = taxRate; + return this; + } + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + public Builder setTaxableAmount(Long taxableAmount) { + this.taxableAmount = taxableAmount; + return this; + } + } + } + public enum Type implements ApiRequestParams.EnumParam { @SerializedName("custom_line_item") CUSTOM_LINE_ITEM("custom_line_item"), diff --git a/src/main/java/com/stripe/param/CreditNotePreviewParams.java b/src/main/java/com/stripe/param/CreditNotePreviewParams.java index 35e2caf3ac7..a4513a36656 100644 --- a/src/main/java/com/stripe/param/CreditNotePreviewParams.java +++ b/src/main/java/com/stripe/param/CreditNotePreviewParams.java @@ -406,9 +406,16 @@ public static class Line { @SerializedName("quantity") Long quantity; + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + @SerializedName("tax_amounts") + Object taxAmounts; + /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ @SerializedName("tax_rates") Object taxRates; @@ -442,6 +449,7 @@ private Line( Map extraParams, String invoiceLineItem, Long quantity, + Object taxAmounts, Object taxRates, Type type, Long unitAmount, @@ -451,6 +459,7 @@ private Line( this.extraParams = extraParams; this.invoiceLineItem = invoiceLineItem; this.quantity = quantity; + this.taxAmounts = taxAmounts; this.taxRates = taxRates; this.type = type; this.unitAmount = unitAmount; @@ -472,6 +481,8 @@ public static class Builder { private Long quantity; + private Object taxAmounts; + private Object taxRates; private Type type; @@ -488,6 +499,7 @@ public CreditNotePreviewParams.Line build() { this.extraParams, this.invoiceLineItem, this.quantity, + this.taxAmounts, this.taxRates, this.type, this.unitAmount, @@ -552,6 +564,52 @@ public Builder setQuantity(Long quantity) { return this; } + /** + * Add an element to `taxAmounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * CreditNotePreviewParams.Line#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addTaxAmount(CreditNotePreviewParams.Line.TaxAmount element) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).add(element); + return this; + } + + /** + * Add all elements to `taxAmounts` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * CreditNotePreviewParams.Line#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllTaxAmount(List elements) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).addAll(elements); + return this; + } + + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + public Builder setTaxAmounts(EmptyParam taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + + /** + * A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with {@code + * tax_rates}. + */ + public Builder setTaxAmounts(List taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + /** * Add an element to `taxRates` list. A list is initialized for the first `add/addAll` call, * and subsequent calls adds additional elements to the original list. See {@link @@ -582,7 +640,7 @@ public Builder addAllTaxRate(List elements) { /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ public Builder setTaxRates(EmptyParam taxRates) { this.taxRates = taxRates; @@ -591,7 +649,7 @@ public Builder setTaxRates(EmptyParam taxRates) { /** * The tax rates which apply to the credit note line item. Only valid when the {@code type} is - * {@code custom_line_item}. + * {@code custom_line_item} and cannot be mixed with {@code tax_amounts}. */ public Builder setTaxRates(List taxRates) { this.taxRates = taxRates; @@ -628,6 +686,116 @@ public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) { } } + @Getter + public static class TaxAmount { + /** Required. The amount, in cents (or local equivalent), of the tax. */ + @SerializedName("amount") + Long amount; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. The id of the tax rate for this tax amount. The tax rate must + * have been automatically created by Stripe. + */ + @SerializedName("tax_rate") + String taxRate; + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + @SerializedName("taxable_amount") + Long taxableAmount; + + private TaxAmount( + Long amount, Map extraParams, String taxRate, Long taxableAmount) { + this.amount = amount; + this.extraParams = extraParams; + this.taxRate = taxRate; + this.taxableAmount = taxableAmount; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long amount; + + private Map extraParams; + + private String taxRate; + + private Long taxableAmount; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditNotePreviewParams.Line.TaxAmount build() { + return new CreditNotePreviewParams.Line.TaxAmount( + this.amount, this.extraParams, this.taxRate, this.taxableAmount); + } + + /** Required. The amount, in cents (or local equivalent), of the tax. */ + public Builder setAmount(Long amount) { + this.amount = amount; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CreditNotePreviewParams.Line.TaxAmount#extraParams} for the field + * documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link CreditNotePreviewParams.Line.TaxAmount#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Required. The id of the tax rate for this tax amount. The tax rate must + * have been automatically created by Stripe. + */ + public Builder setTaxRate(String taxRate) { + this.taxRate = taxRate; + return this; + } + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + public Builder setTaxableAmount(Long taxableAmount) { + this.taxableAmount = taxableAmount; + return this; + } + } + } + public enum Type implements ApiRequestParams.EnumParam { @SerializedName("custom_line_item") CUSTOM_LINE_ITEM("custom_line_item"), diff --git a/src/main/java/com/stripe/param/InvoiceLineItemUpdateParams.java b/src/main/java/com/stripe/param/InvoiceLineItemUpdateParams.java new file mode 100644 index 00000000000..a0bc54f9bdc --- /dev/null +++ b/src/main/java/com/stripe/param/InvoiceLineItemUpdateParams.java @@ -0,0 +1,1590 @@ +// File generated from our OpenAPI spec +package com.stripe.param; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import com.stripe.param.common.EmptyParam; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class InvoiceLineItemUpdateParams extends ApiRequestParams { + /** + * The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming + * invoice. If you want to apply a credit to the customer's account, pass a negative amount. + */ + @SerializedName("amount") + Long amount; + + /** + * An arbitrary string which you can attach to the invoice item. The description is displayed in + * the invoice for easy tracking. + */ + @SerializedName("description") + Object description; + + /** + * Controls whether discounts apply to this line item. Defaults to false for prorations or + * negative line items, and true for all other line items. Cannot be set to true for prorations. + */ + @SerializedName("discountable") + Boolean discountable; + + /** + * The coupons & existing discounts which apply to the line item. Item discounts are applied + * before invoice discounts. Pass an empty string to remove previously-defined discounts. + */ + @SerializedName("discounts") + Object discounts; + + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * 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. Individual keys can be unset by posting an empty value to them. All keys can + * be unset by posting an empty value to {@code metadata}. + */ + @SerializedName("metadata") + Object metadata; + + /** + * The period associated with this invoice item. When set to different values, the period will be + * rendered on the invoice. If you have Stripe Revenue Recognition enabled, the + * period will be used to recognize and defer revenue. See the Revenue + * Recognition documentation for details. + */ + @SerializedName("period") + Period period; + + /** The ID of the price object. */ + @SerializedName("price") + Object price; + + /** + * Data used to generate a new Price object + * inline. + */ + @SerializedName("price_data") + PriceData priceData; + + /** Non-negative integer. The quantity of units for the line item. */ + @SerializedName("quantity") + Long quantity; + + /** + * A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes on + * your own or use a third-party to calculate them. You cannot set tax amounts if any line item + * has tax_rates + * or if the invoice has default_tax_rates + * or uses automatic tax. Pass an empty string + * to remove previously defined tax amounts. + */ + @SerializedName("tax_amounts") + Object taxAmounts; + + /** + * The tax rates which apply to the line item. When set, the {@code default_tax_rates} on the + * invoice do not apply to this line item. Pass an empty string to remove previously-defined tax + * rates. + */ + @SerializedName("tax_rates") + Object taxRates; + + private InvoiceLineItemUpdateParams( + Long amount, + Object description, + Boolean discountable, + Object discounts, + List expand, + Map extraParams, + Object metadata, + Period period, + Object price, + PriceData priceData, + Long quantity, + Object taxAmounts, + Object taxRates) { + this.amount = amount; + this.description = description; + this.discountable = discountable; + this.discounts = discounts; + this.expand = expand; + this.extraParams = extraParams; + this.metadata = metadata; + this.period = period; + this.price = price; + this.priceData = priceData; + this.quantity = quantity; + this.taxAmounts = taxAmounts; + this.taxRates = taxRates; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long amount; + + private Object description; + + private Boolean discountable; + + private Object discounts; + + private List expand; + + private Map extraParams; + + private Object metadata; + + private Period period; + + private Object price; + + private PriceData priceData; + + private Long quantity; + + private Object taxAmounts; + + private Object taxRates; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams build() { + return new InvoiceLineItemUpdateParams( + this.amount, + this.description, + this.discountable, + this.discounts, + this.expand, + this.extraParams, + this.metadata, + this.period, + this.price, + this.priceData, + this.quantity, + this.taxAmounts, + this.taxRates); + } + + /** + * The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming + * invoice. If you want to apply a credit to the customer's account, pass a negative amount. + */ + public Builder setAmount(Long amount) { + this.amount = amount; + return this; + } + + /** + * An arbitrary string which you can attach to the invoice item. The description is displayed in + * the invoice for easy tracking. + */ + public Builder setDescription(String description) { + this.description = description; + return this; + } + + /** + * An arbitrary string which you can attach to the invoice item. The description is displayed in + * the invoice for easy tracking. + */ + public Builder setDescription(EmptyParam description) { + this.description = description; + return this; + } + + /** + * Controls whether discounts apply to this line item. Defaults to false for prorations or + * negative line items, and true for all other line items. Cannot be set to true for prorations. + */ + public Builder setDiscountable(Boolean discountable) { + this.discountable = discountable; + return this; + } + + /** + * Add an element to `discounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#discounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addDiscount(InvoiceLineItemUpdateParams.Discount element) { + if (this.discounts == null || this.discounts instanceof EmptyParam) { + this.discounts = new ArrayList(); + } + ((List) this.discounts).add(element); + return this; + } + + /** + * Add all elements to `discounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#discounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllDiscount(List elements) { + if (this.discounts == null || this.discounts instanceof EmptyParam) { + this.discounts = new ArrayList(); + } + ((List) this.discounts).addAll(elements); + return this; + } + + /** + * The coupons & existing discounts which apply to the line item. Item discounts are applied + * before invoice discounts. Pass an empty string to remove previously-defined discounts. + */ + public Builder setDiscounts(EmptyParam discounts) { + this.discounts = discounts; + return this; + } + + /** + * The coupons & existing discounts which apply to the line item. Item discounts are applied + * before invoice discounts. Pass an empty string to remove previously-defined discounts. + */ + public Builder setDiscounts(List discounts) { + this.discounts = discounts; + return this; + } + + /** + * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#expand} for the field documentation. + */ + public Builder addExpand(String element) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.add(element); + return this; + } + + /** + * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#expand} for the field documentation. + */ + public Builder addAllExpand(List elements) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.addAll(elements); + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link InvoiceLineItemUpdateParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll` call, + * and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams#metadata} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder putMetadata(String key, String value) { + if (this.metadata == null || this.metadata instanceof EmptyParam) { + this.metadata = new HashMap(); + } + ((Map) this.metadata).put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `metadata` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link InvoiceLineItemUpdateParams#metadata} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder putAllMetadata(Map map) { + if (this.metadata == null || this.metadata instanceof EmptyParam) { + this.metadata = new HashMap(); + } + ((Map) this.metadata).putAll(map); + return this; + } + + /** + * 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. Individual keys can be unset by posting an empty value to them. All keys + * can be unset by posting an empty value to {@code metadata}. + */ + public Builder setMetadata(EmptyParam metadata) { + this.metadata = metadata; + return this; + } + + /** + * 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. Individual keys can be unset by posting an empty value to them. All keys + * can be unset by posting an empty value to {@code metadata}. + */ + public Builder setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * The period associated with this invoice item. When set to different values, the period will + * be rendered on the invoice. If you have Stripe Revenue Recognition enabled, + * the period will be used to recognize and defer revenue. See the Revenue + * Recognition documentation for details. + */ + public Builder setPeriod(InvoiceLineItemUpdateParams.Period period) { + this.period = period; + return this; + } + + /** The ID of the price object. */ + public Builder setPrice(String price) { + this.price = price; + return this; + } + + /** The ID of the price object. */ + public Builder setPrice(EmptyParam price) { + this.price = price; + return this; + } + + /** + * Data used to generate a new Price object + * inline. + */ + public Builder setPriceData(InvoiceLineItemUpdateParams.PriceData priceData) { + this.priceData = priceData; + return this; + } + + /** Non-negative integer. The quantity of units for the line item. */ + public Builder setQuantity(Long quantity) { + this.quantity = quantity; + return this; + } + + /** + * Add an element to `taxAmounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addTaxAmount(InvoiceLineItemUpdateParams.TaxAmount element) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).add(element); + return this; + } + + /** + * Add all elements to `taxAmounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#taxAmounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllTaxAmount(List elements) { + if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { + this.taxAmounts = new ArrayList(); + } + ((List) this.taxAmounts).addAll(elements); + return this; + } + + /** + * A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes + * on your own or use a third-party to calculate them. You cannot set tax amounts if any line + * item has tax_rates + * or if the invoice has default_tax_rates + * or uses automatic tax. Pass an empty + * string to remove previously defined tax amounts. + */ + public Builder setTaxAmounts(EmptyParam taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + + /** + * A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes + * on your own or use a third-party to calculate them. You cannot set tax amounts if any line + * item has tax_rates + * or if the invoice has default_tax_rates + * or uses automatic tax. Pass an empty + * string to remove previously defined tax amounts. + */ + public Builder setTaxAmounts(List taxAmounts) { + this.taxAmounts = taxAmounts; + return this; + } + + /** + * Add an element to `taxRates` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#taxRates} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addTaxRate(String element) { + if (this.taxRates == null || this.taxRates instanceof EmptyParam) { + this.taxRates = new ArrayList(); + } + ((List) this.taxRates).add(element); + return this; + } + + /** + * Add all elements to `taxRates` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams#taxRates} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllTaxRate(List elements) { + if (this.taxRates == null || this.taxRates instanceof EmptyParam) { + this.taxRates = new ArrayList(); + } + ((List) this.taxRates).addAll(elements); + return this; + } + + /** + * The tax rates which apply to the line item. When set, the {@code default_tax_rates} on the + * invoice do not apply to this line item. Pass an empty string to remove previously-defined tax + * rates. + */ + public Builder setTaxRates(EmptyParam taxRates) { + this.taxRates = taxRates; + return this; + } + + /** + * The tax rates which apply to the line item. When set, the {@code default_tax_rates} on the + * invoice do not apply to this line item. Pass an empty string to remove previously-defined tax + * rates. + */ + public Builder setTaxRates(List taxRates) { + this.taxRates = taxRates; + return this; + } + } + + @Getter + public static class Discount { + /** ID of the coupon to create a new discount for. */ + @SerializedName("coupon") + Object coupon; + + /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ + @SerializedName("discount") + Object discount; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private Discount(Object coupon, Object discount, Map extraParams) { + this.coupon = coupon; + this.discount = discount; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object coupon; + + private Object discount; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.Discount build() { + return new InvoiceLineItemUpdateParams.Discount( + this.coupon, this.discount, this.extraParams); + } + + /** ID of the coupon to create a new discount for. */ + public Builder setCoupon(String coupon) { + this.coupon = coupon; + return this; + } + + /** ID of the coupon to create a new discount for. */ + public Builder setCoupon(EmptyParam coupon) { + this.coupon = coupon; + return this; + } + + /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ + public Builder setDiscount(String discount) { + this.discount = discount; + return this; + } + + /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ + public Builder setDiscount(EmptyParam discount) { + this.discount = discount; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams.Discount#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link InvoiceLineItemUpdateParams.Discount#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } + + @Getter + public static class Period { + /** + * Required. The end of the period, which must be greater than or equal to the + * start. This value is inclusive. + */ + @SerializedName("end") + Long end; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** Required. The start of the period. This value is inclusive. */ + @SerializedName("start") + Long start; + + private Period(Long end, Map extraParams, Long start) { + this.end = end; + this.extraParams = extraParams; + this.start = start; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long end; + + private Map extraParams; + + private Long start; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.Period build() { + return new InvoiceLineItemUpdateParams.Period(this.end, this.extraParams, this.start); + } + + /** + * Required. The end of the period, which must be greater than or equal to + * the start. This value is inclusive. + */ + public Builder setEnd(Long end) { + this.end = end; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams.Period#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link InvoiceLineItemUpdateParams.Period#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Required. The start of the period. This value is inclusive. */ + public Builder setStart(Long start) { + this.start = start; + return this; + } + } + } + + @Getter + public static class PriceData { + /** + * Required. Three-letter ISO currency code, in lowercase. + * Must be a supported currency. + */ + @SerializedName("currency") + Object currency; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * The ID of the product that this price will belong to. One of {@code product} or {@code + * product_data} is required. + */ + @SerializedName("product") + Object product; + + /** + * Data used to generate a new product object inline. One of {@code product} or {@code + * product_data} is required. + */ + @SerializedName("product_data") + ProductData productData; + + /** + * Only required if a default + * tax behavior was not provided in the Stripe Tax settings. Specifies whether the price is + * considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code + * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code + * exclusive}, it cannot be changed. + */ + @SerializedName("tax_behavior") + TaxBehavior taxBehavior; + + /** + * A non-negative integer in cents (or local equivalent) representing how much to charge. One of + * {@code unit_amount} or {@code unit_amount_decimal} is required. + */ + @SerializedName("unit_amount") + Long unitAmount; + + /** + * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent) with + * at most 12 decimal places. Only one of {@code unit_amount} and {@code unit_amount_decimal} + * can be set. + */ + @SerializedName("unit_amount_decimal") + Object unitAmountDecimal; + + private PriceData( + Object currency, + Map extraParams, + Object product, + ProductData productData, + TaxBehavior taxBehavior, + Long unitAmount, + Object unitAmountDecimal) { + this.currency = currency; + this.extraParams = extraParams; + this.product = product; + this.productData = productData; + this.taxBehavior = taxBehavior; + this.unitAmount = unitAmount; + this.unitAmountDecimal = unitAmountDecimal; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object currency; + + private Map extraParams; + + private Object product; + + private ProductData productData; + + private TaxBehavior taxBehavior; + + private Long unitAmount; + + private Object unitAmountDecimal; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.PriceData build() { + return new InvoiceLineItemUpdateParams.PriceData( + this.currency, + this.extraParams, + this.product, + this.productData, + this.taxBehavior, + this.unitAmount, + this.unitAmountDecimal); + } + + /** + * Required. Three-letter ISO currency code, in + * lowercase. Must be a supported currency. + */ + public Builder setCurrency(String currency) { + this.currency = currency; + return this; + } + + /** + * Required. Three-letter ISO currency code, in + * lowercase. Must be a supported currency. + */ + public Builder setCurrency(EmptyParam currency) { + this.currency = currency; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams.PriceData#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link InvoiceLineItemUpdateParams.PriceData#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * The ID of the product that this price will belong to. One of {@code product} or {@code + * product_data} is required. + */ + public Builder setProduct(String product) { + this.product = product; + return this; + } + + /** + * The ID of the product that this price will belong to. One of {@code product} or {@code + * product_data} is required. + */ + public Builder setProduct(EmptyParam product) { + this.product = product; + return this; + } + + /** + * Data used to generate a new product object inline. One of {@code product} or {@code + * product_data} is required. + */ + public Builder setProductData(InvoiceLineItemUpdateParams.PriceData.ProductData productData) { + this.productData = productData; + return this; + } + + /** + * Only required if a default + * tax behavior was not provided in the Stripe Tax settings. Specifies whether the price + * is considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code + * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code + * exclusive}, it cannot be changed. + */ + public Builder setTaxBehavior(InvoiceLineItemUpdateParams.PriceData.TaxBehavior taxBehavior) { + this.taxBehavior = taxBehavior; + return this; + } + + /** + * A non-negative integer in cents (or local equivalent) representing how much to charge. One + * of {@code unit_amount} or {@code unit_amount_decimal} is required. + */ + public Builder setUnitAmount(Long unitAmount) { + this.unitAmount = unitAmount; + return this; + } + + /** + * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent) + * with at most 12 decimal places. Only one of {@code unit_amount} and {@code + * unit_amount_decimal} can be set. + */ + public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) { + this.unitAmountDecimal = unitAmountDecimal; + return this; + } + + /** + * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent) + * with at most 12 decimal places. Only one of {@code unit_amount} and {@code + * unit_amount_decimal} can be set. + */ + public Builder setUnitAmountDecimal(EmptyParam unitAmountDecimal) { + this.unitAmountDecimal = unitAmountDecimal; + return this; + } + } + + @Getter + public static class ProductData { + /** + * The product's description, meant to be displayable to the customer. Use this field to + * optionally store a long form explanation of the product being sold for your own rendering + * purposes. + */ + @SerializedName("description") + Object description; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. + */ + @SerializedName("images") + List images; + + /** + * 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. Individual keys can be unset by posting an empty value to them. All + * keys can be unset by posting an empty value to {@code metadata}. + */ + @SerializedName("metadata") + Map metadata; + + /** Required. The product's name, meant to be displayable to the customer. */ + @SerializedName("name") + Object name; + + /** A tax code ID. */ + @SerializedName("tax_code") + Object taxCode; + + private ProductData( + Object description, + Map extraParams, + List images, + Map metadata, + Object name, + Object taxCode) { + this.description = description; + this.extraParams = extraParams; + this.images = images; + this.metadata = metadata; + this.name = name; + this.taxCode = taxCode; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object description; + + private Map extraParams; + + private List images; + + private Map metadata; + + private Object name; + + private Object taxCode; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.PriceData.ProductData build() { + return new InvoiceLineItemUpdateParams.PriceData.ProductData( + this.description, + this.extraParams, + this.images, + this.metadata, + this.name, + this.taxCode); + } + + /** + * The product's description, meant to be displayable to the customer. Use this field to + * optionally store a long form explanation of the product being sold for your own rendering + * purposes. + */ + public Builder setDescription(String description) { + this.description = description; + return this; + } + + /** + * The product's description, meant to be displayable to the customer. Use this field to + * optionally store a long form explanation of the product being sold for your own rendering + * purposes. + */ + public Builder setDescription(EmptyParam description) { + this.description = description; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.PriceData.ProductData#extraParams} for the + * field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.PriceData.ProductData#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Add an element to `images` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams.PriceData.ProductData#images} for the field documentation. + */ + public Builder addImage(String element) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(element); + return this; + } + + /** + * Add all elements to `images` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceLineItemUpdateParams.PriceData.ProductData#images} for the field documentation. + */ + public Builder addAllImage(List elements) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.addAll(elements); + return this; + } + + /** + * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams.PriceData.ProductData#metadata} for the field documentation. + */ + public Builder putMetadata(String key, String value) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `metadata` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.PriceData.ProductData#metadata} for the field + * documentation. + */ + public Builder putAllMetadata(Map map) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.putAll(map); + return this; + } + + /** + * Required. The product's name, meant to be displayable to the customer. + */ + public Builder setName(String name) { + this.name = name; + return this; + } + + /** + * Required. The product's name, meant to be displayable to the customer. + */ + public Builder setName(EmptyParam name) { + this.name = name; + return this; + } + + /** A tax code ID. */ + public Builder setTaxCode(String taxCode) { + this.taxCode = taxCode; + return this; + } + + /** A tax code ID. */ + public Builder setTaxCode(EmptyParam taxCode) { + this.taxCode = taxCode; + return this; + } + } + } + + public enum TaxBehavior implements ApiRequestParams.EnumParam { + @SerializedName("exclusive") + EXCLUSIVE("exclusive"), + + @SerializedName("inclusive") + INCLUSIVE("inclusive"), + + @SerializedName("unspecified") + UNSPECIFIED("unspecified"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + TaxBehavior(String value) { + this.value = value; + } + } + } + + @Getter + public static class TaxAmount { + /** Required. The amount, in cents (or local equivalent), of the tax. */ + @SerializedName("amount") + Long amount; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. Data to find or create a TaxRate object. + * + *

Stripe automatically creates or reuses a TaxRate object for each tax amount. If the {@code + * tax_rate_data} exactly matches a previous value, Stripe will reuse the TaxRate object. + * TaxRate objects created automatically by Stripe are immediately archived, do not appear in + * the line item’s {@code tax_rates}, and cannot be directly added to invoices, payments, or + * line items. + */ + @SerializedName("tax_rate_data") + TaxRateData taxRateData; + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + @SerializedName("taxable_amount") + Long taxableAmount; + + private TaxAmount( + Long amount, Map extraParams, TaxRateData taxRateData, Long taxableAmount) { + this.amount = amount; + this.extraParams = extraParams; + this.taxRateData = taxRateData; + this.taxableAmount = taxableAmount; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long amount; + + private Map extraParams; + + private TaxRateData taxRateData; + + private Long taxableAmount; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.TaxAmount build() { + return new InvoiceLineItemUpdateParams.TaxAmount( + this.amount, this.extraParams, this.taxRateData, this.taxableAmount); + } + + /** Required. The amount, in cents (or local equivalent), of the tax. */ + public Builder setAmount(Long amount) { + this.amount = amount; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * InvoiceLineItemUpdateParams.TaxAmount#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link InvoiceLineItemUpdateParams.TaxAmount#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Required. Data to find or create a TaxRate object. + * + *

Stripe automatically creates or reuses a TaxRate object for each tax amount. If the + * {@code tax_rate_data} exactly matches a previous value, Stripe will reuse the TaxRate + * object. TaxRate objects created automatically by Stripe are immediately archived, do not + * appear in the line item’s {@code tax_rates}, and cannot be directly added to invoices, + * payments, or line items. + */ + public Builder setTaxRateData(InvoiceLineItemUpdateParams.TaxAmount.TaxRateData taxRateData) { + this.taxRateData = taxRateData; + return this; + } + + /** + * Required. The amount on which tax is calculated, in cents (or local + * equivalent). + */ + public Builder setTaxableAmount(Long taxableAmount) { + this.taxableAmount = taxableAmount; + return this; + } + } + + @Getter + public static class TaxRateData { + /** + * Two-letter country code (ISO + * 3166-1 alpha-2). + */ + @SerializedName("country") + Object country; + + /** + * An arbitrary string attached to the tax rate for your internal use only. It will not be + * visible to your customers. + */ + @SerializedName("description") + Object description; + + /** + * Required. The display name of the tax rate, which will be shown to users. + */ + @SerializedName("display_name") + Object displayName; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** Required. This specifies if the tax rate is inclusive or exclusive. */ + @SerializedName("inclusive") + Boolean inclusive; + + /** + * The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. + * It also appears on your customer’s invoice. + */ + @SerializedName("jurisdiction") + Object jurisdiction; + + /** + * Required. The statutory tax rate percent. This field accepts decimal + * values between 0 and 100 inclusive with at most 4 decimal places. To accommodate + * fixed-amount taxes, set the percentage to zero. Stripe will not display zero percentages on + * the invoice unless the {@code amount} of the tax is also zero. + */ + @SerializedName("percentage") + BigDecimal percentage; + + /** + * ISO 3166-2 subdivision code, + * without country prefix. For example, "NY" for New York, United States. + */ + @SerializedName("state") + Object state; + + /** The high-level tax type, such as {@code vat} or {@code sales_tax}. */ + @SerializedName("tax_type") + TaxType taxType; + + private TaxRateData( + Object country, + Object description, + Object displayName, + Map extraParams, + Boolean inclusive, + Object jurisdiction, + BigDecimal percentage, + Object state, + TaxType taxType) { + this.country = country; + this.description = description; + this.displayName = displayName; + this.extraParams = extraParams; + this.inclusive = inclusive; + this.jurisdiction = jurisdiction; + this.percentage = percentage; + this.state = state; + this.taxType = taxType; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object country; + + private Object description; + + private Object displayName; + + private Map extraParams; + + private Boolean inclusive; + + private Object jurisdiction; + + private BigDecimal percentage; + + private Object state; + + private TaxType taxType; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceLineItemUpdateParams.TaxAmount.TaxRateData build() { + return new InvoiceLineItemUpdateParams.TaxAmount.TaxRateData( + this.country, + this.description, + this.displayName, + this.extraParams, + this.inclusive, + this.jurisdiction, + this.percentage, + this.state, + this.taxType); + } + + /** + * Two-letter country code (ISO + * 3166-1 alpha-2). + */ + public Builder setCountry(String country) { + this.country = country; + return this; + } + + /** + * Two-letter country code (ISO + * 3166-1 alpha-2). + */ + public Builder setCountry(EmptyParam country) { + this.country = country; + return this; + } + + /** + * An arbitrary string attached to the tax rate for your internal use only. It will not be + * visible to your customers. + */ + public Builder setDescription(String description) { + this.description = description; + return this; + } + + /** + * An arbitrary string attached to the tax rate for your internal use only. It will not be + * visible to your customers. + */ + public Builder setDescription(EmptyParam description) { + this.description = description; + return this; + } + + /** + * Required. The display name of the tax rate, which will be shown to + * users. + */ + public Builder setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Required. The display name of the tax rate, which will be shown to + * users. + */ + public Builder setDisplayName(EmptyParam displayName) { + this.displayName = displayName; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.TaxAmount.TaxRateData#extraParams} for the + * field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceLineItemUpdateParams.TaxAmount.TaxRateData#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Required. This specifies if the tax rate is inclusive or exclusive. */ + public Builder setInclusive(Boolean inclusive) { + this.inclusive = inclusive; + return this; + } + + /** + * The jurisdiction for the tax rate. You can use this label field for tax reporting + * purposes. It also appears on your customer’s invoice. + */ + public Builder setJurisdiction(String jurisdiction) { + this.jurisdiction = jurisdiction; + return this; + } + + /** + * The jurisdiction for the tax rate. You can use this label field for tax reporting + * purposes. It also appears on your customer’s invoice. + */ + public Builder setJurisdiction(EmptyParam jurisdiction) { + this.jurisdiction = jurisdiction; + return this; + } + + /** + * Required. The statutory tax rate percent. This field accepts decimal + * values between 0 and 100 inclusive with at most 4 decimal places. To accommodate + * fixed-amount taxes, set the percentage to zero. Stripe will not display zero percentages + * on the invoice unless the {@code amount} of the tax is also zero. + */ + public Builder setPercentage(BigDecimal percentage) { + this.percentage = percentage; + return this; + } + + /** + * ISO 3166-2 subdivision code, + * without country prefix. For example, "NY" for New York, United States. + */ + public Builder setState(String state) { + this.state = state; + return this; + } + + /** + * ISO 3166-2 subdivision code, + * without country prefix. For example, "NY" for New York, United States. + */ + public Builder setState(EmptyParam state) { + this.state = state; + return this; + } + + /** The high-level tax type, such as {@code vat} or {@code sales_tax}. */ + public Builder setTaxType( + InvoiceLineItemUpdateParams.TaxAmount.TaxRateData.TaxType taxType) { + this.taxType = taxType; + return this; + } + } + + public enum TaxType implements ApiRequestParams.EnumParam { + @SerializedName("amusement_tax") + AMUSEMENT_TAX("amusement_tax"), + + @SerializedName("communications_tax") + COMMUNICATIONS_TAX("communications_tax"), + + @SerializedName("gst") + GST("gst"), + + @SerializedName("hst") + HST("hst"), + + @SerializedName("igst") + IGST("igst"), + + @SerializedName("jct") + JCT("jct"), + + @SerializedName("lease_tax") + LEASE_TAX("lease_tax"), + + @SerializedName("pst") + PST("pst"), + + @SerializedName("qst") + QST("qst"), + + @SerializedName("rst") + RST("rst"), + + @SerializedName("sales_tax") + SALES_TAX("sales_tax"), + + @SerializedName("service_tax") + SERVICE_TAX("service_tax"), + + @SerializedName("vat") + VAT("vat"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + TaxType(String value) { + this.value = value; + } + } + } + } +} diff --git a/src/main/java/com/stripe/service/InvoiceLineItemService.java b/src/main/java/com/stripe/service/InvoiceLineItemService.java index b1dc41dd745..6e3b149c6f4 100644 --- a/src/main/java/com/stripe/service/InvoiceLineItemService.java +++ b/src/main/java/com/stripe/service/InvoiceLineItemService.java @@ -13,6 +13,7 @@ import com.stripe.net.RequestOptions; import com.stripe.net.StripeResponseGetter; import com.stripe.param.InvoiceLineItemListParams; +import com.stripe.param.InvoiceLineItemUpdateParams; public final class InvoiceLineItemService extends ApiService { public InvoiceLineItemService(StripeResponseGetter responseGetter) { @@ -64,4 +65,61 @@ public StripeCollection list( options, ApiMode.V1); } + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update( + String invoice, String lineItemId, InvoiceLineItemUpdateParams params) + throws StripeException { + return update(invoice, lineItemId, params, (RequestOptions) null); + } + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update(String invoice, String lineItemId, RequestOptions options) + throws StripeException { + return update(invoice, lineItemId, (InvoiceLineItemUpdateParams) null, options); + } + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update(String invoice, String lineItemId) throws StripeException { + return update(invoice, lineItemId, (InvoiceLineItemUpdateParams) null, (RequestOptions) null); + } + /** + * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the + * invoice line item, so they can only be updated through this endpoint. Other fields, such as + * {@code amount}, live on both the invoice item and the invoice line item, so updates on this + * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only + * possible before the invoice is finalized. + */ + public InvoiceLineItem update( + String invoice, String lineItemId, InvoiceLineItemUpdateParams params, RequestOptions options) + throws StripeException { + String path = + String.format( + "/v1/invoices/%s/lines/%s", + ApiResource.urlEncodeId(invoice), ApiResource.urlEncodeId(lineItemId)); + return getResponseGetter() + .request( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + InvoiceLineItem.class, + options, + ApiMode.V1); + } } diff --git a/src/main/java/com/stripe/service/PriceService.java b/src/main/java/com/stripe/service/PriceService.java index ba9a518bc1d..074e0829c8b 100644 --- a/src/main/java/com/stripe/service/PriceService.java +++ b/src/main/java/com/stripe/service/PriceService.java @@ -56,19 +56,31 @@ public StripeSearchResult search(PriceSearchParams params, RequestOptions options, ApiMode.V1); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public StripeCollection list(PriceListParams params) throws StripeException { return list(params, (RequestOptions) null); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public StripeCollection list(RequestOptions options) throws StripeException { return list((PriceListParams) null, options); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public StripeCollection list() throws StripeException { return list((PriceListParams) null, (RequestOptions) null); } - /** Returns a list of your prices. */ + /** + * Returns a list of your active prices. For the list of inactive prices, set {@code active} to + * false. + */ public StripeCollection list(PriceListParams params, RequestOptions options) throws StripeException { String path = "/v1/prices"; diff --git a/src/test/java/com/stripe/model/StandardizationTest.java b/src/test/java/com/stripe/model/StandardizationTest.java index d66c924f6c1..e941dda3a33 100644 --- a/src/test/java/com/stripe/model/StandardizationTest.java +++ b/src/test/java/com/stripe/model/StandardizationTest.java @@ -95,6 +95,14 @@ public void allNonDeprecatedMethodsTakeOptions() throws IOException, NoSuchMetho continue; } + // Skip the `public InvoiceLineItem update(String invoice, ... params) {...` overloads + // on InvoiceLineItem. + if (String.class.equals(parameters.get(0).getType().getRawType()) + && parameters.size() == 2 + && "update".equals(method.getName())) { + continue; + } + if (RequestOptions.class.isAssignableFrom(finalParamType)) { continue; } From 65deb0c1af0d09954e19402a354696eb6236fdb3 Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 16 Nov 2023 23:27:18 +0000 Subject: [PATCH 13/15] Update generated code (#1685) * Update generated code for v668 * Update generated code for v669 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- OPENAPI_VERSION | 2 +- .../com/stripe/model/InvoiceLineItem.java | 94 +- .../param/InvoiceLineItemUpdateParams.java | 1590 ----------------- .../param/checkout/SessionListParams.java | 33 + .../service/InvoiceLineItemService.java | 58 - 5 files changed, 35 insertions(+), 1742 deletions(-) delete mode 100644 src/main/java/com/stripe/param/InvoiceLineItemUpdateParams.java diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 4f79f809489..d491c28018d 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v667 \ No newline at end of file +v669 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/InvoiceLineItem.java b/src/main/java/com/stripe/model/InvoiceLineItem.java index 0f27aa961b8..011e4b30a70 100644 --- a/src/main/java/com/stripe/model/InvoiceLineItem.java +++ b/src/main/java/com/stripe/model/InvoiceLineItem.java @@ -2,14 +2,7 @@ package com.stripe.model; import com.google.gson.annotations.SerializedName; -import com.stripe.exception.StripeException; -import com.stripe.net.ApiMode; -import com.stripe.net.ApiRequestParams; import com.stripe.net.ApiResource; -import com.stripe.net.BaseAddress; -import com.stripe.net.RequestOptions; -import com.stripe.net.StripeResponseGetter; -import com.stripe.param.InvoiceLineItemUpdateParams; import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -21,7 +14,7 @@ @Getter @Setter @EqualsAndHashCode(callSuper = false) -public class InvoiceLineItem extends ApiResource implements HasId { +public class InvoiceLineItem extends StripeObject implements HasId { /** The amount, in cents (or local equivalent). */ @SerializedName("amount") Long amount; @@ -256,79 +249,6 @@ public void setDiscountObjects(List objs) { : null; } - /** - * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the - * invoice line item, so they can only be updated through this endpoint. Other fields, such as - * {@code amount}, live on both the invoice item and the invoice line item, so updates on this - * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only - * possible before the invoice is finalized. - */ - public InvoiceLineItem update(String invoice, Map params) throws StripeException { - return update(invoice, params, (RequestOptions) null); - } - - /** - * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the - * invoice line item, so they can only be updated through this endpoint. Other fields, such as - * {@code amount}, live on both the invoice item and the invoice line item, so updates on this - * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only - * possible before the invoice is finalized. - */ - public InvoiceLineItem update(String invoice, Map params, RequestOptions options) - throws StripeException { - String path = - String.format( - "/v1/invoices/%s/lines/%s", - ApiResource.urlEncodeId(invoice), ApiResource.urlEncodeId(this.getId())); - return getResponseGetter() - .request( - BaseAddress.API, - ApiResource.RequestMethod.POST, - path, - params, - InvoiceLineItem.class, - options, - ApiMode.V1); - } - - /** - * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the - * invoice line item, so they can only be updated through this endpoint. Other fields, such as - * {@code amount}, live on both the invoice item and the invoice line item, so updates on this - * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only - * possible before the invoice is finalized. - */ - public InvoiceLineItem update(String invoice, InvoiceLineItemUpdateParams params) - throws StripeException { - return update(invoice, params, (RequestOptions) null); - } - - /** - * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the - * invoice line item, so they can only be updated through this endpoint. Other fields, such as - * {@code amount}, live on both the invoice item and the invoice line item, so updates on this - * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only - * possible before the invoice is finalized. - */ - public InvoiceLineItem update( - String invoice, InvoiceLineItemUpdateParams params, RequestOptions options) - throws StripeException { - String path = - String.format( - "/v1/invoices/%s/lines/%s", - ApiResource.urlEncodeId(invoice), ApiResource.urlEncodeId(this.getId())); - ApiResource.checkNullTypedParams(path, params); - return getResponseGetter() - .request( - BaseAddress.API, - ApiResource.RequestMethod.POST, - path, - ApiRequestParams.paramsToMap(params), - InvoiceLineItem.class, - options, - ApiMode.V1); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -456,16 +376,4 @@ public void setTaxRateObject(TaxRate expandableObject) { this.taxRate = new ExpandableField(expandableObject.getId(), expandableObject); } } - - @Override - public void setResponseGetter(StripeResponseGetter responseGetter) { - super.setResponseGetter(responseGetter); - trySetResponseGetter(invoiceItem, responseGetter); - trySetResponseGetter(period, responseGetter); - trySetResponseGetter(plan, responseGetter); - trySetResponseGetter(price, responseGetter); - trySetResponseGetter(prorationDetails, responseGetter); - trySetResponseGetter(subscription, responseGetter); - trySetResponseGetter(subscriptionItem, responseGetter); - } } diff --git a/src/main/java/com/stripe/param/InvoiceLineItemUpdateParams.java b/src/main/java/com/stripe/param/InvoiceLineItemUpdateParams.java deleted file mode 100644 index a0bc54f9bdc..00000000000 --- a/src/main/java/com/stripe/param/InvoiceLineItemUpdateParams.java +++ /dev/null @@ -1,1590 +0,0 @@ -// File generated from our OpenAPI spec -package com.stripe.param; - -import com.google.gson.annotations.SerializedName; -import com.stripe.net.ApiRequestParams; -import com.stripe.param.common.EmptyParam; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import lombok.Getter; - -@Getter -public class InvoiceLineItemUpdateParams extends ApiRequestParams { - /** - * The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming - * invoice. If you want to apply a credit to the customer's account, pass a negative amount. - */ - @SerializedName("amount") - Long amount; - - /** - * An arbitrary string which you can attach to the invoice item. The description is displayed in - * the invoice for easy tracking. - */ - @SerializedName("description") - Object description; - - /** - * Controls whether discounts apply to this line item. Defaults to false for prorations or - * negative line items, and true for all other line items. Cannot be set to true for prorations. - */ - @SerializedName("discountable") - Boolean discountable; - - /** - * The coupons & existing discounts which apply to the line item. Item discounts are applied - * before invoice discounts. Pass an empty string to remove previously-defined discounts. - */ - @SerializedName("discounts") - Object discounts; - - /** Specifies which fields in the response should be expanded. */ - @SerializedName("expand") - List expand; - - /** - * Map of extra parameters for custom features not available in this client library. The content - * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each - * key/value pair is serialized as if the key is a root-level field (serialized) name in this - * param object. Effectively, this map is flattened to its parent instance. - */ - @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) - Map extraParams; - - /** - * 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. Individual keys can be unset by posting an empty value to them. All keys can - * be unset by posting an empty value to {@code metadata}. - */ - @SerializedName("metadata") - Object metadata; - - /** - * The period associated with this invoice item. When set to different values, the period will be - * rendered on the invoice. If you have Stripe Revenue Recognition enabled, the - * period will be used to recognize and defer revenue. See the Revenue - * Recognition documentation for details. - */ - @SerializedName("period") - Period period; - - /** The ID of the price object. */ - @SerializedName("price") - Object price; - - /** - * Data used to generate a new Price object - * inline. - */ - @SerializedName("price_data") - PriceData priceData; - - /** Non-negative integer. The quantity of units for the line item. */ - @SerializedName("quantity") - Long quantity; - - /** - * A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes on - * your own or use a third-party to calculate them. You cannot set tax amounts if any line item - * has tax_rates - * or if the invoice has default_tax_rates - * or uses automatic tax. Pass an empty string - * to remove previously defined tax amounts. - */ - @SerializedName("tax_amounts") - Object taxAmounts; - - /** - * The tax rates which apply to the line item. When set, the {@code default_tax_rates} on the - * invoice do not apply to this line item. Pass an empty string to remove previously-defined tax - * rates. - */ - @SerializedName("tax_rates") - Object taxRates; - - private InvoiceLineItemUpdateParams( - Long amount, - Object description, - Boolean discountable, - Object discounts, - List expand, - Map extraParams, - Object metadata, - Period period, - Object price, - PriceData priceData, - Long quantity, - Object taxAmounts, - Object taxRates) { - this.amount = amount; - this.description = description; - this.discountable = discountable; - this.discounts = discounts; - this.expand = expand; - this.extraParams = extraParams; - this.metadata = metadata; - this.period = period; - this.price = price; - this.priceData = priceData; - this.quantity = quantity; - this.taxAmounts = taxAmounts; - this.taxRates = taxRates; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Long amount; - - private Object description; - - private Boolean discountable; - - private Object discounts; - - private List expand; - - private Map extraParams; - - private Object metadata; - - private Period period; - - private Object price; - - private PriceData priceData; - - private Long quantity; - - private Object taxAmounts; - - private Object taxRates; - - /** Finalize and obtain parameter instance from this builder. */ - public InvoiceLineItemUpdateParams build() { - return new InvoiceLineItemUpdateParams( - this.amount, - this.description, - this.discountable, - this.discounts, - this.expand, - this.extraParams, - this.metadata, - this.period, - this.price, - this.priceData, - this.quantity, - this.taxAmounts, - this.taxRates); - } - - /** - * The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming - * invoice. If you want to apply a credit to the customer's account, pass a negative amount. - */ - public Builder setAmount(Long amount) { - this.amount = amount; - return this; - } - - /** - * An arbitrary string which you can attach to the invoice item. The description is displayed in - * the invoice for easy tracking. - */ - public Builder setDescription(String description) { - this.description = description; - return this; - } - - /** - * An arbitrary string which you can attach to the invoice item. The description is displayed in - * the invoice for easy tracking. - */ - public Builder setDescription(EmptyParam description) { - this.description = description; - return this; - } - - /** - * Controls whether discounts apply to this line item. Defaults to false for prorations or - * negative line items, and true for all other line items. Cannot be set to true for prorations. - */ - public Builder setDiscountable(Boolean discountable) { - this.discountable = discountable; - return this; - } - - /** - * Add an element to `discounts` list. A list is initialized for the first `add/addAll` call, - * and subsequent calls adds additional elements to the original list. See {@link - * InvoiceLineItemUpdateParams#discounts} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder addDiscount(InvoiceLineItemUpdateParams.Discount element) { - if (this.discounts == null || this.discounts instanceof EmptyParam) { - this.discounts = new ArrayList(); - } - ((List) this.discounts).add(element); - return this; - } - - /** - * Add all elements to `discounts` list. A list is initialized for the first `add/addAll` call, - * and subsequent calls adds additional elements to the original list. See {@link - * InvoiceLineItemUpdateParams#discounts} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder addAllDiscount(List elements) { - if (this.discounts == null || this.discounts instanceof EmptyParam) { - this.discounts = new ArrayList(); - } - ((List) this.discounts).addAll(elements); - return this; - } - - /** - * The coupons & existing discounts which apply to the line item. Item discounts are applied - * before invoice discounts. Pass an empty string to remove previously-defined discounts. - */ - public Builder setDiscounts(EmptyParam discounts) { - this.discounts = discounts; - return this; - } - - /** - * The coupons & existing discounts which apply to the line item. Item discounts are applied - * before invoice discounts. Pass an empty string to remove previously-defined discounts. - */ - public Builder setDiscounts(List discounts) { - this.discounts = discounts; - return this; - } - - /** - * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and - * subsequent calls adds additional elements to the original list. See {@link - * InvoiceLineItemUpdateParams#expand} for the field documentation. - */ - public Builder addExpand(String element) { - if (this.expand == null) { - this.expand = new ArrayList<>(); - } - this.expand.add(element); - return this; - } - - /** - * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and - * subsequent calls adds additional elements to the original list. See {@link - * InvoiceLineItemUpdateParams#expand} for the field documentation. - */ - public Builder addAllExpand(List elements) { - if (this.expand == null) { - this.expand = new ArrayList<>(); - } - this.expand.addAll(elements); - return this; - } - - /** - * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` - * call, and subsequent calls add additional key/value pairs to the original map. See {@link - * InvoiceLineItemUpdateParams#extraParams} for the field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. - * See {@link InvoiceLineItemUpdateParams#extraParams} for the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - - /** - * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll` call, - * and subsequent calls add additional key/value pairs to the original map. See {@link - * InvoiceLineItemUpdateParams#metadata} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder putMetadata(String key, String value) { - if (this.metadata == null || this.metadata instanceof EmptyParam) { - this.metadata = new HashMap(); - } - ((Map) this.metadata).put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `metadata` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. - * See {@link InvoiceLineItemUpdateParams#metadata} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder putAllMetadata(Map map) { - if (this.metadata == null || this.metadata instanceof EmptyParam) { - this.metadata = new HashMap(); - } - ((Map) this.metadata).putAll(map); - return this; - } - - /** - * 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. Individual keys can be unset by posting an empty value to them. All keys - * can be unset by posting an empty value to {@code metadata}. - */ - public Builder setMetadata(EmptyParam metadata) { - this.metadata = metadata; - return this; - } - - /** - * 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. Individual keys can be unset by posting an empty value to them. All keys - * can be unset by posting an empty value to {@code metadata}. - */ - public Builder setMetadata(Map metadata) { - this.metadata = metadata; - return this; - } - - /** - * The period associated with this invoice item. When set to different values, the period will - * be rendered on the invoice. If you have Stripe Revenue Recognition enabled, - * the period will be used to recognize and defer revenue. See the Revenue - * Recognition documentation for details. - */ - public Builder setPeriod(InvoiceLineItemUpdateParams.Period period) { - this.period = period; - return this; - } - - /** The ID of the price object. */ - public Builder setPrice(String price) { - this.price = price; - return this; - } - - /** The ID of the price object. */ - public Builder setPrice(EmptyParam price) { - this.price = price; - return this; - } - - /** - * Data used to generate a new Price object - * inline. - */ - public Builder setPriceData(InvoiceLineItemUpdateParams.PriceData priceData) { - this.priceData = priceData; - return this; - } - - /** Non-negative integer. The quantity of units for the line item. */ - public Builder setQuantity(Long quantity) { - this.quantity = quantity; - return this; - } - - /** - * Add an element to `taxAmounts` list. A list is initialized for the first `add/addAll` call, - * and subsequent calls adds additional elements to the original list. See {@link - * InvoiceLineItemUpdateParams#taxAmounts} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder addTaxAmount(InvoiceLineItemUpdateParams.TaxAmount element) { - if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { - this.taxAmounts = new ArrayList(); - } - ((List) this.taxAmounts).add(element); - return this; - } - - /** - * Add all elements to `taxAmounts` list. A list is initialized for the first `add/addAll` call, - * and subsequent calls adds additional elements to the original list. See {@link - * InvoiceLineItemUpdateParams#taxAmounts} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder addAllTaxAmount(List elements) { - if (this.taxAmounts == null || this.taxAmounts instanceof EmptyParam) { - this.taxAmounts = new ArrayList(); - } - ((List) this.taxAmounts).addAll(elements); - return this; - } - - /** - * A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes - * on your own or use a third-party to calculate them. You cannot set tax amounts if any line - * item has tax_rates - * or if the invoice has default_tax_rates - * or uses automatic tax. Pass an empty - * string to remove previously defined tax amounts. - */ - public Builder setTaxAmounts(EmptyParam taxAmounts) { - this.taxAmounts = taxAmounts; - return this; - } - - /** - * A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes - * on your own or use a third-party to calculate them. You cannot set tax amounts if any line - * item has tax_rates - * or if the invoice has default_tax_rates - * or uses automatic tax. Pass an empty - * string to remove previously defined tax amounts. - */ - public Builder setTaxAmounts(List taxAmounts) { - this.taxAmounts = taxAmounts; - return this; - } - - /** - * Add an element to `taxRates` list. A list is initialized for the first `add/addAll` call, and - * subsequent calls adds additional elements to the original list. See {@link - * InvoiceLineItemUpdateParams#taxRates} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder addTaxRate(String element) { - if (this.taxRates == null || this.taxRates instanceof EmptyParam) { - this.taxRates = new ArrayList(); - } - ((List) this.taxRates).add(element); - return this; - } - - /** - * Add all elements to `taxRates` list. A list is initialized for the first `add/addAll` call, - * and subsequent calls adds additional elements to the original list. See {@link - * InvoiceLineItemUpdateParams#taxRates} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder addAllTaxRate(List elements) { - if (this.taxRates == null || this.taxRates instanceof EmptyParam) { - this.taxRates = new ArrayList(); - } - ((List) this.taxRates).addAll(elements); - return this; - } - - /** - * The tax rates which apply to the line item. When set, the {@code default_tax_rates} on the - * invoice do not apply to this line item. Pass an empty string to remove previously-defined tax - * rates. - */ - public Builder setTaxRates(EmptyParam taxRates) { - this.taxRates = taxRates; - return this; - } - - /** - * The tax rates which apply to the line item. When set, the {@code default_tax_rates} on the - * invoice do not apply to this line item. Pass an empty string to remove previously-defined tax - * rates. - */ - public Builder setTaxRates(List taxRates) { - this.taxRates = taxRates; - return this; - } - } - - @Getter - public static class Discount { - /** ID of the coupon to create a new discount for. */ - @SerializedName("coupon") - Object coupon; - - /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ - @SerializedName("discount") - Object discount; - - /** - * Map of extra parameters for custom features not available in this client library. The content - * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each - * key/value pair is serialized as if the key is a root-level field (serialized) name in this - * param object. Effectively, this map is flattened to its parent instance. - */ - @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) - Map extraParams; - - private Discount(Object coupon, Object discount, Map extraParams) { - this.coupon = coupon; - this.discount = discount; - this.extraParams = extraParams; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Object coupon; - - private Object discount; - - private Map extraParams; - - /** Finalize and obtain parameter instance from this builder. */ - public InvoiceLineItemUpdateParams.Discount build() { - return new InvoiceLineItemUpdateParams.Discount( - this.coupon, this.discount, this.extraParams); - } - - /** ID of the coupon to create a new discount for. */ - public Builder setCoupon(String coupon) { - this.coupon = coupon; - return this; - } - - /** ID of the coupon to create a new discount for. */ - public Builder setCoupon(EmptyParam coupon) { - this.coupon = coupon; - return this; - } - - /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ - public Builder setDiscount(String discount) { - this.discount = discount; - return this; - } - - /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ - public Builder setDiscount(EmptyParam discount) { - this.discount = discount; - return this; - } - - /** - * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` - * call, and subsequent calls add additional key/value pairs to the original map. See {@link - * InvoiceLineItemUpdateParams.Discount#extraParams} for the field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. - * See {@link InvoiceLineItemUpdateParams.Discount#extraParams} for the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - } - } - - @Getter - public static class Period { - /** - * Required. The end of the period, which must be greater than or equal to the - * start. This value is inclusive. - */ - @SerializedName("end") - Long end; - - /** - * Map of extra parameters for custom features not available in this client library. The content - * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each - * key/value pair is serialized as if the key is a root-level field (serialized) name in this - * param object. Effectively, this map is flattened to its parent instance. - */ - @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) - Map extraParams; - - /** Required. The start of the period. This value is inclusive. */ - @SerializedName("start") - Long start; - - private Period(Long end, Map extraParams, Long start) { - this.end = end; - this.extraParams = extraParams; - this.start = start; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Long end; - - private Map extraParams; - - private Long start; - - /** Finalize and obtain parameter instance from this builder. */ - public InvoiceLineItemUpdateParams.Period build() { - return new InvoiceLineItemUpdateParams.Period(this.end, this.extraParams, this.start); - } - - /** - * Required. The end of the period, which must be greater than or equal to - * the start. This value is inclusive. - */ - public Builder setEnd(Long end) { - this.end = end; - return this; - } - - /** - * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` - * call, and subsequent calls add additional key/value pairs to the original map. See {@link - * InvoiceLineItemUpdateParams.Period#extraParams} for the field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. - * See {@link InvoiceLineItemUpdateParams.Period#extraParams} for the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - - /** Required. The start of the period. This value is inclusive. */ - public Builder setStart(Long start) { - this.start = start; - return this; - } - } - } - - @Getter - public static class PriceData { - /** - * Required. Three-letter ISO currency code, in lowercase. - * Must be a supported currency. - */ - @SerializedName("currency") - Object currency; - - /** - * Map of extra parameters for custom features not available in this client library. The content - * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each - * key/value pair is serialized as if the key is a root-level field (serialized) name in this - * param object. Effectively, this map is flattened to its parent instance. - */ - @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) - Map extraParams; - - /** - * The ID of the product that this price will belong to. One of {@code product} or {@code - * product_data} is required. - */ - @SerializedName("product") - Object product; - - /** - * Data used to generate a new product object inline. One of {@code product} or {@code - * product_data} is required. - */ - @SerializedName("product_data") - ProductData productData; - - /** - * Only required if a default - * tax behavior was not provided in the Stripe Tax settings. Specifies whether the price is - * considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code - * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code - * exclusive}, it cannot be changed. - */ - @SerializedName("tax_behavior") - TaxBehavior taxBehavior; - - /** - * A non-negative integer in cents (or local equivalent) representing how much to charge. One of - * {@code unit_amount} or {@code unit_amount_decimal} is required. - */ - @SerializedName("unit_amount") - Long unitAmount; - - /** - * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent) with - * at most 12 decimal places. Only one of {@code unit_amount} and {@code unit_amount_decimal} - * can be set. - */ - @SerializedName("unit_amount_decimal") - Object unitAmountDecimal; - - private PriceData( - Object currency, - Map extraParams, - Object product, - ProductData productData, - TaxBehavior taxBehavior, - Long unitAmount, - Object unitAmountDecimal) { - this.currency = currency; - this.extraParams = extraParams; - this.product = product; - this.productData = productData; - this.taxBehavior = taxBehavior; - this.unitAmount = unitAmount; - this.unitAmountDecimal = unitAmountDecimal; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Object currency; - - private Map extraParams; - - private Object product; - - private ProductData productData; - - private TaxBehavior taxBehavior; - - private Long unitAmount; - - private Object unitAmountDecimal; - - /** Finalize and obtain parameter instance from this builder. */ - public InvoiceLineItemUpdateParams.PriceData build() { - return new InvoiceLineItemUpdateParams.PriceData( - this.currency, - this.extraParams, - this.product, - this.productData, - this.taxBehavior, - this.unitAmount, - this.unitAmountDecimal); - } - - /** - * Required. Three-letter ISO currency code, in - * lowercase. Must be a supported currency. - */ - public Builder setCurrency(String currency) { - this.currency = currency; - return this; - } - - /** - * Required. Three-letter ISO currency code, in - * lowercase. Must be a supported currency. - */ - public Builder setCurrency(EmptyParam currency) { - this.currency = currency; - return this; - } - - /** - * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` - * call, and subsequent calls add additional key/value pairs to the original map. See {@link - * InvoiceLineItemUpdateParams.PriceData#extraParams} for the field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. - * See {@link InvoiceLineItemUpdateParams.PriceData#extraParams} for the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - - /** - * The ID of the product that this price will belong to. One of {@code product} or {@code - * product_data} is required. - */ - public Builder setProduct(String product) { - this.product = product; - return this; - } - - /** - * The ID of the product that this price will belong to. One of {@code product} or {@code - * product_data} is required. - */ - public Builder setProduct(EmptyParam product) { - this.product = product; - return this; - } - - /** - * Data used to generate a new product object inline. One of {@code product} or {@code - * product_data} is required. - */ - public Builder setProductData(InvoiceLineItemUpdateParams.PriceData.ProductData productData) { - this.productData = productData; - return this; - } - - /** - * Only required if a default - * tax behavior was not provided in the Stripe Tax settings. Specifies whether the price - * is considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code - * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code - * exclusive}, it cannot be changed. - */ - public Builder setTaxBehavior(InvoiceLineItemUpdateParams.PriceData.TaxBehavior taxBehavior) { - this.taxBehavior = taxBehavior; - return this; - } - - /** - * A non-negative integer in cents (or local equivalent) representing how much to charge. One - * of {@code unit_amount} or {@code unit_amount_decimal} is required. - */ - public Builder setUnitAmount(Long unitAmount) { - this.unitAmount = unitAmount; - return this; - } - - /** - * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent) - * with at most 12 decimal places. Only one of {@code unit_amount} and {@code - * unit_amount_decimal} can be set. - */ - public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) { - this.unitAmountDecimal = unitAmountDecimal; - return this; - } - - /** - * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent) - * with at most 12 decimal places. Only one of {@code unit_amount} and {@code - * unit_amount_decimal} can be set. - */ - public Builder setUnitAmountDecimal(EmptyParam unitAmountDecimal) { - this.unitAmountDecimal = unitAmountDecimal; - return this; - } - } - - @Getter - public static class ProductData { - /** - * The product's description, meant to be displayable to the customer. Use this field to - * optionally store a long form explanation of the product being sold for your own rendering - * purposes. - */ - @SerializedName("description") - Object description; - - /** - * Map of extra parameters for custom features not available in this client library. The - * content in this map is not serialized under this field's {@code @SerializedName} value. - * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) - * name in this param object. Effectively, this map is flattened to its parent instance. - */ - @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) - Map extraParams; - - /** - * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. - */ - @SerializedName("images") - List images; - - /** - * 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. Individual keys can be unset by posting an empty value to them. All - * keys can be unset by posting an empty value to {@code metadata}. - */ - @SerializedName("metadata") - Map metadata; - - /** Required. The product's name, meant to be displayable to the customer. */ - @SerializedName("name") - Object name; - - /** A tax code ID. */ - @SerializedName("tax_code") - Object taxCode; - - private ProductData( - Object description, - Map extraParams, - List images, - Map metadata, - Object name, - Object taxCode) { - this.description = description; - this.extraParams = extraParams; - this.images = images; - this.metadata = metadata; - this.name = name; - this.taxCode = taxCode; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Object description; - - private Map extraParams; - - private List images; - - private Map metadata; - - private Object name; - - private Object taxCode; - - /** Finalize and obtain parameter instance from this builder. */ - public InvoiceLineItemUpdateParams.PriceData.ProductData build() { - return new InvoiceLineItemUpdateParams.PriceData.ProductData( - this.description, - this.extraParams, - this.images, - this.metadata, - this.name, - this.taxCode); - } - - /** - * The product's description, meant to be displayable to the customer. Use this field to - * optionally store a long form explanation of the product being sold for your own rendering - * purposes. - */ - public Builder setDescription(String description) { - this.description = description; - return this; - } - - /** - * The product's description, meant to be displayable to the customer. Use this field to - * optionally store a long form explanation of the product being sold for your own rendering - * purposes. - */ - public Builder setDescription(EmptyParam description) { - this.description = description; - return this; - } - - /** - * Add a key/value pair to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original - * map. See {@link InvoiceLineItemUpdateParams.PriceData.ProductData#extraParams} for the - * field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original - * map. See {@link InvoiceLineItemUpdateParams.PriceData.ProductData#extraParams} for the - * field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - - /** - * Add an element to `images` list. A list is initialized for the first `add/addAll` call, - * and subsequent calls adds additional elements to the original list. See {@link - * InvoiceLineItemUpdateParams.PriceData.ProductData#images} for the field documentation. - */ - public Builder addImage(String element) { - if (this.images == null) { - this.images = new ArrayList<>(); - } - this.images.add(element); - return this; - } - - /** - * Add all elements to `images` list. A list is initialized for the first `add/addAll` call, - * and subsequent calls adds additional elements to the original list. See {@link - * InvoiceLineItemUpdateParams.PriceData.ProductData#images} for the field documentation. - */ - public Builder addAllImage(List elements) { - if (this.images == null) { - this.images = new ArrayList<>(); - } - this.images.addAll(elements); - return this; - } - - /** - * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll` - * call, and subsequent calls add additional key/value pairs to the original map. See {@link - * InvoiceLineItemUpdateParams.PriceData.ProductData#metadata} for the field documentation. - */ - public Builder putMetadata(String key, String value) { - if (this.metadata == null) { - this.metadata = new HashMap<>(); - } - this.metadata.put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `metadata` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original - * map. See {@link InvoiceLineItemUpdateParams.PriceData.ProductData#metadata} for the field - * documentation. - */ - public Builder putAllMetadata(Map map) { - if (this.metadata == null) { - this.metadata = new HashMap<>(); - } - this.metadata.putAll(map); - return this; - } - - /** - * Required. The product's name, meant to be displayable to the customer. - */ - public Builder setName(String name) { - this.name = name; - return this; - } - - /** - * Required. The product's name, meant to be displayable to the customer. - */ - public Builder setName(EmptyParam name) { - this.name = name; - return this; - } - - /** A tax code ID. */ - public Builder setTaxCode(String taxCode) { - this.taxCode = taxCode; - return this; - } - - /** A tax code ID. */ - public Builder setTaxCode(EmptyParam taxCode) { - this.taxCode = taxCode; - return this; - } - } - } - - public enum TaxBehavior implements ApiRequestParams.EnumParam { - @SerializedName("exclusive") - EXCLUSIVE("exclusive"), - - @SerializedName("inclusive") - INCLUSIVE("inclusive"), - - @SerializedName("unspecified") - UNSPECIFIED("unspecified"); - - @Getter(onMethod_ = {@Override}) - private final String value; - - TaxBehavior(String value) { - this.value = value; - } - } - } - - @Getter - public static class TaxAmount { - /** Required. The amount, in cents (or local equivalent), of the tax. */ - @SerializedName("amount") - Long amount; - - /** - * Map of extra parameters for custom features not available in this client library. The content - * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each - * key/value pair is serialized as if the key is a root-level field (serialized) name in this - * param object. Effectively, this map is flattened to its parent instance. - */ - @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) - Map extraParams; - - /** - * Required. Data to find or create a TaxRate object. - * - *

Stripe automatically creates or reuses a TaxRate object for each tax amount. If the {@code - * tax_rate_data} exactly matches a previous value, Stripe will reuse the TaxRate object. - * TaxRate objects created automatically by Stripe are immediately archived, do not appear in - * the line item’s {@code tax_rates}, and cannot be directly added to invoices, payments, or - * line items. - */ - @SerializedName("tax_rate_data") - TaxRateData taxRateData; - - /** - * Required. The amount on which tax is calculated, in cents (or local - * equivalent). - */ - @SerializedName("taxable_amount") - Long taxableAmount; - - private TaxAmount( - Long amount, Map extraParams, TaxRateData taxRateData, Long taxableAmount) { - this.amount = amount; - this.extraParams = extraParams; - this.taxRateData = taxRateData; - this.taxableAmount = taxableAmount; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Long amount; - - private Map extraParams; - - private TaxRateData taxRateData; - - private Long taxableAmount; - - /** Finalize and obtain parameter instance from this builder. */ - public InvoiceLineItemUpdateParams.TaxAmount build() { - return new InvoiceLineItemUpdateParams.TaxAmount( - this.amount, this.extraParams, this.taxRateData, this.taxableAmount); - } - - /** Required. The amount, in cents (or local equivalent), of the tax. */ - public Builder setAmount(Long amount) { - this.amount = amount; - return this; - } - - /** - * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` - * call, and subsequent calls add additional key/value pairs to the original map. See {@link - * InvoiceLineItemUpdateParams.TaxAmount#extraParams} for the field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. - * See {@link InvoiceLineItemUpdateParams.TaxAmount#extraParams} for the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - - /** - * Required. Data to find or create a TaxRate object. - * - *

Stripe automatically creates or reuses a TaxRate object for each tax amount. If the - * {@code tax_rate_data} exactly matches a previous value, Stripe will reuse the TaxRate - * object. TaxRate objects created automatically by Stripe are immediately archived, do not - * appear in the line item’s {@code tax_rates}, and cannot be directly added to invoices, - * payments, or line items. - */ - public Builder setTaxRateData(InvoiceLineItemUpdateParams.TaxAmount.TaxRateData taxRateData) { - this.taxRateData = taxRateData; - return this; - } - - /** - * Required. The amount on which tax is calculated, in cents (or local - * equivalent). - */ - public Builder setTaxableAmount(Long taxableAmount) { - this.taxableAmount = taxableAmount; - return this; - } - } - - @Getter - public static class TaxRateData { - /** - * Two-letter country code (ISO - * 3166-1 alpha-2). - */ - @SerializedName("country") - Object country; - - /** - * An arbitrary string attached to the tax rate for your internal use only. It will not be - * visible to your customers. - */ - @SerializedName("description") - Object description; - - /** - * Required. The display name of the tax rate, which will be shown to users. - */ - @SerializedName("display_name") - Object displayName; - - /** - * Map of extra parameters for custom features not available in this client library. The - * content in this map is not serialized under this field's {@code @SerializedName} value. - * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) - * name in this param object. Effectively, this map is flattened to its parent instance. - */ - @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) - Map extraParams; - - /** Required. This specifies if the tax rate is inclusive or exclusive. */ - @SerializedName("inclusive") - Boolean inclusive; - - /** - * The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. - * It also appears on your customer’s invoice. - */ - @SerializedName("jurisdiction") - Object jurisdiction; - - /** - * Required. The statutory tax rate percent. This field accepts decimal - * values between 0 and 100 inclusive with at most 4 decimal places. To accommodate - * fixed-amount taxes, set the percentage to zero. Stripe will not display zero percentages on - * the invoice unless the {@code amount} of the tax is also zero. - */ - @SerializedName("percentage") - BigDecimal percentage; - - /** - * ISO 3166-2 subdivision code, - * without country prefix. For example, "NY" for New York, United States. - */ - @SerializedName("state") - Object state; - - /** The high-level tax type, such as {@code vat} or {@code sales_tax}. */ - @SerializedName("tax_type") - TaxType taxType; - - private TaxRateData( - Object country, - Object description, - Object displayName, - Map extraParams, - Boolean inclusive, - Object jurisdiction, - BigDecimal percentage, - Object state, - TaxType taxType) { - this.country = country; - this.description = description; - this.displayName = displayName; - this.extraParams = extraParams; - this.inclusive = inclusive; - this.jurisdiction = jurisdiction; - this.percentage = percentage; - this.state = state; - this.taxType = taxType; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Object country; - - private Object description; - - private Object displayName; - - private Map extraParams; - - private Boolean inclusive; - - private Object jurisdiction; - - private BigDecimal percentage; - - private Object state; - - private TaxType taxType; - - /** Finalize and obtain parameter instance from this builder. */ - public InvoiceLineItemUpdateParams.TaxAmount.TaxRateData build() { - return new InvoiceLineItemUpdateParams.TaxAmount.TaxRateData( - this.country, - this.description, - this.displayName, - this.extraParams, - this.inclusive, - this.jurisdiction, - this.percentage, - this.state, - this.taxType); - } - - /** - * Two-letter country code (ISO - * 3166-1 alpha-2). - */ - public Builder setCountry(String country) { - this.country = country; - return this; - } - - /** - * Two-letter country code (ISO - * 3166-1 alpha-2). - */ - public Builder setCountry(EmptyParam country) { - this.country = country; - return this; - } - - /** - * An arbitrary string attached to the tax rate for your internal use only. It will not be - * visible to your customers. - */ - public Builder setDescription(String description) { - this.description = description; - return this; - } - - /** - * An arbitrary string attached to the tax rate for your internal use only. It will not be - * visible to your customers. - */ - public Builder setDescription(EmptyParam description) { - this.description = description; - return this; - } - - /** - * Required. The display name of the tax rate, which will be shown to - * users. - */ - public Builder setDisplayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Required. The display name of the tax rate, which will be shown to - * users. - */ - public Builder setDisplayName(EmptyParam displayName) { - this.displayName = displayName; - return this; - } - - /** - * Add a key/value pair to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original - * map. See {@link InvoiceLineItemUpdateParams.TaxAmount.TaxRateData#extraParams} for the - * field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.put(key, value); - return this; - } - - /** - * Add all map key/value pairs to `extraParams` map. A map is initialized for the first - * `put/putAll` call, and subsequent calls add additional key/value pairs to the original - * map. See {@link InvoiceLineItemUpdateParams.TaxAmount.TaxRateData#extraParams} for the - * field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - - /** Required. This specifies if the tax rate is inclusive or exclusive. */ - public Builder setInclusive(Boolean inclusive) { - this.inclusive = inclusive; - return this; - } - - /** - * The jurisdiction for the tax rate. You can use this label field for tax reporting - * purposes. It also appears on your customer’s invoice. - */ - public Builder setJurisdiction(String jurisdiction) { - this.jurisdiction = jurisdiction; - return this; - } - - /** - * The jurisdiction for the tax rate. You can use this label field for tax reporting - * purposes. It also appears on your customer’s invoice. - */ - public Builder setJurisdiction(EmptyParam jurisdiction) { - this.jurisdiction = jurisdiction; - return this; - } - - /** - * Required. The statutory tax rate percent. This field accepts decimal - * values between 0 and 100 inclusive with at most 4 decimal places. To accommodate - * fixed-amount taxes, set the percentage to zero. Stripe will not display zero percentages - * on the invoice unless the {@code amount} of the tax is also zero. - */ - public Builder setPercentage(BigDecimal percentage) { - this.percentage = percentage; - return this; - } - - /** - * ISO 3166-2 subdivision code, - * without country prefix. For example, "NY" for New York, United States. - */ - public Builder setState(String state) { - this.state = state; - return this; - } - - /** - * ISO 3166-2 subdivision code, - * without country prefix. For example, "NY" for New York, United States. - */ - public Builder setState(EmptyParam state) { - this.state = state; - return this; - } - - /** The high-level tax type, such as {@code vat} or {@code sales_tax}. */ - public Builder setTaxType( - InvoiceLineItemUpdateParams.TaxAmount.TaxRateData.TaxType taxType) { - this.taxType = taxType; - return this; - } - } - - public enum TaxType implements ApiRequestParams.EnumParam { - @SerializedName("amusement_tax") - AMUSEMENT_TAX("amusement_tax"), - - @SerializedName("communications_tax") - COMMUNICATIONS_TAX("communications_tax"), - - @SerializedName("gst") - GST("gst"), - - @SerializedName("hst") - HST("hst"), - - @SerializedName("igst") - IGST("igst"), - - @SerializedName("jct") - JCT("jct"), - - @SerializedName("lease_tax") - LEASE_TAX("lease_tax"), - - @SerializedName("pst") - PST("pst"), - - @SerializedName("qst") - QST("qst"), - - @SerializedName("rst") - RST("rst"), - - @SerializedName("sales_tax") - SALES_TAX("sales_tax"), - - @SerializedName("service_tax") - SERVICE_TAX("service_tax"), - - @SerializedName("vat") - VAT("vat"); - - @Getter(onMethod_ = {@Override}) - private final String value; - - TaxType(String value) { - this.value = value; - } - } - } - } -} diff --git a/src/main/java/com/stripe/param/checkout/SessionListParams.java b/src/main/java/com/stripe/param/checkout/SessionListParams.java index ddabf018e8c..647c993ede1 100644 --- a/src/main/java/com/stripe/param/checkout/SessionListParams.java +++ b/src/main/java/com/stripe/param/checkout/SessionListParams.java @@ -65,6 +65,10 @@ public class SessionListParams extends ApiRequestParams { @SerializedName("starting_after") String startingAfter; + /** Only return the Checkout Sessions matching the given status. */ + @SerializedName("status") + Status status; + /** Only return the Checkout Session for the subscription specified. */ @SerializedName("subscription") String subscription; @@ -79,6 +83,7 @@ private SessionListParams( String paymentIntent, String paymentLink, String startingAfter, + Status status, String subscription) { this.customer = customer; this.customerDetails = customerDetails; @@ -89,6 +94,7 @@ private SessionListParams( this.paymentIntent = paymentIntent; this.paymentLink = paymentLink; this.startingAfter = startingAfter; + this.status = status; this.subscription = subscription; } @@ -115,6 +121,8 @@ public static class Builder { private String startingAfter; + private Status status; + private String subscription; /** Finalize and obtain parameter instance from this builder. */ @@ -129,6 +137,7 @@ public SessionListParams build() { this.paymentIntent, this.paymentLink, this.startingAfter, + this.status, this.subscription); } @@ -239,6 +248,12 @@ public Builder setStartingAfter(String startingAfter) { return this; } + /** Only return the Checkout Sessions matching the given status. */ + public Builder setStatus(SessionListParams.Status status) { + this.status = status; + return this; + } + /** Only return the Checkout Session for the subscription specified. */ public Builder setSubscription(String subscription) { this.subscription = subscription; @@ -313,4 +328,22 @@ public Builder putAllExtraParam(Map map) { } } } + + public enum Status implements ApiRequestParams.EnumParam { + @SerializedName("complete") + COMPLETE("complete"), + + @SerializedName("expired") + EXPIRED("expired"), + + @SerializedName("open") + OPEN("open"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Status(String value) { + this.value = value; + } + } } diff --git a/src/main/java/com/stripe/service/InvoiceLineItemService.java b/src/main/java/com/stripe/service/InvoiceLineItemService.java index 6e3b149c6f4..b1dc41dd745 100644 --- a/src/main/java/com/stripe/service/InvoiceLineItemService.java +++ b/src/main/java/com/stripe/service/InvoiceLineItemService.java @@ -13,7 +13,6 @@ import com.stripe.net.RequestOptions; import com.stripe.net.StripeResponseGetter; import com.stripe.param.InvoiceLineItemListParams; -import com.stripe.param.InvoiceLineItemUpdateParams; public final class InvoiceLineItemService extends ApiService { public InvoiceLineItemService(StripeResponseGetter responseGetter) { @@ -65,61 +64,4 @@ public StripeCollection list( options, ApiMode.V1); } - /** - * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the - * invoice line item, so they can only be updated through this endpoint. Other fields, such as - * {@code amount}, live on both the invoice item and the invoice line item, so updates on this - * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only - * possible before the invoice is finalized. - */ - public InvoiceLineItem update( - String invoice, String lineItemId, InvoiceLineItemUpdateParams params) - throws StripeException { - return update(invoice, lineItemId, params, (RequestOptions) null); - } - /** - * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the - * invoice line item, so they can only be updated through this endpoint. Other fields, such as - * {@code amount}, live on both the invoice item and the invoice line item, so updates on this - * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only - * possible before the invoice is finalized. - */ - public InvoiceLineItem update(String invoice, String lineItemId, RequestOptions options) - throws StripeException { - return update(invoice, lineItemId, (InvoiceLineItemUpdateParams) null, options); - } - /** - * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the - * invoice line item, so they can only be updated through this endpoint. Other fields, such as - * {@code amount}, live on both the invoice item and the invoice line item, so updates on this - * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only - * possible before the invoice is finalized. - */ - public InvoiceLineItem update(String invoice, String lineItemId) throws StripeException { - return update(invoice, lineItemId, (InvoiceLineItemUpdateParams) null, (RequestOptions) null); - } - /** - * Updates an invoice’s line item. Some fields, such as {@code tax_amounts}, only live on the - * invoice line item, so they can only be updated through this endpoint. Other fields, such as - * {@code amount}, live on both the invoice item and the invoice line item, so updates on this - * endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only - * possible before the invoice is finalized. - */ - public InvoiceLineItem update( - String invoice, String lineItemId, InvoiceLineItemUpdateParams params, RequestOptions options) - throws StripeException { - String path = - String.format( - "/v1/invoices/%s/lines/%s", - ApiResource.urlEncodeId(invoice), ApiResource.urlEncodeId(lineItemId)); - return getResponseGetter() - .request( - BaseAddress.API, - ApiResource.RequestMethod.POST, - path, - ApiRequestParams.paramsToMap(params), - InvoiceLineItem.class, - options, - ApiMode.V1); - } } From c977fb354583ee9540ec23e011a8591ca94fb2ee Mon Sep 17 00:00:00 2001 From: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com> Date: Thu, 16 Nov 2023 15:44:47 -0800 Subject: [PATCH 14/15] Merge latest codegen master (#1689) * Update generated code for v668 * Update generated code for v669 * Revert "Handle InvoiceLineItem update case in test (#1684)" (#1688) This reverts commit 6122eb2dd89f7a1b1d134666d3e4b2a145572513. --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- src/test/java/com/stripe/model/StandardizationTest.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/test/java/com/stripe/model/StandardizationTest.java b/src/test/java/com/stripe/model/StandardizationTest.java index e941dda3a33..d66c924f6c1 100644 --- a/src/test/java/com/stripe/model/StandardizationTest.java +++ b/src/test/java/com/stripe/model/StandardizationTest.java @@ -95,14 +95,6 @@ public void allNonDeprecatedMethodsTakeOptions() throws IOException, NoSuchMetho continue; } - // Skip the `public InvoiceLineItem update(String invoice, ... params) {...` overloads - // on InvoiceLineItem. - if (String.class.equals(parameters.get(0).getType().getRawType()) - && parameters.size() == 2 - && "update".equals(method.getName())) { - continue; - } - if (RequestOptions.class.isAssignableFrom(finalParamType)) { continue; } From c0c97856cd461dee71e26ea2dc3b1f92583a3b14 Mon Sep 17 00:00:00 2001 From: Annie Li Date: Thu, 16 Nov 2023 16:13:34 -0800 Subject: [PATCH 15/15] Bump version to 24.3.0 --- CHANGELOG.md | 11 +++++++++++ README.md | 8 ++++---- VERSION | 2 +- gradle.properties | 2 +- src/main/java/com/stripe/Stripe.java | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17e9ec09684..ceb60a37b6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ # Changelog +## 24.3.0 - 2023-11-16 +* [#1685](https://github.com/stripe/stripe-java/pull/1685) Update generated code + * Add support for `status` on `checkout.SessionListParams` +* [#1683](https://github.com/stripe/stripe-java/pull/1683) Update generated code + * Add support for `bacs_debit_payments` on `AccountCreateParams.settings` and `AccountUpdateParams.settings` + * Add support for `service_user_number` on `Account.settings.bacs_debit_payments` + * Add support for `capture_before` on `Charge.payment_method_details.card` + * Add support for `paypal` on `Checkout.Session.payment_method_options` + * Add support for `tax_amounts` on `CreditNoteCreateParams.lines[]`, `CreditNotePreviewLinesParams.lines[]`, and `CreditNotePreviewParams.lines[]` + * Add support for `network_data` on `Issuing.Transaction` + ## 24.2.0 - 2023-11-09 * [#1679](https://github.com/stripe/stripe-java/pull/1679) Update generated code * Add support for `metadata` on `Quote.subscription_data`, `QuoteCreateParams.subscription_data`, and `QuoteUpdateParams.subscription_data` diff --git a/README.md b/README.md index ef66c547c48..2ce4224db39 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Stripe Java client library -[![Maven Central](https://img.shields.io/badge/maven--central-v24.2.0-blue)](https://mvnrepository.com/artifact/com.stripe/stripe-java) +[![Maven Central](https://img.shields.io/badge/maven--central-v24.3.0-blue)](https://mvnrepository.com/artifact/com.stripe/stripe-java) [![JavaDoc](http://img.shields.io/badge/javadoc-reference-blue.svg)](https://stripe.dev/stripe-java) [![Build Status](https://github.com/stripe/stripe-java/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-java/actions?query=branch%3Amaster) [![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-java/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-java?branch=master) @@ -18,7 +18,7 @@ The official [Stripe][stripe] Java client library. Add this dependency to your project's build file: ```groovy -implementation "com.stripe:stripe-java:24.2.0" +implementation "com.stripe:stripe-java:24.3.0" ``` ### Maven users @@ -29,7 +29,7 @@ Add this dependency to your project's POM: com.stripe stripe-java - 24.2.0 + 24.3.0 ``` @@ -37,7 +37,7 @@ Add this dependency to your project's POM: You'll need to manually install the following JARs: -- [The Stripe JAR](https://search.maven.org/remotecontent?filepath=com/stripe/stripe-java/24.2.0/stripe-java-24.2.0.jar) +- [The Stripe JAR](https://search.maven.org/remotecontent?filepath=com/stripe/stripe-java/24.3.0/stripe-java-24.3.0.jar) - [Google Gson][gson] from . ### [ProGuard][proguard] diff --git a/VERSION b/VERSION index 5003ba8fd96..e9a9b4514ef 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -24.2.0 +24.3.0 diff --git a/gradle.properties b/gradle.properties index d786b58e52e..0edaab368cf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.stripe -VERSION_NAME=24.2.0 +VERSION_NAME=24.3.0 POM_URL=https://github.com/stripe/stripe-java POM_SCM_URL=git@github.com:stripe/stripe-java.git diff --git a/src/main/java/com/stripe/Stripe.java b/src/main/java/com/stripe/Stripe.java index 96619d421df..0f16a905b69 100644 --- a/src/main/java/com/stripe/Stripe.java +++ b/src/main/java/com/stripe/Stripe.java @@ -13,7 +13,7 @@ public abstract class Stripe { public static final String CONNECT_API_BASE = "https://connect.stripe.com"; public static final String LIVE_API_BASE = "https://api.stripe.com"; public static final String UPLOAD_API_BASE = "https://files.stripe.com"; - public static final String VERSION = "24.2.0"; + public static final String VERSION = "24.3.0"; public static volatile String apiKey; public static volatile String clientId;