From 265dcb5d509b1968760576ebaa093e604faf6536 Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 11:35:31 -0700 Subject: [PATCH] Update generated code (#1876) * Update generated code for v1268 * Update generated code for v1268 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- OPENAPI_VERSION | 2 +- src/main/java/com/stripe/ApiVersion.java | 2 +- .../java/com/stripe/model/Capability.java | 6 +- .../java/com/stripe/model/CreditNote.java | 73 +++ .../com/stripe/model/CreditNoteLineItem.java | 73 +++ src/main/java/com/stripe/model/Customer.java | 9 +- .../stripe/model/EventDataClassLookup.java | 7 + src/main/java/com/stripe/model/Invoice.java | 97 +++ .../com/stripe/model/InvoiceLineItem.java | 97 +++ src/main/java/com/stripe/model/Margin.java | 72 ++ .../java/com/stripe/model/PromotionCode.java | 3 +- .../java/com/stripe/model/Subscription.java | 90 +-- .../java/com/stripe/model/billing/Alert.java | 85 +-- .../model/billing/CreditBalanceSummary.java | 191 ++++++ .../billing/CreditBalanceTransaction.java | 346 ++++++++++ .../CreditBalanceTransactionCollection.java | 7 + .../com/stripe/model/billing/CreditGrant.java | 448 +++++++++++++ .../model/billing/CreditGrantCollection.java | 6 + .../java/com/stripe/model/tax/Settings.java | 3 +- .../stripe/model/treasury/ReceivedCredit.java | 3 +- .../com/stripe/param/ProductCreateParams.java | 155 ++++- .../param/PromotionCodeCreateParams.java | 10 +- .../param/WebhookEndpointCreateParams.java | 5 +- .../param/billing/AlertCreateParams.java | 283 ++++---- .../CreditBalanceSummaryRetrieveParams.java | 332 ++++++++++ .../CreditBalanceTransactionListParams.java | 203 ++++++ ...reditBalanceTransactionRetrieveParams.java | 99 +++ .../billing/CreditGrantCreateParams.java | 620 ++++++++++++++++++ .../billing/CreditGrantExpireParams.java | 98 +++ .../param/billing/CreditGrantListParams.java | 188 ++++++ .../billing/CreditGrantRetrieveParams.java | 98 +++ .../billing/CreditGrantUpdateParams.java | 168 +++++ .../billing/CreditGrantVoidGrantParams.java | 98 +++ .../ConfigurationCreateParams.java | 26 +- .../param/checkout/SessionCreateParams.java | 6 +- .../ReaderProcessPaymentIntentParams.java | 47 +- .../ReaderProcessSetupIntentParams.java | 52 +- .../com/stripe/service/BillingService.java | 12 + .../stripe/service/SubscriptionService.java | 72 +- .../billing/CreditBalanceSummaryService.java | 38 ++ .../CreditBalanceTransactionService.java | 71 ++ .../service/billing/CreditGrantService.java | 170 +++++ .../stripe/functional/GeneratedExamples.java | 42 -- 43 files changed, 4162 insertions(+), 351 deletions(-) create mode 100644 src/main/java/com/stripe/model/Margin.java create mode 100644 src/main/java/com/stripe/model/billing/CreditBalanceSummary.java create mode 100644 src/main/java/com/stripe/model/billing/CreditBalanceTransaction.java create mode 100644 src/main/java/com/stripe/model/billing/CreditBalanceTransactionCollection.java create mode 100644 src/main/java/com/stripe/model/billing/CreditGrant.java create mode 100644 src/main/java/com/stripe/model/billing/CreditGrantCollection.java create mode 100644 src/main/java/com/stripe/param/billing/CreditBalanceSummaryRetrieveParams.java create mode 100644 src/main/java/com/stripe/param/billing/CreditBalanceTransactionListParams.java create mode 100644 src/main/java/com/stripe/param/billing/CreditBalanceTransactionRetrieveParams.java create mode 100644 src/main/java/com/stripe/param/billing/CreditGrantCreateParams.java create mode 100644 src/main/java/com/stripe/param/billing/CreditGrantExpireParams.java create mode 100644 src/main/java/com/stripe/param/billing/CreditGrantListParams.java create mode 100644 src/main/java/com/stripe/param/billing/CreditGrantRetrieveParams.java create mode 100644 src/main/java/com/stripe/param/billing/CreditGrantUpdateParams.java create mode 100644 src/main/java/com/stripe/param/billing/CreditGrantVoidGrantParams.java create mode 100644 src/main/java/com/stripe/service/billing/CreditBalanceSummaryService.java create mode 100644 src/main/java/com/stripe/service/billing/CreditBalanceTransactionService.java create mode 100644 src/main/java/com/stripe/service/billing/CreditGrantService.java diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 5f5b311191b..8f166ae2e06 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1267 \ No newline at end of file +v1268 \ No newline at end of file diff --git a/src/main/java/com/stripe/ApiVersion.java b/src/main/java/com/stripe/ApiVersion.java index df7e1a4f5d7..f10ace355e9 100644 --- a/src/main/java/com/stripe/ApiVersion.java +++ b/src/main/java/com/stripe/ApiVersion.java @@ -2,5 +2,5 @@ package com.stripe; final class ApiVersion { - public static final String CURRENT = "2024-06-20"; + public static final String CURRENT = "2024-09-30.acacia"; } diff --git a/src/main/java/com/stripe/model/Capability.java b/src/main/java/com/stripe/model/Capability.java index 3d62d9f46a8..5446816aa3d 100644 --- a/src/main/java/com/stripe/model/Capability.java +++ b/src/main/java/com/stripe/model/Capability.java @@ -60,8 +60,10 @@ public class Capability extends ApiResource implements HasId { Requirements requirements; /** - * The status of the capability. Can be {@code active}, {@code inactive}, {@code pending}, or - * {@code unrequested}. + * The status of the capability. + * + *

One of {@code active}, {@code disabled}, {@code inactive}, {@code pending}, or {@code + * unrequested}. */ @SerializedName("status") String status; diff --git a/src/main/java/com/stripe/model/CreditNote.java b/src/main/java/com/stripe/model/CreditNote.java index c1fd5c8a4ba..d9765793826 100644 --- a/src/main/java/com/stripe/model/CreditNote.java +++ b/src/main/java/com/stripe/model/CreditNote.java @@ -3,6 +3,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; +import com.stripe.model.billing.CreditBalanceTransaction; import com.stripe.net.ApiRequest; import com.stripe.net.ApiRequestParams; import com.stripe.net.ApiResource; @@ -142,6 +143,9 @@ public class CreditNote extends ApiResource implements HasId, MetadataStore pretaxCreditAmounts; + /** * Reason for issuing this credit note, one of {@code duplicate}, {@code fraudulent}, {@code * order_change}, or {@code product_unsatisfactory}. @@ -647,6 +651,75 @@ public void setDiscountObject(Discount expandableObject) { } } + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class PretaxCreditAmount extends StripeObject { + /** The amount, in cents (or local equivalent), of the pretax credit amount. */ + @SerializedName("amount") + Long amount; + + /** The credit balance transaction that was applied to get this pretax credit amount. */ + @SerializedName("credit_balance_transaction") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField creditBalanceTransaction; + + /** The discount that was applied to get this pretax credit amount. */ + @SerializedName("discount") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField discount; + + /** + * Type of the pretax credit amount referenced. + * + *

One of {@code credit_balance_transaction}, or {@code discount}. + */ + @SerializedName("type") + String type; + + /** Get ID of expandable {@code creditBalanceTransaction} object. */ + public String getCreditBalanceTransaction() { + return (this.creditBalanceTransaction != null) ? this.creditBalanceTransaction.getId() : null; + } + + public void setCreditBalanceTransaction(String id) { + this.creditBalanceTransaction = + ApiResource.setExpandableFieldId(id, this.creditBalanceTransaction); + } + + /** Get expanded {@code creditBalanceTransaction}. */ + public CreditBalanceTransaction getCreditBalanceTransactionObject() { + return (this.creditBalanceTransaction != null) + ? this.creditBalanceTransaction.getExpanded() + : null; + } + + public void setCreditBalanceTransactionObject(CreditBalanceTransaction expandableObject) { + this.creditBalanceTransaction = + new ExpandableField(expandableObject.getId(), expandableObject); + } + + /** Get ID of expandable {@code discount} object. */ + public String getDiscount() { + return (this.discount != null) ? this.discount.getId() : null; + } + + public void setDiscount(String id) { + this.discount = ApiResource.setExpandableFieldId(id, this.discount); + } + + /** Get expanded {@code discount}. */ + public Discount getDiscountObject() { + return (this.discount != null) ? this.discount.getExpanded() : null; + } + + public void setDiscountObject(Discount expandableObject) { + this.discount = new ExpandableField(expandableObject.getId(), expandableObject); + } + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/CreditNoteLineItem.java b/src/main/java/com/stripe/model/CreditNoteLineItem.java index 78b0f2f3f57..e22dec665c7 100644 --- a/src/main/java/com/stripe/model/CreditNoteLineItem.java +++ b/src/main/java/com/stripe/model/CreditNoteLineItem.java @@ -2,6 +2,7 @@ package com.stripe.model; import com.google.gson.annotations.SerializedName; +import com.stripe.model.billing.CreditBalanceTransaction; import com.stripe.net.ApiResource; import java.math.BigDecimal; import java.util.List; @@ -67,6 +68,9 @@ public class CreditNoteLineItem extends StripeObject implements HasId { @SerializedName("object") String object; + @SerializedName("pretax_credit_amounts") + List pretaxCreditAmounts; + /** The number of units of product being credited. */ @SerializedName("quantity") Long quantity; @@ -136,6 +140,75 @@ public void setDiscountObject(Discount expandableObject) { } } + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class PretaxCreditAmount extends StripeObject { + /** The amount, in cents (or local equivalent), of the pretax credit amount. */ + @SerializedName("amount") + Long amount; + + /** The credit balance transaction that was applied to get this pretax credit amount. */ + @SerializedName("credit_balance_transaction") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField creditBalanceTransaction; + + /** The discount that was applied to get this pretax credit amount. */ + @SerializedName("discount") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField discount; + + /** + * Type of the pretax credit amount referenced. + * + *

One of {@code credit_balance_transaction}, or {@code discount}. + */ + @SerializedName("type") + String type; + + /** Get ID of expandable {@code creditBalanceTransaction} object. */ + public String getCreditBalanceTransaction() { + return (this.creditBalanceTransaction != null) ? this.creditBalanceTransaction.getId() : null; + } + + public void setCreditBalanceTransaction(String id) { + this.creditBalanceTransaction = + ApiResource.setExpandableFieldId(id, this.creditBalanceTransaction); + } + + /** Get expanded {@code creditBalanceTransaction}. */ + public CreditBalanceTransaction getCreditBalanceTransactionObject() { + return (this.creditBalanceTransaction != null) + ? this.creditBalanceTransaction.getExpanded() + : null; + } + + public void setCreditBalanceTransactionObject(CreditBalanceTransaction expandableObject) { + this.creditBalanceTransaction = + new ExpandableField(expandableObject.getId(), expandableObject); + } + + /** Get ID of expandable {@code discount} object. */ + public String getDiscount() { + return (this.discount != null) ? this.discount.getId() : null; + } + + public void setDiscount(String id) { + this.discount = ApiResource.setExpandableFieldId(id, this.discount); + } + + /** Get expanded {@code discount}. */ + public Discount getDiscountObject() { + return (this.discount != null) ? this.discount.getExpanded() : null; + } + + public void setDiscountObject(Discount expandableObject) { + this.discount = new ExpandableField(expandableObject.getId(), expandableObject); + } + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Customer.java b/src/main/java/com/stripe/model/Customer.java index ee6edc8a467..aee848a4c6e 100644 --- a/src/main/java/com/stripe/model/Customer.java +++ b/src/main/java/com/stripe/model/Customer.java @@ -28,11 +28,10 @@ import lombok.Setter; /** - * This object represents a customer of your business. Use it to create recurring charges and track - * payments that belong to the same customer. - * - *

Related guide: Save a card - * during payment + * This object represents a customer of your business. Use it to create recurring charges, save payment and contact + * information, and track payments that belong to the same customer. */ @Getter @Setter diff --git a/src/main/java/com/stripe/model/EventDataClassLookup.java b/src/main/java/com/stripe/model/EventDataClassLookup.java index ef93e6eb9c5..77010d67fc5 100644 --- a/src/main/java/com/stripe/model/EventDataClassLookup.java +++ b/src/main/java/com/stripe/model/EventDataClassLookup.java @@ -51,6 +51,7 @@ final class EventDataClassLookup { classLookup.put("line_item", InvoiceLineItem.class); classLookup.put("login_link", LoginLink.class); classLookup.put("mandate", Mandate.class); + classLookup.put("margin", Margin.class); classLookup.put("payment_intent", PaymentIntent.class); classLookup.put("payment_link", PaymentLink.class); classLookup.put("payment_method", PaymentMethod.class); @@ -92,6 +93,12 @@ final class EventDataClassLookup { classLookup.put("billing.alert", com.stripe.model.billing.Alert.class); classLookup.put("billing.alert_triggered", com.stripe.model.billing.AlertTriggered.class); + classLookup.put( + "billing.credit_balance_summary", com.stripe.model.billing.CreditBalanceSummary.class); + classLookup.put( + "billing.credit_balance_transaction", + com.stripe.model.billing.CreditBalanceTransaction.class); + classLookup.put("billing.credit_grant", com.stripe.model.billing.CreditGrant.class); classLookup.put("billing.meter", com.stripe.model.billing.Meter.class); classLookup.put("billing.meter_event", com.stripe.model.billing.MeterEvent.class); classLookup.put( diff --git a/src/main/java/com/stripe/model/Invoice.java b/src/main/java/com/stripe/model/Invoice.java index 1e95ff9de66..157984478a2 100644 --- a/src/main/java/com/stripe/model/Invoice.java +++ b/src/main/java/com/stripe/model/Invoice.java @@ -3,6 +3,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; +import com.stripe.model.billing.CreditBalanceTransaction; import com.stripe.model.testhelpers.TestClock; import com.stripe.net.ApiRequest; import com.stripe.net.ApiRequestParams; @@ -615,6 +616,9 @@ public class Invoice extends ApiResource implements HasId, MetadataStore totalPretaxCreditAmounts; + /** The aggregate amounts calculated per tax rate for all line items. */ @SerializedName("total_tax_amounts") List totalTaxAmounts; @@ -2801,6 +2805,99 @@ public void setDiscountObject(Discount expandableObject) { } } + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class TotalPretaxCreditAmount extends StripeObject { + /** The amount, in cents (or local equivalent), of the pretax credit amount. */ + @SerializedName("amount") + Long amount; + + /** The credit balance transaction that was applied to get this pretax credit amount. */ + @SerializedName("credit_balance_transaction") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField creditBalanceTransaction; + + /** The discount that was applied to get this pretax credit amount. */ + @SerializedName("discount") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField discount; + + /** The margin that was applied to get this pretax credit amount. */ + @SerializedName("margin") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField margin; + + /** + * Type of the pretax credit amount referenced. + * + *

One of {@code credit_balance_transaction}, or {@code discount}. + */ + @SerializedName("type") + String type; + + /** Get ID of expandable {@code creditBalanceTransaction} object. */ + public String getCreditBalanceTransaction() { + return (this.creditBalanceTransaction != null) ? this.creditBalanceTransaction.getId() : null; + } + + public void setCreditBalanceTransaction(String id) { + this.creditBalanceTransaction = + ApiResource.setExpandableFieldId(id, this.creditBalanceTransaction); + } + + /** Get expanded {@code creditBalanceTransaction}. */ + public CreditBalanceTransaction getCreditBalanceTransactionObject() { + return (this.creditBalanceTransaction != null) + ? this.creditBalanceTransaction.getExpanded() + : null; + } + + public void setCreditBalanceTransactionObject(CreditBalanceTransaction expandableObject) { + this.creditBalanceTransaction = + new ExpandableField(expandableObject.getId(), expandableObject); + } + + /** Get ID of expandable {@code discount} object. */ + public String getDiscount() { + return (this.discount != null) ? this.discount.getId() : null; + } + + public void setDiscount(String id) { + this.discount = ApiResource.setExpandableFieldId(id, this.discount); + } + + /** Get expanded {@code discount}. */ + public Discount getDiscountObject() { + return (this.discount != null) ? this.discount.getExpanded() : null; + } + + public void setDiscountObject(Discount expandableObject) { + this.discount = new ExpandableField(expandableObject.getId(), expandableObject); + } + + /** Get ID of expandable {@code margin} object. */ + public String getMargin() { + return (this.margin != null) ? this.margin.getId() : null; + } + + public void setMargin(String id) { + this.margin = ApiResource.setExpandableFieldId(id, this.margin); + } + + /** Get expanded {@code margin}. */ + public Margin getMarginObject() { + return (this.margin != null) ? this.margin.getExpanded() : null; + } + + public void setMarginObject(Margin expandableObject) { + this.margin = new ExpandableField(expandableObject.getId(), expandableObject); + } + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/InvoiceLineItem.java b/src/main/java/com/stripe/model/InvoiceLineItem.java index 40fe6c4477e..cca366a045a 100644 --- a/src/main/java/com/stripe/model/InvoiceLineItem.java +++ b/src/main/java/com/stripe/model/InvoiceLineItem.java @@ -3,6 +3,7 @@ import com.google.gson.annotations.SerializedName; import com.stripe.exception.StripeException; +import com.stripe.model.billing.CreditBalanceTransaction; import com.stripe.net.ApiRequest; import com.stripe.net.ApiRequestParams; import com.stripe.net.ApiResource; @@ -119,6 +120,9 @@ public class InvoiceLineItem extends ApiResource implements HasId, MetadataStore @SerializedName("plan") Plan plan; + @SerializedName("pretax_credit_amounts") + List pretaxCreditAmounts; + /** The price of the line item. */ @SerializedName("price") Price price; @@ -386,6 +390,99 @@ public static class Period extends StripeObject { Long start; } + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class PretaxCreditAmount extends StripeObject { + /** The amount, in cents (or local equivalent), of the pretax credit amount. */ + @SerializedName("amount") + Long amount; + + /** The credit balance transaction that was applied to get this pretax credit amount. */ + @SerializedName("credit_balance_transaction") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField creditBalanceTransaction; + + /** The discount that was applied to get this pretax credit amount. */ + @SerializedName("discount") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField discount; + + /** The margin that was applied to get this pretax credit amount. */ + @SerializedName("margin") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField margin; + + /** + * Type of the pretax credit amount referenced. + * + *

One of {@code credit_balance_transaction}, or {@code discount}. + */ + @SerializedName("type") + String type; + + /** Get ID of expandable {@code creditBalanceTransaction} object. */ + public String getCreditBalanceTransaction() { + return (this.creditBalanceTransaction != null) ? this.creditBalanceTransaction.getId() : null; + } + + public void setCreditBalanceTransaction(String id) { + this.creditBalanceTransaction = + ApiResource.setExpandableFieldId(id, this.creditBalanceTransaction); + } + + /** Get expanded {@code creditBalanceTransaction}. */ + public CreditBalanceTransaction getCreditBalanceTransactionObject() { + return (this.creditBalanceTransaction != null) + ? this.creditBalanceTransaction.getExpanded() + : null; + } + + public void setCreditBalanceTransactionObject(CreditBalanceTransaction expandableObject) { + this.creditBalanceTransaction = + new ExpandableField(expandableObject.getId(), expandableObject); + } + + /** Get ID of expandable {@code discount} object. */ + public String getDiscount() { + return (this.discount != null) ? this.discount.getId() : null; + } + + public void setDiscount(String id) { + this.discount = ApiResource.setExpandableFieldId(id, this.discount); + } + + /** Get expanded {@code discount}. */ + public Discount getDiscountObject() { + return (this.discount != null) ? this.discount.getExpanded() : null; + } + + public void setDiscountObject(Discount expandableObject) { + this.discount = new ExpandableField(expandableObject.getId(), expandableObject); + } + + /** Get ID of expandable {@code margin} object. */ + public String getMargin() { + return (this.margin != null) ? this.margin.getId() : null; + } + + public void setMargin(String id) { + this.margin = ApiResource.setExpandableFieldId(id, this.margin); + } + + /** Get expanded {@code margin}. */ + public Margin getMarginObject() { + return (this.margin != null) ? this.margin.getExpanded() : null; + } + + public void setMarginObject(Margin expandableObject) { + this.margin = new ExpandableField(expandableObject.getId(), expandableObject); + } + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Margin.java b/src/main/java/com/stripe/model/Margin.java new file mode 100644 index 00000000000..c07035c635e --- /dev/null +++ b/src/main/java/com/stripe/model/Margin.java @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec +package com.stripe.model; + +import com.google.gson.annotations.SerializedName; +import java.math.BigDecimal; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + * A (partner) margin represents a specific discount distributed in partner reseller programs to + * business partners who resell products and services and earn a discount (margin) for doing so. + */ +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class Margin extends StripeObject implements HasId { + /** + * Whether the margin can be applied to invoices, invoice items, or invoice line items. Defaults + * to {@code true}. + */ + @SerializedName("active") + Boolean active; + + /** Time at which the object was created. Measured in seconds since the Unix epoch. */ + @SerializedName("created") + Long created; + + /** Unique identifier for the object. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + + /** + * Has the value {@code true} if the object exists in live mode or the value {@code false} if the + * object exists in test mode. + */ + @SerializedName("livemode") + Boolean livemode; + + /** + * Set of key-value pairs that you can attach + * to an object. This can be useful for storing additional information about the object in a + * structured format. + */ + @SerializedName("metadata") + Map metadata; + + /** Name of the margin that's displayed on, for example, invoices. */ + @SerializedName("name") + String name; + + /** + * String representing the object's type. Objects of the same type share the same value. + * + *

Equal to {@code margin}. + */ + @SerializedName("object") + String object; + + /** + * Percent that will be taken off the subtotal before tax (after all other discounts and + * promotions) of any invoice to which the margin is applied. + */ + @SerializedName("percent_off") + BigDecimal percentOff; + + /** Time at which the object was last updated. Measured in seconds since the Unix epoch. */ + @SerializedName("updated") + Long updated; +} diff --git a/src/main/java/com/stripe/model/PromotionCode.java b/src/main/java/com/stripe/model/PromotionCode.java index 06079e876e8..565bf323612 100644 --- a/src/main/java/com/stripe/model/PromotionCode.java +++ b/src/main/java/com/stripe/model/PromotionCode.java @@ -36,7 +36,8 @@ public class PromotionCode extends ApiResource implements HasId, MetadataStore

objs) { } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. + * Cancels a customer’s subscription immediately. The customer won’t be charged again for the + * subscription. After it’s canceled, you can no longer update the subscription or its metadata. * - *

Note, however, that any pending invoice items that you’ve created will still be charged for - * at the end of the period, unless manually deleted. If you’ve set the - * subscription to cancel at the end of the period, any pending prorations will also be left in - * place and collected at the end of the period. But if the subscription is set to cancel - * immediately, pending prorations will be removed. + *

Any pending invoice items that you’ve created are still charged at the end of the period, + * unless manually deleted. If you’ve + * set the subscription to cancel at the end of the period, any pending prorations are also left + * in place and collected at the end of the period. But if the subscription is set to cancel + * immediately, pending prorations are removed. * - *

By default, upon subscription cancellation, Stripe will stop automatic collection of all + *

By default, upon subscription cancellation, Stripe stops automatic collection of all * finalized invoices for the customer. This is intended to prevent unexpected payment attempts * after the customer has canceled a subscription. However, you can resume automatic collection of * the invoices manually after subscription cancellation to have us proceed. Or, you could check @@ -611,17 +611,17 @@ public Subscription cancel() throws StripeException { } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. + * Cancels a customer’s subscription immediately. The customer won’t be charged again for the + * subscription. After it’s canceled, you can no longer update the subscription or its metadata. * - *

Note, however, that any pending invoice items that you’ve created will still be charged for - * at the end of the period, unless manually deleted. If you’ve set the - * subscription to cancel at the end of the period, any pending prorations will also be left in - * place and collected at the end of the period. But if the subscription is set to cancel - * immediately, pending prorations will be removed. + *

Any pending invoice items that you’ve created are still charged at the end of the period, + * unless manually deleted. If you’ve + * set the subscription to cancel at the end of the period, any pending prorations are also left + * in place and collected at the end of the period. But if the subscription is set to cancel + * immediately, pending prorations are removed. * - *

By default, upon subscription cancellation, Stripe will stop automatic collection of all + *

By default, upon subscription cancellation, Stripe stops automatic collection of all * finalized invoices for the customer. This is intended to prevent unexpected payment attempts * after the customer has canceled a subscription. However, you can resume automatic collection of * the invoices manually after subscription cancellation to have us proceed. Or, you could check @@ -632,17 +632,17 @@ public Subscription cancel(Map params) throws StripeException { } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. + * Cancels a customer’s subscription immediately. The customer won’t be charged again for the + * subscription. After it’s canceled, you can no longer update the subscription or its metadata. * - *

Note, however, that any pending invoice items that you’ve created will still be charged for - * at the end of the period, unless manually deleted. If you’ve set the - * subscription to cancel at the end of the period, any pending prorations will also be left in - * place and collected at the end of the period. But if the subscription is set to cancel - * immediately, pending prorations will be removed. + *

Any pending invoice items that you’ve created are still charged at the end of the period, + * unless manually deleted. If you’ve + * set the subscription to cancel at the end of the period, any pending prorations are also left + * in place and collected at the end of the period. But if the subscription is set to cancel + * immediately, pending prorations are removed. * - *

By default, upon subscription cancellation, Stripe will stop automatic collection of all + *

By default, upon subscription cancellation, Stripe stops automatic collection of all * finalized invoices for the customer. This is intended to prevent unexpected payment attempts * after the customer has canceled a subscription. However, you can resume automatic collection of * the invoices manually after subscription cancellation to have us proceed. Or, you could check @@ -657,17 +657,17 @@ public Subscription cancel(Map params, RequestOptions options) } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. + * Cancels a customer’s subscription immediately. The customer won’t be charged again for the + * subscription. After it’s canceled, you can no longer update the subscription or its metadata. * - *

Note, however, that any pending invoice items that you’ve created will still be charged for - * at the end of the period, unless manually deleted. If you’ve set the - * subscription to cancel at the end of the period, any pending prorations will also be left in - * place and collected at the end of the period. But if the subscription is set to cancel - * immediately, pending prorations will be removed. + *

Any pending invoice items that you’ve created are still charged at the end of the period, + * unless manually deleted. If you’ve + * set the subscription to cancel at the end of the period, any pending prorations are also left + * in place and collected at the end of the period. But if the subscription is set to cancel + * immediately, pending prorations are removed. * - *

By default, upon subscription cancellation, Stripe will stop automatic collection of all + *

By default, upon subscription cancellation, Stripe stops automatic collection of all * finalized invoices for the customer. This is intended to prevent unexpected payment attempts * after the customer has canceled a subscription. However, you can resume automatic collection of * the invoices manually after subscription cancellation to have us proceed. Or, you could check @@ -678,17 +678,17 @@ public Subscription cancel(SubscriptionCancelParams params) throws StripeExcepti } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. + * Cancels a customer’s subscription immediately. The customer won’t be charged again for the + * subscription. After it’s canceled, you can no longer update the subscription or its metadata. * - *

Note, however, that any pending invoice items that you’ve created will still be charged for - * at the end of the period, unless manually deleted. If you’ve set the - * subscription to cancel at the end of the period, any pending prorations will also be left in - * place and collected at the end of the period. But if the subscription is set to cancel - * immediately, pending prorations will be removed. + *

Any pending invoice items that you’ve created are still charged at the end of the period, + * unless manually deleted. If you’ve + * set the subscription to cancel at the end of the period, any pending prorations are also left + * in place and collected at the end of the period. But if the subscription is set to cancel + * immediately, pending prorations are removed. * - *

By default, upon subscription cancellation, Stripe will stop automatic collection of all + *

By default, upon subscription cancellation, Stripe stops automatic collection of all * finalized invoices for the customer. This is intended to prevent unexpected payment attempts * after the customer has canceled a subscription. However, you can resume automatic collection of * the invoices manually after subscription cancellation to have us proceed. Or, you could check diff --git a/src/main/java/com/stripe/model/billing/Alert.java b/src/main/java/com/stripe/model/billing/Alert.java index db248973a72..d8c7f04fdb5 100644 --- a/src/main/java/com/stripe/model/billing/Alert.java +++ b/src/main/java/com/stripe/model/billing/Alert.java @@ -19,6 +19,7 @@ import com.stripe.param.billing.AlertDeactivateParams; import com.stripe.param.billing.AlertListParams; import com.stripe.param.billing.AlertRetrieveParams; +import java.util.List; import java.util.Map; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -41,13 +42,6 @@ public class Alert extends ApiResource implements HasId { @SerializedName("alert_type") String alertType; - /** - * Limits the scope of the alert to a specific customer. - */ - @SerializedName("filter") - Filter filter; - /** Unique identifier for the object. */ @Getter(onMethod_ = {@Override}) @SerializedName("id") @@ -84,8 +78,8 @@ public class Alert extends ApiResource implements HasId { * Encapsulates configuration of the alert to monitor usage on a specific Billing Meter. */ - @SerializedName("usage_threshold_config") - UsageThresholdConfig usageThresholdConfig; + @SerializedName("usage_threshold") + UsageThreshold usageThreshold; /** Reactivates this alert, allowing it to trigger again. */ public Alert activate() throws StripeException { @@ -323,35 +317,6 @@ public static Alert retrieve(String id, AlertRetrieveParams params, RequestOptio return getGlobalResponseGetter().request(request, Alert.class); } - @Getter - @Setter - @EqualsAndHashCode(callSuper = false) - public static class Filter extends StripeObject { - /** Limit the scope of the alert to this customer ID. */ - @SerializedName("customer") - @Getter(lombok.AccessLevel.NONE) - @Setter(lombok.AccessLevel.NONE) - ExpandableField customer; - - /** Get ID of expandable {@code customer} object. */ - public String getCustomer() { - return (this.customer != null) ? this.customer.getId() : null; - } - - public void setCustomer(String id) { - this.customer = ApiResource.setExpandableFieldId(id, this.customer); - } - - /** Get expanded {@code customer}. */ - public Customer getCustomerObject() { - return (this.customer != null) ? this.customer.getExpanded() : null; - } - - public void setCustomerObject(Customer expandableObject) { - this.customer = new ExpandableField(expandableObject.getId(), expandableObject); - } - } - /** * The usage threshold alert configuration enables setting up alerts for when a certain usage * threshold on a specific meter is crossed. @@ -359,7 +324,14 @@ public void setCustomerObject(Customer expandableObject) { @Getter @Setter @EqualsAndHashCode(callSuper = false) - public static class UsageThresholdConfig extends StripeObject { + public static class UsageThreshold extends StripeObject { + /** + * The filters allow limiting the scope of this usage alert. You can only specify up to one + * filter at this time. + */ + @SerializedName("filters") + List filters; + /** The value at which this alert will trigger. */ @SerializedName("gte") Long gte; @@ -398,12 +370,43 @@ public Meter getMeterObject() { public void setMeterObject(Meter expandableObject) { this.meter = new ExpandableField(expandableObject.getId(), expandableObject); } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Filter extends StripeObject { + /** Limit the scope of the alert to this customer ID. */ + @SerializedName("customer") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField customer; + + @SerializedName("type") + String type; + + /** Get ID of expandable {@code customer} object. */ + public String getCustomer() { + return (this.customer != null) ? this.customer.getId() : null; + } + + public void setCustomer(String id) { + this.customer = ApiResource.setExpandableFieldId(id, this.customer); + } + + /** Get expanded {@code customer}. */ + public Customer getCustomerObject() { + return (this.customer != null) ? this.customer.getExpanded() : null; + } + + public void setCustomerObject(Customer expandableObject) { + this.customer = new ExpandableField(expandableObject.getId(), expandableObject); + } + } } @Override public void setResponseGetter(StripeResponseGetter responseGetter) { super.setResponseGetter(responseGetter); - trySetResponseGetter(filter, responseGetter); - trySetResponseGetter(usageThresholdConfig, responseGetter); + trySetResponseGetter(usageThreshold, responseGetter); } } diff --git a/src/main/java/com/stripe/model/billing/CreditBalanceSummary.java b/src/main/java/com/stripe/model/billing/CreditBalanceSummary.java new file mode 100644 index 00000000000..5a6e5a2d0d8 --- /dev/null +++ b/src/main/java/com/stripe/model/billing/CreditBalanceSummary.java @@ -0,0 +1,191 @@ +// File generated from our OpenAPI spec +package com.stripe.model.billing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.Customer; +import com.stripe.model.ExpandableField; +import com.stripe.model.StripeObject; +import com.stripe.net.ApiRequest; +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.billing.CreditBalanceSummaryRetrieveParams; +import java.util.List; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** Indicates the credit balance for credits granted to a customer. */ +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class CreditBalanceSummary extends ApiResource { + /** + * The credit balances. One entry per credit grant currency. If a customer only has credit grants + * in a single currency, then this will have a single balance entry. + */ + @SerializedName("balances") + List balances; + + /** The customer the balance is for. */ + @SerializedName("customer") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField customer; + + /** + * Has the value {@code true} if the object exists in live mode or the value {@code false} if the + * object exists in test mode. + */ + @SerializedName("livemode") + Boolean livemode; + + /** + * String representing the object's type. Objects of the same type share the same value. + * + *

Equal to {@code billing.credit_balance_summary}. + */ + @SerializedName("object") + String object; + + /** Get ID of expandable {@code customer} object. */ + public String getCustomer() { + return (this.customer != null) ? this.customer.getId() : null; + } + + public void setCustomer(String id) { + this.customer = ApiResource.setExpandableFieldId(id, this.customer); + } + + /** Get expanded {@code customer}. */ + public Customer getCustomerObject() { + return (this.customer != null) ? this.customer.getExpanded() : null; + } + + public void setCustomerObject(Customer expandableObject) { + this.customer = new ExpandableField(expandableObject.getId(), expandableObject); + } + + /** Retrieves the credit balance summary for a customer. */ + public static CreditBalanceSummary retrieve() throws StripeException { + return retrieve((Map) null, (RequestOptions) null); + } + + /** Retrieves the credit balance summary for a customer. */ + public static CreditBalanceSummary retrieve(RequestOptions options) throws StripeException { + return retrieve((Map) null, options); + } + + /** Retrieves the credit balance summary for a customer. */ + public static CreditBalanceSummary retrieve(Map params, RequestOptions options) + throws StripeException { + String path = "/v1/billing/credit_balance_summary"; + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options); + return getGlobalResponseGetter().request(request, CreditBalanceSummary.class); + } + + /** Retrieves the credit balance summary for a customer. */ + public static CreditBalanceSummary retrieve( + CreditBalanceSummaryRetrieveParams params, RequestOptions options) throws StripeException { + String path = "/v1/billing/credit_balance_summary"; + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, CreditBalanceSummary.class); + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Balance extends StripeObject { + @SerializedName("available_balance") + AvailableBalance availableBalance; + + @SerializedName("ledger_balance") + LedgerBalance ledgerBalance; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AvailableBalance extends StripeObject { + /** The monetary amount. */ + @SerializedName("monetary") + Monetary monetary; + + /** + * The type of this amount. We currently only support {@code monetary} credits. + * + *

Equal to {@code monetary}. + */ + @SerializedName("type") + String type; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Monetary extends StripeObject { + /** + * Three-letter ISO currency + * code, in lowercase. Must be a supported + * currency. + */ + @SerializedName("currency") + String currency; + + /** A positive integer representing the amount. */ + @SerializedName("value") + Long value; + } + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class LedgerBalance extends StripeObject { + /** The monetary amount. */ + @SerializedName("monetary") + Monetary monetary; + + /** + * The type of this amount. We currently only support {@code monetary} credits. + * + *

Equal to {@code monetary}. + */ + @SerializedName("type") + String type; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Monetary extends StripeObject { + /** + * Three-letter ISO currency + * code, in lowercase. Must be a supported + * currency. + */ + @SerializedName("currency") + String currency; + + /** A positive integer representing the amount. */ + @SerializedName("value") + Long value; + } + } + } + + @Override + public void setResponseGetter(StripeResponseGetter responseGetter) { + super.setResponseGetter(responseGetter); + trySetResponseGetter(customer, responseGetter); + } +} diff --git a/src/main/java/com/stripe/model/billing/CreditBalanceTransaction.java b/src/main/java/com/stripe/model/billing/CreditBalanceTransaction.java new file mode 100644 index 00000000000..3fed5c315ce --- /dev/null +++ b/src/main/java/com/stripe/model/billing/CreditBalanceTransaction.java @@ -0,0 +1,346 @@ +// File generated from our OpenAPI spec +package com.stripe.model.billing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.ExpandableField; +import com.stripe.model.HasId; +import com.stripe.model.Invoice; +import com.stripe.model.StripeObject; +import com.stripe.model.testhelpers.TestClock; +import com.stripe.net.ApiRequest; +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.billing.CreditBalanceTransactionListParams; +import com.stripe.param.billing.CreditBalanceTransactionRetrieveParams; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + * A credit balance transaction is a resource representing a transaction (either a credit or a + * debit) against an existing credit grant. + */ +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class CreditBalanceTransaction extends ApiResource implements HasId { + /** Time at which the object was created. Measured in seconds since the Unix epoch. */ + @SerializedName("created") + Long created; + + /** Credit details for this balance transaction. Only present if type is {@code credit}. */ + @SerializedName("credit") + Credit credit; + + /** The credit grant associated with this balance transaction. */ + @SerializedName("credit_grant") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField creditGrant; + + /** Debit details for this balance transaction. Only present if type is {@code debit}. */ + @SerializedName("debit") + Debit debit; + + /** The effective time of this balance transaction. */ + @SerializedName("effective_at") + Long effectiveAt; + + /** Unique identifier for the object. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + + /** + * Has the value {@code true} if the object exists in live mode or the value {@code false} if the + * object exists in test mode. + */ + @SerializedName("livemode") + Boolean livemode; + + /** + * String representing the object's type. Objects of the same type share the same value. + * + *

Equal to {@code billing.credit_balance_transaction}. + */ + @SerializedName("object") + String object; + + /** ID of the test clock this credit balance transaction belongs to. */ + @SerializedName("test_clock") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField testClock; + + /** + * The type of balance transaction (credit or debit). + * + *

One of {@code credit}, or {@code debit}. + */ + @SerializedName("type") + String type; + + /** Get ID of expandable {@code creditGrant} object. */ + public String getCreditGrant() { + return (this.creditGrant != null) ? this.creditGrant.getId() : null; + } + + public void setCreditGrant(String id) { + this.creditGrant = ApiResource.setExpandableFieldId(id, this.creditGrant); + } + + /** Get expanded {@code creditGrant}. */ + public CreditGrant getCreditGrantObject() { + return (this.creditGrant != null) ? this.creditGrant.getExpanded() : null; + } + + public void setCreditGrantObject(CreditGrant expandableObject) { + this.creditGrant = new ExpandableField(expandableObject.getId(), expandableObject); + } + + /** Get ID of expandable {@code testClock} object. */ + public String getTestClock() { + return (this.testClock != null) ? this.testClock.getId() : null; + } + + public void setTestClock(String id) { + this.testClock = ApiResource.setExpandableFieldId(id, this.testClock); + } + + /** Get expanded {@code testClock}. */ + public TestClock getTestClockObject() { + return (this.testClock != null) ? this.testClock.getExpanded() : null; + } + + public void setTestClockObject(TestClock expandableObject) { + this.testClock = new ExpandableField(expandableObject.getId(), expandableObject); + } + + /** Retrieve a list of credit balance transactions. */ + public static CreditBalanceTransactionCollection list(Map params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Retrieve a list of credit balance transactions. */ + public static CreditBalanceTransactionCollection list( + Map params, RequestOptions options) throws StripeException { + String path = "/v1/billing/credit_balance_transactions"; + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options); + return getGlobalResponseGetter().request(request, CreditBalanceTransactionCollection.class); + } + + /** Retrieve a list of credit balance transactions. */ + public static CreditBalanceTransactionCollection list(CreditBalanceTransactionListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Retrieve a list of credit balance transactions. */ + public static CreditBalanceTransactionCollection list( + CreditBalanceTransactionListParams params, RequestOptions options) throws StripeException { + String path = "/v1/billing/credit_balance_transactions"; + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, CreditBalanceTransactionCollection.class); + } + + /** Retrieves a credit balance transaction. */ + public static CreditBalanceTransaction retrieve(String id) throws StripeException { + return retrieve(id, (Map) null, (RequestOptions) null); + } + + /** Retrieves a credit balance transaction. */ + public static CreditBalanceTransaction retrieve(String id, RequestOptions options) + throws StripeException { + return retrieve(id, (Map) null, options); + } + + /** Retrieves a credit balance transaction. */ + public static CreditBalanceTransaction retrieve( + String id, Map params, RequestOptions options) throws StripeException { + String path = + String.format("/v1/billing/credit_balance_transactions/%s", ApiResource.urlEncodeId(id)); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options); + return getGlobalResponseGetter().request(request, CreditBalanceTransaction.class); + } + + /** Retrieves a credit balance transaction. */ + public static CreditBalanceTransaction retrieve( + String id, CreditBalanceTransactionRetrieveParams params, RequestOptions options) + throws StripeException { + String path = + String.format("/v1/billing/credit_balance_transactions/%s", ApiResource.urlEncodeId(id)); + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, CreditBalanceTransaction.class); + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Credit extends StripeObject { + @SerializedName("amount") + Amount amount; + + /** + * The type of credit transaction. + * + *

Equal to {@code credits_granted}. + */ + @SerializedName("type") + String type; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Amount extends StripeObject { + /** The monetary amount. */ + @SerializedName("monetary") + Monetary monetary; + + /** + * The type of this amount. We currently only support {@code monetary} credits. + * + *

Equal to {@code monetary}. + */ + @SerializedName("type") + String type; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Monetary extends StripeObject { + /** + * Three-letter ISO currency + * code, in lowercase. Must be a supported + * currency. + */ + @SerializedName("currency") + String currency; + + /** A positive integer representing the amount. */ + @SerializedName("value") + Long value; + } + } + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Debit extends StripeObject { + @SerializedName("amount") + Amount amount; + + /** + * Details of how the credits were applied to an invoice. Only present if {@code type} is {@code + * credits_applied}. + */ + @SerializedName("credits_applied") + CreditsApplied creditsApplied; + + /** + * The type of debit transaction. + * + *

One of {@code credits_applied}, {@code credits_expired}, or {@code credits_voided}. + */ + @SerializedName("type") + String type; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Amount extends StripeObject { + /** The monetary amount. */ + @SerializedName("monetary") + Monetary monetary; + + /** + * The type of this amount. We currently only support {@code monetary} credits. + * + *

Equal to {@code monetary}. + */ + @SerializedName("type") + String type; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Monetary extends StripeObject { + /** + * Three-letter ISO currency + * code, in lowercase. Must be a supported + * currency. + */ + @SerializedName("currency") + String currency; + + /** A positive integer representing the amount. */ + @SerializedName("value") + Long value; + } + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class CreditsApplied extends StripeObject { + /** The invoice to which the credits were applied. */ + @SerializedName("invoice") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField invoice; + + /** The invoice line item to which the credits were applied. */ + @SerializedName("invoice_line_item") + String invoiceLineItem; + + /** Get ID of expandable {@code invoice} object. */ + public String getInvoice() { + return (this.invoice != null) ? this.invoice.getId() : null; + } + + public void setInvoice(String id) { + this.invoice = ApiResource.setExpandableFieldId(id, this.invoice); + } + + /** Get expanded {@code invoice}. */ + public Invoice getInvoiceObject() { + return (this.invoice != null) ? this.invoice.getExpanded() : null; + } + + public void setInvoiceObject(Invoice expandableObject) { + this.invoice = new ExpandableField(expandableObject.getId(), expandableObject); + } + } + } + + @Override + public void setResponseGetter(StripeResponseGetter responseGetter) { + super.setResponseGetter(responseGetter); + trySetResponseGetter(credit, responseGetter); + trySetResponseGetter(creditGrant, responseGetter); + trySetResponseGetter(debit, responseGetter); + trySetResponseGetter(testClock, responseGetter); + } +} diff --git a/src/main/java/com/stripe/model/billing/CreditBalanceTransactionCollection.java b/src/main/java/com/stripe/model/billing/CreditBalanceTransactionCollection.java new file mode 100644 index 00000000000..cd943c7dd0e --- /dev/null +++ b/src/main/java/com/stripe/model/billing/CreditBalanceTransactionCollection.java @@ -0,0 +1,7 @@ +// File generated from our OpenAPI spec +package com.stripe.model.billing; + +import com.stripe.model.StripeCollection; + +public class CreditBalanceTransactionCollection + extends StripeCollection {} diff --git a/src/main/java/com/stripe/model/billing/CreditGrant.java b/src/main/java/com/stripe/model/billing/CreditGrant.java new file mode 100644 index 00000000000..183537ad1ad --- /dev/null +++ b/src/main/java/com/stripe/model/billing/CreditGrant.java @@ -0,0 +1,448 @@ +// File generated from our OpenAPI spec +package com.stripe.model.billing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.Customer; +import com.stripe.model.ExpandableField; +import com.stripe.model.HasId; +import com.stripe.model.MetadataStore; +import com.stripe.model.StripeObject; +import com.stripe.model.testhelpers.TestClock; +import com.stripe.net.ApiRequest; +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.billing.CreditGrantCreateParams; +import com.stripe.param.billing.CreditGrantExpireParams; +import com.stripe.param.billing.CreditGrantListParams; +import com.stripe.param.billing.CreditGrantRetrieveParams; +import com.stripe.param.billing.CreditGrantUpdateParams; +import com.stripe.param.billing.CreditGrantVoidGrantParams; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** A credit grant is a resource that records a grant of some credit to a customer. */ +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class CreditGrant extends ApiResource implements HasId, MetadataStore { + @SerializedName("amount") + Amount amount; + + @SerializedName("applicability_config") + ApplicabilityConfig applicabilityConfig; + + /** + * The category of this credit grant. + * + *

One of {@code paid}, or {@code promotional}. + */ + @SerializedName("category") + String category; + + /** Time at which the object was created. Measured in seconds since the Unix epoch. */ + @SerializedName("created") + Long created; + + /** Id of the customer to whom the credit was granted. */ + @SerializedName("customer") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField customer; + + /** The time when the credit becomes effective i.e when it is eligible to be used. */ + @SerializedName("effective_at") + Long effectiveAt; + + /** The time when the credit will expire. If not present, the credit will never expire. */ + @SerializedName("expires_at") + Long expiresAt; + + /** Unique identifier for the object. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + + /** + * Has the value {@code true} if the object exists in live mode or the value {@code false} if the + * object exists in test mode. + */ + @SerializedName("livemode") + Boolean livemode; + + /** + * Set of key-value pairs that you can attach + * to an object. This can be useful for storing additional information about the object in a + * structured format. + */ + @Getter(onMethod_ = {@Override}) + @SerializedName("metadata") + Map metadata; + + /** A descriptive name shown in dashboard and on invoices. */ + @SerializedName("name") + String name; + + /** + * String representing the object's type. Objects of the same type share the same value. + * + *

Equal to {@code billing.credit_grant}. + */ + @SerializedName("object") + String object; + + /** ID of the test clock this credit grant belongs to. */ + @SerializedName("test_clock") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField testClock; + + /** Time at which the object was last updated. Measured in seconds since the Unix epoch. */ + @SerializedName("updated") + Long updated; + + /** + * The time when this credit grant was voided. If not present, the credit grant hasn't been + * voided. + */ + @SerializedName("voided_at") + Long voidedAt; + + /** Get ID of expandable {@code customer} object. */ + public String getCustomer() { + return (this.customer != null) ? this.customer.getId() : null; + } + + public void setCustomer(String id) { + this.customer = ApiResource.setExpandableFieldId(id, this.customer); + } + + /** Get expanded {@code customer}. */ + public Customer getCustomerObject() { + return (this.customer != null) ? this.customer.getExpanded() : null; + } + + public void setCustomerObject(Customer expandableObject) { + this.customer = new ExpandableField(expandableObject.getId(), expandableObject); + } + + /** Get ID of expandable {@code testClock} object. */ + public String getTestClock() { + return (this.testClock != null) ? this.testClock.getId() : null; + } + + public void setTestClock(String id) { + this.testClock = ApiResource.setExpandableFieldId(id, this.testClock); + } + + /** Get expanded {@code testClock}. */ + public TestClock getTestClockObject() { + return (this.testClock != null) ? this.testClock.getExpanded() : null; + } + + public void setTestClockObject(TestClock expandableObject) { + this.testClock = new ExpandableField(expandableObject.getId(), expandableObject); + } + + /** Creates a credit grant. */ + public static CreditGrant create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a credit grant. */ + public static CreditGrant create(Map params, RequestOptions options) + throws StripeException { + String path = "/v1/billing/credit_grants"; + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); + return getGlobalResponseGetter().request(request, CreditGrant.class); + } + + /** Creates a credit grant. */ + public static CreditGrant create(CreditGrantCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a credit grant. */ + public static CreditGrant create(CreditGrantCreateParams params, RequestOptions options) + throws StripeException { + String path = "/v1/billing/credit_grants"; + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, CreditGrant.class); + } + + /** Expires a credit grant. */ + public CreditGrant expire() throws StripeException { + return expire((Map) null, (RequestOptions) null); + } + + /** Expires a credit grant. */ + public CreditGrant expire(RequestOptions options) throws StripeException { + return expire((Map) null, options); + } + + /** Expires a credit grant. */ + public CreditGrant expire(Map params) throws StripeException { + return expire(params, (RequestOptions) null); + } + + /** Expires a credit grant. */ + public CreditGrant expire(Map params, RequestOptions options) + throws StripeException { + String path = + String.format("/v1/billing/credit_grants/%s/expire", ApiResource.urlEncodeId(this.getId())); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); + return getResponseGetter().request(request, CreditGrant.class); + } + + /** Expires a credit grant. */ + public CreditGrant expire(CreditGrantExpireParams params) throws StripeException { + return expire(params, (RequestOptions) null); + } + + /** Expires a credit grant. */ + public CreditGrant expire(CreditGrantExpireParams params, RequestOptions options) + throws StripeException { + String path = + String.format("/v1/billing/credit_grants/%s/expire", ApiResource.urlEncodeId(this.getId())); + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return getResponseGetter().request(request, CreditGrant.class); + } + + /** Retrieve a list of credit grants. */ + public static CreditGrantCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Retrieve a list of credit grants. */ + public static CreditGrantCollection list(Map params, RequestOptions options) + throws StripeException { + String path = "/v1/billing/credit_grants"; + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options); + return getGlobalResponseGetter().request(request, CreditGrantCollection.class); + } + + /** Retrieve a list of credit grants. */ + public static CreditGrantCollection list(CreditGrantListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Retrieve a list of credit grants. */ + public static CreditGrantCollection list(CreditGrantListParams params, RequestOptions options) + throws StripeException { + String path = "/v1/billing/credit_grants"; + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, CreditGrantCollection.class); + } + + /** Retrieves a credit grant. */ + public static CreditGrant retrieve(String id) throws StripeException { + return retrieve(id, (Map) null, (RequestOptions) null); + } + + /** Retrieves a credit grant. */ + public static CreditGrant retrieve(String id, RequestOptions options) throws StripeException { + return retrieve(id, (Map) null, options); + } + + /** Retrieves a credit grant. */ + public static CreditGrant retrieve(String id, Map params, RequestOptions options) + throws StripeException { + String path = String.format("/v1/billing/credit_grants/%s", ApiResource.urlEncodeId(id)); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options); + return getGlobalResponseGetter().request(request, CreditGrant.class); + } + + /** Retrieves a credit grant. */ + public static CreditGrant retrieve( + String id, CreditGrantRetrieveParams params, RequestOptions options) throws StripeException { + String path = String.format("/v1/billing/credit_grants/%s", ApiResource.urlEncodeId(id)); + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, CreditGrant.class); + } + + /** Updates a credit grant. */ + @Override + public CreditGrant update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates a credit grant. */ + @Override + public CreditGrant update(Map params, RequestOptions options) + throws StripeException { + String path = + String.format("/v1/billing/credit_grants/%s", ApiResource.urlEncodeId(this.getId())); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); + return getResponseGetter().request(request, CreditGrant.class); + } + + /** Updates a credit grant. */ + public CreditGrant update(CreditGrantUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates a credit grant. */ + public CreditGrant update(CreditGrantUpdateParams params, RequestOptions options) + throws StripeException { + String path = + String.format("/v1/billing/credit_grants/%s", ApiResource.urlEncodeId(this.getId())); + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return getResponseGetter().request(request, CreditGrant.class); + } + + /** Voids a credit grant. */ + public CreditGrant voidGrant() throws StripeException { + return voidGrant((Map) null, (RequestOptions) null); + } + + /** Voids a credit grant. */ + public CreditGrant voidGrant(RequestOptions options) throws StripeException { + return voidGrant((Map) null, options); + } + + /** Voids a credit grant. */ + public CreditGrant voidGrant(Map params) throws StripeException { + return voidGrant(params, (RequestOptions) null); + } + + /** Voids a credit grant. */ + public CreditGrant voidGrant(Map params, RequestOptions options) + throws StripeException { + String path = + String.format("/v1/billing/credit_grants/%s/void", ApiResource.urlEncodeId(this.getId())); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); + return getResponseGetter().request(request, CreditGrant.class); + } + + /** Voids a credit grant. */ + public CreditGrant voidGrant(CreditGrantVoidGrantParams params) throws StripeException { + return voidGrant(params, (RequestOptions) null); + } + + /** Voids a credit grant. */ + public CreditGrant voidGrant(CreditGrantVoidGrantParams params, RequestOptions options) + throws StripeException { + String path = + String.format("/v1/billing/credit_grants/%s/void", ApiResource.urlEncodeId(this.getId())); + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return getResponseGetter().request(request, CreditGrant.class); + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Amount extends StripeObject { + /** The monetary amount. */ + @SerializedName("monetary") + Monetary monetary; + + /** + * The type of this amount. We currently only support {@code monetary} credits. + * + *

Equal to {@code monetary}. + */ + @SerializedName("type") + String type; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Monetary extends StripeObject { + /** + * Three-letter ISO currency + * code, in lowercase. Must be a supported + * currency. + */ + @SerializedName("currency") + String currency; + + /** A positive integer representing the amount. */ + @SerializedName("value") + Long value; + } + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ApplicabilityConfig extends StripeObject { + @SerializedName("scope") + Scope scope; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Scope extends StripeObject { + /** + * The price type to which credit grants can apply to. We currently only support {@code + * metered} price type. + * + *

Equal to {@code metered}. + */ + @SerializedName("price_type") + String priceType; + } + } + + @Override + public void setResponseGetter(StripeResponseGetter responseGetter) { + super.setResponseGetter(responseGetter); + trySetResponseGetter(amount, responseGetter); + trySetResponseGetter(applicabilityConfig, responseGetter); + trySetResponseGetter(customer, responseGetter); + trySetResponseGetter(testClock, responseGetter); + } +} diff --git a/src/main/java/com/stripe/model/billing/CreditGrantCollection.java b/src/main/java/com/stripe/model/billing/CreditGrantCollection.java new file mode 100644 index 00000000000..e2457267b2f --- /dev/null +++ b/src/main/java/com/stripe/model/billing/CreditGrantCollection.java @@ -0,0 +1,6 @@ +// File generated from our OpenAPI spec +package com.stripe.model.billing; + +import com.stripe.model.StripeCollection; + +public class CreditGrantCollection extends StripeCollection {} diff --git a/src/main/java/com/stripe/model/tax/Settings.java b/src/main/java/com/stripe/model/tax/Settings.java index 5c5a47854d8..3a21e2736ae 100644 --- a/src/main/java/com/stripe/model/tax/Settings.java +++ b/src/main/java/com/stripe/model/tax/Settings.java @@ -51,8 +51,7 @@ public class Settings extends ApiResource { String object; /** - * The {@code active} status indicates you have all required settings to calculate tax. A status - * can transition out of {@code active} when new required settings are introduced. + * The status of the Tax {@code Settings}. * *

One of {@code active}, or {@code pending}. */ diff --git a/src/main/java/com/stripe/model/treasury/ReceivedCredit.java b/src/main/java/com/stripe/model/treasury/ReceivedCredit.java index c79b6d1f1cc..1bf83826fdd 100644 --- a/src/main/java/com/stripe/model/treasury/ReceivedCredit.java +++ b/src/main/java/com/stripe/model/treasury/ReceivedCredit.java @@ -54,7 +54,8 @@ public class ReceivedCredit extends ApiResource implements HasId { * Reason for the failure. A ReceivedCredit might fail because the receiving FinancialAccount is * closed or frozen. * - *

One of {@code account_closed}, {@code account_frozen}, or {@code other}. + *

One of {@code account_closed}, {@code account_frozen}, {@code international_transaction}, or + * {@code other}. */ @SerializedName("failure_code") String failureCode; diff --git a/src/main/java/com/stripe/param/ProductCreateParams.java b/src/main/java/com/stripe/param/ProductCreateParams.java index c1b26d14a1d..6ab9a8a8b8f 100644 --- a/src/main/java/com/stripe/param/ProductCreateParams.java +++ b/src/main/java/com/stripe/param/ProductCreateParams.java @@ -466,6 +466,13 @@ public static class DefaultPriceData { @SerializedName("currency_options") Map currencyOptions; + /** + * When set, provides configuration for the amount to be adjusted by the customer during + * Checkout Sessions and Payment Links. + */ + @SerializedName("custom_unit_amount") + CustomUnitAmount customUnitAmount; + /** * 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 @@ -492,7 +499,8 @@ public static class DefaultPriceData { /** * A positive integer in cents (or local equivalent) (or 0 for a free price) representing how - * much to charge. One of {@code unit_amount} or {@code unit_amount_decimal} is required. + * much to charge. One of {@code unit_amount}, {@code unit_amount_decimal}, or {@code + * custom_unit_amount} is required. */ @SerializedName("unit_amount") Long unitAmount; @@ -508,6 +516,7 @@ public static class DefaultPriceData { private DefaultPriceData( String currency, Map currencyOptions, + CustomUnitAmount customUnitAmount, Map extraParams, Recurring recurring, TaxBehavior taxBehavior, @@ -515,6 +524,7 @@ private DefaultPriceData( BigDecimal unitAmountDecimal) { this.currency = currency; this.currencyOptions = currencyOptions; + this.customUnitAmount = customUnitAmount; this.extraParams = extraParams; this.recurring = recurring; this.taxBehavior = taxBehavior; @@ -531,6 +541,8 @@ public static class Builder { private Map currencyOptions; + private CustomUnitAmount customUnitAmount; + private Map extraParams; private Recurring recurring; @@ -546,6 +558,7 @@ public ProductCreateParams.DefaultPriceData build() { return new ProductCreateParams.DefaultPriceData( this.currency, this.currencyOptions, + this.customUnitAmount, this.extraParams, this.recurring, this.taxBehavior, @@ -593,6 +606,16 @@ public Builder putAllCurrencyOption( return this; } + /** + * When set, provides configuration for the amount to be adjusted by the customer during + * Checkout Sessions and Payment Links. + */ + public Builder setCustomUnitAmount( + ProductCreateParams.DefaultPriceData.CustomUnitAmount customUnitAmount) { + this.customUnitAmount = customUnitAmount; + 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 @@ -642,7 +665,8 @@ public Builder setTaxBehavior(ProductCreateParams.DefaultPriceData.TaxBehavior t /** * A positive integer in cents (or local equivalent) (or 0 for a free price) representing how - * much to charge. One of {@code unit_amount} or {@code unit_amount_decimal} is required. + * much to charge. One of {@code unit_amount}, {@code unit_amount_decimal}, or {@code + * custom_unit_amount} is required. */ public Builder setUnitAmount(Long unitAmount) { this.unitAmount = unitAmount; @@ -1190,6 +1214,133 @@ public enum TaxBehavior implements ApiRequestParams.EnumParam { } } + @Getter + public static class CustomUnitAmount { + /** + * Required. Pass in {@code true} to enable {@code custom_unit_amount}, + * otherwise omit {@code custom_unit_amount}. + */ + @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 maximum unit amount the customer can specify for this item. */ + @SerializedName("maximum") + Long maximum; + + /** + * The minimum unit amount the customer can specify for this item. Must be at least the + * minimum charge amount. + */ + @SerializedName("minimum") + Long minimum; + + /** The starting unit amount which can be updated by the customer. */ + @SerializedName("preset") + Long preset; + + private CustomUnitAmount( + Boolean enabled, + Map extraParams, + Long maximum, + Long minimum, + Long preset) { + this.enabled = enabled; + this.extraParams = extraParams; + this.maximum = maximum; + this.minimum = minimum; + this.preset = preset; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Boolean enabled; + + private Map extraParams; + + private Long maximum; + + private Long minimum; + + private Long preset; + + /** Finalize and obtain parameter instance from this builder. */ + public ProductCreateParams.DefaultPriceData.CustomUnitAmount build() { + return new ProductCreateParams.DefaultPriceData.CustomUnitAmount( + this.enabled, this.extraParams, this.maximum, this.minimum, this.preset); + } + + /** + * Required. Pass in {@code true} to enable {@code custom_unit_amount}, + * otherwise omit {@code custom_unit_amount}. + */ + 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 ProductCreateParams.DefaultPriceData.CustomUnitAmount#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 ProductCreateParams.DefaultPriceData.CustomUnitAmount#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 maximum unit amount the customer can specify for this item. */ + public Builder setMaximum(Long maximum) { + this.maximum = maximum; + return this; + } + + /** + * The minimum unit amount the customer can specify for this item. Must be at least the + * minimum charge amount. + */ + public Builder setMinimum(Long minimum) { + this.minimum = minimum; + return this; + } + + /** The starting unit amount which can be updated by the customer. */ + public Builder setPreset(Long preset) { + this.preset = preset; + return this; + } + } + } + @Getter public static class Recurring { /** diff --git a/src/main/java/com/stripe/param/PromotionCodeCreateParams.java b/src/main/java/com/stripe/param/PromotionCodeCreateParams.java index db93888390e..b103e7abf89 100644 --- a/src/main/java/com/stripe/param/PromotionCodeCreateParams.java +++ b/src/main/java/com/stripe/param/PromotionCodeCreateParams.java @@ -17,7 +17,10 @@ public class PromotionCodeCreateParams extends ApiRequestParams { /** * The customer-facing code. Regardless of case, this code must be unique across all active - * promotion codes for a specific customer. If left blank, we will generate one automatically. + * promotion codes for a specific customer. Valid characters are lower case letters (a-z), upper + * case letters (A-Z), and digits (0-9). + * + *

If left blank, we will generate one automatically. */ @SerializedName("code") String code; @@ -145,7 +148,10 @@ public Builder setActive(Boolean active) { /** * The customer-facing code. Regardless of case, this code must be unique across all active - * promotion codes for a specific customer. If left blank, we will generate one automatically. + * promotion codes for a specific customer. Valid characters are lower case letters (a-z), upper + * case letters (A-Z), and digits (0-9). + * + *

If left blank, we will generate one automatically. */ public Builder setCode(String code) { this.code = code; diff --git a/src/main/java/com/stripe/param/WebhookEndpointCreateParams.java b/src/main/java/com/stripe/param/WebhookEndpointCreateParams.java index c58bb754745..9b63c4a34bc 100644 --- a/src/main/java/com/stripe/param/WebhookEndpointCreateParams.java +++ b/src/main/java/com/stripe/param/WebhookEndpointCreateParams.java @@ -586,7 +586,10 @@ public enum ApiVersion implements ApiRequestParams.EnumParam { VERSION_2024_04_10("2024-04-10"), @SerializedName("2024-06-20") - VERSION_2024_06_20("2024-06-20"); + VERSION_2024_06_20("2024-06-20"), + + @SerializedName("2024-09-30.acacia") + VERSION_2024_09_30_ACACIA("2024-09-30.acacia"); @Getter(onMethod_ = {@Override}) private final String value; diff --git a/src/main/java/com/stripe/param/billing/AlertCreateParams.java b/src/main/java/com/stripe/param/billing/AlertCreateParams.java index af8441deb1c..c039cf504bb 100644 --- a/src/main/java/com/stripe/param/billing/AlertCreateParams.java +++ b/src/main/java/com/stripe/param/billing/AlertCreateParams.java @@ -28,31 +28,25 @@ public class AlertCreateParams extends ApiRequestParams { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; - /** Filters to limit the scope of an alert. */ - @SerializedName("filter") - Filter filter; - /** Required. The title of the alert. */ @SerializedName("title") String title; /** The configuration of the usage threshold. */ - @SerializedName("usage_threshold_config") - UsageThresholdConfig usageThresholdConfig; + @SerializedName("usage_threshold") + UsageThreshold usageThreshold; private AlertCreateParams( AlertType alertType, List expand, Map extraParams, - Filter filter, String title, - UsageThresholdConfig usageThresholdConfig) { + UsageThreshold usageThreshold) { this.alertType = alertType; this.expand = expand; this.extraParams = extraParams; - this.filter = filter; this.title = title; - this.usageThresholdConfig = usageThresholdConfig; + this.usageThreshold = usageThreshold; } public static Builder builder() { @@ -66,21 +60,14 @@ public static class Builder { private Map extraParams; - private Filter filter; - private String title; - private UsageThresholdConfig usageThresholdConfig; + private UsageThreshold usageThreshold; /** Finalize and obtain parameter instance from this builder. */ public AlertCreateParams build() { return new AlertCreateParams( - this.alertType, - this.expand, - this.extraParams, - this.filter, - this.title, - this.usageThresholdConfig); + this.alertType, this.expand, this.extraParams, this.title, this.usageThreshold); } /** Required. The type of alert to create. */ @@ -141,12 +128,6 @@ public Builder putAllExtraParam(Map map) { return this; } - /** Filters to limit the scope of an alert. */ - public Builder setFilter(AlertCreateParams.Filter filter) { - this.filter = filter; - return this; - } - /** Required. The title of the alert. */ public Builder setTitle(String title) { this.title = title; @@ -154,19 +135,14 @@ public Builder setTitle(String title) { } /** The configuration of the usage threshold. */ - public Builder setUsageThresholdConfig( - AlertCreateParams.UsageThresholdConfig usageThresholdConfig) { - this.usageThresholdConfig = usageThresholdConfig; + public Builder setUsageThreshold(AlertCreateParams.UsageThreshold usageThreshold) { + this.usageThreshold = usageThreshold; return this; } } @Getter - public static class Filter { - /** Limit the scope to this alert only to this customer. */ - @SerializedName("customer") - String customer; - + public static class UsageThreshold { /** * 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 @@ -176,100 +152,12 @@ public static class Filter { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; - /** Limit the scope of this rated usage alert to this subscription. */ - @SerializedName("subscription") - String subscription; - - /** Limit the scope of this rated usage alert to this subscription item. */ - @SerializedName("subscription_item") - String subscriptionItem; - - private Filter( - String customer, - Map extraParams, - String subscription, - String subscriptionItem) { - this.customer = customer; - this.extraParams = extraParams; - this.subscription = subscription; - this.subscriptionItem = subscriptionItem; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String customer; - - private Map extraParams; - - private String subscription; - - private String subscriptionItem; - - /** Finalize and obtain parameter instance from this builder. */ - public AlertCreateParams.Filter build() { - return new AlertCreateParams.Filter( - this.customer, this.extraParams, this.subscription, this.subscriptionItem); - } - - /** Limit the scope to this alert only to this customer. */ - public Builder setCustomer(String customer) { - this.customer = customer; - 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 - * AlertCreateParams.Filter#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 AlertCreateParams.Filter#extraParams} for the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - - /** Limit the scope of this rated usage alert to this subscription. */ - public Builder setSubscription(String subscription) { - this.subscription = subscription; - return this; - } - - /** Limit the scope of this rated usage alert to this subscription item. */ - public Builder setSubscriptionItem(String subscriptionItem) { - this.subscriptionItem = subscriptionItem; - return this; - } - } - } - - @Getter - public static class UsageThresholdConfig { /** - * 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. + * The filters allows limiting the scope of this usage alert. You can only specify up to one + * filter at this time. */ - @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) - Map extraParams; + @SerializedName("filters") + List filters; /** Required. Defines at which value the alert will fire. */ @SerializedName("gte") @@ -289,9 +177,14 @@ public static class UsageThresholdConfig { @SerializedName("recurrence") Recurrence recurrence; - private UsageThresholdConfig( - Map extraParams, Long gte, String meter, Recurrence recurrence) { + private UsageThreshold( + Map extraParams, + List filters, + Long gte, + String meter, + Recurrence recurrence) { this.extraParams = extraParams; + this.filters = filters; this.gte = gte; this.meter = meter; this.recurrence = recurrence; @@ -304,6 +197,8 @@ public static Builder builder() { public static class Builder { private Map extraParams; + private List filters; + private Long gte; private String meter; @@ -311,15 +206,15 @@ public static class Builder { private Recurrence recurrence; /** Finalize and obtain parameter instance from this builder. */ - public AlertCreateParams.UsageThresholdConfig build() { - return new AlertCreateParams.UsageThresholdConfig( - this.extraParams, this.gte, this.meter, this.recurrence); + public AlertCreateParams.UsageThreshold build() { + return new AlertCreateParams.UsageThreshold( + this.extraParams, this.filters, this.gte, this.meter, this.recurrence); } /** * 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 - * AlertCreateParams.UsageThresholdConfig#extraParams} for the field documentation. + * AlertCreateParams.UsageThreshold#extraParams} for the field documentation. */ public Builder putExtraParam(String key, Object value) { if (this.extraParams == null) { @@ -332,7 +227,7 @@ public Builder putExtraParam(String key, Object value) { /** * 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 AlertCreateParams.UsageThresholdConfig#extraParams} for the field documentation. + * See {@link AlertCreateParams.UsageThreshold#extraParams} for the field documentation. */ public Builder putAllExtraParam(Map map) { if (this.extraParams == null) { @@ -342,6 +237,32 @@ public Builder putAllExtraParam(Map map) { return this; } + /** + * Add an element to `filters` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * AlertCreateParams.UsageThreshold#filters} for the field documentation. + */ + public Builder addFilter(AlertCreateParams.UsageThreshold.Filter element) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(element); + return this; + } + + /** + * Add all elements to `filters` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * AlertCreateParams.UsageThreshold#filters} for the field documentation. + */ + public Builder addAllFilter(List elements) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.addAll(elements); + return this; + } + /** Required. Defines at which value the alert will fire. */ public Builder setGte(Long gte) { this.gte = gte; @@ -361,12 +282,108 @@ public Builder setMeter(String meter) { * Required. Whether the alert should only fire only once, or once per * billing cycle. */ - public Builder setRecurrence(AlertCreateParams.UsageThresholdConfig.Recurrence recurrence) { + public Builder setRecurrence(AlertCreateParams.UsageThreshold.Recurrence recurrence) { this.recurrence = recurrence; return this; } } + @Getter + public static class Filter { + /** Limit the scope to this usage alert only to this customer. */ + @SerializedName("customer") + String customer; + + /** + * 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. What type of filter is being applied to this usage alert. */ + @SerializedName("type") + Type type; + + private Filter(String customer, Map extraParams, Type type) { + this.customer = customer; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String customer; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public AlertCreateParams.UsageThreshold.Filter build() { + return new AlertCreateParams.UsageThreshold.Filter( + this.customer, this.extraParams, this.type); + } + + /** Limit the scope to this usage alert only to this customer. */ + public Builder setCustomer(String customer) { + this.customer = customer; + 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 AlertCreateParams.UsageThreshold.Filter#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 AlertCreateParams.UsageThreshold.Filter#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. What type of filter is being applied to this usage alert. */ + public Builder setType(AlertCreateParams.UsageThreshold.Filter.Type type) { + this.type = type; + return this; + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("customer") + CUSTOMER("customer"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + public enum Recurrence implements ApiRequestParams.EnumParam { @SerializedName("one_time") ONE_TIME("one_time"); diff --git a/src/main/java/com/stripe/param/billing/CreditBalanceSummaryRetrieveParams.java b/src/main/java/com/stripe/param/billing/CreditBalanceSummaryRetrieveParams.java new file mode 100644 index 00000000000..3f9453ebe76 --- /dev/null +++ b/src/main/java/com/stripe/param/billing/CreditBalanceSummaryRetrieveParams.java @@ -0,0 +1,332 @@ +// File generated from our OpenAPI spec +package com.stripe.param.billing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class CreditBalanceSummaryRetrieveParams extends ApiRequestParams { + /** Required. The customer for which to fetch credit balance summary. */ + @SerializedName("customer") + String customer; + + /** 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; + + /** Required. The filter criteria for the credit balance summary. */ + @SerializedName("filter") + Filter filter; + + private CreditBalanceSummaryRetrieveParams( + String customer, List expand, Map extraParams, Filter filter) { + this.customer = customer; + this.expand = expand; + this.extraParams = extraParams; + this.filter = filter; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String customer; + + private List expand; + + private Map extraParams; + + private Filter filter; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditBalanceSummaryRetrieveParams build() { + return new CreditBalanceSummaryRetrieveParams( + this.customer, this.expand, this.extraParams, this.filter); + } + + /** Required. The customer for which to fetch credit balance summary. */ + public Builder setCustomer(String customer) { + this.customer = customer; + 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 + * CreditBalanceSummaryRetrieveParams#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 + * CreditBalanceSummaryRetrieveParams#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 + * CreditBalanceSummaryRetrieveParams#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 CreditBalanceSummaryRetrieveParams#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 filter criteria for the credit balance summary. */ + public Builder setFilter(CreditBalanceSummaryRetrieveParams.Filter filter) { + this.filter = filter; + return this; + } + } + + @Getter + public static class Filter { + /** The credit applicability scope for which to fetch balance summary. */ + @SerializedName("applicability_scope") + ApplicabilityScope applicabilityScope; + + /** The credit grant for which to fetch balance summary. */ + @SerializedName("credit_grant") + String creditGrant; + + /** + * 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. Specify the type of this filter. */ + @SerializedName("type") + Type type; + + private Filter( + ApplicabilityScope applicabilityScope, + String creditGrant, + Map extraParams, + Type type) { + this.applicabilityScope = applicabilityScope; + this.creditGrant = creditGrant; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private ApplicabilityScope applicabilityScope; + + private String creditGrant; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditBalanceSummaryRetrieveParams.Filter build() { + return new CreditBalanceSummaryRetrieveParams.Filter( + this.applicabilityScope, this.creditGrant, this.extraParams, this.type); + } + + /** The credit applicability scope for which to fetch balance summary. */ + public Builder setApplicabilityScope( + CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope applicabilityScope) { + this.applicabilityScope = applicabilityScope; + return this; + } + + /** The credit grant for which to fetch balance summary. */ + public Builder setCreditGrant(String creditGrant) { + this.creditGrant = creditGrant; + 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 + * CreditBalanceSummaryRetrieveParams.Filter#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 CreditBalanceSummaryRetrieveParams.Filter#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. Specify the type of this filter. */ + public Builder setType(CreditBalanceSummaryRetrieveParams.Filter.Type type) { + this.type = type; + return this; + } + } + + @Getter + public static class ApplicabilityScope { + /** + * 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 price type to which credit grants can apply to. We currently + * only support {@code metered} price type. + */ + @SerializedName("price_type") + PriceType priceType; + + private ApplicabilityScope(Map extraParams, PriceType priceType) { + this.extraParams = extraParams; + this.priceType = priceType; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private PriceType priceType; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope build() { + return new CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope( + this.extraParams, this.priceType); + } + + /** + * 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 CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope#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 CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope#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 price type to which credit grants can apply to. We + * currently only support {@code metered} price type. + */ + public Builder setPriceType( + CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope.PriceType priceType) { + this.priceType = priceType; + return this; + } + } + + public enum PriceType implements ApiRequestParams.EnumParam { + @SerializedName("metered") + METERED("metered"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + PriceType(String value) { + this.value = value; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("applicability_scope") + APPLICABILITY_SCOPE("applicability_scope"), + + @SerializedName("credit_grant") + CREDIT_GRANT("credit_grant"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } +} diff --git a/src/main/java/com/stripe/param/billing/CreditBalanceTransactionListParams.java b/src/main/java/com/stripe/param/billing/CreditBalanceTransactionListParams.java new file mode 100644 index 00000000000..ed3811c27d1 --- /dev/null +++ b/src/main/java/com/stripe/param/billing/CreditBalanceTransactionListParams.java @@ -0,0 +1,203 @@ +// File generated from our OpenAPI spec +package com.stripe.param.billing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class CreditBalanceTransactionListParams extends ApiRequestParams { + /** The credit grant for which to fetch credit balance transactions. */ + @SerializedName("credit_grant") + String creditGrant; + + /** Required. The customer for which to fetch credit balance transactions. */ + @SerializedName("customer") + String customer; + + /** + * A cursor for use in pagination. {@code ending_before} is an object ID that defines your place + * in the list. For instance, if you make a list request and receive 100 objects, starting with + * {@code obj_bar}, your subsequent call can include {@code ending_before=obj_bar} in order to + * fetch the previous page of the list. + */ + @SerializedName("ending_before") + String endingBefore; + + /** 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; + + /** + * A limit on the number of objects to be returned. Limit can range between 1 and 100, and the + * default is 10. + */ + @SerializedName("limit") + Long limit; + + /** + * A cursor for use in pagination. {@code starting_after} is an object ID that defines your place + * in the list. For instance, if you make a list request and receive 100 objects, ending with + * {@code obj_foo}, your subsequent call can include {@code starting_after=obj_foo} in order to + * fetch the next page of the list. + */ + @SerializedName("starting_after") + String startingAfter; + + private CreditBalanceTransactionListParams( + String creditGrant, + String customer, + String endingBefore, + List expand, + Map extraParams, + Long limit, + String startingAfter) { + this.creditGrant = creditGrant; + this.customer = customer; + this.endingBefore = endingBefore; + this.expand = expand; + this.extraParams = extraParams; + this.limit = limit; + this.startingAfter = startingAfter; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String creditGrant; + + private String customer; + + private String endingBefore; + + private List expand; + + private Map extraParams; + + private Long limit; + + private String startingAfter; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditBalanceTransactionListParams build() { + return new CreditBalanceTransactionListParams( + this.creditGrant, + this.customer, + this.endingBefore, + this.expand, + this.extraParams, + this.limit, + this.startingAfter); + } + + /** The credit grant for which to fetch credit balance transactions. */ + public Builder setCreditGrant(String creditGrant) { + this.creditGrant = creditGrant; + return this; + } + + /** Required. The customer for which to fetch credit balance transactions. */ + public Builder setCustomer(String customer) { + this.customer = customer; + return this; + } + + /** + * A cursor for use in pagination. {@code ending_before} is an object ID that defines your place + * in the list. For instance, if you make a list request and receive 100 objects, starting with + * {@code obj_bar}, your subsequent call can include {@code ending_before=obj_bar} in order to + * fetch the previous page of the list. + */ + public Builder setEndingBefore(String endingBefore) { + this.endingBefore = endingBefore; + 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 + * CreditBalanceTransactionListParams#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 + * CreditBalanceTransactionListParams#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 + * CreditBalanceTransactionListParams#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 CreditBalanceTransactionListParams#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 limit on the number of objects to be returned. Limit can range between 1 and 100, and the + * default is 10. + */ + public Builder setLimit(Long limit) { + this.limit = limit; + return this; + } + + /** + * A cursor for use in pagination. {@code starting_after} is an object ID that defines your + * place in the list. For instance, if you make a list request and receive 100 objects, ending + * with {@code obj_foo}, your subsequent call can include {@code starting_after=obj_foo} in + * order to fetch the next page of the list. + */ + public Builder setStartingAfter(String startingAfter) { + this.startingAfter = startingAfter; + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/billing/CreditBalanceTransactionRetrieveParams.java b/src/main/java/com/stripe/param/billing/CreditBalanceTransactionRetrieveParams.java new file mode 100644 index 00000000000..2b6e700bc8e --- /dev/null +++ b/src/main/java/com/stripe/param/billing/CreditBalanceTransactionRetrieveParams.java @@ -0,0 +1,99 @@ +// File generated from our OpenAPI spec +package com.stripe.param.billing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class CreditBalanceTransactionRetrieveParams extends ApiRequestParams { + /** 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; + + private CreditBalanceTransactionRetrieveParams( + List expand, Map extraParams) { + this.expand = expand; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List expand; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditBalanceTransactionRetrieveParams build() { + return new CreditBalanceTransactionRetrieveParams(this.expand, this.extraParams); + } + + /** + * 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 + * CreditBalanceTransactionRetrieveParams#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 + * CreditBalanceTransactionRetrieveParams#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 + * CreditBalanceTransactionRetrieveParams#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 CreditBalanceTransactionRetrieveParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/billing/CreditGrantCreateParams.java b/src/main/java/com/stripe/param/billing/CreditGrantCreateParams.java new file mode 100644 index 00000000000..6f1fd7e316a --- /dev/null +++ b/src/main/java/com/stripe/param/billing/CreditGrantCreateParams.java @@ -0,0 +1,620 @@ +// File generated from our OpenAPI spec +package com.stripe.param.billing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class CreditGrantCreateParams extends ApiRequestParams { + /** Required. Amount of this credit grant. */ + @SerializedName("amount") + Amount amount; + + /** Required. Configuration specifying what this credit grant applies to. */ + @SerializedName("applicability_config") + ApplicabilityConfig applicabilityConfig; + + /** Required. The category of this credit grant. */ + @SerializedName("category") + Category category; + + /** Required. Id of the customer to whom the credit should be granted. */ + @SerializedName("customer") + String customer; + + /** + * The time when the credit becomes effective i.e when it is eligible to be used. Defaults to the + * current timestamp if not specified. + */ + @SerializedName("effective_at") + Long effectiveAt; + + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** The time when the credit will expire. If not specified, the credit will never expire. */ + @SerializedName("expires_at") + Long expiresAt; + + /** + * 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 (ex: cost basis) in a structured format. + */ + @SerializedName("metadata") + Map metadata; + + /** A descriptive name shown in dashboard and on invoices. */ + @SerializedName("name") + String name; + + private CreditGrantCreateParams( + Amount amount, + ApplicabilityConfig applicabilityConfig, + Category category, + String customer, + Long effectiveAt, + List expand, + Long expiresAt, + Map extraParams, + Map metadata, + String name) { + this.amount = amount; + this.applicabilityConfig = applicabilityConfig; + this.category = category; + this.customer = customer; + this.effectiveAt = effectiveAt; + this.expand = expand; + this.expiresAt = expiresAt; + this.extraParams = extraParams; + this.metadata = metadata; + this.name = name; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Amount amount; + + private ApplicabilityConfig applicabilityConfig; + + private Category category; + + private String customer; + + private Long effectiveAt; + + private List expand; + + private Long expiresAt; + + private Map extraParams; + + private Map metadata; + + private String name; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditGrantCreateParams build() { + return new CreditGrantCreateParams( + this.amount, + this.applicabilityConfig, + this.category, + this.customer, + this.effectiveAt, + this.expand, + this.expiresAt, + this.extraParams, + this.metadata, + this.name); + } + + /** Required. Amount of this credit grant. */ + public Builder setAmount(CreditGrantCreateParams.Amount amount) { + this.amount = amount; + return this; + } + + /** Required. Configuration specifying what this credit grant applies to. */ + public Builder setApplicabilityConfig( + CreditGrantCreateParams.ApplicabilityConfig applicabilityConfig) { + this.applicabilityConfig = applicabilityConfig; + return this; + } + + /** Required. The category of this credit grant. */ + public Builder setCategory(CreditGrantCreateParams.Category category) { + this.category = category; + return this; + } + + /** Required. Id of the customer to whom the credit should be granted. */ + public Builder setCustomer(String customer) { + this.customer = customer; + return this; + } + + /** + * The time when the credit becomes effective i.e when it is eligible to be used. Defaults to + * the current timestamp if not specified. + */ + public Builder setEffectiveAt(Long effectiveAt) { + this.effectiveAt = effectiveAt; + 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 + * CreditGrantCreateParams#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 + * CreditGrantCreateParams#expand} for the field documentation. + */ + public Builder addAllExpand(List elements) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.addAll(elements); + return this; + } + + /** The time when the credit will expire. If not specified, the credit will never expire. */ + public Builder setExpiresAt(Long expiresAt) { + this.expiresAt = expiresAt; + 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 + * CreditGrantCreateParams#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 CreditGrantCreateParams#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 + * CreditGrantCreateParams#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 CreditGrantCreateParams#metadata} for the field documentation. + */ + public Builder putAllMetadata(Map map) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.putAll(map); + return this; + } + + /** A descriptive name shown in dashboard and on invoices. */ + public Builder setName(String name) { + this.name = name; + return this; + } + } + + @Getter + public static class 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; + + /** The monetary amount. */ + @SerializedName("monetary") + Monetary monetary; + + /** + * Required. Specify the type of this amount. We currently only support {@code + * monetary} credits. + */ + @SerializedName("type") + Type type; + + private Amount(Map extraParams, Monetary monetary, Type type) { + this.extraParams = extraParams; + this.monetary = monetary; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Monetary monetary; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditGrantCreateParams.Amount build() { + return new CreditGrantCreateParams.Amount(this.extraParams, this.monetary, this.type); + } + + /** + * 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 + * CreditGrantCreateParams.Amount#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 CreditGrantCreateParams.Amount#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 monetary amount. */ + public Builder setMonetary(CreditGrantCreateParams.Amount.Monetary monetary) { + this.monetary = monetary; + return this; + } + + /** + * Required. Specify the type of this amount. We currently only support + * {@code monetary} credits. + */ + public Builder setType(CreditGrantCreateParams.Amount.Type type) { + this.type = type; + return this; + } + } + + @Getter + public static class Monetary { + /** + * Required. Three-letter ISO + * code for the currency of the {@code value} parameter. + */ + @SerializedName("currency") + String 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; + + /** + * Required. A positive integer representing the amount of the credit grant. + */ + @SerializedName("value") + Long value; + + private Monetary(String currency, Map extraParams, Long value) { + this.currency = currency; + this.extraParams = extraParams; + this.value = value; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String currency; + + private Map extraParams; + + private Long value; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditGrantCreateParams.Amount.Monetary build() { + return new CreditGrantCreateParams.Amount.Monetary( + this.currency, this.extraParams, this.value); + } + + /** + * Required. Three-letter ISO + * code for the currency of the {@code value} parameter. + */ + public Builder setCurrency(String 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 CreditGrantCreateParams.Amount.Monetary#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 CreditGrantCreateParams.Amount.Monetary#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. A positive integer representing the amount of the credit + * grant. + */ + public Builder setValue(Long value) { + this.value = value; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("monetary") + MONETARY("monetary"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + @Getter + public static class ApplicabilityConfig { + /** + * 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. Specify the scope of this applicability config. */ + @SerializedName("scope") + Scope scope; + + private ApplicabilityConfig(Map extraParams, Scope scope) { + this.extraParams = extraParams; + this.scope = scope; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Scope scope; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditGrantCreateParams.ApplicabilityConfig build() { + return new CreditGrantCreateParams.ApplicabilityConfig(this.extraParams, this.scope); + } + + /** + * 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 + * CreditGrantCreateParams.ApplicabilityConfig#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 CreditGrantCreateParams.ApplicabilityConfig#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. Specify the scope of this applicability config. */ + public Builder setScope(CreditGrantCreateParams.ApplicabilityConfig.Scope scope) { + this.scope = scope; + return this; + } + } + + @Getter + public static class Scope { + /** + * 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 price type to which credit grants can apply to. We currently + * only support {@code metered} price type. + */ + @SerializedName("price_type") + PriceType priceType; + + private Scope(Map extraParams, PriceType priceType) { + this.extraParams = extraParams; + this.priceType = priceType; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private PriceType priceType; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditGrantCreateParams.ApplicabilityConfig.Scope build() { + return new CreditGrantCreateParams.ApplicabilityConfig.Scope( + this.extraParams, this.priceType); + } + + /** + * 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 CreditGrantCreateParams.ApplicabilityConfig.Scope#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 CreditGrantCreateParams.ApplicabilityConfig.Scope#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 price type to which credit grants can apply to. We + * currently only support {@code metered} price type. + */ + public Builder setPriceType( + CreditGrantCreateParams.ApplicabilityConfig.Scope.PriceType priceType) { + this.priceType = priceType; + return this; + } + } + + public enum PriceType implements ApiRequestParams.EnumParam { + @SerializedName("metered") + METERED("metered"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + PriceType(String value) { + this.value = value; + } + } + } + } + + public enum Category implements ApiRequestParams.EnumParam { + @SerializedName("paid") + PAID("paid"), + + @SerializedName("promotional") + PROMOTIONAL("promotional"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Category(String value) { + this.value = value; + } + } +} diff --git a/src/main/java/com/stripe/param/billing/CreditGrantExpireParams.java b/src/main/java/com/stripe/param/billing/CreditGrantExpireParams.java new file mode 100644 index 00000000000..928eb38fe4c --- /dev/null +++ b/src/main/java/com/stripe/param/billing/CreditGrantExpireParams.java @@ -0,0 +1,98 @@ +// File generated from our OpenAPI spec +package com.stripe.param.billing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class CreditGrantExpireParams extends ApiRequestParams { + /** 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; + + private CreditGrantExpireParams(List expand, Map extraParams) { + this.expand = expand; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List expand; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditGrantExpireParams build() { + return new CreditGrantExpireParams(this.expand, this.extraParams); + } + + /** + * 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 + * CreditGrantExpireParams#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 + * CreditGrantExpireParams#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 + * CreditGrantExpireParams#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 CreditGrantExpireParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/billing/CreditGrantListParams.java b/src/main/java/com/stripe/param/billing/CreditGrantListParams.java new file mode 100644 index 00000000000..0e5ae22ce3f --- /dev/null +++ b/src/main/java/com/stripe/param/billing/CreditGrantListParams.java @@ -0,0 +1,188 @@ +// File generated from our OpenAPI spec +package com.stripe.param.billing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class CreditGrantListParams extends ApiRequestParams { + /** Only return credit grants for this customer. */ + @SerializedName("customer") + String customer; + + /** + * A cursor for use in pagination. {@code ending_before} is an object ID that defines your place + * in the list. For instance, if you make a list request and receive 100 objects, starting with + * {@code obj_bar}, your subsequent call can include {@code ending_before=obj_bar} in order to + * fetch the previous page of the list. + */ + @SerializedName("ending_before") + String endingBefore; + + /** 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; + + /** + * A limit on the number of objects to be returned. Limit can range between 1 and 100, and the + * default is 10. + */ + @SerializedName("limit") + Long limit; + + /** + * A cursor for use in pagination. {@code starting_after} is an object ID that defines your place + * in the list. For instance, if you make a list request and receive 100 objects, ending with + * {@code obj_foo}, your subsequent call can include {@code starting_after=obj_foo} in order to + * fetch the next page of the list. + */ + @SerializedName("starting_after") + String startingAfter; + + private CreditGrantListParams( + String customer, + String endingBefore, + List expand, + Map extraParams, + Long limit, + String startingAfter) { + this.customer = customer; + this.endingBefore = endingBefore; + this.expand = expand; + this.extraParams = extraParams; + this.limit = limit; + this.startingAfter = startingAfter; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String customer; + + private String endingBefore; + + private List expand; + + private Map extraParams; + + private Long limit; + + private String startingAfter; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditGrantListParams build() { + return new CreditGrantListParams( + this.customer, + this.endingBefore, + this.expand, + this.extraParams, + this.limit, + this.startingAfter); + } + + /** Only return credit grants for this customer. */ + public Builder setCustomer(String customer) { + this.customer = customer; + return this; + } + + /** + * A cursor for use in pagination. {@code ending_before} is an object ID that defines your place + * in the list. For instance, if you make a list request and receive 100 objects, starting with + * {@code obj_bar}, your subsequent call can include {@code ending_before=obj_bar} in order to + * fetch the previous page of the list. + */ + public Builder setEndingBefore(String endingBefore) { + this.endingBefore = endingBefore; + 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 + * CreditGrantListParams#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 + * CreditGrantListParams#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 + * CreditGrantListParams#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 CreditGrantListParams#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 limit on the number of objects to be returned. Limit can range between 1 and 100, and the + * default is 10. + */ + public Builder setLimit(Long limit) { + this.limit = limit; + return this; + } + + /** + * A cursor for use in pagination. {@code starting_after} is an object ID that defines your + * place in the list. For instance, if you make a list request and receive 100 objects, ending + * with {@code obj_foo}, your subsequent call can include {@code starting_after=obj_foo} in + * order to fetch the next page of the list. + */ + public Builder setStartingAfter(String startingAfter) { + this.startingAfter = startingAfter; + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/billing/CreditGrantRetrieveParams.java b/src/main/java/com/stripe/param/billing/CreditGrantRetrieveParams.java new file mode 100644 index 00000000000..ffec603dd71 --- /dev/null +++ b/src/main/java/com/stripe/param/billing/CreditGrantRetrieveParams.java @@ -0,0 +1,98 @@ +// File generated from our OpenAPI spec +package com.stripe.param.billing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class CreditGrantRetrieveParams extends ApiRequestParams { + /** 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; + + private CreditGrantRetrieveParams(List expand, Map extraParams) { + this.expand = expand; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List expand; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditGrantRetrieveParams build() { + return new CreditGrantRetrieveParams(this.expand, this.extraParams); + } + + /** + * 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 + * CreditGrantRetrieveParams#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 + * CreditGrantRetrieveParams#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 + * CreditGrantRetrieveParams#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 CreditGrantRetrieveParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/billing/CreditGrantUpdateParams.java b/src/main/java/com/stripe/param/billing/CreditGrantUpdateParams.java new file mode 100644 index 00000000000..e5dca877928 --- /dev/null +++ b/src/main/java/com/stripe/param/billing/CreditGrantUpdateParams.java @@ -0,0 +1,168 @@ +// File generated from our OpenAPI spec +package com.stripe.param.billing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import com.stripe.param.common.EmptyParam; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class CreditGrantUpdateParams extends ApiRequestParams { + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** + * The time when the credit created by this credit grant will expire. If set to empty, the credit + * will never expire. + */ + @SerializedName("expires_at") + Object expiresAt; + + /** + * 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 (ex: cost basis) in a structured format. + */ + @SerializedName("metadata") + Map metadata; + + private CreditGrantUpdateParams( + List expand, + Object expiresAt, + Map extraParams, + Map metadata) { + this.expand = expand; + this.expiresAt = expiresAt; + this.extraParams = extraParams; + this.metadata = metadata; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List expand; + + private Object expiresAt; + + private Map extraParams; + + private Map metadata; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditGrantUpdateParams build() { + return new CreditGrantUpdateParams( + this.expand, this.expiresAt, this.extraParams, this.metadata); + } + + /** + * 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 + * CreditGrantUpdateParams#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 + * CreditGrantUpdateParams#expand} for the field documentation. + */ + public Builder addAllExpand(List elements) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.addAll(elements); + return this; + } + + /** + * The time when the credit created by this credit grant will expire. If set to empty, the + * credit will never expire. + */ + public Builder setExpiresAt(Long expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * The time when the credit created by this credit grant will expire. If set to empty, the + * credit will never expire. + */ + public Builder setExpiresAt(EmptyParam expiresAt) { + this.expiresAt = expiresAt; + 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 + * CreditGrantUpdateParams#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 CreditGrantUpdateParams#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 + * CreditGrantUpdateParams#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 CreditGrantUpdateParams#metadata} for the field documentation. + */ + public Builder putAllMetadata(Map map) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.putAll(map); + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/billing/CreditGrantVoidGrantParams.java b/src/main/java/com/stripe/param/billing/CreditGrantVoidGrantParams.java new file mode 100644 index 00000000000..15496e666c1 --- /dev/null +++ b/src/main/java/com/stripe/param/billing/CreditGrantVoidGrantParams.java @@ -0,0 +1,98 @@ +// File generated from our OpenAPI spec +package com.stripe.param.billing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class CreditGrantVoidGrantParams extends ApiRequestParams { + /** 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; + + private CreditGrantVoidGrantParams(List expand, Map extraParams) { + this.expand = expand; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List expand; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditGrantVoidGrantParams build() { + return new CreditGrantVoidGrantParams(this.expand, this.extraParams); + } + + /** + * 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 + * CreditGrantVoidGrantParams#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 + * CreditGrantVoidGrantParams#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 + * CreditGrantVoidGrantParams#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 CreditGrantVoidGrantParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/billingportal/ConfigurationCreateParams.java b/src/main/java/com/stripe/param/billingportal/ConfigurationCreateParams.java index 758f2a8d823..6408ccf1c9b 100644 --- a/src/main/java/com/stripe/param/billingportal/ConfigurationCreateParams.java +++ b/src/main/java/com/stripe/param/billingportal/ConfigurationCreateParams.java @@ -1137,8 +1137,8 @@ public enum ProrationBehavior implements ApiRequestParams.EnumParam { @Getter public static class SubscriptionUpdate { /** - * Required. The types of subscription updates that are supported. When - * empty, subscriptions are not updateable. + * The types of subscription updates that are supported. When empty, subscriptions are not + * updateable. */ @SerializedName("default_allowed_updates") Object defaultAllowedUpdates; @@ -1156,9 +1156,7 @@ public static class SubscriptionUpdate { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; - /** - * Required. The list of up to 10 products that support subscription updates. - */ + /** The list of up to 10 products that support subscription updates. */ @SerializedName("products") Object products; @@ -1251,8 +1249,8 @@ public Builder addAllDefaultAllowedUpdate( } /** - * Required. The types of subscription updates that are supported. When - * empty, subscriptions are not updateable. + * The types of subscription updates that are supported. When empty, subscriptions are not + * updateable. */ public Builder setDefaultAllowedUpdates(EmptyParam defaultAllowedUpdates) { this.defaultAllowedUpdates = defaultAllowedUpdates; @@ -1260,8 +1258,8 @@ public Builder setDefaultAllowedUpdates(EmptyParam defaultAllowedUpdates) { } /** - * Required. The types of subscription updates that are supported. When - * empty, subscriptions are not updateable. + * The types of subscription updates that are supported. When empty, subscriptions are not + * updateable. */ public Builder setDefaultAllowedUpdates( List @@ -1340,19 +1338,13 @@ public Builder addAllProduct( return this; } - /** - * Required. The list of up to 10 products that support subscription - * updates. - */ + /** The list of up to 10 products that support subscription updates. */ public Builder setProducts(EmptyParam products) { this.products = products; return this; } - /** - * Required. The list of up to 10 products that support subscription - * updates. - */ + /** The list of up to 10 products that support subscription updates. */ public Builder setProducts( List products) { this.products = products; diff --git a/src/main/java/com/stripe/param/checkout/SessionCreateParams.java b/src/main/java/com/stripe/param/checkout/SessionCreateParams.java index 06cb2526d0c..e7e75d0b7f0 100644 --- a/src/main/java/com/stripe/param/checkout/SessionCreateParams.java +++ b/src/main/java/com/stripe/param/checkout/SessionCreateParams.java @@ -4001,8 +4001,7 @@ public Builder addAllTaxRate(List elements) { public static class AdjustableQuantity { /** * Required. Set to true if the quantity can be adjusted to any non-negative - * integer. By default customers will be able to remove the line item by setting the quantity - * to 0. + * integer. */ @SerializedName("enabled") Boolean enabled; @@ -4059,8 +4058,7 @@ public SessionCreateParams.LineItem.AdjustableQuantity build() { /** * Required. Set to true if the quantity can be adjusted to any - * non-negative integer. By default customers will be able to remove the line item by - * setting the quantity to 0. + * non-negative integer. */ public Builder setEnabled(Boolean enabled) { this.enabled = enabled; diff --git a/src/main/java/com/stripe/param/terminal/ReaderProcessPaymentIntentParams.java b/src/main/java/com/stripe/param/terminal/ReaderProcessPaymentIntentParams.java index 90aa74e6a9b..52db2d41fa7 100644 --- a/src/main/java/com/stripe/param/terminal/ReaderProcessPaymentIntentParams.java +++ b/src/main/java/com/stripe/param/terminal/ReaderProcessPaymentIntentParams.java @@ -129,6 +129,14 @@ public Builder setProcessConfig(ReaderProcessPaymentIntentParams.ProcessConfig p @Getter public static class ProcessConfig { + /** + * This field indicates whether this payment method can be shown again to its customer in a + * checkout flow. Stripe products such as Checkout and Elements use this field to determine + * whether a payment method can be shown as a saved payment method in a checkout flow. + */ + @SerializedName("allow_redisplay") + AllowRedisplay allowRedisplay; + /** Enables cancel button on transaction screens. */ @SerializedName("enable_customer_cancellation") Boolean enableCustomerCancellation; @@ -151,10 +159,12 @@ public static class ProcessConfig { Tipping tipping; private ProcessConfig( + AllowRedisplay allowRedisplay, Boolean enableCustomerCancellation, Map extraParams, Boolean skipTipping, Tipping tipping) { + this.allowRedisplay = allowRedisplay; this.enableCustomerCancellation = enableCustomerCancellation; this.extraParams = extraParams; this.skipTipping = skipTipping; @@ -166,6 +176,8 @@ public static Builder builder() { } public static class Builder { + private AllowRedisplay allowRedisplay; + private Boolean enableCustomerCancellation; private Map extraParams; @@ -177,7 +189,22 @@ public static class Builder { /** Finalize and obtain parameter instance from this builder. */ public ReaderProcessPaymentIntentParams.ProcessConfig build() { return new ReaderProcessPaymentIntentParams.ProcessConfig( - this.enableCustomerCancellation, this.extraParams, this.skipTipping, this.tipping); + this.allowRedisplay, + this.enableCustomerCancellation, + this.extraParams, + this.skipTipping, + this.tipping); + } + + /** + * This field indicates whether this payment method can be shown again to its customer in a + * checkout flow. Stripe products such as Checkout and Elements use this field to determine + * whether a payment method can be shown as a saved payment method in a checkout flow. + */ + public Builder setAllowRedisplay( + ReaderProcessPaymentIntentParams.ProcessConfig.AllowRedisplay allowRedisplay) { + this.allowRedisplay = allowRedisplay; + return this; } /** Enables cancel button on transaction screens. */ @@ -304,5 +331,23 @@ public Builder putAllExtraParam(Map map) { } } } + + public enum AllowRedisplay implements ApiRequestParams.EnumParam { + @SerializedName("always") + ALWAYS("always"), + + @SerializedName("limited") + LIMITED("limited"), + + @SerializedName("unspecified") + UNSPECIFIED("unspecified"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + AllowRedisplay(String value) { + this.value = value; + } + } } } diff --git a/src/main/java/com/stripe/param/terminal/ReaderProcessSetupIntentParams.java b/src/main/java/com/stripe/param/terminal/ReaderProcessSetupIntentParams.java index 01c63713f69..60715e00b0e 100644 --- a/src/main/java/com/stripe/param/terminal/ReaderProcessSetupIntentParams.java +++ b/src/main/java/com/stripe/param/terminal/ReaderProcessSetupIntentParams.java @@ -11,9 +11,14 @@ @Getter public class ReaderProcessSetupIntentParams extends ApiRequestParams { - /** Customer Consent Collected. */ - @SerializedName("customer_consent_collected") - Boolean customerConsentCollected; + /** + * Required. This field indicates whether this payment method can be shown again + * to its customer in a checkout flow. Stripe products such as Checkout and Elements use this + * field to determine whether a payment method can be shown as a saved payment method in a + * checkout flow. + */ + @SerializedName("allow_redisplay") + AllowRedisplay allowRedisplay; /** Specifies which fields in the response should be expanded. */ @SerializedName("expand") @@ -37,12 +42,12 @@ public class ReaderProcessSetupIntentParams extends ApiRequestParams { String setupIntent; private ReaderProcessSetupIntentParams( - Boolean customerConsentCollected, + AllowRedisplay allowRedisplay, List expand, Map extraParams, ProcessConfig processConfig, String setupIntent) { - this.customerConsentCollected = customerConsentCollected; + this.allowRedisplay = allowRedisplay; this.expand = expand; this.extraParams = extraParams; this.processConfig = processConfig; @@ -54,7 +59,7 @@ public static Builder builder() { } public static class Builder { - private Boolean customerConsentCollected; + private AllowRedisplay allowRedisplay; private List expand; @@ -67,16 +72,17 @@ public static class Builder { /** Finalize and obtain parameter instance from this builder. */ public ReaderProcessSetupIntentParams build() { return new ReaderProcessSetupIntentParams( - this.customerConsentCollected, - this.expand, - this.extraParams, - this.processConfig, - this.setupIntent); + this.allowRedisplay, this.expand, this.extraParams, this.processConfig, this.setupIntent); } - /** Customer Consent Collected. */ - public Builder setCustomerConsentCollected(Boolean customerConsentCollected) { - this.customerConsentCollected = customerConsentCollected; + /** + * Required. This field indicates whether this payment method can be shown + * again to its customer in a checkout flow. Stripe products such as Checkout and Elements use + * this field to determine whether a payment method can be shown as a saved payment method in a + * checkout flow. + */ + public Builder setAllowRedisplay(ReaderProcessSetupIntentParams.AllowRedisplay allowRedisplay) { + this.allowRedisplay = allowRedisplay; return this; } @@ -214,4 +220,22 @@ public Builder putAllExtraParam(Map map) { } } } + + public enum AllowRedisplay implements ApiRequestParams.EnumParam { + @SerializedName("always") + ALWAYS("always"), + + @SerializedName("limited") + LIMITED("limited"), + + @SerializedName("unspecified") + UNSPECIFIED("unspecified"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + AllowRedisplay(String value) { + this.value = value; + } + } } diff --git a/src/main/java/com/stripe/service/BillingService.java b/src/main/java/com/stripe/service/BillingService.java index f8281269a70..e92df43aaac 100644 --- a/src/main/java/com/stripe/service/BillingService.java +++ b/src/main/java/com/stripe/service/BillingService.java @@ -13,6 +13,18 @@ public com.stripe.service.billing.AlertService alerts() { return new com.stripe.service.billing.AlertService(this.getResponseGetter()); } + public com.stripe.service.billing.CreditBalanceSummaryService creditBalanceSummary() { + return new com.stripe.service.billing.CreditBalanceSummaryService(this.getResponseGetter()); + } + + public com.stripe.service.billing.CreditBalanceTransactionService creditBalanceTransactions() { + return new com.stripe.service.billing.CreditBalanceTransactionService(this.getResponseGetter()); + } + + public com.stripe.service.billing.CreditGrantService creditGrants() { + return new com.stripe.service.billing.CreditGrantService(this.getResponseGetter()); + } + public com.stripe.service.billing.MeterEventAdjustmentService meterEventAdjustments() { return new com.stripe.service.billing.MeterEventAdjustmentService(this.getResponseGetter()); } diff --git a/src/main/java/com/stripe/service/SubscriptionService.java b/src/main/java/com/stripe/service/SubscriptionService.java index 355c74be7cf..e716e23a4b7 100644 --- a/src/main/java/com/stripe/service/SubscriptionService.java +++ b/src/main/java/com/stripe/service/SubscriptionService.java @@ -28,17 +28,17 @@ public SubscriptionService(StripeResponseGetter responseGetter) { } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. + * Cancels a customer’s subscription immediately. The customer won’t be charged again for the + * subscription. After it’s canceled, you can no longer update the subscription or its metadata. * - *

Note, however, that any pending invoice items that you’ve created will still be charged for - * at the end of the period, unless manually deleted. If you’ve set the - * subscription to cancel at the end of the period, any pending prorations will also be left in - * place and collected at the end of the period. But if the subscription is set to cancel - * immediately, pending prorations will be removed. + *

Any pending invoice items that you’ve created are still charged at the end of the period, + * unless manually deleted. If you’ve + * set the subscription to cancel at the end of the period, any pending prorations are also left + * in place and collected at the end of the period. But if the subscription is set to cancel + * immediately, pending prorations are removed. * - *

By default, upon subscription cancellation, Stripe will stop automatic collection of all + *

By default, upon subscription cancellation, Stripe stops automatic collection of all * finalized invoices for the customer. This is intended to prevent unexpected payment attempts * after the customer has canceled a subscription. However, you can resume automatic collection of * the invoices manually after subscription cancellation to have us proceed. Or, you could check @@ -49,17 +49,17 @@ public Subscription cancel(String subscriptionExposedId, SubscriptionCancelParam return cancel(subscriptionExposedId, params, (RequestOptions) null); } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. + * Cancels a customer’s subscription immediately. The customer won’t be charged again for the + * subscription. After it’s canceled, you can no longer update the subscription or its metadata. * - *

Note, however, that any pending invoice items that you’ve created will still be charged for - * at the end of the period, unless manually deleted. If you’ve set the - * subscription to cancel at the end of the period, any pending prorations will also be left in - * place and collected at the end of the period. But if the subscription is set to cancel - * immediately, pending prorations will be removed. + *

Any pending invoice items that you’ve created are still charged at the end of the period, + * unless manually deleted. If you’ve + * set the subscription to cancel at the end of the period, any pending prorations are also left + * in place and collected at the end of the period. But if the subscription is set to cancel + * immediately, pending prorations are removed. * - *

By default, upon subscription cancellation, Stripe will stop automatic collection of all + *

By default, upon subscription cancellation, Stripe stops automatic collection of all * finalized invoices for the customer. This is intended to prevent unexpected payment attempts * after the customer has canceled a subscription. However, you can resume automatic collection of * the invoices manually after subscription cancellation to have us proceed. Or, you could check @@ -70,17 +70,17 @@ public Subscription cancel(String subscriptionExposedId, RequestOptions options) return cancel(subscriptionExposedId, (SubscriptionCancelParams) null, options); } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. + * Cancels a customer’s subscription immediately. The customer won’t be charged again for the + * subscription. After it’s canceled, you can no longer update the subscription or its metadata. * - *

Note, however, that any pending invoice items that you’ve created will still be charged for - * at the end of the period, unless manually deleted. If you’ve set the - * subscription to cancel at the end of the period, any pending prorations will also be left in - * place and collected at the end of the period. But if the subscription is set to cancel - * immediately, pending prorations will be removed. + *

Any pending invoice items that you’ve created are still charged at the end of the period, + * unless manually deleted. If you’ve + * set the subscription to cancel at the end of the period, any pending prorations are also left + * in place and collected at the end of the period. But if the subscription is set to cancel + * immediately, pending prorations are removed. * - *

By default, upon subscription cancellation, Stripe will stop automatic collection of all + *

By default, upon subscription cancellation, Stripe stops automatic collection of all * finalized invoices for the customer. This is intended to prevent unexpected payment attempts * after the customer has canceled a subscription. However, you can resume automatic collection of * the invoices manually after subscription cancellation to have us proceed. Or, you could check @@ -90,17 +90,17 @@ public Subscription cancel(String subscriptionExposedId) throws StripeException return cancel(subscriptionExposedId, (SubscriptionCancelParams) null, (RequestOptions) null); } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. + * Cancels a customer’s subscription immediately. The customer won’t be charged again for the + * subscription. After it’s canceled, you can no longer update the subscription or its metadata. * - *

Note, however, that any pending invoice items that you’ve created will still be charged for - * at the end of the period, unless manually deleted. If you’ve set the - * subscription to cancel at the end of the period, any pending prorations will also be left in - * place and collected at the end of the period. But if the subscription is set to cancel - * immediately, pending prorations will be removed. + *

Any pending invoice items that you’ve created are still charged at the end of the period, + * unless manually deleted. If you’ve + * set the subscription to cancel at the end of the period, any pending prorations are also left + * in place and collected at the end of the period. But if the subscription is set to cancel + * immediately, pending prorations are removed. * - *

By default, upon subscription cancellation, Stripe will stop automatic collection of all + *

By default, upon subscription cancellation, Stripe stops automatic collection of all * finalized invoices for the customer. This is intended to prevent unexpected payment attempts * after the customer has canceled a subscription. However, you can resume automatic collection of * the invoices manually after subscription cancellation to have us proceed. Or, you could check diff --git a/src/main/java/com/stripe/service/billing/CreditBalanceSummaryService.java b/src/main/java/com/stripe/service/billing/CreditBalanceSummaryService.java new file mode 100644 index 00000000000..b20e3ab4cf9 --- /dev/null +++ b/src/main/java/com/stripe/service/billing/CreditBalanceSummaryService.java @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec +package com.stripe.service.billing; + +import com.stripe.exception.StripeException; +import com.stripe.model.billing.CreditBalanceSummary; +import com.stripe.net.ApiRequest; +import com.stripe.net.ApiRequestParams; +import com.stripe.net.ApiResource; +import com.stripe.net.ApiService; +import com.stripe.net.BaseAddress; +import com.stripe.net.RequestOptions; +import com.stripe.net.StripeResponseGetter; +import com.stripe.param.billing.CreditBalanceSummaryRetrieveParams; + +public final class CreditBalanceSummaryService extends ApiService { + public CreditBalanceSummaryService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + /** Retrieves the credit balance summary for a customer. */ + public CreditBalanceSummary retrieve(CreditBalanceSummaryRetrieveParams params) + throws StripeException { + return retrieve(params, (RequestOptions) null); + } + /** Retrieves the credit balance summary for a customer. */ + public CreditBalanceSummary retrieve( + CreditBalanceSummaryRetrieveParams params, RequestOptions options) throws StripeException { + String path = "/v1/billing/credit_balance_summary"; + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, CreditBalanceSummary.class); + } +} diff --git a/src/main/java/com/stripe/service/billing/CreditBalanceTransactionService.java b/src/main/java/com/stripe/service/billing/CreditBalanceTransactionService.java new file mode 100644 index 00000000000..101ab5fa719 --- /dev/null +++ b/src/main/java/com/stripe/service/billing/CreditBalanceTransactionService.java @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec +package com.stripe.service.billing; + +import com.google.gson.reflect.TypeToken; +import com.stripe.exception.StripeException; +import com.stripe.model.StripeCollection; +import com.stripe.model.billing.CreditBalanceTransaction; +import com.stripe.net.ApiRequest; +import com.stripe.net.ApiRequestParams; +import com.stripe.net.ApiResource; +import com.stripe.net.ApiService; +import com.stripe.net.BaseAddress; +import com.stripe.net.RequestOptions; +import com.stripe.net.StripeResponseGetter; +import com.stripe.param.billing.CreditBalanceTransactionListParams; +import com.stripe.param.billing.CreditBalanceTransactionRetrieveParams; + +public final class CreditBalanceTransactionService extends ApiService { + public CreditBalanceTransactionService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + /** Retrieve a list of credit balance transactions. */ + public StripeCollection list(CreditBalanceTransactionListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + /** Retrieve a list of credit balance transactions. */ + public StripeCollection list( + CreditBalanceTransactionListParams params, RequestOptions options) throws StripeException { + String path = "/v1/billing/credit_balance_transactions"; + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request( + request, new TypeToken>() {}.getType()); + } + /** Retrieves a credit balance transaction. */ + public CreditBalanceTransaction retrieve(String id, CreditBalanceTransactionRetrieveParams params) + throws StripeException { + return retrieve(id, params, (RequestOptions) null); + } + /** Retrieves a credit balance transaction. */ + public CreditBalanceTransaction retrieve(String id, RequestOptions options) + throws StripeException { + return retrieve(id, (CreditBalanceTransactionRetrieveParams) null, options); + } + /** Retrieves a credit balance transaction. */ + public CreditBalanceTransaction retrieve(String id) throws StripeException { + return retrieve(id, (CreditBalanceTransactionRetrieveParams) null, (RequestOptions) null); + } + /** Retrieves a credit balance transaction. */ + public CreditBalanceTransaction retrieve( + String id, CreditBalanceTransactionRetrieveParams params, RequestOptions options) + throws StripeException { + String path = + String.format("/v1/billing/credit_balance_transactions/%s", ApiResource.urlEncodeId(id)); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, CreditBalanceTransaction.class); + } +} diff --git a/src/main/java/com/stripe/service/billing/CreditGrantService.java b/src/main/java/com/stripe/service/billing/CreditGrantService.java new file mode 100644 index 00000000000..adb40a05ab6 --- /dev/null +++ b/src/main/java/com/stripe/service/billing/CreditGrantService.java @@ -0,0 +1,170 @@ +// File generated from our OpenAPI spec +package com.stripe.service.billing; + +import com.google.gson.reflect.TypeToken; +import com.stripe.exception.StripeException; +import com.stripe.model.StripeCollection; +import com.stripe.model.billing.CreditGrant; +import com.stripe.net.ApiRequest; +import com.stripe.net.ApiRequestParams; +import com.stripe.net.ApiResource; +import com.stripe.net.ApiService; +import com.stripe.net.BaseAddress; +import com.stripe.net.RequestOptions; +import com.stripe.net.StripeResponseGetter; +import com.stripe.param.billing.CreditGrantCreateParams; +import com.stripe.param.billing.CreditGrantExpireParams; +import com.stripe.param.billing.CreditGrantListParams; +import com.stripe.param.billing.CreditGrantRetrieveParams; +import com.stripe.param.billing.CreditGrantUpdateParams; +import com.stripe.param.billing.CreditGrantVoidGrantParams; + +public final class CreditGrantService extends ApiService { + public CreditGrantService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + /** Retrieve a list of credit grants. */ + public StripeCollection list(CreditGrantListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + /** Retrieve a list of credit grants. */ + public StripeCollection list(RequestOptions options) throws StripeException { + return list((CreditGrantListParams) null, options); + } + /** Retrieve a list of credit grants. */ + public StripeCollection list() throws StripeException { + return list((CreditGrantListParams) null, (RequestOptions) null); + } + /** Retrieve a list of credit grants. */ + public StripeCollection list(CreditGrantListParams params, RequestOptions options) + throws StripeException { + String path = "/v1/billing/credit_grants"; + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, new TypeToken>() {}.getType()); + } + /** Creates a credit grant. */ + public CreditGrant create(CreditGrantCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + /** Creates a credit grant. */ + public CreditGrant create(CreditGrantCreateParams params, RequestOptions options) + throws StripeException { + String path = "/v1/billing/credit_grants"; + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, CreditGrant.class); + } + /** Retrieves a credit grant. */ + public CreditGrant retrieve(String id, CreditGrantRetrieveParams params) throws StripeException { + return retrieve(id, params, (RequestOptions) null); + } + /** Retrieves a credit grant. */ + public CreditGrant retrieve(String id, RequestOptions options) throws StripeException { + return retrieve(id, (CreditGrantRetrieveParams) null, options); + } + /** Retrieves a credit grant. */ + public CreditGrant retrieve(String id) throws StripeException { + return retrieve(id, (CreditGrantRetrieveParams) null, (RequestOptions) null); + } + /** Retrieves a credit grant. */ + public CreditGrant retrieve(String id, CreditGrantRetrieveParams params, RequestOptions options) + throws StripeException { + String path = String.format("/v1/billing/credit_grants/%s", ApiResource.urlEncodeId(id)); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, CreditGrant.class); + } + /** Updates a credit grant. */ + public CreditGrant update(String id, CreditGrantUpdateParams params) throws StripeException { + return update(id, params, (RequestOptions) null); + } + /** Updates a credit grant. */ + public CreditGrant update(String id, RequestOptions options) throws StripeException { + return update(id, (CreditGrantUpdateParams) null, options); + } + /** Updates a credit grant. */ + public CreditGrant update(String id) throws StripeException { + return update(id, (CreditGrantUpdateParams) null, (RequestOptions) null); + } + /** Updates a credit grant. */ + public CreditGrant update(String id, CreditGrantUpdateParams params, RequestOptions options) + throws StripeException { + String path = String.format("/v1/billing/credit_grants/%s", ApiResource.urlEncodeId(id)); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, CreditGrant.class); + } + /** Expires a credit grant. */ + public CreditGrant expire(String id, CreditGrantExpireParams params) throws StripeException { + return expire(id, params, (RequestOptions) null); + } + /** Expires a credit grant. */ + public CreditGrant expire(String id, RequestOptions options) throws StripeException { + return expire(id, (CreditGrantExpireParams) null, options); + } + /** Expires a credit grant. */ + public CreditGrant expire(String id) throws StripeException { + return expire(id, (CreditGrantExpireParams) null, (RequestOptions) null); + } + /** Expires a credit grant. */ + public CreditGrant expire(String id, CreditGrantExpireParams params, RequestOptions options) + throws StripeException { + String path = String.format("/v1/billing/credit_grants/%s/expire", ApiResource.urlEncodeId(id)); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, CreditGrant.class); + } + /** Voids a credit grant. */ + public CreditGrant voidGrant(String id, CreditGrantVoidGrantParams params) + throws StripeException { + return voidGrant(id, params, (RequestOptions) null); + } + /** Voids a credit grant. */ + public CreditGrant voidGrant(String id, RequestOptions options) throws StripeException { + return voidGrant(id, (CreditGrantVoidGrantParams) null, options); + } + /** Voids a credit grant. */ + public CreditGrant voidGrant(String id) throws StripeException { + return voidGrant(id, (CreditGrantVoidGrantParams) null, (RequestOptions) null); + } + /** Voids a credit grant. */ + public CreditGrant voidGrant(String id, CreditGrantVoidGrantParams params, RequestOptions options) + throws StripeException { + String path = String.format("/v1/billing/credit_grants/%s/void", ApiResource.urlEncodeId(id)); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, CreditGrant.class); + } +} diff --git a/src/test/java/com/stripe/functional/GeneratedExamples.java b/src/test/java/com/stripe/functional/GeneratedExamples.java index 4113c48a1ac..e7f95c25fa9 100644 --- a/src/test/java/com/stripe/functional/GeneratedExamples.java +++ b/src/test/java/com/stripe/functional/GeneratedExamples.java @@ -11888,48 +11888,6 @@ public void testTerminalReadersProcessPaymentIntentPostServices() throws StripeE null); } - @Test - public void testTerminalReadersProcessSetupIntentPost() throws StripeException { - com.stripe.model.terminal.Reader resource = - com.stripe.model.terminal.Reader.retrieve("tmr_xxxxxxxxxxxxx"); - - com.stripe.param.terminal.ReaderProcessSetupIntentParams params = - com.stripe.param.terminal.ReaderProcessSetupIntentParams.builder() - .setSetupIntent("seti_xxxxxxxxxxxxx") - .setCustomerConsentCollected(true) - .build(); - - com.stripe.model.terminal.Reader reader = resource.processSetupIntent(params); - assertNotNull(reader); - verifyRequest( - BaseAddress.API, - ApiResource.RequestMethod.POST, - "/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent", - params.toMap(), - null); - } - - @Test - public void testTerminalReadersProcessSetupIntentPostServices() throws StripeException { - StripeClient client = new StripeClient(networkSpy); - - com.stripe.param.terminal.ReaderProcessSetupIntentParams params = - com.stripe.param.terminal.ReaderProcessSetupIntentParams.builder() - .setSetupIntent("seti_xxxxxxxxxxxxx") - .setCustomerConsentCollected(true) - .build(); - - com.stripe.model.terminal.Reader reader = - client.terminal().readers().processSetupIntent("tmr_xxxxxxxxxxxxx", params); - assertNotNull(reader); - verifyRequest( - BaseAddress.API, - ApiResource.RequestMethod.POST, - "/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent", - params.toMap(), - null); - } - @Test public void testTestHelpersCustomersFundCashBalancePost() throws StripeException { Customer resource = Customer.retrieve("cus_123");