From b9560ae98178fc3771552c434d24c98baa0141e2 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 6 Jan 2026 18:54:42 +0000 Subject: [PATCH] Update generated code for v2150 and --- CODEGEN_VERSION | 2 +- ...cludingFutureRequirementsUpdatedEvent.java | 22 +++ ...eRequirementsUpdatedEventNotification.java | 28 ++++ .../stripe/model/v2/EventDataClassLookup.java | 3 + .../v2/EventNotificationClassLookup.java | 3 + .../v2/moneymanagement/OutboundPayment.java | 119 +++++++++++++++ .../OutboundPaymentCreateParams.java | 140 +++++++++++++++++- .../service/v2/core/AccountLinkService.java | 6 +- .../service/v2/core/AccountService.java | 50 ++++--- .../service/v2/core/AccountTokenService.java | 15 +- .../v2/core/accounts/PersonService.java | 40 +++-- .../v2/core/accounts/PersonTokenService.java | 14 +- .../stripe/service/v2/iam/ApiKeyService.java | 52 +++++-- .../stripe/functional/GeneratedExamples.java | 36 +---- 14 files changed, 434 insertions(+), 96 deletions(-) create mode 100644 src/main/java/com/stripe/events/V2CoreAccountIncludingFutureRequirementsUpdatedEvent.java create mode 100644 src/main/java/com/stripe/events/V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification.java diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index fc0689d976d..c7a4fc4f718 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -5abe0e44caedb3474ee672265284096ec89e0fa3 +4b8685a69ee5061fca67cc7e3fd69c8e6890b24e \ No newline at end of file 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/model/v2/EventDataClassLookup.java b/src/main/java/com/stripe/model/v2/EventDataClassLookup.java index cd76fa28834..0e7af33b020 100644 --- a/src/main/java/com/stripe/model/v2/EventDataClassLookup.java +++ b/src/main/java/com/stripe/model/v2/EventDataClassLookup.java @@ -307,6 +307,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 eaecd71b083..0457533021f 100644 --- a/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java +++ b/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java @@ -190,6 +190,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/moneymanagement/OutboundPayment.java b/src/main/java/com/stripe/model/v2/moneymanagement/OutboundPayment.java index f5927a4c795..9adac1d5fe7 100644 --- a/src/main/java/com/stripe/model/v2/moneymanagement/OutboundPayment.java +++ b/src/main/java/com/stripe/model/v2/moneymanagement/OutboundPayment.java @@ -149,6 +149,10 @@ public class OutboundPayment extends StripeObject implements HasId { @SerializedName("trace_id") TraceId traceId; + /** Information to track this OutboundPayment with the recipient bank. */ + @SerializedName("tracking_details") + TrackingDetails trackingDetails; + /** The "presentment amount" for the OutboundPayment. */ @Getter @Setter @@ -183,6 +187,10 @@ public static class DeliveryOptions extends StripeObject { @SerializedName("bank_account") String bankAccount; + /** Delivery options for paper check. */ + @SerializedName("paper_check") + PaperCheck paperCheck; + /** * Open Enum. Speed of the payout. * @@ -190,6 +198,28 @@ public static class DeliveryOptions extends StripeObject { */ @SerializedName("speed") String speed; + + /** Delivery options for paper check. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class PaperCheck extends StripeObject { + /** Memo printed on the memo field of the check. */ + @SerializedName("memo") + String memo; + + /** + * Open Enum. Shipping speed of the paper check. + * + *

One of {@code priority}, or {@code standard}. + */ + @SerializedName("shipping_speed") + String shippingSpeed; + + /** Signature for the paper check. */ + @SerializedName("signature") + String signature; + } } /** The FinancialAccount that funds were pulled from. */ @@ -392,4 +422,93 @@ public static class TraceId extends StripeObject { @SerializedName("value") String value; } + + /** Information to track this OutboundPayment with the recipient bank. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class TrackingDetails extends StripeObject { + /** Paper check tracking details. */ + @SerializedName("paper_check") + PaperCheck paperCheck; + + /** Paper check tracking details. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class PaperCheck extends StripeObject { + /** + * Open Enum. Carrier of the paper check. + * + *

One of {@code fedex}, or {@code usps}. + */ + @SerializedName("carrier") + String carrier; + + /** Check number. */ + @SerializedName("check_number") + String checkNumber; + + /** Postal code of the latest tracking update. */ + @SerializedName("current_postal_code") + String currentPostalCode; + + /** Mailing address of the paper check. */ + @SerializedName("mailing_address") + MailingAddress mailingAddress; + + /** Tracking number for the check. */ + @SerializedName("tracking_number") + String trackingNumber; + + /** + * Open Enum. Tracking status of the paper check. + * + *

One of {@code delivered}, {@code in_transit}, or {@code mailed}. + */ + @SerializedName("tracking_status") + String trackingStatus; + + /** When the tracking details were last updated. */ + @SerializedName("updated_at") + Instant updatedAt; + + /** Mailing address of the paper check. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class MailingAddress extends StripeObject { + /** City, district, suburb, town, or village. */ + @SerializedName("city") + String city; + + /** + * Two-letter country code (ISO + * 3166-1 alpha-2). + */ + @SerializedName("country") + String country; + + /** Address line 1 (e.g., street, PO Box, or company name). */ + @SerializedName("line1") + String line1; + + /** Address line 2 (e.g., apartment, suite, unit, or building). */ + @SerializedName("line2") + String line2; + + /** ZIP or postal code. */ + @SerializedName("postal_code") + String postalCode; + + /** State, county, province, or region. */ + @SerializedName("state") + String state; + + /** Town or district. */ + @SerializedName("town") + String town; + } + } + } } diff --git a/src/main/java/com/stripe/param/v2/moneymanagement/OutboundPaymentCreateParams.java b/src/main/java/com/stripe/param/v2/moneymanagement/OutboundPaymentCreateParams.java index 667b561eb13..a68ed5d3101 100644 --- a/src/main/java/com/stripe/param/v2/moneymanagement/OutboundPaymentCreateParams.java +++ b/src/main/java/com/stripe/param/v2/moneymanagement/OutboundPaymentCreateParams.java @@ -354,13 +354,22 @@ public static class DeliveryOptions { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; + /** Delivery options for paper check. */ + @SerializedName("paper_check") + PaperCheck paperCheck; + /** Open Enum. Speed of the payout. */ @SerializedName("speed") Speed speed; - private DeliveryOptions(BankAccount bankAccount, Map extraParams, Speed speed) { + private DeliveryOptions( + BankAccount bankAccount, + Map extraParams, + PaperCheck paperCheck, + Speed speed) { this.bankAccount = bankAccount; this.extraParams = extraParams; + this.paperCheck = paperCheck; this.speed = speed; } @@ -373,12 +382,14 @@ public static class Builder { private Map extraParams; + private PaperCheck paperCheck; + private Speed speed; /** Finalize and obtain parameter instance from this builder. */ public OutboundPaymentCreateParams.DeliveryOptions build() { return new OutboundPaymentCreateParams.DeliveryOptions( - this.bankAccount, this.extraParams, this.speed); + this.bankAccount, this.extraParams, this.paperCheck, this.speed); } /** Open Enum. Method for bank account. */ @@ -415,6 +426,13 @@ public Builder putAllExtraParam(Map map) { return this; } + /** Delivery options for paper check. */ + public Builder setPaperCheck( + OutboundPaymentCreateParams.DeliveryOptions.PaperCheck paperCheck) { + this.paperCheck = paperCheck; + return this; + } + /** Open Enum. Speed of the payout. */ public Builder setSpeed(OutboundPaymentCreateParams.DeliveryOptions.Speed speed) { this.speed = speed; @@ -422,6 +440,124 @@ public Builder setSpeed(OutboundPaymentCreateParams.DeliveryOptions.Speed speed) } } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class PaperCheck { + /** + * 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; + + /** Memo printed on the memo field of the check. */ + @SerializedName("memo") + String memo; + + /** Open Enum. Shipping speed of the paper check. Defaults to standard. */ + @SerializedName("shipping_speed") + ShippingSpeed shippingSpeed; + + /** Required. Signature for the paper check. */ + @SerializedName("signature") + String signature; + + private PaperCheck( + Map extraParams, + String memo, + ShippingSpeed shippingSpeed, + String signature) { + this.extraParams = extraParams; + this.memo = memo; + this.shippingSpeed = shippingSpeed; + this.signature = signature; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String memo; + + private ShippingSpeed shippingSpeed; + + private String signature; + + /** Finalize and obtain parameter instance from this builder. */ + public OutboundPaymentCreateParams.DeliveryOptions.PaperCheck build() { + return new OutboundPaymentCreateParams.DeliveryOptions.PaperCheck( + this.extraParams, this.memo, this.shippingSpeed, this.signature); + } + + /** + * 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 OutboundPaymentCreateParams.DeliveryOptions.PaperCheck#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 OutboundPaymentCreateParams.DeliveryOptions.PaperCheck#extraParams} for + * the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Memo printed on the memo field of the check. */ + public Builder setMemo(String memo) { + this.memo = memo; + return this; + } + + /** Open Enum. Shipping speed of the paper check. Defaults to standard. */ + public Builder setShippingSpeed( + OutboundPaymentCreateParams.DeliveryOptions.PaperCheck.ShippingSpeed shippingSpeed) { + this.shippingSpeed = shippingSpeed; + return this; + } + + /** Required. Signature for the paper check. */ + public Builder setSignature(String signature) { + this.signature = signature; + return this; + } + } + + public enum ShippingSpeed implements ApiRequestParams.EnumParam { + @SerializedName("priority") + PRIORITY("priority"), + + @SerializedName("standard") + STANDARD("standard"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + ShippingSpeed(String value) { + this.value = value; + } + } + } + public enum BankAccount implements ApiRequestParams.EnumParam { @SerializedName("automatic") AUTOMATIC("automatic"), 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/main/java/com/stripe/service/v2/iam/ApiKeyService.java b/src/main/java/com/stripe/service/v2/iam/ApiKeyService.java index cb19f38439b..382f89495fb 100644 --- a/src/main/java/com/stripe/service/v2/iam/ApiKeyService.java +++ b/src/main/java/com/stripe/service/v2/iam/ApiKeyService.java @@ -47,11 +47,17 @@ public StripeCollection list(ApiKeyListParams params, RequestOptions opt options); return this.request(request, new TypeToken>() {}.getType()); } - /** Create an API key. */ + /** + * Create an API key. To create a secret key in livemode, a public key for encryption must be + * provided. + */ public ApiKey create(ApiKeyCreateParams params) throws StripeException { return create(params, (RequestOptions) null); } - /** Create an API key. */ + /** + * Create an API key. To create a secret key in livemode, a public key for encryption must be + * provided. + */ public ApiKey create(ApiKeyCreateParams params, RequestOptions options) throws StripeException { String path = "/v2/iam/api_keys"; ApiRequest request = @@ -63,30 +69,36 @@ public ApiKey create(ApiKeyCreateParams params, RequestOptions options) throws S options); return this.request(request, ApiKey.class); } - /** Retrieve an API key. */ + /** + * Retrieve an API key. For livemode secret keys, secret tokens are only returned on creation, and + * never returned here. + */ public ApiKey retrieve(String id) throws StripeException { return retrieve(id, (RequestOptions) null); } - /** Retrieve an API key. */ + /** + * Retrieve an API key. For livemode secret keys, secret tokens are only returned on creation, and + * never returned here. + */ public ApiKey retrieve(String id, RequestOptions options) throws StripeException { String path = String.format("/v2/iam/api_keys/%s", ApiResource.urlEncodeId(id)); ApiRequest request = new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, null, options); return this.request(request, ApiKey.class); } - /** Update an API key. */ + /** Update an API key. Only parameters that are specified in the request will be updated. */ public ApiKey update(String id, ApiKeyUpdateParams params) throws StripeException { return update(id, params, (RequestOptions) null); } - /** Update an API key. */ + /** Update an API key. Only parameters that are specified in the request will be updated. */ public ApiKey update(String id, RequestOptions options) throws StripeException { return update(id, (ApiKeyUpdateParams) null, options); } - /** Update an API key. */ + /** Update an API key. Only parameters that are specified in the request will be updated. */ public ApiKey update(String id) throws StripeException { return update(id, (ApiKeyUpdateParams) null, (RequestOptions) null); } - /** Update an API key. */ + /** Update an API key. Only parameters that are specified in the request will be updated. */ public ApiKey update(String id, ApiKeyUpdateParams params, RequestOptions options) throws StripeException { String path = String.format("/v2/iam/api_keys/%s", ApiResource.urlEncodeId(id)); @@ -99,30 +111,42 @@ public ApiKey update(String id, ApiKeyUpdateParams params, RequestOptions option options); return this.request(request, ApiKey.class); } - /** Expire an API key. */ + /** Expire an API key. The specified key becomes invalid immediately. */ public ApiKey expire(String id) throws StripeException { return expire(id, (RequestOptions) null); } - /** Expire an API key. */ + /** Expire an API key. The specified key becomes invalid immediately. */ public ApiKey expire(String id, RequestOptions options) throws StripeException { String path = String.format("/v2/iam/api_keys/%s/expire", ApiResource.urlEncodeId(id)); ApiRequest request = new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, null, options); return this.request(request, ApiKey.class); } - /** Rotate an API key. */ + /** + * Rotate an API key. A new key with the same properties is created and returned. The existing key + * is expired immediately, unless an expiry time is specified. + */ public ApiKey rotate(String id, ApiKeyRotateParams params) throws StripeException { return rotate(id, params, (RequestOptions) null); } - /** Rotate an API key. */ + /** + * Rotate an API key. A new key with the same properties is created and returned. The existing key + * is expired immediately, unless an expiry time is specified. + */ public ApiKey rotate(String id, RequestOptions options) throws StripeException { return rotate(id, (ApiKeyRotateParams) null, options); } - /** Rotate an API key. */ + /** + * Rotate an API key. A new key with the same properties is created and returned. The existing key + * is expired immediately, unless an expiry time is specified. + */ public ApiKey rotate(String id) throws StripeException { return rotate(id, (ApiKeyRotateParams) null, (RequestOptions) null); } - /** Rotate an API key. */ + /** + * Rotate an API key. A new key with the same properties is created and returned. The existing key + * is expired immediately, unless an expiry time is specified. + */ public ApiKey rotate(String id, ApiKeyRotateParams params, RequestOptions options) throws StripeException { String path = String.format("/v2/iam/api_keys/%s/rotate", ApiResource.urlEncodeId(id)); diff --git a/src/test/java/com/stripe/functional/GeneratedExamples.java b/src/test/java/com/stripe/functional/GeneratedExamples.java index 6f26b5f025b..c06ddc5abc8 100644 --- a/src/test/java/com/stripe/functional/GeneratedExamples.java +++ b/src/test/java/com/stripe/functional/GeneratedExamples.java @@ -30519,47 +30519,25 @@ public void testQuotaExceededErrorServices() throws StripeException { public void testRateLimitErrorServices() throws StripeException { stubRequestReturnError( BaseAddress.API, - ApiResource.RequestMethod.POST, - "/v2/reporting/report_runs", + ApiResource.RequestMethod.GET, + "/v2/core/accounts", null, null, - "{\"error\":{\"type\":\"rate_limit\",\"code\":\"report_run_rate_limit_exceeded\"}}", + "{\"error\":{\"type\":\"rate_limit\",\"code\":\"account_rate_limit_exceeded\"}}", 400); StripeClient client = new StripeClient(networkSpy); - com.stripe.param.v2.reporting.ReportRunCreateParams params = - com.stripe.param.v2.reporting.ReportRunCreateParams.builder() - .setReport("report") - .putReportParameter("int_key", new BigDecimal(123)) - .putReportParameter("string_key", "value") - .putReportParameter("boolean_key", true) - .putReportParameter( - "object_key", - new HashMap() { - { - put("object_int_key", new BigDecimal(123)); - put("object_string_key", "value"); - put("object_boolean_key", true); - } - }) - .putReportParameter( - "array_key", - new ArrayList<>( - Arrays.asList(new BigDecimal(1), new BigDecimal(2), new BigDecimal(3)))) - .build(); + com.stripe.param.v2.core.AccountListParams params = + com.stripe.param.v2.core.AccountListParams.builder().build(); try { - client.v2().reporting().reportRuns().create(params); + client.v2().core().accounts().list(params); } catch (RateLimitException e) { } ; verifyRequest( - BaseAddress.API, - ApiResource.RequestMethod.POST, - "/v2/reporting/report_runs", - params.toMap(), - null); + BaseAddress.API, ApiResource.RequestMethod.GET, "/v2/core/accounts", params.toMap(), null); } @Test