diff --git a/CHANGELOG.md b/CHANGELOG.md index 78377b76f4b..a94de1ee0a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 31.2.0 - 2026-01-16 +* [#2144](https://github.com/stripe/stripe-java/pull/2144) Update generated code + * Add support for event notifications `V2CoreAccountClosedEvent`, `V2CoreAccountCreatedEvent`, `V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEvent`, `V2CoreAccountIncludingConfigurationCustomerUpdatedEvent`, `V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEvent`, `V2CoreAccountIncludingConfigurationMerchantUpdatedEvent`, `V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEvent`, `V2CoreAccountIncludingConfigurationRecipientUpdatedEvent`, `V2CoreAccountIncludingDefaultsUpdatedEvent`, `V2CoreAccountIncludingFutureRequirementsUpdatedEvent`, `V2CoreAccountIncludingIdentityUpdatedEvent`, `V2CoreAccountIncludingRequirementsUpdatedEvent`, and `V2CoreAccountUpdatedEvent` with related object `v2.core.Account` + * Add support for event notification `V2CoreAccountLinkReturnedEvent` + * Add support for event notifications `V2CoreAccountPersonCreatedEvent`, `V2CoreAccountPersonDeletedEvent`, and `V2CoreAccountPersonUpdatedEvent` with related object `v2.core.AccountPerson` + ## 31.2.0-beta.1 - 2025-12-16 This release changes the pinned API version to `2025-12-15.preview`. diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index fc0689d976d..81e38dd3bef 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -5abe0e44caedb3474ee672265284096ec89e0fa3 +c250368ba89214c80bc8de3e4fc5d2094c5502cc \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 1bfc0268bdf..4c7a9ad2bfe 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2150 \ No newline at end of file +v2153 \ No newline at end of file diff --git a/src/main/java/com/stripe/StripeEventNotificationHandler.java b/src/main/java/com/stripe/StripeEventNotificationHandler.java index ac2d2706c08..58de6e7e026 100644 --- a/src/main/java/com/stripe/StripeEventNotificationHandler.java +++ b/src/main/java/com/stripe/StripeEventNotificationHandler.java @@ -17,6 +17,7 @@ import com.stripe.events.V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventNotification; import com.stripe.events.V2CoreAccountIncludingConfigurationStorerUpdatedEventNotification; import com.stripe.events.V2CoreAccountIncludingDefaultsUpdatedEventNotification; +import com.stripe.events.V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification; import com.stripe.events.V2CoreAccountIncludingIdentityUpdatedEventNotification; import com.stripe.events.V2CoreAccountIncludingRequirementsUpdatedEventNotification; import com.stripe.events.V2CoreAccountLinkReturnedEventNotification; @@ -276,6 +277,12 @@ public StripeEventNotificationHandler onV2CoreAccountIncludingDefaultsUpdated( return this; } + public StripeEventNotificationHandler onV2CoreAccountIncludingFutureRequirementsUpdated( + Callback callback) { + this.register("v2.core.account[future_requirements].updated", callback); + return this; + } + public StripeEventNotificationHandler onV2CoreAccountIncludingIdentityUpdated( Callback callback) { this.register("v2.core.account[identity].updated", callback); diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingFutureRequirementsUpdatedEvent.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingFutureRequirementsUpdatedEvent.java new file mode 100644 index 00000000000..496147e2216 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingFutureRequirementsUpdatedEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.core.Account; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V2CoreAccountIncludingFutureRequirementsUpdatedEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification.java b/src/main/java/com/stripe/events/V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification.java new file mode 100644 index 00000000000..31c75530fa6 --- /dev/null +++ b/src/main/java/com/stripe/events/V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.v2.core.Account; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V2CoreAccountIncludingFutureRequirementsUpdatedEvent fetchEvent() throws StripeException { + return (V2CoreAccountIncludingFutureRequirementsUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/exception/BlockedByStripeException.java b/src/main/java/com/stripe/exception/BlockedByStripeException.java index 9cbca500927..02181d693c8 100644 --- a/src/main/java/com/stripe/exception/BlockedByStripeException.java +++ b/src/main/java/com/stripe/exception/BlockedByStripeException.java @@ -6,7 +6,7 @@ import com.stripe.model.StripeObject; import com.stripe.net.StripeResponseGetter; -/** Returned when the bank account cannot be added due to previous suspicious activity. */ +/** Returned when the payout method cannot be used due to suspicious activity. */ public final class BlockedByStripeException extends ApiException { private static final long serialVersionUID = 2L; diff --git a/src/main/java/com/stripe/exception/StripeException.java b/src/main/java/com/stripe/exception/StripeException.java index 711895cb5eb..b2cb5f2ba44 100644 --- a/src/main/java/com/stripe/exception/StripeException.java +++ b/src/main/java/com/stripe/exception/StripeException.java @@ -149,6 +149,9 @@ public static StripeException parseV2Exception( case "quota_exceeded": return com.stripe.exception.QuotaExceededException.parse( body, statusCode, requestId, responseGetter); + case "rate_limit": + return com.stripe.exception.RateLimitException.parse( + body, statusCode, requestId, responseGetter); case "recipient_not_notifiable": return com.stripe.exception.RecipientNotNotifiableException.parse( body, statusCode, requestId, responseGetter); diff --git a/src/main/java/com/stripe/model/v2/EventDataClassLookup.java b/src/main/java/com/stripe/model/v2/EventDataClassLookup.java index 96e332b98f9..54d186d5969 100644 --- a/src/main/java/com/stripe/model/v2/EventDataClassLookup.java +++ b/src/main/java/com/stripe/model/v2/EventDataClassLookup.java @@ -140,6 +140,9 @@ public final class EventDataClassLookup { eventClassLookup.put( "v2.core.account[defaults].updated", com.stripe.events.V2CoreAccountIncludingDefaultsUpdatedEvent.class); + eventClassLookup.put( + "v2.core.account[future_requirements].updated", + com.stripe.events.V2CoreAccountIncludingFutureRequirementsUpdatedEvent.class); eventClassLookup.put( "v2.core.account[identity].updated", com.stripe.events.V2CoreAccountIncludingIdentityUpdatedEvent.class); diff --git a/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java b/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java index 65801bfa2e2..88a228d73b3 100644 --- a/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java +++ b/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java @@ -66,6 +66,9 @@ public final class EventNotificationClassLookup { eventClassLookup.put( "v2.core.account[defaults].updated", com.stripe.events.V2CoreAccountIncludingDefaultsUpdatedEventNotification.class); + eventClassLookup.put( + "v2.core.account[future_requirements].updated", + com.stripe.events.V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification.class); eventClassLookup.put( "v2.core.account[identity].updated", com.stripe.events.V2CoreAccountIncludingIdentityUpdatedEventNotification.class); diff --git a/src/main/java/com/stripe/model/v2/core/vault/GbBankAccount.java b/src/main/java/com/stripe/model/v2/core/vault/GbBankAccount.java index 766317d0182..d1ea223c682 100644 --- a/src/main/java/com/stripe/model/v2/core/vault/GbBankAccount.java +++ b/src/main/java/com/stripe/model/v2/core/vault/GbBankAccount.java @@ -14,6 +14,10 @@ @Setter @EqualsAndHashCode(callSuper = false) public class GbBankAccount extends StripeObject implements HasId { + /** The alternative reference for this payout method, if it's a projected payout method. */ + @SerializedName("alternative_reference") + AlternativeReference alternativeReference; + /** * Whether this bank account object was archived. Bank account objects can be archived through the * /archive API, and they will not be automatically archived by Stripe. Archived bank account @@ -76,6 +80,25 @@ public class GbBankAccount extends StripeObject implements HasId { @SerializedName("sort_code") String sortCode; + /** The alternative reference for this payout method, if it's a projected payout method. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AlternativeReference extends StripeObject implements HasId { + /** The ID of the alternative resource being referenced. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + + /** + * The type of the alternative reference (e.g., external_account for V1 external accounts). + * + *

One of {@code external_account}, or {@code payment_method}. + */ + @SerializedName("type") + String type; + } + /** * Information around the status of Confirmation of Payee matching done on this bank account. * Confirmation of Payee is a name matching service that must be done before making diff --git a/src/main/java/com/stripe/model/v2/core/vault/UsBankAccount.java b/src/main/java/com/stripe/model/v2/core/vault/UsBankAccount.java index b0d0f4d2052..a4b359adc37 100644 --- a/src/main/java/com/stripe/model/v2/core/vault/UsBankAccount.java +++ b/src/main/java/com/stripe/model/v2/core/vault/UsBankAccount.java @@ -17,6 +17,10 @@ @Setter @EqualsAndHashCode(callSuper = false) public class UsBankAccount extends StripeObject implements HasId { + /** The alternative reference for this payout method, if it's a projected payout method. */ + @SerializedName("alternative_reference") + AlternativeReference alternativeReference; + /** Whether this USBankAccount object was archived. */ @SerializedName("archived") Boolean archived; @@ -81,6 +85,25 @@ public class UsBankAccount extends StripeObject implements HasId { @SerializedName("verification") Verification verification; + /** The alternative reference for this payout method, if it's a projected payout method. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AlternativeReference extends StripeObject implements HasId { + /** The ID of the alternative resource being referenced. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + + /** + * The type of the alternative reference (e.g., external_account for V1 external accounts). + * + *

One of {@code external_account}, or {@code payment_method}. + */ + @SerializedName("type") + String type; + } + /** The bank account verification details. */ @Getter @Setter diff --git a/src/main/java/com/stripe/model/v2/moneymanagement/FinancialAddress.java b/src/main/java/com/stripe/model/v2/moneymanagement/FinancialAddress.java index ee321c66721..ad9b6e44d26 100644 --- a/src/main/java/com/stripe/model/v2/moneymanagement/FinancialAddress.java +++ b/src/main/java/com/stripe/model/v2/moneymanagement/FinancialAddress.java @@ -185,6 +185,14 @@ public static class SepaBankAccount extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class UsBankAccount extends StripeObject { + /** The address of the account holder. */ + @SerializedName("account_holder_address") + AccountHolderAddress accountHolderAddress; + + /** The name of the account holder. */ + @SerializedName("account_holder_name") + String accountHolderName; + /** The account number of the US Bank Account. */ @SerializedName("account_number") String accountNumber; @@ -208,6 +216,40 @@ public static class UsBankAccount extends StripeObject { /** The swift code of the bank or financial institution. */ @SerializedName("swift_code") String swiftCode; + + /** The address of the account holder. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AccountHolderAddress extends StripeObject { + /** The city of the address. */ + @SerializedName("city") + String city; + + /** The country of the address. */ + @SerializedName("country") + String country; + + /** The first line of the address. */ + @SerializedName("line1") + String line1; + + /** The second line of the address. */ + @SerializedName("line2") + String line2; + + /** The postal / zip code of the address. */ + @SerializedName("postal_code") + String postalCode; + + /** The state of the address. */ + @SerializedName("state") + String state; + + /** The town of the address. */ + @SerializedName("town") + String town; + } } } } diff --git a/src/main/java/com/stripe/model/v2/moneymanagement/PayoutMethod.java b/src/main/java/com/stripe/model/v2/moneymanagement/PayoutMethod.java index 0eae52ea66c..43acadb3ab5 100644 --- a/src/main/java/com/stripe/model/v2/moneymanagement/PayoutMethod.java +++ b/src/main/java/com/stripe/model/v2/moneymanagement/PayoutMethod.java @@ -15,6 +15,10 @@ @Setter @EqualsAndHashCode(callSuper = false) public class PayoutMethod extends StripeObject implements HasId { + /** The alternative reference for this payout method, if it's a projected payout method. */ + @SerializedName("alternative_reference") + AlternativeReference alternativeReference; + /** A set of available payout speeds for this payout method. */ @SerializedName("available_payout_speeds") List availablePayoutSpeeds; @@ -71,6 +75,25 @@ public class PayoutMethod extends StripeObject implements HasId { @SerializedName("usage_status") UsageStatus usageStatus; + /** The alternative reference for this payout method, if it's a projected payout method. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AlternativeReference extends StripeObject implements HasId { + /** The ID of the alternative resource being referenced. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + + /** + * The type of the alternative reference (e.g., external_account for V1 external accounts). + * + *

One of {@code external_account}, or {@code payment_method}. + */ + @SerializedName("type") + String type; + } + /** The PayoutMethodBankAccount object details. */ @Getter @Setter @@ -147,6 +170,13 @@ public static class Card extends StripeObject { @SerializedName("exp_year") String expYear; + /** + * Uniquely identifies this particular card number. You can use this attribute to check whether + * two recipients who’ve signed up with you are using the same card number, for example. + */ + @SerializedName("fingerprint") + String fingerprint; + /** The last 4 digits of the card number. */ @SerializedName("last4") String last4; diff --git a/src/main/java/com/stripe/param/v2/core/vault/UsBankAccountUpdateParams.java b/src/main/java/com/stripe/param/v2/core/vault/UsBankAccountUpdateParams.java index ed3284594ae..af96496ca33 100644 --- a/src/main/java/com/stripe/param/v2/core/vault/UsBankAccountUpdateParams.java +++ b/src/main/java/com/stripe/param/v2/core/vault/UsBankAccountUpdateParams.java @@ -22,7 +22,7 @@ public class UsBankAccountUpdateParams extends ApiRequestParams { Map extraParams; /** - * The bank account's fedwire routing number can be provided for update it was were empty + * The bank account's Fedwire routing number can be provided for update if it was empty * previously. */ @SerializedName("fedwire_routing_number") @@ -85,7 +85,7 @@ public Builder putAllExtraParam(Map map) { } /** - * The bank account's fedwire routing number can be provided for update it was were empty + * The bank account's Fedwire routing number can be provided for update if it was empty * previously. */ public Builder setFedwireRoutingNumber(String fedwireRoutingNumber) { @@ -94,7 +94,7 @@ public Builder setFedwireRoutingNumber(String fedwireRoutingNumber) { } /** - * The bank account's fedwire routing number can be provided for update it was were empty + * The bank account's Fedwire routing number can be provided for update if it was empty * previously. */ public Builder setFedwireRoutingNumber(EmptyParam fedwireRoutingNumber) { diff --git a/src/main/java/com/stripe/service/v2/core/AccountLinkService.java b/src/main/java/com/stripe/service/v2/core/AccountLinkService.java index a47c0c59b5d..7aa70806477 100644 --- a/src/main/java/com/stripe/service/v2/core/AccountLinkService.java +++ b/src/main/java/com/stripe/service/v2/core/AccountLinkService.java @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec package com.stripe.service.v2.core; +import com.stripe.exception.RateLimitException; import com.stripe.exception.StripeException; import com.stripe.model.v2.core.AccountLink; import com.stripe.net.ApiRequest; @@ -21,7 +22,8 @@ public AccountLinkService(StripeResponseGetter responseGetter) { * Creates an AccountLink object that includes a single-use URL that an account can use to access * a Stripe-hosted flow for collecting or updating required information. */ - public AccountLink create(AccountLinkCreateParams params) throws StripeException { + public AccountLink create(AccountLinkCreateParams params) + throws StripeException, RateLimitException { return create(params, (RequestOptions) null); } /** @@ -29,7 +31,7 @@ public AccountLink create(AccountLinkCreateParams params) throws StripeException * a Stripe-hosted flow for collecting or updating required information. */ public AccountLink create(AccountLinkCreateParams params, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { String path = "/v2/core/account_links"; ApiRequest request = new ApiRequest( diff --git a/src/main/java/com/stripe/service/v2/core/AccountService.java b/src/main/java/com/stripe/service/v2/core/AccountService.java index 0ba14c9d182..2f5157cee7c 100644 --- a/src/main/java/com/stripe/service/v2/core/AccountService.java +++ b/src/main/java/com/stripe/service/v2/core/AccountService.java @@ -2,6 +2,7 @@ package com.stripe.service.v2.core; import com.google.gson.reflect.TypeToken; +import com.stripe.exception.RateLimitException; import com.stripe.exception.StripeException; import com.stripe.model.v2.StripeCollection; import com.stripe.model.v2.core.Account; @@ -24,20 +25,22 @@ public AccountService(StripeResponseGetter responseGetter) { } /** Returns a list of Accounts. */ - public StripeCollection list(AccountListParams params) throws StripeException { + public StripeCollection list(AccountListParams params) + throws StripeException, RateLimitException { return list(params, (RequestOptions) null); } /** Returns a list of Accounts. */ - public StripeCollection list(RequestOptions options) throws StripeException { + public StripeCollection list(RequestOptions options) + throws StripeException, RateLimitException { return list((AccountListParams) null, options); } /** Returns a list of Accounts. */ - public StripeCollection list() throws StripeException { + public StripeCollection list() throws StripeException, RateLimitException { return list((AccountListParams) null, (RequestOptions) null); } /** Returns a list of Accounts. */ public StripeCollection list(AccountListParams params, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { String path = "/v2/core/accounts"; ApiRequest request = new ApiRequest( @@ -54,7 +57,7 @@ public StripeCollection list(AccountListParams params, RequestOptions o * the features an account has access to. An account can be configured as any or all of the * following configurations: Customer, Merchant and/or Recipient. */ - public Account create(AccountCreateParams params) throws StripeException { + public Account create(AccountCreateParams params) throws StripeException, RateLimitException { return create(params, (RequestOptions) null); } /** @@ -63,7 +66,7 @@ public Account create(AccountCreateParams params) throws StripeException { * the features an account has access to. An account can be configured as any or all of the * following configurations: Customer, Merchant and/or Recipient. */ - public Account create(RequestOptions options) throws StripeException { + public Account create(RequestOptions options) throws StripeException, RateLimitException { return create((AccountCreateParams) null, options); } /** @@ -72,7 +75,7 @@ public Account create(RequestOptions options) throws StripeException { * the features an account has access to. An account can be configured as any or all of the * following configurations: Customer, Merchant and/or Recipient. */ - public Account create() throws StripeException { + public Account create() throws StripeException, RateLimitException { return create((AccountCreateParams) null, (RequestOptions) null); } /** @@ -81,7 +84,8 @@ public Account create() throws StripeException { * the features an account has access to. An account can be configured as any or all of the * following configurations: Customer, Merchant and/or Recipient. */ - public Account create(AccountCreateParams params, RequestOptions options) throws StripeException { + public Account create(AccountCreateParams params, RequestOptions options) + throws StripeException, RateLimitException { String path = "/v2/core/accounts"; ApiRequest request = new ApiRequest( @@ -93,20 +97,22 @@ public Account create(AccountCreateParams params, RequestOptions options) throws return this.request(request, Account.class); } /** Retrieves the details of an Account. */ - public Account retrieve(String id, AccountRetrieveParams params) throws StripeException { + public Account retrieve(String id, AccountRetrieveParams params) + throws StripeException, RateLimitException { return retrieve(id, params, (RequestOptions) null); } /** Retrieves the details of an Account. */ - public Account retrieve(String id, RequestOptions options) throws StripeException { + public Account retrieve(String id, RequestOptions options) + throws StripeException, RateLimitException { return retrieve(id, (AccountRetrieveParams) null, options); } /** Retrieves the details of an Account. */ - public Account retrieve(String id) throws StripeException { + public Account retrieve(String id) throws StripeException, RateLimitException { return retrieve(id, (AccountRetrieveParams) null, (RequestOptions) null); } /** Retrieves the details of an Account. */ public Account retrieve(String id, AccountRetrieveParams params, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { String path = String.format("/v2/core/accounts/%s", ApiResource.urlEncodeId(id)); ApiRequest request = new ApiRequest( @@ -118,20 +124,22 @@ public Account retrieve(String id, AccountRetrieveParams params, RequestOptions return this.request(request, Account.class); } /** Updates the details of an Account. */ - public Account update(String id, AccountUpdateParams params) throws StripeException { + public Account update(String id, AccountUpdateParams params) + throws StripeException, RateLimitException { return update(id, params, (RequestOptions) null); } /** Updates the details of an Account. */ - public Account update(String id, RequestOptions options) throws StripeException { + public Account update(String id, RequestOptions options) + throws StripeException, RateLimitException { return update(id, (AccountUpdateParams) null, options); } /** Updates the details of an Account. */ - public Account update(String id) throws StripeException { + public Account update(String id) throws StripeException, RateLimitException { return update(id, (AccountUpdateParams) null, (RequestOptions) null); } /** Updates the details of an Account. */ public Account update(String id, AccountUpdateParams params, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { String path = String.format("/v2/core/accounts/%s", ApiResource.urlEncodeId(id)); ApiRequest request = new ApiRequest( @@ -147,7 +155,8 @@ public Account update(String id, AccountUpdateParams params, RequestOptions opti * operated on, but limited information can still be retrieved through the API in order to be able * to track their history. */ - public Account close(String id, AccountCloseParams params) throws StripeException { + public Account close(String id, AccountCloseParams params) + throws StripeException, RateLimitException { return close(id, params, (RequestOptions) null); } /** @@ -155,7 +164,8 @@ public Account close(String id, AccountCloseParams params) throws StripeExceptio * operated on, but limited information can still be retrieved through the API in order to be able * to track their history. */ - public Account close(String id, RequestOptions options) throws StripeException { + public Account close(String id, RequestOptions options) + throws StripeException, RateLimitException { return close(id, (AccountCloseParams) null, options); } /** @@ -163,7 +173,7 @@ public Account close(String id, RequestOptions options) throws StripeException { * operated on, but limited information can still be retrieved through the API in order to be able * to track their history. */ - public Account close(String id) throws StripeException { + public Account close(String id) throws StripeException, RateLimitException { return close(id, (AccountCloseParams) null, (RequestOptions) null); } /** @@ -172,7 +182,7 @@ public Account close(String id) throws StripeException { * to track their history. */ public Account close(String id, AccountCloseParams params, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { String path = String.format("/v2/core/accounts/%s/close", ApiResource.urlEncodeId(id)); ApiRequest request = new ApiRequest( diff --git a/src/main/java/com/stripe/service/v2/core/AccountTokenService.java b/src/main/java/com/stripe/service/v2/core/AccountTokenService.java index cc7c754b89a..3eb34d7d350 100644 --- a/src/main/java/com/stripe/service/v2/core/AccountTokenService.java +++ b/src/main/java/com/stripe/service/v2/core/AccountTokenService.java @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec package com.stripe.service.v2.core; +import com.stripe.exception.RateLimitException; import com.stripe.exception.StripeException; import com.stripe.model.v2.core.AccountToken; import com.stripe.net.ApiRequest; @@ -18,20 +19,21 @@ public AccountTokenService(StripeResponseGetter responseGetter) { } /** Creates an Account Token. */ - public AccountToken create(AccountTokenCreateParams params) throws StripeException { + public AccountToken create(AccountTokenCreateParams params) + throws StripeException, RateLimitException { return create(params, (RequestOptions) null); } /** Creates an Account Token. */ - public AccountToken create(RequestOptions options) throws StripeException { + public AccountToken create(RequestOptions options) throws StripeException, RateLimitException { return create((AccountTokenCreateParams) null, options); } /** Creates an Account Token. */ - public AccountToken create() throws StripeException { + public AccountToken create() throws StripeException, RateLimitException { return create((AccountTokenCreateParams) null, (RequestOptions) null); } /** Creates an Account Token. */ public AccountToken create(AccountTokenCreateParams params, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { String path = "/v2/core/account_tokens"; ApiRequest request = new ApiRequest( @@ -43,11 +45,12 @@ public AccountToken create(AccountTokenCreateParams params, RequestOptions optio return this.request(request, AccountToken.class); } /** Retrieves an Account Token. */ - public AccountToken retrieve(String id) throws StripeException { + public AccountToken retrieve(String id) throws StripeException, RateLimitException { return retrieve(id, (RequestOptions) null); } /** Retrieves an Account Token. */ - public AccountToken retrieve(String id, RequestOptions options) throws StripeException { + public AccountToken retrieve(String id, RequestOptions options) + throws StripeException, RateLimitException { String path = String.format("/v2/core/account_tokens/%s", ApiResource.urlEncodeId(id)); ApiRequest request = new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, null, options); diff --git a/src/main/java/com/stripe/service/v2/core/accounts/PersonService.java b/src/main/java/com/stripe/service/v2/core/accounts/PersonService.java index 1ba7615b0cc..4a1b2b957e4 100644 --- a/src/main/java/com/stripe/service/v2/core/accounts/PersonService.java +++ b/src/main/java/com/stripe/service/v2/core/accounts/PersonService.java @@ -2,6 +2,7 @@ package com.stripe.service.v2.core.accounts; import com.google.gson.reflect.TypeToken; +import com.stripe.exception.RateLimitException; import com.stripe.exception.StripeException; import com.stripe.model.v2.DeletedObject; import com.stripe.model.v2.StripeCollection; @@ -24,21 +25,23 @@ public PersonService(StripeResponseGetter responseGetter) { /** Returns a paginated list of Persons associated with an Account. */ public StripeCollection list(String accountId, PersonListParams params) - throws StripeException { + throws StripeException, RateLimitException { return list(accountId, params, (RequestOptions) null); } /** Returns a paginated list of Persons associated with an Account. */ public StripeCollection list(String accountId, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { return list(accountId, (PersonListParams) null, options); } /** Returns a paginated list of Persons associated with an Account. */ - public StripeCollection list(String accountId) throws StripeException { + public StripeCollection list(String accountId) + throws StripeException, RateLimitException { return list(accountId, (PersonListParams) null, (RequestOptions) null); } /** Returns a paginated list of Persons associated with an Account. */ public StripeCollection list( - String accountId, PersonListParams params, RequestOptions options) throws StripeException { + String accountId, PersonListParams params, RequestOptions options) + throws StripeException, RateLimitException { String path = String.format("/v2/core/accounts/%s/persons", ApiResource.urlEncodeId(accountId)); ApiRequest request = new ApiRequest( @@ -53,21 +56,23 @@ public StripeCollection list( * Create a Person. Adds an individual to an Account's identity. You can set relationship * attributes and identity information at creation. */ - public AccountPerson create(String accountId, PersonCreateParams params) throws StripeException { + public AccountPerson create(String accountId, PersonCreateParams params) + throws StripeException, RateLimitException { return create(accountId, params, (RequestOptions) null); } /** * Create a Person. Adds an individual to an Account's identity. You can set relationship * attributes and identity information at creation. */ - public AccountPerson create(String accountId, RequestOptions options) throws StripeException { + public AccountPerson create(String accountId, RequestOptions options) + throws StripeException, RateLimitException { return create(accountId, (PersonCreateParams) null, options); } /** * Create a Person. Adds an individual to an Account's identity. You can set relationship * attributes and identity information at creation. */ - public AccountPerson create(String accountId) throws StripeException { + public AccountPerson create(String accountId) throws StripeException, RateLimitException { return create(accountId, (PersonCreateParams) null, (RequestOptions) null); } /** @@ -75,7 +80,7 @@ public AccountPerson create(String accountId) throws StripeException { * attributes and identity information at creation. */ public AccountPerson create(String accountId, PersonCreateParams params, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { String path = String.format("/v2/core/accounts/%s/persons", ApiResource.urlEncodeId(accountId)); ApiRequest request = new ApiRequest( @@ -87,12 +92,13 @@ public AccountPerson create(String accountId, PersonCreateParams params, Request return this.request(request, AccountPerson.class); } /** Delete a Person associated with an Account. */ - public DeletedObject delete(String accountId, String id) throws StripeException { + public DeletedObject delete(String accountId, String id) + throws StripeException, RateLimitException { return delete(accountId, id, (RequestOptions) null); } /** Delete a Person associated with an Account. */ public DeletedObject delete(String accountId, String id, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { String path = String.format( "/v2/core/accounts/%s/persons/%s", @@ -102,12 +108,13 @@ public DeletedObject delete(String accountId, String id, RequestOptions options) return this.request(request, DeletedObject.class); } /** Retrieves a Person associated with an Account. */ - public AccountPerson retrieve(String accountId, String id) throws StripeException { + public AccountPerson retrieve(String accountId, String id) + throws StripeException, RateLimitException { return retrieve(accountId, id, (RequestOptions) null); } /** Retrieves a Person associated with an Account. */ public AccountPerson retrieve(String accountId, String id, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { String path = String.format( "/v2/core/accounts/%s/persons/%s", @@ -118,22 +125,23 @@ public AccountPerson retrieve(String accountId, String id, RequestOptions option } /** Updates a Person associated with an Account. */ public AccountPerson update(String accountId, String id, PersonUpdateParams params) - throws StripeException { + throws StripeException, RateLimitException { return update(accountId, id, params, (RequestOptions) null); } /** Updates a Person associated with an Account. */ public AccountPerson update(String accountId, String id, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { return update(accountId, id, (PersonUpdateParams) null, options); } /** Updates a Person associated with an Account. */ - public AccountPerson update(String accountId, String id) throws StripeException { + public AccountPerson update(String accountId, String id) + throws StripeException, RateLimitException { return update(accountId, id, (PersonUpdateParams) null, (RequestOptions) null); } /** Updates a Person associated with an Account. */ public AccountPerson update( String accountId, String id, PersonUpdateParams params, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { String path = String.format( "/v2/core/accounts/%s/persons/%s", diff --git a/src/main/java/com/stripe/service/v2/core/accounts/PersonTokenService.java b/src/main/java/com/stripe/service/v2/core/accounts/PersonTokenService.java index 4325a3193ec..b6180a4b7d7 100644 --- a/src/main/java/com/stripe/service/v2/core/accounts/PersonTokenService.java +++ b/src/main/java/com/stripe/service/v2/core/accounts/PersonTokenService.java @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec package com.stripe.service.v2.core.accounts; +import com.stripe.exception.RateLimitException; import com.stripe.exception.StripeException; import com.stripe.model.v2.core.AccountPersonToken; import com.stripe.net.ApiRequest; @@ -19,22 +20,22 @@ public PersonTokenService(StripeResponseGetter responseGetter) { /** Creates a Person Token associated with an Account. */ public AccountPersonToken create(String accountId, PersonTokenCreateParams params) - throws StripeException { + throws StripeException, RateLimitException { return create(accountId, params, (RequestOptions) null); } /** Creates a Person Token associated with an Account. */ public AccountPersonToken create(String accountId, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { return create(accountId, (PersonTokenCreateParams) null, options); } /** Creates a Person Token associated with an Account. */ - public AccountPersonToken create(String accountId) throws StripeException { + public AccountPersonToken create(String accountId) throws StripeException, RateLimitException { return create(accountId, (PersonTokenCreateParams) null, (RequestOptions) null); } /** Creates a Person Token associated with an Account. */ public AccountPersonToken create( String accountId, PersonTokenCreateParams params, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { String path = String.format("/v2/core/accounts/%s/person_tokens", ApiResource.urlEncodeId(accountId)); ApiRequest request = @@ -47,12 +48,13 @@ public AccountPersonToken create( return this.request(request, AccountPersonToken.class); } /** Retrieves a Person Token associated with an Account. */ - public AccountPersonToken retrieve(String accountId, String id) throws StripeException { + public AccountPersonToken retrieve(String accountId, String id) + throws StripeException, RateLimitException { return retrieve(accountId, id, (RequestOptions) null); } /** Retrieves a Person Token associated with an Account. */ public AccountPersonToken retrieve(String accountId, String id, RequestOptions options) - throws StripeException { + throws StripeException, RateLimitException { String path = String.format( "/v2/core/accounts/%s/person_tokens/%s", diff --git a/src/test/java/com/stripe/functional/GeneratedExamples.java b/src/test/java/com/stripe/functional/GeneratedExamples.java index 6febffbff5a..a4f989b28b6 100644 --- a/src/test/java/com/stripe/functional/GeneratedExamples.java +++ b/src/test/java/com/stripe/functional/GeneratedExamples.java @@ -27372,7 +27372,7 @@ public void testBlockedByStripeErrorServices() throws StripeException { "/v2/core/vault/us_bank_accounts", null, null, - "{\"error\":{\"type\":\"blocked_by_stripe\",\"code\":\"blocked_payout_method_bank_account\"}}", + "{\"error\":{\"type\":\"blocked_by_stripe\",\"code\":\"blocked_payout_method\"}}", 400); StripeClient client = new StripeClient(networkSpy); @@ -27703,6 +27703,31 @@ public void testQuotaExceededErrorServices() throws StripeException { null); } + @Test + public void testRateLimitErrorServices() throws StripeException { + stubRequestReturnError( + BaseAddress.API, + ApiResource.RequestMethod.GET, + "/v2/core/accounts", + null, + null, + "{\"error\":{\"type\":\"rate_limit\",\"code\":\"account_rate_limit_exceeded\"}}", + 400); + StripeClient client = new StripeClient(networkSpy); + + com.stripe.param.v2.core.AccountListParams params = + com.stripe.param.v2.core.AccountListParams.builder().build(); + + try { + client.v2().core().accounts().list(params); + } catch (RateLimitException e) { + + } + ; + verifyRequest( + BaseAddress.API, ApiResource.RequestMethod.GET, "/v2/core/accounts", params.toMap(), null); + } + @Test public void testRecipientNotNotifiableErrorServices() throws StripeException { stubRequestReturnError(