From b9d6f53ac830176fbe54346d631a27849d37cfc5 Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 7 Feb 2025 13:42:34 -0800 Subject: [PATCH] Update generated code for beta (#1942) * Update generated code for v1461 * Update generated code for v1462 * Update generated code for v1463 * Updated upload artifact ci action (#1941) * Update generated code (#1936) * Update generated code for v1441 * Update generated code for v1455 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Co-authored-by: helenye-stripe <111009531+helenye-stripe@users.noreply.github.com> * Bump version to 28.3.0 * Update generated code for v1464 * Update generated code for v1466 * Update generated code for v1467 * Ensure `getRawJsonObject` returns data for constructed webhooks (#1946) * construct fake response during webhook parsing * formatting * Update generated code for v1472 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Co-authored-by: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com> Co-authored-by: helenye-stripe <111009531+helenye-stripe@users.noreply.github.com> Co-authored-by: Helen Ye Co-authored-by: David Brownman <109395161+xavdid-stripe@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 32 ++++ OPENAPI_VERSION | 2 +- src/main/java/com/stripe/model/Account.java | 12 ++ src/main/java/com/stripe/model/Balance.java | 90 ++++++++-- src/main/java/com/stripe/model/Charge.java | 16 ++ .../com/stripe/model/ConfirmationToken.java | 15 +- .../java/com/stripe/model/CreditNote.java | 10 +- src/main/java/com/stripe/model/Invoice.java | 10 +- src/main/java/com/stripe/model/LineItem.java | 10 +- src/main/java/com/stripe/model/Order.java | 20 +-- .../java/com/stripe/model/PaymentMethod.java | 15 +- src/main/java/com/stripe/model/Quote.java | 28 ++- .../com/stripe/model/QuotePreviewInvoice.java | 10 +- src/main/java/com/stripe/model/TaxRate.java | 13 +- .../com/stripe/model/billing/CreditGrant.java | 23 +++ .../model/billing/MeterEventSummary.java | 3 + .../com/stripe/model/checkout/Session.java | 39 +++-- .../com/stripe/model/tax/Calculation.java | 2 +- .../stripe/model/tax/CalculationLineItem.java | 4 +- .../com/stripe/model/tax/Transaction.java | 2 +- src/main/java/com/stripe/net/Webhook.java | 8 + .../param/AccountPersonCreateParams.java | 24 ++- .../param/AccountPersonUpdateParams.java | 34 ++-- .../param/AccountSessionCreateParams.java | 163 ++++++++++++++++++ .../param/InvoiceAttachPaymentParams.java | 4 +- .../param/PersonCollectionCreateParams.java | 24 ++- .../com/stripe/param/PersonUpdateParams.java | 33 ++-- .../com/stripe/param/TaxRateCreateParams.java | 6 +- .../com/stripe/param/TaxRateUpdateParams.java | 10 +- .../com/stripe/param/TokenCreateParams.java | 24 ++- .../CreditBalanceSummaryRetrieveParams.java | 121 ++++++++++++- .../billing/CreditGrantCreateParams.java | 116 ++++++++++++- .../param/checkout/SessionCreateParams.java | 148 ++++++++++++++++ .../SessionCreateParams.java | 4 +- src/test/java/com/stripe/net/WebhookTest.java | 10 ++ 36 files changed, 939 insertions(+), 148 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c03e032fa0..c8e4c0cf005 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -205,7 +205,7 @@ jobs: mv ../japi-compliance-checker/compat_reports/stripe-java/*/compat_report.html report.html - name: Upload report as artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: JAPI Compliance Report path: report.html diff --git a/CHANGELOG.md b/CHANGELOG.md index bb7e7c689a1..a11cf6f54e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,37 @@ # Changelog +## 28.3.0 - 2025-01-27 +* [#1936](https://github.com/stripe/stripe-java/pull/1936) Update generated code + * Add support for `close` method on resource `Treasury.FinancialAccount` + * Add support for `pay_by_bank_payments` on `Account.capabilities`, `AccountCreateParams.capabilities`, and `AccountUpdateParams.capabilities` + * Add support for `directorship_declaration` and `ownership_exemption_reason` on `Account.company`, `AccountCreateParams.company`, `AccountUpdateParams.company`, and `TokenCreateParams.account.company` + * Add support for `proof_of_ultimate_beneficial_ownership` on `AccountCreateParams.documents` and `AccountUpdateParams.documents` + * Add support for `financial_account` on `AccountSession.components`, `AccountSessionCreateParams.components`, and `Treasury.OutboundTransfer.destination_payment_method_details` + * Add support for `financial_account_transactions`, `issuing_card`, and `issuing_cards_list` on `AccountSession.components` and `AccountSessionCreateParams.components` + * Add support for `advice_code` on `Charge.outcome`, `Invoice.last_finalization_error`, `PaymentIntent.last_payment_error`, `SetupAttempt.setup_error`, `SetupIntent.last_setup_error`, and `StripeError` + * Add support for `pay_by_bank` on `Charge.payment_method_details`, `ConfirmationToken.payment_method_preview`, `ConfirmationTokenCreateParams.payment_method_data`, `PaymentIntent.payment_method_options`, `PaymentIntentConfirmParams.payment_method_data`, `PaymentIntentConfirmParams.payment_method_options`, `PaymentIntentCreateParams.payment_method_data`, `PaymentIntentCreateParams.payment_method_options`, `PaymentIntentUpdateParams.payment_method_data`, `PaymentIntentUpdateParams.payment_method_options`, `PaymentMethodConfigurationCreateParams`, `PaymentMethodConfigurationUpdateParams`, `PaymentMethodConfiguration`, `PaymentMethodCreateParams`, `PaymentMethodUpdateParams`, `PaymentMethod`, `SetupIntentConfirmParams.payment_method_data`, `SetupIntentCreateParams.payment_method_data`, `SetupIntentUpdateParams.payment_method_data`, and `checkout.SessionCreateParams.payment_method_options` + * Add support for `country` on `Charge.payment_method_details.paypal`, `ConfirmationToken.payment_method_preview.paypal`, and `PaymentMethod.paypal` + * Add support for new value `pay_by_bank` on enums `CustomerListPaymentMethodsParams.type`, `PaymentMethodCreateParams.type`, `PaymentMethodListParams.type`, and `checkout.SessionCreateParams.payment_method_types[]` + * Add support for new value `SD` on enums `PaymentLinkCreateParams.shipping_address_collection.allowed_countries[]`, `PaymentLinkUpdateParams.shipping_address_collection.allowed_countries[]`, and `checkout.SessionCreateParams.shipping_address_collection.allowed_countries[]` + * Add support for `discounts` on `Checkout.Session` + * Add support for new value `pay_by_bank` on enums `ConfirmationTokenCreateParams.payment_method_data.type`, `PaymentIntentConfirmParams.payment_method_data.type`, `PaymentIntentCreateParams.payment_method_data.type`, `PaymentIntentUpdateParams.payment_method_data.type`, `SetupIntentConfirmParams.payment_method_data.type`, `SetupIntentCreateParams.payment_method_data.type`, and `SetupIntentUpdateParams.payment_method_data.type` + * Add support for new value `pay_by_bank` on enums `PaymentLinkCreateParams.payment_method_types[]` and `PaymentLinkUpdateParams.payment_method_types[]` + * Add support for `phone_number_collection` on `PaymentLinkUpdateParams` + * Add support for `jpy` on `Terminal.Configuration.tipping`, `terminal.ConfigurationCreateParams.tipping`, and `terminal.ConfigurationUpdateParams.tipping` + * Add support for `nickname` on `Treasury.FinancialAccount`, `treasury.FinancialAccountCreateParams`, and `treasury.FinancialAccountUpdateParams` + * Add support for `forwarding_settings` on `treasury.FinancialAccountUpdateParams` + * Add support for `is_default` on `Treasury.FinancialAccount` + * Add support for `destination_payment_method_data` on `treasury.OutboundTransferCreateParams` + * Change type of `Treasury.OutboundTransfer.destination_payment_method_details.type` from `literal('us_bank_account')` to `enum('financial_account'|'us_bank_account')` + * Add support for new value `outbound_transfer` on enum `treasury.ReceivedCreditListParams.linked_flows.source_flow_type` + * Add support for `outbound_transfer` on `Treasury.ReceivedCredit.linked_flows.source_flow_details` + * Add support for new value `2025-01-27.acacia` on enum `WebhookEndpointCreateParams.api_version` +* [#1941](https://github.com/stripe/stripe-java/pull/1941) Updated upload artifact ci action +* [#1938](https://github.com/stripe/stripe-java/pull/1938) update justfile import & pin CI ubuntu +* [#1937](https://github.com/stripe/stripe-java/pull/1937) Added CONTRIBUTING.md file +* [#1934](https://github.com/stripe/stripe-java/pull/1934) add justfile tweak readme, remove coveralls +* [#1933](https://github.com/stripe/stripe-java/pull/1933) Added pull request template + ## 28.3.0-beta.3 - 2025-01-23 * [#1939](https://github.com/stripe/stripe-java/pull/1939) Update generated code for beta * Remove support for `stripe_account` on `Terminal.Reader.action.collect_payment_method`, `Terminal.Reader.action.confirm_payment_intent`, `Terminal.Reader.action.process_payment_intent`, and `Terminal.Reader.action.refund_payment` diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 5454d94e192..130232bf350 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1460 \ No newline at end of file +v1472 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/Account.java b/src/main/java/com/stripe/model/Account.java index b0d5e77c9d7..d7eaec1d875 100644 --- a/src/main/java/com/stripe/model/Account.java +++ b/src/main/java/com/stripe/model/Account.java @@ -2353,6 +2353,18 @@ public static class RiskControls extends StripeObject { @SerializedName("payouts") Payouts payouts; + /** + * Represents the rejected reason of the account. Empty if account is not rejected, or rejected + * by Stripe. Please see this page for more + * details + * + *

One of {@code credit}, {@code fraud}, {@code fraud_no_intent_to_fulfill}, {@code + * fraud_other}, {@code fraud_payment_method_casher}, {@code fraud_payment_method_tester}, + * {@code other}, or {@code terms_of_service}. + */ + @SerializedName("rejected_reason") + String rejectedReason; + /** * For more details about Charges, please refer to the API * Reference. diff --git a/src/main/java/com/stripe/model/Balance.java b/src/main/java/com/stripe/model/Balance.java index deb715064ae..1e0c70549d6 100644 --- a/src/main/java/com/stripe/model/Balance.java +++ b/src/main/java/com/stripe/model/Balance.java @@ -166,15 +166,24 @@ public static class Available extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class SourceTypes extends StripeObject { - /** Amount for bank account. */ + /** + * Amount coming from legacy US ACH + * payments. + */ @SerializedName("bank_account") Long bankAccount; - /** Amount for card. */ + /** + * Amount coming from most payment methods, including cards as well as non-legacy bank debits. + */ @SerializedName("card") Long card; - /** Amount for FPX. */ + /** + * Amount coming from FPX, a Malaysian + * payment method. + */ @SerializedName("fpx") Long fpx; } @@ -211,15 +220,24 @@ public static class ConnectReserved extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class SourceTypes extends StripeObject { - /** Amount for bank account. */ + /** + * Amount coming from legacy US ACH + * payments. + */ @SerializedName("bank_account") Long bankAccount; - /** Amount for card. */ + /** + * Amount coming from most payment methods, including cards as well as non-legacy bank debits. + */ @SerializedName("card") Long card; - /** Amount for FPX. */ + /** + * Amount coming from FPX, a Malaysian + * payment method. + */ @SerializedName("fpx") Long fpx; } @@ -279,15 +297,24 @@ public static class NetAvailable extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class SourceTypes extends StripeObject { - /** Amount for bank account. */ + /** + * Amount coming from legacy US ACH + * payments. + */ @SerializedName("bank_account") Long bankAccount; - /** Amount for card. */ + /** + * Amount coming from most payment methods, including cards as well as non-legacy bank debits. + */ @SerializedName("card") Long card; - /** Amount for FPX. */ + /** + * Amount coming from FPX, a Malaysian + * payment method. + */ @SerializedName("fpx") Long fpx; } @@ -301,15 +328,24 @@ public static class SourceTypes extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class SourceTypes extends StripeObject { - /** Amount for bank account. */ + /** + * Amount coming from legacy US ACH + * payments. + */ @SerializedName("bank_account") Long bankAccount; - /** Amount for card. */ + /** + * Amount coming from most payment methods, including cards as well as non-legacy bank debits. + */ @SerializedName("card") Long card; - /** Amount for FPX. */ + /** + * Amount coming from FPX, a Malaysian + * payment method. + */ @SerializedName("fpx") Long fpx; } @@ -358,15 +394,24 @@ public static class Available extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class SourceTypes extends StripeObject { - /** Amount for bank account. */ + /** + * Amount coming from legacy US ACH + * payments. + */ @SerializedName("bank_account") Long bankAccount; - /** Amount for card. */ + /** + * Amount coming from most payment methods, including cards as well as non-legacy bank debits. + */ @SerializedName("card") Long card; - /** Amount for FPX. */ + /** + * Amount coming from FPX, a Malaysian + * payment method. + */ @SerializedName("fpx") Long fpx; } @@ -404,15 +449,24 @@ public static class Pending extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class SourceTypes extends StripeObject { - /** Amount for bank account. */ + /** + * Amount coming from legacy US ACH + * payments. + */ @SerializedName("bank_account") Long bankAccount; - /** Amount for card. */ + /** + * Amount coming from most payment methods, including cards as well as non-legacy bank debits. + */ @SerializedName("card") Long card; - /** Amount for FPX. */ + /** + * Amount coming from FPX, a Malaysian + * payment method. + */ @SerializedName("fpx") Long fpx; } diff --git a/src/main/java/com/stripe/model/Charge.java b/src/main/java/com/stripe/model/Charge.java index ff3bdda3b9b..6a6269cb249 100644 --- a/src/main/java/com/stripe/model/Charge.java +++ b/src/main/java/com/stripe/model/Charge.java @@ -1563,6 +1563,14 @@ public static class Card extends StripeObject { @SerializedName("brand") String brand; + /** + * The product code that + * identifies the specific program or product associated with a card. (For internal use + * only and not typically available in standard API requests.) + */ + @SerializedName("brand_product") + String brandProduct; + /** * Two-letter ISO code representing the country of the card. You could use this attribute * to get a sense of the international breakdown of cards you've collected. @@ -3633,6 +3641,14 @@ public static class Card extends StripeObject { @SerializedName("brand") String brand; + /** + * The product code that + * identifies the specific program or product associated with a card. (For internal use + * only and not typically available in standard API requests.) + */ + @SerializedName("brand_product") + String brandProduct; + /** * Two-letter ISO code representing the country of the card. You could use this attribute * to get a sense of the international breakdown of cards you've collected. diff --git a/src/main/java/com/stripe/model/ConfirmationToken.java b/src/main/java/com/stripe/model/ConfirmationToken.java index cf685f0d2b4..4c408b5a2bd 100644 --- a/src/main/java/com/stripe/model/ConfirmationToken.java +++ b/src/main/java/com/stripe/model/ConfirmationToken.java @@ -1107,7 +1107,10 @@ public static class Wallet extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Networks extends StripeObject { - /** All available networks for the card. */ + /** + * All networks available for selection via payment_method_options.card.network. + */ @SerializedName("available") List available; @@ -1425,7 +1428,10 @@ public static class CardPresent extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Networks extends StripeObject { - /** All available networks for the card. */ + /** + * All networks available for selection via payment_method_options.card.network. + */ @SerializedName("available") List available; @@ -1732,7 +1738,10 @@ public static class InteracPresent extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Networks extends StripeObject { - /** All available networks for the card. */ + /** + * All networks available for selection via payment_method_options.card.network. + */ @SerializedName("available") List available; diff --git a/src/main/java/com/stripe/model/CreditNote.java b/src/main/java/com/stripe/model/CreditNote.java index 8bf48283545..a1e4b91d970 100644 --- a/src/main/java/com/stripe/model/CreditNote.java +++ b/src/main/java/com/stripe/model/CreditNote.java @@ -841,12 +841,12 @@ public static class Tax extends StripeObject { /** * Tax rates can be applied to invoices, subscriptions and Checkout - * Sessions to collect tax. + * href="https://stripe.com/invoicing/taxes/tax-rates">invoices, subscriptions and Checkout Sessions to + * collect tax. * - *

Related guide: Tax rates + *

Related guide: Tax rates */ @SerializedName("rate") TaxRate rate; diff --git a/src/main/java/com/stripe/model/Invoice.java b/src/main/java/com/stripe/model/Invoice.java index 86b78cc3551..0f98146e3c3 100644 --- a/src/main/java/com/stripe/model/Invoice.java +++ b/src/main/java/com/stripe/model/Invoice.java @@ -3169,12 +3169,12 @@ public static class Tax extends StripeObject { /** * Tax rates can be applied to invoices, subscriptions and Checkout - * Sessions to collect tax. + * href="https://stripe.com/invoicing/taxes/tax-rates">invoices, subscriptions and Checkout Sessions to + * collect tax. * - *

Related guide: Tax rates + *

Related guide: Tax rates */ @SerializedName("rate") TaxRate rate; diff --git a/src/main/java/com/stripe/model/LineItem.java b/src/main/java/com/stripe/model/LineItem.java index ebfe62e4bd3..521a0bded01 100644 --- a/src/main/java/com/stripe/model/LineItem.java +++ b/src/main/java/com/stripe/model/LineItem.java @@ -190,12 +190,12 @@ public static class Tax extends StripeObject { /** * Tax rates can be applied to invoices, subscriptions and Checkout - * Sessions to collect tax. + * href="https://stripe.com/invoicing/taxes/tax-rates">invoices, subscriptions and Checkout Sessions to + * collect tax. * - *

Related guide: Tax rates + *

Related guide: Tax rates */ @SerializedName("rate") TaxRate rate; diff --git a/src/main/java/com/stripe/model/Order.java b/src/main/java/com/stripe/model/Order.java index 105e18a7f32..0c834a2d40c 100644 --- a/src/main/java/com/stripe/model/Order.java +++ b/src/main/java/com/stripe/model/Order.java @@ -1845,12 +1845,12 @@ public static class Tax extends StripeObject { /** * Tax rates can be applied to invoices, subscriptions and Checkout - * Sessions to collect tax. + * href="https://stripe.com/invoicing/taxes/tax-rates">invoices, subscriptions and Checkout Sessions to + * collect tax. * - *

Related guide: Tax rates + *

Related guide: Tax rates */ @SerializedName("rate") TaxRate rate; @@ -2034,12 +2034,12 @@ public static class Tax extends StripeObject { /** * Tax rates can be applied to invoices, subscriptions and Checkout - * Sessions to collect tax. + * href="https://stripe.com/invoicing/taxes/tax-rates">invoices, subscriptions and Checkout Sessions to + * collect tax. * - *

Related guide: Tax rates + *

Related guide: Tax rates */ @SerializedName("rate") TaxRate rate; diff --git a/src/main/java/com/stripe/model/PaymentMethod.java b/src/main/java/com/stripe/model/PaymentMethod.java index bcfc978f0ad..08120444062 100644 --- a/src/main/java/com/stripe/model/PaymentMethod.java +++ b/src/main/java/com/stripe/model/PaymentMethod.java @@ -1337,7 +1337,10 @@ public static class Wallet extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Networks extends StripeObject { - /** All available networks for the card. */ + /** + * All networks available for selection via payment_method_options.card.network. + */ @SerializedName("available") List available; @@ -1649,7 +1652,10 @@ public static class CardPresent extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Networks extends StripeObject { - /** All available networks for the card. */ + /** + * All networks available for selection via payment_method_options.card.network. + */ @SerializedName("available") List available; @@ -1955,7 +1961,10 @@ public static class InteracPresent extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Networks extends StripeObject { - /** All available networks for the card. */ + /** + * All networks available for selection via payment_method_options.card.network. + */ @SerializedName("available") List available; diff --git a/src/main/java/com/stripe/model/Quote.java b/src/main/java/com/stripe/model/Quote.java index cd86d6e3150..cfd6d8d2537 100644 --- a/src/main/java/com/stripe/model/Quote.java +++ b/src/main/java/com/stripe/model/Quote.java @@ -1470,13 +1470,12 @@ public static class Tax extends StripeObject { /** * Tax rates can be applied to invoices, subscriptions and Checkout + * href="https://stripe.com/invoicing/taxes/tax-rates">invoices, subscriptions and Checkout * Sessions to collect tax. * - *

Related guide: Tax - * rates + *

Related guide: Tax rates */ @SerializedName("rate") TaxRate rate; @@ -1610,13 +1609,12 @@ public static class Tax extends StripeObject { /** * Tax rates can be applied to invoices, subscriptions and Checkout + * href="https://stripe.com/invoicing/taxes/tax-rates">invoices, subscriptions and Checkout * Sessions to collect tax. * - *

Related guide: Tax - * rates + *

Related guide: Tax rates */ @SerializedName("rate") TaxRate rate; @@ -2538,12 +2536,12 @@ public static class Tax extends StripeObject { /** * Tax rates can be applied to invoices, subscriptions and Checkout - * Sessions to collect tax. + * href="https://stripe.com/invoicing/taxes/tax-rates">invoices, subscriptions and Checkout Sessions to + * collect tax. * - *

Related guide: Tax rates + *

Related guide: Tax rates */ @SerializedName("rate") TaxRate rate; diff --git a/src/main/java/com/stripe/model/QuotePreviewInvoice.java b/src/main/java/com/stripe/model/QuotePreviewInvoice.java index 1d201f58466..e316e547f88 100644 --- a/src/main/java/com/stripe/model/QuotePreviewInvoice.java +++ b/src/main/java/com/stripe/model/QuotePreviewInvoice.java @@ -1685,12 +1685,12 @@ public static class Tax extends StripeObject { /** * Tax rates can be applied to invoices, subscriptions and Checkout - * Sessions to collect tax. + * href="https://stripe.com/invoicing/taxes/tax-rates">invoices, subscriptions and Checkout Sessions to + * collect tax. * - *

Related guide: Tax rates + *

Related guide: Tax rates */ @SerializedName("rate") TaxRate rate; diff --git a/src/main/java/com/stripe/model/TaxRate.java b/src/main/java/com/stripe/model/TaxRate.java index 84195dd5852..f830d614dcf 100644 --- a/src/main/java/com/stripe/model/TaxRate.java +++ b/src/main/java/com/stripe/model/TaxRate.java @@ -20,13 +20,12 @@ import lombok.Setter; /** - * Tax rates can be applied to invoices, subscriptions and Checkout - * Sessions to collect tax. + * Tax rates can be applied to invoices, + * subscriptions and Checkout Sessions to collect + * tax. * - *

Related guide: Tax rates + *

Related guide: Tax rates */ @Getter @Setter @@ -149,7 +148,7 @@ public class TaxRate extends ApiResource implements HasId, MetadataStoreISO 3166-2 subdivision code, without + * ISO 3166-2 subdivision code, without * country prefix. For example, "NY" for New York, United States. */ @SerializedName("state") diff --git a/src/main/java/com/stripe/model/billing/CreditGrant.java b/src/main/java/com/stripe/model/billing/CreditGrant.java index a320d926d4d..1fb08e47186 100644 --- a/src/main/java/com/stripe/model/billing/CreditGrant.java +++ b/src/main/java/com/stripe/model/billing/CreditGrant.java @@ -21,6 +21,7 @@ import com.stripe.param.billing.CreditGrantRetrieveParams; import com.stripe.param.billing.CreditGrantUpdateParams; import com.stripe.param.billing.CreditGrantVoidGrantParams; +import java.util.List; import java.util.Map; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -459,6 +460,28 @@ public static class Scope extends StripeObject { */ @SerializedName("price_type") String priceType; + + /** + * The prices that credit grants can apply to. We currently only support {@code metered} + * prices. This refers to prices that have a Billing Meter attached to them. + */ + @SerializedName("prices") + List prices; + + /** + * For more details about Price, please refer to the API + * Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Price extends StripeObject implements HasId { + /** Unique identifier for the object. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + } } } diff --git a/src/main/java/com/stripe/model/billing/MeterEventSummary.java b/src/main/java/com/stripe/model/billing/MeterEventSummary.java index 1aa369178a2..477fa928113 100644 --- a/src/main/java/com/stripe/model/billing/MeterEventSummary.java +++ b/src/main/java/com/stripe/model/billing/MeterEventSummary.java @@ -20,6 +20,9 @@ * A billing meter event summary represents an aggregated view of a customer's billing meter events * within a specified timeframe. It indicates how much usage was accrued by a customer for that * period. + * + *

Note: Meters events are aggregated asynchronously so the meter event summaries provide an + * eventually consistent view of the reported usage. */ @Getter @Setter diff --git a/src/main/java/com/stripe/model/checkout/Session.java b/src/main/java/com/stripe/model/checkout/Session.java index b4f7982ffcd..c33b1390bc9 100644 --- a/src/main/java/com/stripe/model/checkout/Session.java +++ b/src/main/java/com/stripe/model/checkout/Session.java @@ -2286,6 +2286,9 @@ public static class Card extends StripeObject { @SerializedName("request_three_d_secure") String requestThreeDSecure; + @SerializedName("restrictions") + Restrictions restrictions; + /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. * @@ -2342,6 +2345,22 @@ public static class Installments extends StripeObject { @SerializedName("enabled") Boolean enabled; } + + /** + * For more details about Restrictions, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Restrictions extends StripeObject { + /** + * Specify the card brands to block in the Checkout Session. If a customer enters or selects + * a card belonging to a blocked brand, they can't complete the Session. + */ + @SerializedName("brands_blocked") + List brandsBlocked; + } } /** @@ -3660,12 +3679,12 @@ public static class Tax extends StripeObject { /** * Tax rates can be applied to invoices, subscriptions and Checkout - * Sessions to collect tax. + * href="https://stripe.com/invoicing/taxes/tax-rates">invoices, subscriptions and Checkout Sessions to + * collect tax. * - *

Related guide: Tax rates + *

Related guide: Tax rates */ @SerializedName("rate") TaxRate rate; @@ -3827,12 +3846,12 @@ public static class Tax extends StripeObject { /** * Tax rates can be applied to invoices, subscriptions and Checkout - * Sessions to collect tax. + * href="https://stripe.com/invoicing/taxes/tax-rates">invoices, subscriptions and Checkout Sessions to + * collect tax. * - *

Related guide: Tax rates + *

Related guide: Tax rates */ @SerializedName("rate") TaxRate rate; diff --git a/src/main/java/com/stripe/model/tax/Calculation.java b/src/main/java/com/stripe/model/tax/Calculation.java index f3ca9f71d69..13685e84a62 100644 --- a/src/main/java/com/stripe/model/tax/Calculation.java +++ b/src/main/java/com/stripe/model/tax/Calculation.java @@ -531,7 +531,7 @@ public static class Jurisdiction extends StripeObject { String level; /** - * ISO 3166-2 subdivision code, + * ISO 3166-2 subdivision code, * without country prefix. For example, "NY" for New York, United States. */ @SerializedName("state") diff --git a/src/main/java/com/stripe/model/tax/CalculationLineItem.java b/src/main/java/com/stripe/model/tax/CalculationLineItem.java index 041f16d431a..cd2fe05f733 100644 --- a/src/main/java/com/stripe/model/tax/CalculationLineItem.java +++ b/src/main/java/com/stripe/model/tax/CalculationLineItem.java @@ -165,8 +165,8 @@ public static class Jurisdiction extends StripeObject { String level; /** - * ISO 3166-2 subdivision code, - * without country prefix. For example, "NY" for New York, United States. + * ISO 3166-2 subdivision code, without + * country prefix. For example, "NY" for New York, United States. */ @SerializedName("state") String state; diff --git a/src/main/java/com/stripe/model/tax/Transaction.java b/src/main/java/com/stripe/model/tax/Transaction.java index a3f2bf91d66..469a5972b0c 100644 --- a/src/main/java/com/stripe/model/tax/Transaction.java +++ b/src/main/java/com/stripe/model/tax/Transaction.java @@ -592,7 +592,7 @@ public static class Jurisdiction extends StripeObject { String level; /** - * ISO 3166-2 subdivision code, + * ISO 3166-2 subdivision code, * without country prefix. For example, "NY" for New York, United States. */ @SerializedName("state") diff --git a/src/main/java/com/stripe/net/Webhook.java b/src/main/java/com/stripe/net/Webhook.java index 7b5a34febf2..ea67ea34362 100644 --- a/src/main/java/com/stripe/net/Webhook.java +++ b/src/main/java/com/stripe/net/Webhook.java @@ -9,6 +9,7 @@ import java.security.NoSuchAlgorithmException; import java.time.Clock; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; @@ -72,6 +73,13 @@ public static Event constructEvent( StripeObject.deserializeStripeObject( payload, Event.class, ApiResource.getGlobalResponseGetter()); Signature.verifyHeader(payload, sigHeader, secret, tolerance, clock); + // StripeObjects source their raw JSON object from their last response, but constructed webhooks + // don't have that + // in order to make the raw object available on parsed events, we fake the response. + if (event.getLastResponse() == null) { + event.setLastResponse( + new StripeResponse(200, HttpHeaders.of(Collections.emptyMap()), payload)); + } return event; } diff --git a/src/main/java/com/stripe/param/AccountPersonCreateParams.java b/src/main/java/com/stripe/param/AccountPersonCreateParams.java index e937acbd681..13633627a67 100644 --- a/src/main/java/com/stripe/param/AccountPersonCreateParams.java +++ b/src/main/java/com/stripe/param/AccountPersonCreateParams.java @@ -148,7 +148,7 @@ public class AccountPersonCreateParams extends ApiRequestParams { * any jurisdiction. */ @SerializedName("political_exposure") - String politicalExposure; + PoliticalExposure politicalExposure; /** The person's registered address. */ @SerializedName("registered_address") @@ -191,7 +191,7 @@ private AccountPersonCreateParams( String nationality, String personToken, String phone, - String politicalExposure, + PoliticalExposure politicalExposure, RegisteredAddress registeredAddress, Relationship relationship, String ssnLast4, @@ -280,7 +280,7 @@ public static class Builder { private String phone; - private String politicalExposure; + private PoliticalExposure politicalExposure; private RegisteredAddress registeredAddress; @@ -621,7 +621,8 @@ public Builder setPhone(String phone) { * related persons, declares that they hold or have held an important public job or function, in * any jurisdiction. */ - public Builder setPoliticalExposure(String politicalExposure) { + public Builder setPoliticalExposure( + AccountPersonCreateParams.PoliticalExposure politicalExposure) { this.politicalExposure = politicalExposure; return this; } @@ -2481,4 +2482,19 @@ public Builder setFront(String front) { } } } + + public enum PoliticalExposure implements ApiRequestParams.EnumParam { + @SerializedName("existing") + EXISTING("existing"), + + @SerializedName("none") + NONE("none"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + PoliticalExposure(String value) { + this.value = value; + } + } } diff --git a/src/main/java/com/stripe/param/AccountPersonUpdateParams.java b/src/main/java/com/stripe/param/AccountPersonUpdateParams.java index bab641a2155..a14396de8d6 100644 --- a/src/main/java/com/stripe/param/AccountPersonUpdateParams.java +++ b/src/main/java/com/stripe/param/AccountPersonUpdateParams.java @@ -148,7 +148,7 @@ public class AccountPersonUpdateParams extends ApiRequestParams { * any jurisdiction. */ @SerializedName("political_exposure") - Object politicalExposure; + PoliticalExposure politicalExposure; /** The person's registered address. */ @SerializedName("registered_address") @@ -191,7 +191,7 @@ private AccountPersonUpdateParams( Object nationality, Object personToken, Object phone, - Object politicalExposure, + PoliticalExposure politicalExposure, RegisteredAddress registeredAddress, Relationship relationship, Object ssnLast4, @@ -280,7 +280,7 @@ public static class Builder { private Object phone; - private Object politicalExposure; + private PoliticalExposure politicalExposure; private RegisteredAddress registeredAddress; @@ -726,17 +726,8 @@ public Builder setPhone(EmptyParam phone) { * related persons, declares that they hold or have held an important public job or function, in * any jurisdiction. */ - public Builder setPoliticalExposure(String politicalExposure) { - this.politicalExposure = politicalExposure; - return this; - } - - /** - * Indicates if the person or any of their representatives, family members, or other closely - * related persons, declares that they hold or have held an important public job or function, in - * any jurisdiction. - */ - public Builder setPoliticalExposure(EmptyParam politicalExposure) { + public Builder setPoliticalExposure( + AccountPersonUpdateParams.PoliticalExposure politicalExposure) { this.politicalExposure = politicalExposure; return this; } @@ -2826,4 +2817,19 @@ public Builder setFront(EmptyParam front) { } } } + + public enum PoliticalExposure implements ApiRequestParams.EnumParam { + @SerializedName("existing") + EXISTING("existing"), + + @SerializedName("none") + NONE("none"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + PoliticalExposure(String value) { + this.value = value; + } + } } diff --git a/src/main/java/com/stripe/param/AccountSessionCreateParams.java b/src/main/java/com/stripe/param/AccountSessionCreateParams.java index 7b86da904a3..6eef0d2ecfc 100644 --- a/src/main/java/com/stripe/param/AccountSessionCreateParams.java +++ b/src/main/java/com/stripe/param/AccountSessionCreateParams.java @@ -224,6 +224,10 @@ public static class Components { @SerializedName("payouts_list") PayoutsList payoutsList; + /** Configuration for the product tax code selector embedded component. */ + @SerializedName("product_tax_code_selector") + ProductTaxCodeSelector productTaxCodeSelector; + /** Configuration for the recipients component. */ @SerializedName("recipients") Recipients recipients; @@ -266,6 +270,7 @@ private Components( Payments payments, Payouts payouts, PayoutsList payoutsList, + ProductTaxCodeSelector productTaxCodeSelector, Recipients recipients, ReportingChart reportingChart, TaxRegistrations taxRegistrations, @@ -292,6 +297,7 @@ private Components( this.payments = payments; this.payouts = payouts; this.payoutsList = payoutsList; + this.productTaxCodeSelector = productTaxCodeSelector; this.recipients = recipients; this.reportingChart = reportingChart; this.taxRegistrations = taxRegistrations; @@ -346,6 +352,8 @@ public static class Builder { private PayoutsList payoutsList; + private ProductTaxCodeSelector productTaxCodeSelector; + private Recipients recipients; private ReportingChart reportingChart; @@ -380,6 +388,7 @@ public AccountSessionCreateParams.Components build() { this.payments, this.payouts, this.payoutsList, + this.productTaxCodeSelector, this.recipients, this.reportingChart, this.taxRegistrations, @@ -548,6 +557,13 @@ public Builder setPayoutsList(AccountSessionCreateParams.Components.PayoutsList return this; } + /** Configuration for the product tax code selector embedded component. */ + public Builder setProductTaxCodeSelector( + AccountSessionCreateParams.Components.ProductTaxCodeSelector productTaxCodeSelector) { + this.productTaxCodeSelector = productTaxCodeSelector; + return this; + } + /** Configuration for the recipients component. */ public Builder setRecipients(AccountSessionCreateParams.Components.Recipients recipients) { this.recipients = recipients; @@ -4405,6 +4421,153 @@ public Builder putAllExtraParam(Map map) { } } + @Getter + public static class ProductTaxCodeSelector { + /** Required. Whether the embedded component is enabled. */ + @SerializedName("enabled") + Boolean enabled; + + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field (serialized) + * name in this param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** The list of features enabled in the embedded component. */ + @SerializedName("features") + Features features; + + private ProductTaxCodeSelector( + Boolean enabled, Map extraParams, Features features) { + this.enabled = enabled; + this.extraParams = extraParams; + this.features = features; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Boolean enabled; + + private Map extraParams; + + private Features features; + + /** Finalize and obtain parameter instance from this builder. */ + public AccountSessionCreateParams.Components.ProductTaxCodeSelector build() { + return new AccountSessionCreateParams.Components.ProductTaxCodeSelector( + this.enabled, this.extraParams, this.features); + } + + /** Required. Whether the embedded component is enabled. */ + public Builder setEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountSessionCreateParams.Components.ProductTaxCodeSelector#extraParams} + * for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link AccountSessionCreateParams.Components.ProductTaxCodeSelector#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** The list of features enabled in the embedded component. */ + public Builder setFeatures( + AccountSessionCreateParams.Components.ProductTaxCodeSelector.Features features) { + this.features = features; + return this; + } + } + + @Getter + public static class Features { + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field + * (serialized) name in this param object. Effectively, this map is flattened to its parent + * instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private Features(Map extraParams) { + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public AccountSessionCreateParams.Components.ProductTaxCodeSelector.Features build() { + return new AccountSessionCreateParams.Components.ProductTaxCodeSelector.Features( + this.extraParams); + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link + * AccountSessionCreateParams.Components.ProductTaxCodeSelector.Features#extraParams} for + * the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link + * AccountSessionCreateParams.Components.ProductTaxCodeSelector.Features#extraParams} for + * the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + } + } + @Getter public static class Recipients { /** Required. Whether the embedded component is enabled. */ diff --git a/src/main/java/com/stripe/param/InvoiceAttachPaymentParams.java b/src/main/java/com/stripe/param/InvoiceAttachPaymentParams.java index cf3b3ac4ca8..fe4f8eb111a 100644 --- a/src/main/java/com/stripe/param/InvoiceAttachPaymentParams.java +++ b/src/main/java/com/stripe/param/InvoiceAttachPaymentParams.java @@ -36,7 +36,7 @@ public class InvoiceAttachPaymentParams extends ApiRequestParams { @SerializedName("payment_intent") String paymentIntent; - /** The ID of the PaymentRecord to detach from the invoice. */ + /** The ID of the PaymentRecord to attach to the invoice. */ @SerializedName("payment_record") String paymentRecord; @@ -154,7 +154,7 @@ public Builder setPaymentIntent(String paymentIntent) { return this; } - /** The ID of the PaymentRecord to detach from the invoice. */ + /** The ID of the PaymentRecord to attach to the invoice. */ public Builder setPaymentRecord(String paymentRecord) { this.paymentRecord = paymentRecord; return this; diff --git a/src/main/java/com/stripe/param/PersonCollectionCreateParams.java b/src/main/java/com/stripe/param/PersonCollectionCreateParams.java index c056d733e01..03d262d3e1b 100644 --- a/src/main/java/com/stripe/param/PersonCollectionCreateParams.java +++ b/src/main/java/com/stripe/param/PersonCollectionCreateParams.java @@ -148,7 +148,7 @@ public class PersonCollectionCreateParams extends ApiRequestParams { * any jurisdiction. */ @SerializedName("political_exposure") - String politicalExposure; + PoliticalExposure politicalExposure; /** The person's registered address. */ @SerializedName("registered_address") @@ -191,7 +191,7 @@ private PersonCollectionCreateParams( String nationality, String personToken, String phone, - String politicalExposure, + PoliticalExposure politicalExposure, RegisteredAddress registeredAddress, Relationship relationship, String ssnLast4, @@ -280,7 +280,7 @@ public static class Builder { private String phone; - private String politicalExposure; + private PoliticalExposure politicalExposure; private RegisteredAddress registeredAddress; @@ -621,7 +621,8 @@ public Builder setPhone(String phone) { * related persons, declares that they hold or have held an important public job or function, in * any jurisdiction. */ - public Builder setPoliticalExposure(String politicalExposure) { + public Builder setPoliticalExposure( + PersonCollectionCreateParams.PoliticalExposure politicalExposure) { this.politicalExposure = politicalExposure; return this; } @@ -2488,4 +2489,19 @@ public Builder setFront(String front) { } } } + + public enum PoliticalExposure implements ApiRequestParams.EnumParam { + @SerializedName("existing") + EXISTING("existing"), + + @SerializedName("none") + NONE("none"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + PoliticalExposure(String value) { + this.value = value; + } + } } diff --git a/src/main/java/com/stripe/param/PersonUpdateParams.java b/src/main/java/com/stripe/param/PersonUpdateParams.java index dc4ed3975da..95fc9763307 100644 --- a/src/main/java/com/stripe/param/PersonUpdateParams.java +++ b/src/main/java/com/stripe/param/PersonUpdateParams.java @@ -148,7 +148,7 @@ public class PersonUpdateParams extends ApiRequestParams { * any jurisdiction. */ @SerializedName("political_exposure") - Object politicalExposure; + PoliticalExposure politicalExposure; /** The person's registered address. */ @SerializedName("registered_address") @@ -191,7 +191,7 @@ private PersonUpdateParams( Object nationality, Object personToken, Object phone, - Object politicalExposure, + PoliticalExposure politicalExposure, RegisteredAddress registeredAddress, Relationship relationship, Object ssnLast4, @@ -280,7 +280,7 @@ public static class Builder { private Object phone; - private Object politicalExposure; + private PoliticalExposure politicalExposure; private RegisteredAddress registeredAddress; @@ -726,17 +726,7 @@ public Builder setPhone(EmptyParam phone) { * related persons, declares that they hold or have held an important public job or function, in * any jurisdiction. */ - public Builder setPoliticalExposure(String politicalExposure) { - this.politicalExposure = politicalExposure; - return this; - } - - /** - * Indicates if the person or any of their representatives, family members, or other closely - * related persons, declares that they hold or have held an important public job or function, in - * any jurisdiction. - */ - public Builder setPoliticalExposure(EmptyParam politicalExposure) { + public Builder setPoliticalExposure(PersonUpdateParams.PoliticalExposure politicalExposure) { this.politicalExposure = politicalExposure; return this; } @@ -2819,4 +2809,19 @@ public Builder setFront(EmptyParam front) { } } } + + public enum PoliticalExposure implements ApiRequestParams.EnumParam { + @SerializedName("existing") + EXISTING("existing"), + + @SerializedName("none") + NONE("none"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + PoliticalExposure(String value) { + this.value = value; + } + } } diff --git a/src/main/java/com/stripe/param/TaxRateCreateParams.java b/src/main/java/com/stripe/param/TaxRateCreateParams.java index a3df1a13942..7bc582c3e31 100644 --- a/src/main/java/com/stripe/param/TaxRateCreateParams.java +++ b/src/main/java/com/stripe/param/TaxRateCreateParams.java @@ -76,7 +76,7 @@ public class TaxRateCreateParams extends ApiRequestParams { BigDecimal percentage; /** - * ISO 3166-2 subdivision code, without + * ISO 3166-2 subdivision code, without * country prefix. For example, "NY" for New York, United States. */ @SerializedName("state") @@ -295,8 +295,8 @@ public Builder setPercentage(BigDecimal percentage) { } /** - * ISO 3166-2 subdivision code, - * without country prefix. For example, "NY" for New York, United States. + * ISO 3166-2 subdivision code, without + * country prefix. For example, "NY" for New York, United States. */ public Builder setState(String state) { this.state = state; diff --git a/src/main/java/com/stripe/param/TaxRateUpdateParams.java b/src/main/java/com/stripe/param/TaxRateUpdateParams.java index 7e24c42954b..0d9f3f5e9a2 100644 --- a/src/main/java/com/stripe/param/TaxRateUpdateParams.java +++ b/src/main/java/com/stripe/param/TaxRateUpdateParams.java @@ -68,7 +68,7 @@ public class TaxRateUpdateParams extends ApiRequestParams { Object metadata; /** - * ISO 3166-2 subdivision code, without + * ISO 3166-2 subdivision code, without * country prefix. For example, "NY" for New York, United States. */ @SerializedName("state") @@ -320,8 +320,8 @@ public Builder setMetadata(Map metadata) { } /** - * ISO 3166-2 subdivision code, - * without country prefix. For example, "NY" for New York, United States. + * ISO 3166-2 subdivision code, without + * country prefix. For example, "NY" for New York, United States. */ public Builder setState(String state) { this.state = state; @@ -329,8 +329,8 @@ public Builder setState(String state) { } /** - * ISO 3166-2 subdivision code, - * without country prefix. For example, "NY" for New York, United States. + * ISO 3166-2 subdivision code, without + * country prefix. For example, "NY" for New York, United States. */ public Builder setState(EmptyParam state) { this.state = state; diff --git a/src/main/java/com/stripe/param/TokenCreateParams.java b/src/main/java/com/stripe/param/TokenCreateParams.java index b87796f5750..51437598e9d 100644 --- a/src/main/java/com/stripe/param/TokenCreateParams.java +++ b/src/main/java/com/stripe/param/TokenCreateParams.java @@ -4454,7 +4454,7 @@ public static class Person { * any jurisdiction. */ @SerializedName("political_exposure") - String politicalExposure; + PoliticalExposure politicalExposure; /** The person's registered address. */ @SerializedName("registered_address") @@ -4495,7 +4495,7 @@ private Person( Object metadata, String nationality, String phone, - String politicalExposure, + PoliticalExposure politicalExposure, RegisteredAddress registeredAddress, Relationship relationship, String ssnLast4, @@ -4578,7 +4578,7 @@ public static class Builder { private String phone; - private String politicalExposure; + private PoliticalExposure politicalExposure; private RegisteredAddress registeredAddress; @@ -4884,7 +4884,8 @@ public Builder setPhone(String phone) { * related persons, declares that they hold or have held an important public job or function, * in any jurisdiction. */ - public Builder setPoliticalExposure(String politicalExposure) { + public Builder setPoliticalExposure( + TokenCreateParams.Person.PoliticalExposure politicalExposure) { this.politicalExposure = politicalExposure; return this; } @@ -6771,6 +6772,21 @@ public Builder setFront(String front) { } } } + + public enum PoliticalExposure implements ApiRequestParams.EnumParam { + @SerializedName("existing") + EXISTING("existing"), + + @SerializedName("none") + NONE("none"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + PoliticalExposure(String value) { + this.value = value; + } + } } @Getter diff --git a/src/main/java/com/stripe/param/billing/CreditBalanceSummaryRetrieveParams.java b/src/main/java/com/stripe/param/billing/CreditBalanceSummaryRetrieveParams.java index cbef780ed3c..ace1a0b40bf 100644 --- a/src/main/java/com/stripe/param/billing/CreditBalanceSummaryRetrieveParams.java +++ b/src/main/java/com/stripe/param/billing/CreditBalanceSummaryRetrieveParams.java @@ -242,9 +242,20 @@ public static class ApplicabilityScope { @SerializedName("price_type") PriceType priceType; - private ApplicabilityScope(Map extraParams, PriceType priceType) { + /** + * A list of prices that the credit grant can apply to. We currently only support the {@code + * metered} prices. + */ + @SerializedName("prices") + List prices; + + private ApplicabilityScope( + Map extraParams, + PriceType priceType, + List prices) { this.extraParams = extraParams; this.priceType = priceType; + this.prices = prices; } public static Builder builder() { @@ -256,10 +267,12 @@ public static class Builder { private PriceType priceType; + private List prices; + /** Finalize and obtain parameter instance from this builder. */ public CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope build() { return new CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope( - this.extraParams, this.priceType); + this.extraParams, this.priceType, this.prices); } /** @@ -299,6 +312,110 @@ public Builder setPriceType( this.priceType = priceType; return this; } + + /** + * Add an element to `prices` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope#prices} for the field + * documentation. + */ + public Builder addPrice( + CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope.Price element) { + if (this.prices == null) { + this.prices = new ArrayList<>(); + } + this.prices.add(element); + return this; + } + + /** + * Add all elements to `prices` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope#prices} for the field + * documentation. + */ + public Builder addAllPrice( + List elements) { + if (this.prices == null) { + this.prices = new ArrayList<>(); + } + this.prices.addAll(elements); + return this; + } + } + + @Getter + public static class Price { + /** + * 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 ID this credit grant should apply to. */ + @SerializedName("id") + String id; + + private Price(Map extraParams, String id) { + this.extraParams = extraParams; + this.id = id; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String id; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope.Price build() { + return new CreditBalanceSummaryRetrieveParams.Filter.ApplicabilityScope.Price( + this.extraParams, this.id); + } + + /** + * 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.Price#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.Price#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 ID this credit grant should apply to. */ + public Builder setId(String id) { + this.id = id; + return this; + } + } } public enum PriceType implements ApiRequestParams.EnumParam { diff --git a/src/main/java/com/stripe/param/billing/CreditGrantCreateParams.java b/src/main/java/com/stripe/param/billing/CreditGrantCreateParams.java index c5ab4882949..4c1a5181c80 100644 --- a/src/main/java/com/stripe/param/billing/CreditGrantCreateParams.java +++ b/src/main/java/com/stripe/param/billing/CreditGrantCreateParams.java @@ -534,9 +534,20 @@ public static class Scope { @SerializedName("price_type") PriceType priceType; - private Scope(Map extraParams, PriceType priceType) { + /** + * A list of prices that the credit grant can apply to. We currently only support the {@code + * metered} prices. + */ + @SerializedName("prices") + List prices; + + private Scope( + Map extraParams, + PriceType priceType, + List prices) { this.extraParams = extraParams; this.priceType = priceType; + this.prices = prices; } public static Builder builder() { @@ -548,10 +559,12 @@ public static class Builder { private PriceType priceType; + private List prices; + /** Finalize and obtain parameter instance from this builder. */ public CreditGrantCreateParams.ApplicabilityConfig.Scope build() { return new CreditGrantCreateParams.ApplicabilityConfig.Scope( - this.extraParams, this.priceType); + this.extraParams, this.priceType, this.prices); } /** @@ -591,6 +604,105 @@ public Builder setPriceType( this.priceType = priceType; return this; } + + /** + * Add an element to `prices` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * CreditGrantCreateParams.ApplicabilityConfig.Scope#prices} for the field documentation. + */ + public Builder addPrice(CreditGrantCreateParams.ApplicabilityConfig.Scope.Price element) { + if (this.prices == null) { + this.prices = new ArrayList<>(); + } + this.prices.add(element); + return this; + } + + /** + * Add all elements to `prices` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * CreditGrantCreateParams.ApplicabilityConfig.Scope#prices} for the field documentation. + */ + public Builder addAllPrice( + List elements) { + if (this.prices == null) { + this.prices = new ArrayList<>(); + } + this.prices.addAll(elements); + return this; + } + } + + @Getter + public static class Price { + /** + * 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 ID this credit grant should apply to. */ + @SerializedName("id") + String id; + + private Price(Map extraParams, String id) { + this.extraParams = extraParams; + this.id = id; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String id; + + /** Finalize and obtain parameter instance from this builder. */ + public CreditGrantCreateParams.ApplicabilityConfig.Scope.Price build() { + return new CreditGrantCreateParams.ApplicabilityConfig.Scope.Price( + this.extraParams, this.id); + } + + /** + * 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.Price#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.Price#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 ID this credit grant should apply to. */ + public Builder setId(String id) { + this.id = id; + return this; + } + } } public enum PriceType implements ApiRequestParams.EnumParam { diff --git a/src/main/java/com/stripe/param/checkout/SessionCreateParams.java b/src/main/java/com/stripe/param/checkout/SessionCreateParams.java index a2ee1868a1c..c673f4f7491 100644 --- a/src/main/java/com/stripe/param/checkout/SessionCreateParams.java +++ b/src/main/java/com/stripe/param/checkout/SessionCreateParams.java @@ -8061,6 +8061,13 @@ public static class Card { @SerializedName("request_three_d_secure") RequestThreeDSecure requestThreeDSecure; + /** + * Restrictions to apply to the card payment method. For example, you can block specific card + * brands. + */ + @SerializedName("restrictions") + Restrictions restrictions; + /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. * @@ -8112,6 +8119,7 @@ private Card( RequestMulticapture requestMulticapture, RequestOvercapture requestOvercapture, RequestThreeDSecure requestThreeDSecure, + Restrictions restrictions, SetupFutureUsage setupFutureUsage, String statementDescriptorSuffixKana, String statementDescriptorSuffixKanji) { @@ -8123,6 +8131,7 @@ private Card( this.requestMulticapture = requestMulticapture; this.requestOvercapture = requestOvercapture; this.requestThreeDSecure = requestThreeDSecure; + this.restrictions = restrictions; this.setupFutureUsage = setupFutureUsage; this.statementDescriptorSuffixKana = statementDescriptorSuffixKana; this.statementDescriptorSuffixKanji = statementDescriptorSuffixKanji; @@ -8149,6 +8158,8 @@ public static class Builder { private RequestThreeDSecure requestThreeDSecure; + private Restrictions restrictions; + private SetupFutureUsage setupFutureUsage; private String statementDescriptorSuffixKana; @@ -8166,6 +8177,7 @@ public SessionCreateParams.PaymentMethodOptions.Card build() { this.requestMulticapture, this.requestOvercapture, this.requestThreeDSecure, + this.restrictions, this.setupFutureUsage, this.statementDescriptorSuffixKana, this.statementDescriptorSuffixKanji); @@ -8277,6 +8289,16 @@ public Builder setRequestThreeDSecure( return this; } + /** + * Restrictions to apply to the card payment method. For example, you can block specific + * card brands. + */ + public Builder setRestrictions( + SessionCreateParams.PaymentMethodOptions.Card.Restrictions restrictions) { + this.restrictions = restrictions; + return this; + } + /** * Indicates that you intend to make future payments with this PaymentIntent's payment * method. @@ -8406,6 +8428,132 @@ public Builder putAllExtraParam(Map map) { } } + @Getter + public static class Restrictions { + /** + * Specify the card brands to block in the Checkout Session. If a customer enters or selects + * a card belonging to a blocked brand, they can't complete the Session. + */ + @SerializedName("brands_blocked") + List + brandsBlocked; + + /** + * 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 Restrictions( + List + brandsBlocked, + Map extraParams) { + this.brandsBlocked = brandsBlocked; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List + brandsBlocked; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public SessionCreateParams.PaymentMethodOptions.Card.Restrictions build() { + return new SessionCreateParams.PaymentMethodOptions.Card.Restrictions( + this.brandsBlocked, this.extraParams); + } + + /** + * Add an element to `brandsBlocked` list. A list is initialized for the first + * `add/addAll` call, and subsequent calls adds additional elements to the original list. + * See {@link SessionCreateParams.PaymentMethodOptions.Card.Restrictions#brandsBlocked} + * for the field documentation. + */ + public Builder addBrandsBlocked( + SessionCreateParams.PaymentMethodOptions.Card.Restrictions.BrandsBlocked element) { + if (this.brandsBlocked == null) { + this.brandsBlocked = new ArrayList<>(); + } + this.brandsBlocked.add(element); + return this; + } + + /** + * Add all elements to `brandsBlocked` list. A list is initialized for the first + * `add/addAll` call, and subsequent calls adds additional elements to the original list. + * See {@link SessionCreateParams.PaymentMethodOptions.Card.Restrictions#brandsBlocked} + * for the field documentation. + */ + public Builder addAllBrandsBlocked( + List + elements) { + if (this.brandsBlocked == null) { + this.brandsBlocked = new ArrayList<>(); + } + this.brandsBlocked.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 SessionCreateParams.PaymentMethodOptions.Card.Restrictions#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 SessionCreateParams.PaymentMethodOptions.Card.Restrictions#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + + public enum BrandsBlocked implements ApiRequestParams.EnumParam { + @SerializedName("american_express") + AMERICAN_EXPRESS("american_express"), + + @SerializedName("discover_global_network") + DISCOVER_GLOBAL_NETWORK("discover_global_network"), + + @SerializedName("mastercard") + MASTERCARD("mastercard"), + + @SerializedName("visa") + VISA("visa"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + BrandsBlocked(String value) { + this.value = value; + } + } + } + public enum RequestDecrementalAuthorization implements ApiRequestParams.EnumParam { @SerializedName("if_available") IF_AVAILABLE("if_available"), diff --git a/src/main/java/com/stripe/param/financialconnections/SessionCreateParams.java b/src/main/java/com/stripe/param/financialconnections/SessionCreateParams.java index 33615dea5f2..16fce4bc83a 100644 --- a/src/main/java/com/stripe/param/financialconnections/SessionCreateParams.java +++ b/src/main/java/com/stripe/param/financialconnections/SessionCreateParams.java @@ -36,7 +36,7 @@ public class SessionCreateParams extends ApiRequestParams { @SerializedName("limits") Limits limits; - /** Settings for configuring manual entry of account details for this Session. */ + /** Customize manual entry behavior. */ @SerializedName("manual_entry") ManualEntry manualEntry; @@ -188,7 +188,7 @@ public Builder setLimits(SessionCreateParams.Limits limits) { return this; } - /** Settings for configuring manual entry of account details for this Session. */ + /** Customize manual entry behavior. */ public Builder setManualEntry(SessionCreateParams.ManualEntry manualEntry) { this.manualEntry = manualEntry; return this; diff --git a/src/test/java/com/stripe/net/WebhookTest.java b/src/test/java/com/stripe/net/WebhookTest.java index 175f0cd5feb..c6a9c89aa77 100644 --- a/src/test/java/com/stripe/net/WebhookTest.java +++ b/src/test/java/com/stripe/net/WebhookTest.java @@ -1,5 +1,6 @@ package com.stripe.net; +import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -325,4 +326,13 @@ public void testStripeClientConstructEventWithTolerance() Mockito.verify(responseGetter).request(Mockito.any(), Mockito.any()); } + + @Test + public void testConstructEventWithRawJson() + throws StripeException, NoSuchAlgorithmException, InvalidKeyException { + + final Event event = Webhook.constructEvent(payload, generateSigHeader(), secret); + + assertNotNull(event.getRawJsonObject()); + } }