diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index fe5aa3c0196..d9f3b7218ea 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v178 \ No newline at end of file +v183 \ 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 467827e927e..f20124c79f0 100644 --- a/src/main/java/com/stripe/model/Account.java +++ b/src/main/java/com/stripe/model/Account.java @@ -19,6 +19,13 @@ import lombok.Getter; import lombok.Setter; +/** + * This is an object representing a Stripe account. You can retrieve it to see properties on the + * account like its current e-mail address or if the account is enabled yet to make live charges. + * + *

Some properties, marked below, are available only to platforms that want to create and manage Express or Custom accounts. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -146,176 +153,57 @@ public class Account extends ApiResource implements MetadataStore, Paym @SerializedName("type") String type; - /** Retrieves the details of an account. */ - public static Account retrieve() throws StripeException { - return retrieve((Map) null, (RequestOptions) null); - } - - /** Retrieves the details of an account. */ - public static Account retrieve(RequestOptions options) throws StripeException { - return retrieve((Map) null, options); - } - - /** Retrieves the details of an account. */ - public static Account retrieve(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/account"); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Account.class, options); - } - - /** Retrieves the details of an account. */ - public static Account retrieve(AccountRetrieveParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/account"); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Account.class, options); - } - - /** Retrieves the details of an account. */ - public static Account retrieve(String account) throws StripeException { - return retrieve(account, (Map) null, (RequestOptions) null); - } - - /** Retrieves the details of an account. */ - public static Account retrieve(String account, RequestOptions options) throws StripeException { - return retrieve(account, (Map) null, options); - } - - /** Retrieves the details of an account. */ - public static Account retrieve(String account, Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/accounts/%s", ApiResource.urlEncodeId(account))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Account.class, options); - } - - /** Retrieves the details of an account. */ - public static Account retrieve( - String account, AccountRetrieveParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/accounts/%s", ApiResource.urlEncodeId(account))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Account.class, options); - } - /** - * Updates a connected account by setting - * the values of the parameters passed. Any parameters not provided are left unchanged. Most - * parameters can be changed only for Custom accounts. (These are marked Custom - * Only below.) Parameters marked Custom and Express are not supported - * for Standard accounts. - * - *

To update your own account, use the Dashboard. Refer to our Connect documentation to learn - * more about updating accounts. - */ - @Override - public Account update(Map params) throws StripeException { - return update(params, (RequestOptions) null); - } - - /** - * Updates a connected account by setting - * the values of the parameters passed. Any parameters not provided are left unchanged. Most - * parameters can be changed only for Custom accounts. (These are marked Custom - * Only below.) Parameters marked Custom and Express are not supported - * for Standard accounts. - * - *

To update your own account, use the Dashboard. Refer to our Connect documentation to learn - * more about updating accounts. + * Returns a list of capabilities associated with the account. The capabilities are returned + * sorted by creation date, with the most recent capability appearing first. */ - @Override - public Account update(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/accounts/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Account.class, options); + public CapabilityCollection capabilities() throws StripeException { + return capabilities((Map) null, (RequestOptions) null); } /** - * Updates a connected account by setting - * the values of the parameters passed. Any parameters not provided are left unchanged. Most - * parameters can be changed only for Custom accounts. (These are marked Custom - * Only below.) Parameters marked Custom and Express are not supported - * for Standard accounts. - * - *

To update your own account, use the Dashboard. Refer to our Connect documentation to learn - * more about updating accounts. + * Returns a list of capabilities associated with the account. The capabilities are returned + * sorted by creation date, with the most recent capability appearing first. */ - public Account update(AccountUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + public CapabilityCollection capabilities(Map params) throws StripeException { + return capabilities(params, (RequestOptions) null); } /** - * Updates a connected account by setting - * the values of the parameters passed. Any parameters not provided are left unchanged. Most - * parameters can be changed only for Custom accounts. (These are marked Custom - * Only below.) Parameters marked Custom and Express are not supported - * for Standard accounts. - * - *

To update your own account, use the Dashboard. Refer to our Connect documentation to learn - * more about updating accounts. + * Returns a list of capabilities associated with the account. The capabilities are returned + * sorted by creation date, with the most recent capability appearing first. */ - public Account update(AccountUpdateParams params, RequestOptions options) throws StripeException { + public CapabilityCollection capabilities(Map params, RequestOptions options) + throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/accounts/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Account.class, options); - } - - /** - * Returns a list of accounts connected to your platform via Connect. If you’re not a platform, the list is - * empty. - */ - public static AccountCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); + String.format("/v1/accounts/%s/capabilities", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.requestCollection(url, params, CapabilityCollection.class, options); } /** - * Returns a list of accounts connected to your platform via Connect. If you’re not a platform, the list is - * empty. + * Returns a list of capabilities associated with the account. The capabilities are returned + * sorted by creation date, with the most recent capability appearing first. */ - public static AccountCollection list(Map params, RequestOptions options) + public CapabilityCollection capabilities(AccountCapabilitiesParams params) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/accounts"); - return ApiResource.requestCollection(url, params, AccountCollection.class, options); - } - - /** - * Returns a list of accounts connected to your platform via Connect. If you’re not a platform, the list is - * empty. - */ - public static AccountCollection list(AccountListParams params) throws StripeException { - return list(params, (RequestOptions) null); + return capabilities(params, (RequestOptions) null); } /** - * Returns a list of accounts connected to your platform via Connect. If you’re not a platform, the list is - * empty. + * Returns a list of capabilities associated with the account. The capabilities are returned + * sorted by creation date, with the most recent capability appearing first. */ - public static AccountCollection list(AccountListParams params, RequestOptions options) + public CapabilityCollection capabilities(AccountCapabilitiesParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/accounts"); - return ApiResource.requestCollection(url, params, AccountCollection.class, options); + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/accounts/%s/capabilities", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.requestCollection(url, params, CapabilityCollection.class, options); } /** @@ -425,57 +313,43 @@ public Account delete(Map params, RequestOptions options) throws } /** - * With Connect, you may flag accounts as - * suspicious. - * - *

Test-mode Custom and Express accounts can be rejected at any time. Accounts created using - * live-mode keys may only be rejected once all balances are zero. + * Returns a list of accounts connected to your platform via Connect. If you’re not a platform, the list is + * empty. */ - public Account reject(Map params) throws StripeException { - return reject(params, (RequestOptions) null); + public static AccountCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); } /** - * With Connect, you may flag accounts as - * suspicious. - * - *

Test-mode Custom and Express accounts can be rejected at any time. Accounts created using - * live-mode keys may only be rejected once all balances are zero. + * Returns a list of accounts connected to your platform via Connect. If you’re not a platform, the list is + * empty. */ - public Account reject(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/accounts/%s/reject", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Account.class, options); + public static AccountCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/accounts"); + return ApiResource.requestCollection(url, params, AccountCollection.class, options); } /** - * With Connect, you may flag accounts as - * suspicious. - * - *

Test-mode Custom and Express accounts can be rejected at any time. Accounts created using - * live-mode keys may only be rejected once all balances are zero. + * Returns a list of accounts connected to your platform via Connect. If you’re not a platform, the list is + * empty. */ - public Account reject(AccountRejectParams params) throws StripeException { - return reject(params, (RequestOptions) null); + public static AccountCollection list(AccountListParams params) throws StripeException { + return list(params, (RequestOptions) null); } /** - * With Connect, you may flag accounts as - * suspicious. - * - *

Test-mode Custom and Express accounts can be rejected at any time. Accounts created using - * live-mode keys may only be rejected once all balances are zero. + * Returns a list of accounts connected to your platform via Connect. If you’re not a platform, the list is + * empty. */ - public Account reject(AccountRejectParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/accounts/%s/reject", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Account.class, options); + public static AccountCollection list(AccountListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/accounts"); + return ApiResource.requestCollection(url, params, AccountCollection.class, options); } /** @@ -531,56 +405,189 @@ public PersonCollection persons(AccountPersonsParams params, RequestOptions opti } /** - * Returns a list of capabilities associated with the account. The capabilities are returned - * sorted by creation date, with the most recent capability appearing first. + * With Connect, you may flag accounts as + * suspicious. + * + *

Test-mode Custom and Express accounts can be rejected at any time. Accounts created using + * live-mode keys may only be rejected once all balances are zero. */ - public CapabilityCollection capabilities() throws StripeException { - return capabilities((Map) null, (RequestOptions) null); + public Account reject(Map params) throws StripeException { + return reject(params, (RequestOptions) null); } /** - * Returns a list of capabilities associated with the account. The capabilities are returned - * sorted by creation date, with the most recent capability appearing first. + * With Connect, you may flag accounts as + * suspicious. + * + *

Test-mode Custom and Express accounts can be rejected at any time. Accounts created using + * live-mode keys may only be rejected once all balances are zero. */ - public CapabilityCollection capabilities(Map params) throws StripeException { - return capabilities(params, (RequestOptions) null); + public Account reject(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/accounts/%s/reject", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Account.class, options); } /** - * Returns a list of capabilities associated with the account. The capabilities are returned - * sorted by creation date, with the most recent capability appearing first. + * With Connect, you may flag accounts as + * suspicious. + * + *

Test-mode Custom and Express accounts can be rejected at any time. Accounts created using + * live-mode keys may only be rejected once all balances are zero. */ - public CapabilityCollection capabilities(Map params, RequestOptions options) + public Account reject(AccountRejectParams params) throws StripeException { + return reject(params, (RequestOptions) null); + } + + /** + * With Connect, you may flag accounts as + * suspicious. + * + *

Test-mode Custom and Express accounts can be rejected at any time. Accounts created using + * live-mode keys may only be rejected once all balances are zero. + */ + public Account reject(AccountRejectParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/accounts/%s/reject", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Account.class, options); + } + + /** Retrieves the details of an account. */ + public static Account retrieve() throws StripeException { + return retrieve((Map) null, (RequestOptions) null); + } + + /** Retrieves the details of an account. */ + public static Account retrieve(RequestOptions options) throws StripeException { + return retrieve((Map) null, options); + } + + /** Retrieves the details of an account. */ + public static Account retrieve(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/account"); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Account.class, options); + } + + /** Retrieves the details of an account. */ + public static Account retrieve(AccountRetrieveParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/account"); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Account.class, options); + } + + /** Retrieves the details of an account. */ + public static Account retrieve(String account) throws StripeException { + return retrieve(account, (Map) null, (RequestOptions) null); + } + + /** Retrieves the details of an account. */ + public static Account retrieve(String account, RequestOptions options) throws StripeException { + return retrieve(account, (Map) null, options); + } + + /** Retrieves the details of an account. */ + public static Account retrieve(String account, Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/accounts/%s/capabilities", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.requestCollection(url, params, CapabilityCollection.class, options); + String.format("/v1/accounts/%s", ApiResource.urlEncodeId(account))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Account.class, options); + } + + /** Retrieves the details of an account. */ + public static Account retrieve( + String account, AccountRetrieveParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/accounts/%s", ApiResource.urlEncodeId(account))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Account.class, options); } /** - * Returns a list of capabilities associated with the account. The capabilities are returned - * sorted by creation date, with the most recent capability appearing first. + * Updates a connected account by setting + * the values of the parameters passed. Any parameters not provided are left unchanged. Most + * parameters can be changed only for Custom accounts. (These are marked Custom + * Only below.) Parameters marked Custom and Express are not supported + * for Standard accounts. + * + *

To update your own account, use the Dashboard. Refer to our Connect documentation to learn + * more about updating accounts. */ - public CapabilityCollection capabilities(AccountCapabilitiesParams params) - throws StripeException { - return capabilities(params, (RequestOptions) null); + @Override + public Account update(Map params) throws StripeException { + return update(params, (RequestOptions) null); } /** - * Returns a list of capabilities associated with the account. The capabilities are returned - * sorted by creation date, with the most recent capability appearing first. + * Updates a connected account by setting + * the values of the parameters passed. Any parameters not provided are left unchanged. Most + * parameters can be changed only for Custom accounts. (These are marked Custom + * Only below.) Parameters marked Custom and Express are not supported + * for Standard accounts. + * + *

To update your own account, use the Dashboard. Refer to our Connect documentation to learn + * more about updating accounts. */ - public CapabilityCollection capabilities(AccountCapabilitiesParams params, RequestOptions options) - throws StripeException { + @Override + public Account update(Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/accounts/%s/capabilities", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.requestCollection(url, params, CapabilityCollection.class, options); + String.format("/v1/accounts/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Account.class, options); + } + + /** + * Updates a connected account by setting + * the values of the parameters passed. Any parameters not provided are left unchanged. Most + * parameters can be changed only for Custom accounts. (These are marked Custom + * Only below.) Parameters marked Custom and Express are not supported + * for Standard accounts. + * + *

To update your own account, use the Dashboard. Refer to our Connect documentation to learn + * more about updating accounts. + */ + public Account update(AccountUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Updates a connected account by setting + * the values of the parameters passed. Any parameters not provided are left unchanged. Most + * parameters can be changed only for Custom accounts. (These are marked Custom + * Only below.) Parameters marked Custom and Express are not supported + * for Standard accounts. + * + *

To update your own account, use the Dashboard. Refer to our Connect documentation to learn + * more about updating accounts. + */ + public Account update(AccountUpdateParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/accounts/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Account.class, options); } @Getter @@ -971,13 +978,6 @@ public static class Company extends StripeObject { @SerializedName("name_kanji") String nameKanji; - /** - * This hash is used to attest that the beneficial owner information provided to Stripe is both - * current and correct. - */ - @SerializedName("ownership_declaration") - OwnershipDeclaration ownershipDeclaration; - /** * Whether the company's owners have been provided. This Boolean will be {@code true} if you've * manually indicated that all owners are provided via Related guide: Connect + * Onboarding. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/ApplePayDomain.java b/src/main/java/com/stripe/model/ApplePayDomain.java index e23d63b90bb..d80fd050754 100644 --- a/src/main/java/com/stripe/model/ApplePayDomain.java +++ b/src/main/java/com/stripe/model/ApplePayDomain.java @@ -49,31 +49,6 @@ public class ApplePayDomain extends ApiResource implements HasId { @SerializedName("object") String object; - /** List apple pay domains. */ - public static ApplePayDomainCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** List apple pay domains. */ - public static ApplePayDomainCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/apple_pay/domains"); - return ApiResource.requestCollection(url, params, ApplePayDomainCollection.class, options); - } - - /** List apple pay domains. */ - public static ApplePayDomainCollection list(ApplePayDomainListParams params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** List apple pay domains. */ - public static ApplePayDomainCollection list( - ApplePayDomainListParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/apple_pay/domains"); - return ApiResource.requestCollection(url, params, ApplePayDomainCollection.class, options); - } - /** Create an apple pay domain. */ public static ApplePayDomain create(Map params) throws StripeException { return create(params, (RequestOptions) null); @@ -100,6 +75,58 @@ public static ApplePayDomain create(ApplePayDomainCreateParams params, RequestOp ApiResource.RequestMethod.POST, url, params, ApplePayDomain.class, options); } + /** Delete an apple pay domain. */ + public ApplePayDomain delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); + } + + /** Delete an apple pay domain. */ + public ApplePayDomain delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); + } + + /** Delete an apple pay domain. */ + public ApplePayDomain delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); + } + + /** Delete an apple pay domain. */ + public ApplePayDomain delete(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/apple_pay/domains/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, ApplePayDomain.class, options); + } + + /** List apple pay domains. */ + public static ApplePayDomainCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** List apple pay domains. */ + public static ApplePayDomainCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/apple_pay/domains"); + return ApiResource.requestCollection(url, params, ApplePayDomainCollection.class, options); + } + + /** List apple pay domains. */ + public static ApplePayDomainCollection list(ApplePayDomainListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** List apple pay domains. */ + public static ApplePayDomainCollection list( + ApplePayDomainListParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/apple_pay/domains"); + return ApiResource.requestCollection(url, params, ApplePayDomainCollection.class, options); + } + /** Retrieve an apple pay domain. */ public static ApplePayDomain retrieve(String domain) throws StripeException { return retrieve(domain, (Map) null, (RequestOptions) null); @@ -135,31 +162,4 @@ public static ApplePayDomain retrieve( return ApiResource.request( ApiResource.RequestMethod.GET, url, params, ApplePayDomain.class, options); } - - /** Delete an apple pay domain. */ - public ApplePayDomain delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); - } - - /** Delete an apple pay domain. */ - public ApplePayDomain delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); - } - - /** Delete an apple pay domain. */ - public ApplePayDomain delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** Delete an apple pay domain. */ - public ApplePayDomain delete(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/apple_pay/domains/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, ApplePayDomain.class, options); - } } diff --git a/src/main/java/com/stripe/model/Balance.java b/src/main/java/com/stripe/model/Balance.java index 2a5d50622f0..f15ea717791 100644 --- a/src/main/java/com/stripe/model/Balance.java +++ b/src/main/java/com/stripe/model/Balance.java @@ -13,6 +13,20 @@ import lombok.Getter; import lombok.Setter; +/** + * This is an object representing your Stripe balance. You can retrieve it to see the balance + * currently on your Stripe account. + * + *

You can also retrieve the balance history, which contains a list of transactions that + * contributed to the balance (charges, payouts, and so forth). + * + *

The available and pending amounts for each currency are broken down further by payment source + * types. + * + *

Related guide: Understanding + * Connect Account Balances. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/BalanceTransaction.java b/src/main/java/com/stripe/model/BalanceTransaction.java index 5e8ceb1e506..eb01d4db328 100644 --- a/src/main/java/com/stripe/model/BalanceTransaction.java +++ b/src/main/java/com/stripe/model/BalanceTransaction.java @@ -15,6 +15,13 @@ import lombok.Getter; import lombok.Setter; +/** + * Balance transactions represent funds moving through your Stripe account. They're created for + * every type of transaction that comes into or flows out of your Stripe account balance. + * + *

Related guide: Balance + * Transaction Types. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/BankAccount.java b/src/main/java/com/stripe/model/BankAccount.java index 5a7e71ae810..116b4612309 100644 --- a/src/main/java/com/stripe/model/BankAccount.java +++ b/src/main/java/com/stripe/model/BankAccount.java @@ -16,6 +16,17 @@ import lombok.Getter; import lombok.Setter; +/** + * These bank accounts are payment methods on {@code Customer} objects. + * + *

On the other hand External + * Accounts are transfer destinations on {@code Account} objects for Custom accounts. They can be bank + * accounts or debit cards as well, and are documented in the links above. + * + *

Related guide: Bank Debits + * and Transfers. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Capability.java b/src/main/java/com/stripe/model/Capability.java index 27da638fe3a..f22bf7eeec4 100644 --- a/src/main/java/com/stripe/model/Capability.java +++ b/src/main/java/com/stripe/model/Capability.java @@ -13,6 +13,12 @@ import lombok.Getter; import lombok.Setter; +/** + * This is an object representing a capability for a Stripe account. + * + *

Related guide: Account + * capabilities. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Card.java b/src/main/java/com/stripe/model/Card.java index ecb6b519163..72a92276fec 100644 --- a/src/main/java/com/stripe/model/Card.java +++ b/src/main/java/com/stripe/model/Card.java @@ -15,6 +15,12 @@ import lombok.Getter; import lombok.Setter; +/** + * You can store multiple cards on a customer in order to charge the customer later. You can also + * store multiple debit cards on a recipient in order to transfer to those cards later. + * + *

Related guide: Card Payments with Sources. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/CashBalance.java b/src/main/java/com/stripe/model/CashBalance.java index 2802bbb8289..2127f2580ee 100644 --- a/src/main/java/com/stripe/model/CashBalance.java +++ b/src/main/java/com/stripe/model/CashBalance.java @@ -13,6 +13,11 @@ import lombok.Getter; import lombok.Setter; +/** + * A customer's {@code Cash balance} represents real funds. Customers can add funds to their cash + * balance by sending a bank transfer. These funds can be used for payment and can eventually be + * paid out to your bank account. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -119,6 +124,39 @@ public CashBalance update(CashBalanceUpdateParams params, RequestOptions options ApiResource.RequestMethod.POST, url, params, CashBalance.class, options); } + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AppliedToPaymentTransaction extends StripeObject { + /** + * The Payment Intent that + * funds were applied to. + */ + @SerializedName("payment_intent") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField paymentIntent; + + /** Get ID of expandable {@code paymentIntent} object. */ + public String getPaymentIntent() { + return (this.paymentIntent != null) ? this.paymentIntent.getId() : null; + } + + public void setPaymentIntent(String id) { + this.paymentIntent = ApiResource.setExpandableFieldId(id, this.paymentIntent); + } + + /** Get expanded {@code paymentIntent}. */ + public PaymentIntent getPaymentIntentObject() { + return (this.paymentIntent != null) ? this.paymentIntent.getExpanded() : null; + } + + public void setPaymentIntentObject(PaymentIntent expandableObject) { + this.paymentIntent = + new ExpandableField(expandableObject.getId(), expandableObject); + } + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -131,4 +169,117 @@ public static class BalanceSettings extends StripeObject { @SerializedName("reconciliation_mode") String reconciliationMode; } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class FundedTransaction extends StripeObject { + @SerializedName("bank_transfer") + BankTransfer bankTransfer; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class BankTransfer extends StripeObject { + @SerializedName("eu_bank_transfer") + EuBankTransfer euBankTransfer; + + /** The user-supplied reference field on the bank transfer. */ + @SerializedName("reference") + String reference; + + /** + * The funding method type used to fund the customer balance. Permitted values include: {@code + * eu_bank_transfer}, {@code gb_bank_transfer}, {@code jp_bank_transfer}, or {@code + * mx_bank_transfer}. + * + *

One of {@code eu_bank_transfer}, {@code gb_bank_transfer}, {@code jp_bank_transfer}, or + * {@code mx_bank_transfer}. + */ + @SerializedName("type") + String type; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class EuBankTransfer extends StripeObject { + /** The BIC of the bank of the sender of the funding. */ + @SerializedName("bic") + String bic; + + /** The last 4 digits of the IBAN of the sender of the funding. */ + @SerializedName("iban_last4") + String ibanLast4; + + /** The full name of the sender, as supplied by the sending bank. */ + @SerializedName("sender_name") + String senderName; + } + } + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class RefundedFromPaymentTransaction extends StripeObject { + /** + * The Refund that moved these funds + * into the customer's cash balance. + */ + @SerializedName("refund") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField refund; + + /** Get ID of expandable {@code refund} object. */ + public String getRefund() { + return (this.refund != null) ? this.refund.getId() : null; + } + + public void setRefund(String id) { + this.refund = ApiResource.setExpandableFieldId(id, this.refund); + } + + /** Get expanded {@code refund}. */ + public Refund getRefundObject() { + return (this.refund != null) ? this.refund.getExpanded() : null; + } + + public void setRefundObject(Refund expandableObject) { + this.refund = new ExpandableField(expandableObject.getId(), expandableObject); + } + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class UnappliedFromPaymentTransaction extends StripeObject { + /** + * The Payment Intent that + * funds were unapplied from. + */ + @SerializedName("payment_intent") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField paymentIntent; + + /** Get ID of expandable {@code paymentIntent} object. */ + public String getPaymentIntent() { + return (this.paymentIntent != null) ? this.paymentIntent.getId() : null; + } + + public void setPaymentIntent(String id) { + this.paymentIntent = ApiResource.setExpandableFieldId(id, this.paymentIntent); + } + + /** Get expanded {@code paymentIntent}. */ + public PaymentIntent getPaymentIntentObject() { + return (this.paymentIntent != null) ? this.paymentIntent.getExpanded() : null; + } + + public void setPaymentIntentObject(PaymentIntent expandableObject) { + this.paymentIntent = + new ExpandableField(expandableObject.getId(), expandableObject); + } + } } diff --git a/src/main/java/com/stripe/model/Charge.java b/src/main/java/com/stripe/model/Charge.java index e29e63aca00..26bbc83cb1d 100644 --- a/src/main/java/com/stripe/model/Charge.java +++ b/src/main/java/com/stripe/model/Charge.java @@ -19,6 +19,14 @@ import lombok.Getter; import lombok.Setter; +/** + * To charge a credit or a debit card, you create a {@code Charge} object. You can retrieve and + * refund individual charges as well as list all charges. Charges are identified by a unique, random + * ID. + * + *

Related guide: Accept a + * payment with the Charges API. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -600,91 +608,97 @@ public void setTransferObject(Transfer expandableObject) { } /** - * Search for charges you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static ChargeSearchResult search(Map params) throws StripeException { - return search(params, (RequestOptions) null); - } - - /** - * Search for charges you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static ChargeSearchResult search(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/charges/search"); - return ApiResource.requestSearchResult(url, params, ChargeSearchResult.class, options); - } - - /** - * Search for charges you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step + * payment flow, where first you created a + * charge with the capture option set to false. + * + *

Uncaptured payments expire a set number of days after they are created (7 by default). If they are not + * captured by that point in time, they will be marked as refunded and will no longer be + * capturable. */ - public static ChargeSearchResult search(ChargeSearchParams params) throws StripeException { - return search(params, (RequestOptions) null); + public Charge capture() throws StripeException { + return capture((Map) null, (RequestOptions) null); } /** - * Search for charges you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step + * payment flow, where first you created a + * charge with the capture option set to false. + * + *

Uncaptured payments expire a set number of days after they are created (7 by default). If they are not + * captured by that point in time, they will be marked as refunded and will no longer be + * capturable. */ - public static ChargeSearchResult search(ChargeSearchParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/charges/search"); - return ApiResource.requestSearchResult(url, params, ChargeSearchResult.class, options); + public Charge capture(RequestOptions options) throws StripeException { + return capture((Map) null, options); } /** - * Returns a list of charges you’ve previously created. The charges are returned in sorted order, - * with the most recent charges appearing first. + * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step + * payment flow, where first you created a + * charge with the capture option set to false. + * + *

Uncaptured payments expire a set number of days after they are created (7 by default). If they are not + * captured by that point in time, they will be marked as refunded and will no longer be + * capturable. */ - public static ChargeCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); + public Charge capture(Map params) throws StripeException { + return capture(params, (RequestOptions) null); } /** - * Returns a list of charges you’ve previously created. The charges are returned in sorted order, - * with the most recent charges appearing first. + * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step + * payment flow, where first you created a + * charge with the capture option set to false. + * + *

Uncaptured payments expire a set number of days after they are created (7 by default). If they are not + * captured by that point in time, they will be marked as refunded and will no longer be + * capturable. */ - public static ChargeCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/charges"); - return ApiResource.requestCollection(url, params, ChargeCollection.class, options); + public Charge capture(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/charges/%s/capture", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Charge.class, options); } /** - * Returns a list of charges you’ve previously created. The charges are returned in sorted order, - * with the most recent charges appearing first. + * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step + * payment flow, where first you created a + * charge with the capture option set to false. + * + *

Uncaptured payments expire a set number of days after they are created (7 by default). If they are not + * captured by that point in time, they will be marked as refunded and will no longer be + * capturable. */ - public static ChargeCollection list(ChargeListParams params) throws StripeException { - return list(params, (RequestOptions) null); + public Charge capture(ChargeCaptureParams params) throws StripeException { + return capture(params, (RequestOptions) null); } /** - * Returns a list of charges you’ve previously created. The charges are returned in sorted order, - * with the most recent charges appearing first. + * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step + * payment flow, where first you created a + * charge with the capture option set to false. + * + *

Uncaptured payments expire a set number of days after they are created (7 by default). If they are not + * captured by that point in time, they will be marked as refunded and will no longer be + * capturable. */ - public static ChargeCollection list(ChargeListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/charges"); - return ApiResource.requestCollection(url, params, ChargeCollection.class, options); + public Charge capture(ChargeCaptureParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/charges/%s/capture", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Charge.class, options); } /** @@ -731,6 +745,42 @@ public static Charge create(ChargeCreateParams params, RequestOptions options) return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Charge.class, options); } + /** + * Returns a list of charges you’ve previously created. The charges are returned in sorted order, + * with the most recent charges appearing first. + */ + public static ChargeCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** + * Returns a list of charges you’ve previously created. The charges are returned in sorted order, + * with the most recent charges appearing first. + */ + public static ChargeCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/charges"); + return ApiResource.requestCollection(url, params, ChargeCollection.class, options); + } + + /** + * Returns a list of charges you’ve previously created. The charges are returned in sorted order, + * with the most recent charges appearing first. + */ + public static ChargeCollection list(ChargeListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** + * Returns a list of charges you’ve previously created. The charges are returned in sorted order, + * with the most recent charges appearing first. + */ + public static ChargeCollection list(ChargeListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/charges"); + return ApiResource.requestCollection(url, params, ChargeCollection.class, options); + } + /** * Retrieves the details of a charge that has previously been created. Supply the unique charge ID * that was returned from your previous request, and Stripe will return the corresponding charge @@ -777,6 +827,58 @@ public static Charge retrieve(String charge, ChargeRetrieveParams params, Reques return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Charge.class, options); } + /** + * Search for charges you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. + */ + public static ChargeSearchResult search(Map params) throws StripeException { + return search(params, (RequestOptions) null); + } + + /** + * Search for charges you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. + */ + public static ChargeSearchResult search(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/charges/search"); + return ApiResource.requestSearchResult(url, params, ChargeSearchResult.class, options); + } + + /** + * Search for charges you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. + */ + public static ChargeSearchResult search(ChargeSearchParams params) throws StripeException { + return search(params, (RequestOptions) null); + } + + /** + * Search for charges you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. + */ + public static ChargeSearchResult search(ChargeSearchParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/charges/search"); + return ApiResource.requestSearchResult(url, params, ChargeSearchResult.class, options); + } + /** * Updates the specified charge by setting the values of the parameters passed. Any parameters not * provided will be left unchanged. @@ -821,100 +923,6 @@ public Charge update(ChargeUpdateParams params, RequestOptions options) throws S return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Charge.class, options); } - /** - * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step - * payment flow, where first you created a - * charge with the capture option set to false. - * - *

Uncaptured payments expire a set number of days after they are created (7 by default). If they are not - * captured by that point in time, they will be marked as refunded and will no longer be - * capturable. - */ - public Charge capture() throws StripeException { - return capture((Map) null, (RequestOptions) null); - } - - /** - * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step - * payment flow, where first you created a - * charge with the capture option set to false. - * - *

Uncaptured payments expire a set number of days after they are created (7 by default). If they are not - * captured by that point in time, they will be marked as refunded and will no longer be - * capturable. - */ - public Charge capture(RequestOptions options) throws StripeException { - return capture((Map) null, options); - } - - /** - * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step - * payment flow, where first you created a - * charge with the capture option set to false. - * - *

Uncaptured payments expire a set number of days after they are created (7 by default). If they are not - * captured by that point in time, they will be marked as refunded and will no longer be - * capturable. - */ - public Charge capture(Map params) throws StripeException { - return capture(params, (RequestOptions) null); - } - - /** - * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step - * payment flow, where first you created a - * charge with the capture option set to false. - * - *

Uncaptured payments expire a set number of days after they are created (7 by default). If they are not - * captured by that point in time, they will be marked as refunded and will no longer be - * capturable. - */ - public Charge capture(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/charges/%s/capture", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Charge.class, options); - } - - /** - * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step - * payment flow, where first you created a - * charge with the capture option set to false. - * - *

Uncaptured payments expire a set number of days after they are created (7 by default). If they are not - * captured by that point in time, they will be marked as refunded and will no longer be - * capturable. - */ - public Charge capture(ChargeCaptureParams params) throws StripeException { - return capture(params, (RequestOptions) null); - } - - /** - * Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step - * payment flow, where first you created a - * charge with the capture option set to false. - * - *

Uncaptured payments expire a set number of days after they are created (7 by default). If they are not - * captured by that point in time, they will be marked as refunded and will no longer be - * capturable. - */ - public Charge capture(ChargeCaptureParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/charges/%s/capture", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Charge.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -2658,6 +2666,10 @@ public static class WechatPay extends StripeObject { } } + /** + * Options to configure Radar. See Radar + * Session for more information. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/CountrySpec.java b/src/main/java/com/stripe/model/CountrySpec.java index aeacd627422..0305dfbb6a3 100644 --- a/src/main/java/com/stripe/model/CountrySpec.java +++ b/src/main/java/com/stripe/model/CountrySpec.java @@ -14,6 +14,14 @@ import lombok.Getter; import lombok.Setter; +/** + * Stripe needs to collect certain pieces of information about each account created. These + * requirements can differ depending on the account's country. The Country Specs API makes these + * rules available to your integration. + * + *

You can also view the information from this API call as an online guide. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Coupon.java b/src/main/java/com/stripe/model/Coupon.java index 6e3bd1a9473..605feebbbd8 100644 --- a/src/main/java/com/stripe/model/Coupon.java +++ b/src/main/java/com/stripe/model/Coupon.java @@ -17,6 +17,16 @@ import lombok.Getter; import lombok.Setter; +/** + * A coupon contains information about a percent-off or amount-off discount you might want to apply + * to a customer. Coupons may be applied to subscriptions, invoices, checkout sessions, quotes, and more. Coupons do not work with + * conventional one-off charges or payment intents. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -131,30 +141,6 @@ public class Coupon extends ApiResource implements HasId, MetadataStore @SerializedName("valid") Boolean valid; - /** Returns a list of your coupons. */ - public static CouponCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of your coupons. */ - public static CouponCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/coupons"); - return ApiResource.requestCollection(url, params, CouponCollection.class, options); - } - - /** Returns a list of your coupons. */ - public static CouponCollection list(CouponListParams params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of your coupons. */ - public static CouponCollection list(CouponListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/coupons"); - return ApiResource.requestCollection(url, params, CouponCollection.class, options); - } - /** * You can create coupons easily via the coupon * management page of the Stripe dashboard. Coupon creation is also accessible via the API if @@ -223,6 +209,76 @@ public static Coupon create(CouponCreateParams params, RequestOptions options) return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Coupon.class, options); } + /** + * You can delete coupons via the coupon + * management page of the Stripe dashboard. However, deleting a coupon does not affect any + * customers who have already applied the coupon; it means that new customers can’t redeem the + * coupon. You can also delete coupons via the API. + */ + public Coupon delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); + } + + /** + * You can delete coupons via the coupon + * management page of the Stripe dashboard. However, deleting a coupon does not affect any + * customers who have already applied the coupon; it means that new customers can’t redeem the + * coupon. You can also delete coupons via the API. + */ + public Coupon delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); + } + + /** + * You can delete coupons via the coupon + * management page of the Stripe dashboard. However, deleting a coupon does not affect any + * customers who have already applied the coupon; it means that new customers can’t redeem the + * coupon. You can also delete coupons via the API. + */ + public Coupon delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); + } + + /** + * You can delete coupons via the coupon + * management page of the Stripe dashboard. However, deleting a coupon does not affect any + * customers who have already applied the coupon; it means that new customers can’t redeem the + * coupon. You can also delete coupons via the API. + */ + public Coupon delete(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/coupons/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, Coupon.class, options); + } + + /** Returns a list of your coupons. */ + public static CouponCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of your coupons. */ + public static CouponCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/coupons"); + return ApiResource.requestCollection(url, params, CouponCollection.class, options); + } + + /** Returns a list of your coupons. */ + public static CouponCollection list(CouponListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of your coupons. */ + public static CouponCollection list(CouponListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/coupons"); + return ApiResource.requestCollection(url, params, CouponCollection.class, options); + } + /** Retrieves the coupon with the given ID. */ public static Coupon retrieve(String coupon) throws StripeException { return retrieve(coupon, (Map) null, (RequestOptions) null); @@ -297,52 +353,6 @@ public Coupon update(CouponUpdateParams params, RequestOptions options) throws S return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Coupon.class, options); } - /** - * You can delete coupons via the coupon - * management page of the Stripe dashboard. However, deleting a coupon does not affect any - * customers who have already applied the coupon; it means that new customers can’t redeem the - * coupon. You can also delete coupons via the API. - */ - public Coupon delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); - } - - /** - * You can delete coupons via the coupon - * management page of the Stripe dashboard. However, deleting a coupon does not affect any - * customers who have already applied the coupon; it means that new customers can’t redeem the - * coupon. You can also delete coupons via the API. - */ - public Coupon delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); - } - - /** - * You can delete coupons via the coupon - * management page of the Stripe dashboard. However, deleting a coupon does not affect any - * customers who have already applied the coupon; it means that new customers can’t redeem the - * coupon. You can also delete coupons via the API. - */ - public Coupon delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** - * You can delete coupons via the coupon - * management page of the Stripe dashboard. However, deleting a coupon does not affect any - * customers who have already applied the coupon; it means that new customers can’t redeem the - * coupon. You can also delete coupons via the API. - */ - public Coupon delete(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/coupons/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, Coupon.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/CreditNote.java b/src/main/java/com/stripe/model/CreditNote.java index 5af4775f951..c0d208b2d00 100644 --- a/src/main/java/com/stripe/model/CreditNote.java +++ b/src/main/java/com/stripe/model/CreditNote.java @@ -18,6 +18,12 @@ import lombok.Getter; import lombok.Setter; +/** + * Issue a credit note to adjust an invoice's amount after the invoice is finalized. + * + *

Related guide: Credit + * Notes. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -371,6 +377,30 @@ public static CreditNote create(CreditNoteCreateParams params, RequestOptions op ApiResource.RequestMethod.POST, url, params, CreditNote.class, options); } + /** Returns a list of credit notes. */ + public static CreditNoteCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of credit notes. */ + public static CreditNoteCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/credit_notes"); + return ApiResource.requestCollection(url, params, CreditNoteCollection.class, options); + } + + /** Returns a list of credit notes. */ + public static CreditNoteCollection list(CreditNoteListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of credit notes. */ + public static CreditNoteCollection list(CreditNoteListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/credit_notes"); + return ApiResource.requestCollection(url, params, CreditNoteCollection.class, options); + } + /** Get a preview of a credit note without creating it. */ public static CreditNote preview(Map params) throws StripeException { return preview(params, (RequestOptions) null); @@ -429,30 +459,6 @@ public static CreditNote retrieve( ApiResource.RequestMethod.GET, url, params, CreditNote.class, options); } - /** Returns a list of credit notes. */ - public static CreditNoteCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of credit notes. */ - public static CreditNoteCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/credit_notes"); - return ApiResource.requestCollection(url, params, CreditNoteCollection.class, options); - } - - /** Returns a list of credit notes. */ - public static CreditNoteCollection list(CreditNoteListParams params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of credit notes. */ - public static CreditNoteCollection list(CreditNoteListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/credit_notes"); - return ApiResource.requestCollection(url, params, CreditNoteCollection.class, options); - } - /** Updates an existing credit note. */ @Override public CreditNote update(Map params) throws StripeException { diff --git a/src/main/java/com/stripe/model/Customer.java b/src/main/java/com/stripe/model/Customer.java index dabc8ddd71d..4cc817f1e5a 100644 --- a/src/main/java/com/stripe/model/Customer.java +++ b/src/main/java/com/stripe/model/Customer.java @@ -23,6 +23,13 @@ import lombok.Getter; import lombok.Setter; +/** + * This object represents a customer of your business. It lets you create recurring charges and + * track payments that belong to the same customer. + * + *

Related guide: Save a card + * during payment. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -238,91 +245,61 @@ public void setTestClockObject(TestClock expandableObject) { } /** - * Search for customers you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static CustomerSearchResult search(Map params) throws StripeException { - return search(params, (RequestOptions) null); - } - - /** - * Search for customers you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static CustomerSearchResult search(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/customers/search"); - return ApiResource.requestSearchResult(url, params, CustomerSearchResult.class, options); - } - - /** - * Search for customers you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * Returns a list of transactions that updated the customer’s balances. */ - public static CustomerSearchResult search(CustomerSearchParams params) throws StripeException { - return search(params, (RequestOptions) null); + public CustomerBalanceTransactionCollection balanceTransactions() throws StripeException { + return balanceTransactions((Map) null, (RequestOptions) null); } /** - * Search for customers you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * Returns a list of transactions that updated the customer’s balances. */ - public static CustomerSearchResult search(CustomerSearchParams params, RequestOptions options) + public CustomerBalanceTransactionCollection balanceTransactions(Map params) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/customers/search"); - return ApiResource.requestSearchResult(url, params, CustomerSearchResult.class, options); - } - - /** - * Returns a list of your customers. The customers are returned sorted by creation date, with the - * most recent customers appearing first. - */ - public static CustomerCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); + return balanceTransactions(params, (RequestOptions) null); } /** - * Returns a list of your customers. The customers are returned sorted by creation date, with the - * most recent customers appearing first. + * Returns a list of transactions that updated the customer’s balances. */ - public static CustomerCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/customers"); - return ApiResource.requestCollection(url, params, CustomerCollection.class, options); + public CustomerBalanceTransactionCollection balanceTransactions( + Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/customers/%s/balance_transactions", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.requestCollection( + url, params, CustomerBalanceTransactionCollection.class, options); } /** - * Returns a list of your customers. The customers are returned sorted by creation date, with the - * most recent customers appearing first. + * Returns a list of transactions that updated the customer’s balances. */ - public static CustomerCollection list(CustomerListParams params) throws StripeException { - return list(params, (RequestOptions) null); + public CustomerBalanceTransactionCollection balanceTransactions( + CustomerBalanceTransactionsParams params) throws StripeException { + return balanceTransactions(params, (RequestOptions) null); } /** - * Returns a list of your customers. The customers are returned sorted by creation date, with the - * most recent customers appearing first. + * Returns a list of transactions that updated the customer’s balances. */ - public static CustomerCollection list(CustomerListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/customers"); - return ApiResource.requestCollection(url, params, CustomerCollection.class, options); + public CustomerBalanceTransactionCollection balanceTransactions( + CustomerBalanceTransactionsParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/customers/%s/balance_transactions", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.requestCollection( + url, params, CustomerBalanceTransactionCollection.class, options); } /** Creates a new customer object. */ @@ -351,125 +328,63 @@ public static Customer create(CustomerCreateParams params, RequestOptions option ApiResource.RequestMethod.POST, url, params, Customer.class, options); } - /** Retrieves a Customer object. */ - public static Customer retrieve(String customer) throws StripeException { - return retrieve(customer, (Map) null, (RequestOptions) null); - } - - /** Retrieves a Customer object. */ - public static Customer retrieve(String customer, RequestOptions options) throws StripeException { - return retrieve(customer, (Map) null, options); - } - - /** Retrieves a Customer object. */ - public static Customer retrieve( - String customer, Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/customers/%s", ApiResource.urlEncodeId(customer))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Customer.class, options); - } - - /** Retrieves a Customer object. */ - public static Customer retrieve( - String customer, CustomerRetrieveParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/customers/%s", ApiResource.urlEncodeId(customer))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Customer.class, options); - } - /** - * Updates the specified customer by setting the values of the parameters passed. Any parameters - * not provided will be left unchanged. For example, if you pass the source - * parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges - * in the future. When you update a customer to a new valid card source by passing the - * source parameter: for each of the customer’s current subscriptions, if the - * subscription bills automatically and is in the past_due state, then the latest - * open invoice for the subscription with automatic collection enabled will be retried. This retry - * will not count as an automatic retry, and will not affect the next regularly scheduled payment - * for the invoice. Changing the default_source for a customer will not trigger - * this behavior. - * - *

This request accepts mostly the same arguments as the customer creation call. + * Retrieve funding instructions for a customer cash balance. If funding instructions do not yet + * exist for the customer, new funding instructions will be created. If funding instructions have + * already been created for a given customer, the same funding instructions will be retrieved. In + * other words, we will return the same funding instructions each time. */ - @Override - public Customer update(Map params) throws StripeException { - return update(params, (RequestOptions) null); + public FundingInstructions createFundingInstructions(Map params) + throws StripeException { + return createFundingInstructions(params, (RequestOptions) null); } /** - * Updates the specified customer by setting the values of the parameters passed. Any parameters - * not provided will be left unchanged. For example, if you pass the source - * parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges - * in the future. When you update a customer to a new valid card source by passing the - * source parameter: for each of the customer’s current subscriptions, if the - * subscription bills automatically and is in the past_due state, then the latest - * open invoice for the subscription with automatic collection enabled will be retried. This retry - * will not count as an automatic retry, and will not affect the next regularly scheduled payment - * for the invoice. Changing the default_source for a customer will not trigger - * this behavior. - * - *

This request accepts mostly the same arguments as the customer creation call. + * Retrieve funding instructions for a customer cash balance. If funding instructions do not yet + * exist for the customer, new funding instructions will be created. If funding instructions have + * already been created for a given customer, the same funding instructions will be retrieved. In + * other words, we will return the same funding instructions each time. */ - @Override - public Customer update(Map params, RequestOptions options) - throws StripeException { + public FundingInstructions createFundingInstructions( + Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/customers/%s", ApiResource.urlEncodeId(this.getId()))); + String.format( + "/v1/customers/%s/funding_instructions", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, Customer.class, options); + ApiResource.RequestMethod.POST, url, params, FundingInstructions.class, options); } /** - * Updates the specified customer by setting the values of the parameters passed. Any parameters - * not provided will be left unchanged. For example, if you pass the source - * parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges - * in the future. When you update a customer to a new valid card source by passing the - * source parameter: for each of the customer’s current subscriptions, if the - * subscription bills automatically and is in the past_due state, then the latest - * open invoice for the subscription with automatic collection enabled will be retried. This retry - * will not count as an automatic retry, and will not affect the next regularly scheduled payment - * for the invoice. Changing the default_source for a customer will not trigger - * this behavior. - * - *

This request accepts mostly the same arguments as the customer creation call. + * Retrieve funding instructions for a customer cash balance. If funding instructions do not yet + * exist for the customer, new funding instructions will be created. If funding instructions have + * already been created for a given customer, the same funding instructions will be retrieved. In + * other words, we will return the same funding instructions each time. */ - public Customer update(CustomerUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + public FundingInstructions createFundingInstructions( + CustomerCreateFundingInstructionsParams params) throws StripeException { + return createFundingInstructions(params, (RequestOptions) null); } /** - * Updates the specified customer by setting the values of the parameters passed. Any parameters - * not provided will be left unchanged. For example, if you pass the source - * parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges - * in the future. When you update a customer to a new valid card source by passing the - * source parameter: for each of the customer’s current subscriptions, if the - * subscription bills automatically and is in the past_due state, then the latest - * open invoice for the subscription with automatic collection enabled will be retried. This retry - * will not count as an automatic retry, and will not affect the next regularly scheduled payment - * for the invoice. Changing the default_source for a customer will not trigger - * this behavior. - * - *

This request accepts mostly the same arguments as the customer creation call. + * Retrieve funding instructions for a customer cash balance. If funding instructions do not yet + * exist for the customer, new funding instructions will be created. If funding instructions have + * already been created for a given customer, the same funding instructions will be retrieved. In + * other words, we will return the same funding instructions each time. */ - public Customer update(CustomerUpdateParams params, RequestOptions options) + public FundingInstructions createFundingInstructions( + CustomerCreateFundingInstructionsParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/customers/%s", ApiResource.urlEncodeId(this.getId()))); + String.format( + "/v1/customers/%s/funding_instructions", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, Customer.class, options); + ApiResource.RequestMethod.POST, url, params, FundingInstructions.class, options); } /** @@ -511,6 +426,64 @@ public Customer delete(Map params, RequestOptions options) ApiResource.RequestMethod.DELETE, url, params, Customer.class, options); } + /** Removes the currently applied discount on a customer. */ + public Discount deleteDiscount() throws StripeException { + return deleteDiscount((Map) null, (RequestOptions) null); + } + + /** Removes the currently applied discount on a customer. */ + public Discount deleteDiscount(Map params) throws StripeException { + return deleteDiscount(params, (RequestOptions) null); + } + + /** Removes the currently applied discount on a customer. */ + public Discount deleteDiscount(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/customers/%s/discount", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, Discount.class, options); + } + + /** + * Returns a list of your customers. The customers are returned sorted by creation date, with the + * most recent customers appearing first. + */ + public static CustomerCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** + * Returns a list of your customers. The customers are returned sorted by creation date, with the + * most recent customers appearing first. + */ + public static CustomerCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/customers"); + return ApiResource.requestCollection(url, params, CustomerCollection.class, options); + } + + /** + * Returns a list of your customers. The customers are returned sorted by creation date, with the + * most recent customers appearing first. + */ + public static CustomerCollection list(CustomerListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** + * Returns a list of your customers. The customers are returned sorted by creation date, with the + * most recent customers appearing first. + */ + public static CustomerCollection list(CustomerListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/customers"); + return ApiResource.requestCollection(url, params, CustomerCollection.class, options); + } + /** Returns a list of PaymentMethods for a given Customer. */ public PaymentMethodCollection listPaymentMethods(Map params) throws StripeException { @@ -547,6 +520,39 @@ public PaymentMethodCollection listPaymentMethods( return ApiResource.requestCollection(url, params, PaymentMethodCollection.class, options); } + /** Retrieves a Customer object. */ + public static Customer retrieve(String customer) throws StripeException { + return retrieve(customer, (Map) null, (RequestOptions) null); + } + + /** Retrieves a Customer object. */ + public static Customer retrieve(String customer, RequestOptions options) throws StripeException { + return retrieve(customer, (Map) null, options); + } + + /** Retrieves a Customer object. */ + public static Customer retrieve( + String customer, Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/customers/%s", ApiResource.urlEncodeId(customer))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Customer.class, options); + } + + /** Retrieves a Customer object. */ + public static Customer retrieve( + String customer, CustomerRetrieveParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/customers/%s", ApiResource.urlEncodeId(customer))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Customer.class, options); + } + /** Retrieves a PaymentMethod object for a given Customer. */ public PaymentMethod retrievePaymentMethod( String customer, Map params, RequestOptions options) throws StripeException { @@ -577,142 +583,143 @@ public PaymentMethod retrievePaymentMethod( } /** - * Returns a list of transactions that updated the customer’s balances. + * Search for customers you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public CustomerBalanceTransactionCollection balanceTransactions() throws StripeException { - return balanceTransactions((Map) null, (RequestOptions) null); + public static CustomerSearchResult search(Map params) throws StripeException { + return search(params, (RequestOptions) null); } /** - * Returns a list of transactions that updated the customer’s balances. + * Search for customers you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public CustomerBalanceTransactionCollection balanceTransactions(Map params) + public static CustomerSearchResult search(Map params, RequestOptions options) throws StripeException { - return balanceTransactions(params, (RequestOptions) null); + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/customers/search"); + return ApiResource.requestSearchResult(url, params, CustomerSearchResult.class, options); } /** - * Returns a list of transactions that updated the customer’s balances. + * Search for customers you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public CustomerBalanceTransactionCollection balanceTransactions( - Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/customers/%s/balance_transactions", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.requestCollection( - url, params, CustomerBalanceTransactionCollection.class, options); + public static CustomerSearchResult search(CustomerSearchParams params) throws StripeException { + return search(params, (RequestOptions) null); } /** - * Returns a list of transactions that updated the customer’s balances. + * Search for customers you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public CustomerBalanceTransactionCollection balanceTransactions( - CustomerBalanceTransactionsParams params) throws StripeException { - return balanceTransactions(params, (RequestOptions) null); + public static CustomerSearchResult search(CustomerSearchParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/customers/search"); + return ApiResource.requestSearchResult(url, params, CustomerSearchResult.class, options); } /** - * Returns a list of transactions that updated the customer’s balances. + * Updates the specified customer by setting the values of the parameters passed. Any parameters + * not provided will be left unchanged. For example, if you pass the source + * parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges + * in the future. When you update a customer to a new valid card source by passing the + * source parameter: for each of the customer’s current subscriptions, if the + * subscription bills automatically and is in the past_due state, then the latest + * open invoice for the subscription with automatic collection enabled will be retried. This retry + * will not count as an automatic retry, and will not affect the next regularly scheduled payment + * for the invoice. Changing the default_source for a customer will not trigger + * this behavior. + * + *

This request accepts mostly the same arguments as the customer creation call. */ - public CustomerBalanceTransactionCollection balanceTransactions( - CustomerBalanceTransactionsParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/customers/%s/balance_transactions", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.requestCollection( - url, params, CustomerBalanceTransactionCollection.class, options); + @Override + public Customer update(Map params) throws StripeException { + return update(params, (RequestOptions) null); } /** - * Retrieve funding instructions for a customer cash balance. If funding instructions do not yet - * exist for the customer, new funding instructions will be created. If funding instructions have - * already been created for a given customer, the same funding instructions will be retrieved. In - * other words, we will return the same funding instructions each time. + * Updates the specified customer by setting the values of the parameters passed. Any parameters + * not provided will be left unchanged. For example, if you pass the source + * parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges + * in the future. When you update a customer to a new valid card source by passing the + * source parameter: for each of the customer’s current subscriptions, if the + * subscription bills automatically and is in the past_due state, then the latest + * open invoice for the subscription with automatic collection enabled will be retried. This retry + * will not count as an automatic retry, and will not affect the next regularly scheduled payment + * for the invoice. Changing the default_source for a customer will not trigger + * this behavior. + * + *

This request accepts mostly the same arguments as the customer creation call. */ - public FundingInstructions createFundingInstructions(Map params) + @Override + public Customer update(Map params, RequestOptions options) throws StripeException { - return createFundingInstructions(params, (RequestOptions) null); - } - - /** - * Retrieve funding instructions for a customer cash balance. If funding instructions do not yet - * exist for the customer, new funding instructions will be created. If funding instructions have - * already been created for a given customer, the same funding instructions will be retrieved. In - * other words, we will return the same funding instructions each time. - */ - public FundingInstructions createFundingInstructions( - Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format( - "/v1/customers/%s/funding_instructions", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/customers/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, FundingInstructions.class, options); + ApiResource.RequestMethod.POST, url, params, Customer.class, options); } /** - * Retrieve funding instructions for a customer cash balance. If funding instructions do not yet - * exist for the customer, new funding instructions will be created. If funding instructions have - * already been created for a given customer, the same funding instructions will be retrieved. In - * other words, we will return the same funding instructions each time. + * Updates the specified customer by setting the values of the parameters passed. Any parameters + * not provided will be left unchanged. For example, if you pass the source + * parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges + * in the future. When you update a customer to a new valid card source by passing the + * source parameter: for each of the customer’s current subscriptions, if the + * subscription bills automatically and is in the past_due state, then the latest + * open invoice for the subscription with automatic collection enabled will be retried. This retry + * will not count as an automatic retry, and will not affect the next regularly scheduled payment + * for the invoice. Changing the default_source for a customer will not trigger + * this behavior. + * + *

This request accepts mostly the same arguments as the customer creation call. */ - public FundingInstructions createFundingInstructions( - CustomerCreateFundingInstructionsParams params) throws StripeException { - return createFundingInstructions(params, (RequestOptions) null); + public Customer update(CustomerUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); } /** - * Retrieve funding instructions for a customer cash balance. If funding instructions do not yet - * exist for the customer, new funding instructions will be created. If funding instructions have - * already been created for a given customer, the same funding instructions will be retrieved. In - * other words, we will return the same funding instructions each time. + * Updates the specified customer by setting the values of the parameters passed. Any parameters + * not provided will be left unchanged. For example, if you pass the source + * parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges + * in the future. When you update a customer to a new valid card source by passing the + * source parameter: for each of the customer’s current subscriptions, if the + * subscription bills automatically and is in the past_due state, then the latest + * open invoice for the subscription with automatic collection enabled will be retried. This retry + * will not count as an automatic retry, and will not affect the next regularly scheduled payment + * for the invoice. Changing the default_source for a customer will not trigger + * this behavior. + * + *

This request accepts mostly the same arguments as the customer creation call. */ - public FundingInstructions createFundingInstructions( - CustomerCreateFundingInstructionsParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/customers/%s/funding_instructions", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, FundingInstructions.class, options); - } - - /** Removes the currently applied discount on a customer. */ - public Discount deleteDiscount() throws StripeException { - return deleteDiscount((Map) null, (RequestOptions) null); - } - - /** Removes the currently applied discount on a customer. */ - public Discount deleteDiscount(Map params) throws StripeException { - return deleteDiscount(params, (RequestOptions) null); - } - - /** Removes the currently applied discount on a customer. */ - public Discount deleteDiscount(Map params, RequestOptions options) + public Customer update(CustomerUpdateParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/customers/%s/discount", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/customers/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, Discount.class, options); + ApiResource.RequestMethod.POST, url, params, Customer.class, options); } @Getter diff --git a/src/main/java/com/stripe/model/CustomerBalanceTransaction.java b/src/main/java/com/stripe/model/CustomerBalanceTransaction.java index 62bd7d83bc8..cd08da9a102 100644 --- a/src/main/java/com/stripe/model/CustomerBalanceTransaction.java +++ b/src/main/java/com/stripe/model/CustomerBalanceTransaction.java @@ -12,6 +12,18 @@ import lombok.Getter; import lombok.Setter; +/** + * Each customer has a {@code balance} + * value, which denotes a debit or credit that's automatically applied to their next invoice upon + * finalization. You may modify the value directly by using the update customer API, or by creating a + * Customer Balance Transaction, which increments or decrements the customer's {@code balance} by + * the specified {@code amount}. + * + *

Related guide: Customer Balance + * to learn more. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/CustomerBalanceTransactionCollection.java b/src/main/java/com/stripe/model/CustomerBalanceTransactionCollection.java index e7c6ef53b33..63c3b69b587 100644 --- a/src/main/java/com/stripe/model/CustomerBalanceTransactionCollection.java +++ b/src/main/java/com/stripe/model/CustomerBalanceTransactionCollection.java @@ -13,51 +13,43 @@ public class CustomerBalanceTransactionCollection extends StripeCollection { /** - * Retrieves a specific customer balance transaction that updated the customer’s balances. + * Creates an immutable transaction that updates the customer’s credit balance. */ - public CustomerBalanceTransaction retrieve(String id) throws StripeException { - return retrieve(id, (Map) null, (RequestOptions) null); + public CustomerBalanceTransaction create(Map params) throws StripeException { + return create(params, (RequestOptions) null); } /** - * Retrieves a specific customer balance transaction that updated the customer’s balances. + * Creates an immutable transaction that updates the customer’s credit balance. */ - public CustomerBalanceTransaction retrieve(String id, RequestOptions options) + public CustomerBalanceTransaction create(Map params, RequestOptions options) throws StripeException { - return retrieve(id, (Map) null, options); + String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, CustomerBalanceTransaction.class, options); } /** - * Retrieves a specific customer balance transaction that updated the customer’s balances. + * Creates an immutable transaction that updates the customer’s credit balance. */ - public CustomerBalanceTransaction retrieve( - String id, Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("%s/%s", this.getUrl(), ApiResource.urlEncodeId(id))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, CustomerBalanceTransaction.class, options); + public CustomerBalanceTransaction create(CustomerBalanceTransactionCollectionCreateParams params) + throws StripeException { + return create(params, (RequestOptions) null); } /** - * Retrieves a specific customer balance transaction that updated the customer’s balances. + * Creates an immutable transaction that updates the customer’s credit balance. */ - public CustomerBalanceTransaction retrieve( - String id, CustomerBalanceTransactionCollectionRetrieveParams params, RequestOptions options) + public CustomerBalanceTransaction create( + CustomerBalanceTransactionCollectionCreateParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("%s/%s", this.getUrl(), ApiResource.urlEncodeId(id))); + String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, CustomerBalanceTransaction.class, options); + ApiResource.RequestMethod.POST, url, params, CustomerBalanceTransaction.class, options); } /** @@ -102,42 +94,50 @@ public CustomerBalanceTransactionCollection list( } /** - * Creates an immutable transaction that updates the customer’s credit balance. + * Retrieves a specific customer balance transaction that updated the customer’s balances. */ - public CustomerBalanceTransaction create(Map params) throws StripeException { - return create(params, (RequestOptions) null); + public CustomerBalanceTransaction retrieve(String id) throws StripeException { + return retrieve(id, (Map) null, (RequestOptions) null); } /** - * Creates an immutable transaction that updates the customer’s credit balance. + * Retrieves a specific customer balance transaction that updated the customer’s balances. */ - public CustomerBalanceTransaction create(Map params, RequestOptions options) + public CustomerBalanceTransaction retrieve(String id, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, CustomerBalanceTransaction.class, options); + return retrieve(id, (Map) null, options); } /** - * Creates an immutable transaction that updates the customer’s credit balance. + * Retrieves a specific customer balance transaction that updated the customer’s balances. */ - public CustomerBalanceTransaction create(CustomerBalanceTransactionCollectionCreateParams params) - throws StripeException { - return create(params, (RequestOptions) null); + public CustomerBalanceTransaction retrieve( + String id, Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("%s/%s", this.getUrl(), ApiResource.urlEncodeId(id))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, CustomerBalanceTransaction.class, options); } /** - * Creates an immutable transaction that updates the customer’s credit balance. + * Retrieves a specific customer balance transaction that updated the customer’s balances. */ - public CustomerBalanceTransaction create( - CustomerBalanceTransactionCollectionCreateParams params, RequestOptions options) + public CustomerBalanceTransaction retrieve( + String id, CustomerBalanceTransactionCollectionRetrieveParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("%s/%s", this.getUrl(), ApiResource.urlEncodeId(id))); return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, CustomerBalanceTransaction.class, options); + ApiResource.RequestMethod.GET, url, params, CustomerBalanceTransaction.class, options); } } diff --git a/src/main/java/com/stripe/model/CustomerCashBalanceTransaction.java b/src/main/java/com/stripe/model/CustomerCashBalanceTransaction.java new file mode 100644 index 00000000000..d85751c4558 --- /dev/null +++ b/src/main/java/com/stripe/model/CustomerCashBalanceTransaction.java @@ -0,0 +1,259 @@ +// File generated from our OpenAPI spec +package com.stripe.model; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiResource; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + * Customers with certain payments enabled have a cash balance, representing funds that were paid by + * the customer to a merchant, but have not yet been allocated to a payment. Cash Balance + * Transactions represent when funds are moved into or out of this balance. This includes funding by + * the customer, allocation to payments, and refunds to the customer. + */ +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class CustomerCashBalanceTransaction extends StripeObject implements HasId { + @SerializedName("applied_to_payment") + AppliedToPayment appliedToPayment; + + /** Time at which the object was created. Measured in seconds since the Unix epoch. */ + @SerializedName("created") + Long created; + + /** + * Three-letter ISO currency code, + * in lowercase. Must be a supported currency. + */ + @SerializedName("currency") + String currency; + + /** The customer whose available cash balance changed as a result of this transaction. */ + @SerializedName("customer") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField customer; + + /** + * The total available cash balance for the specified currency after this transaction was applied. + * Represented in the smallest currency + * unit. + */ + @SerializedName("ending_balance") + Long endingBalance; + + @SerializedName("funded") + Funded funded; + + /** Unique identifier for the object. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + + /** + * Has the value {@code true} if the object exists in live mode or the value {@code false} if the + * object exists in test mode. + */ + @SerializedName("livemode") + Boolean livemode; + + /** + * The amount by which the cash balance changed, represented in the smallest currency unit. A positive + * value represents funds being added to the cash balance, a negative value represents funds being + * removed from the cash balance. + */ + @SerializedName("net_amount") + Long netAmount; + + /** + * String representing the object's type. Objects of the same type share the same value. + * + *

Equal to {@code customer_cash_balance_transaction}. + */ + @SerializedName("object") + String object; + + @SerializedName("refunded_from_payment") + RefundedFromPayment refundedFromPayment; + + /** + * The type of the cash balance transaction. One of {@code applied_to_payment}, {@code + * unapplied_from_payment}, {@code refunded_from_payment}, {@code funded}, {@code + * return_initiated}, or {@code return_canceled}. New types may be added in future. See Customer Balance to learn + * more about these types. + */ + @SerializedName("type") + String type; + + @SerializedName("unapplied_from_payment") + UnappliedFromPayment unappliedFromPayment; + + /** Get ID of expandable {@code customer} object. */ + public String getCustomer() { + return (this.customer != null) ? this.customer.getId() : null; + } + + public void setCustomer(String id) { + this.customer = ApiResource.setExpandableFieldId(id, this.customer); + } + + /** Get expanded {@code customer}. */ + public Customer getCustomerObject() { + return (this.customer != null) ? this.customer.getExpanded() : null; + } + + public void setCustomerObject(Customer expandableObject) { + this.customer = new ExpandableField(expandableObject.getId(), expandableObject); + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AppliedToPayment extends StripeObject { + /** + * The Payment Intent that + * funds were applied to. + */ + @SerializedName("payment_intent") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField paymentIntent; + + /** Get ID of expandable {@code paymentIntent} object. */ + public String getPaymentIntent() { + return (this.paymentIntent != null) ? this.paymentIntent.getId() : null; + } + + public void setPaymentIntent(String id) { + this.paymentIntent = ApiResource.setExpandableFieldId(id, this.paymentIntent); + } + + /** Get expanded {@code paymentIntent}. */ + public PaymentIntent getPaymentIntentObject() { + return (this.paymentIntent != null) ? this.paymentIntent.getExpanded() : null; + } + + public void setPaymentIntentObject(PaymentIntent expandableObject) { + this.paymentIntent = + new ExpandableField(expandableObject.getId(), expandableObject); + } + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Funded extends StripeObject { + @SerializedName("bank_transfer") + CashBalance.FundedTransaction.BankTransfer bankTransfer; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class BankTransfer extends StripeObject { + @SerializedName("eu_bank_transfer") + EuBankTransfer euBankTransfer; + + /** The user-supplied reference field on the bank transfer. */ + @SerializedName("reference") + String reference; + + /** + * The funding method type used to fund the customer balance. Permitted values include: {@code + * eu_bank_transfer}, {@code gb_bank_transfer}, {@code jp_bank_transfer}, or {@code + * mx_bank_transfer}. + * + *

One of {@code eu_bank_transfer}, {@code gb_bank_transfer}, {@code jp_bank_transfer}, or + * {@code mx_bank_transfer}. + */ + @SerializedName("type") + String type; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class EuBankTransfer extends StripeObject { + /** The BIC of the bank of the sender of the funding. */ + @SerializedName("bic") + String bic; + + /** The last 4 digits of the IBAN of the sender of the funding. */ + @SerializedName("iban_last4") + String ibanLast4; + + /** The full name of the sender, as supplied by the sending bank. */ + @SerializedName("sender_name") + String senderName; + } + } + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class RefundedFromPayment extends StripeObject { + /** + * The Refund that moved these funds + * into the customer's cash balance. + */ + @SerializedName("refund") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField refund; + + /** Get ID of expandable {@code refund} object. */ + public String getRefund() { + return (this.refund != null) ? this.refund.getId() : null; + } + + public void setRefund(String id) { + this.refund = ApiResource.setExpandableFieldId(id, this.refund); + } + + /** Get expanded {@code refund}. */ + public Refund getRefundObject() { + return (this.refund != null) ? this.refund.getExpanded() : null; + } + + public void setRefundObject(Refund expandableObject) { + this.refund = new ExpandableField(expandableObject.getId(), expandableObject); + } + } + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class UnappliedFromPayment extends StripeObject { + /** + * The Payment Intent that + * funds were unapplied from. + */ + @SerializedName("payment_intent") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField paymentIntent; + + /** Get ID of expandable {@code paymentIntent} object. */ + public String getPaymentIntent() { + return (this.paymentIntent != null) ? this.paymentIntent.getId() : null; + } + + public void setPaymentIntent(String id) { + this.paymentIntent = ApiResource.setExpandableFieldId(id, this.paymentIntent); + } + + /** Get expanded {@code paymentIntent}. */ + public PaymentIntent getPaymentIntentObject() { + return (this.paymentIntent != null) ? this.paymentIntent.getExpanded() : null; + } + + public void setPaymentIntentObject(PaymentIntent expandableObject) { + this.paymentIntent = + new ExpandableField(expandableObject.getId(), expandableObject); + } + } +} diff --git a/src/main/java/com/stripe/model/CustomerCashBalanceTransactionCollection.java b/src/main/java/com/stripe/model/CustomerCashBalanceTransactionCollection.java new file mode 100644 index 00000000000..e54e03ba8d9 --- /dev/null +++ b/src/main/java/com/stripe/model/CustomerCashBalanceTransactionCollection.java @@ -0,0 +1,104 @@ +// File generated from our OpenAPI spec +package com.stripe.model; + +import com.stripe.Stripe; +import com.stripe.exception.StripeException; +import com.stripe.net.ApiResource; +import com.stripe.net.RequestOptions; +import com.stripe.param.CustomerCashBalanceTransactionCollectionListParams; +import com.stripe.param.CustomerCashBalanceTransactionCollectionRetrieveParams; +import java.util.Map; + +public class CustomerCashBalanceTransactionCollection + extends StripeCollection { + /** + * Returns a list of transactions that modified the customer’s cash balance. + */ + public CustomerCashBalanceTransactionCollection list(Map params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** + * Returns a list of transactions that modified the customer’s cash balance. + */ + public CustomerCashBalanceTransactionCollection list( + Map params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); + return ApiResource.requestCollection( + url, params, CustomerCashBalanceTransactionCollection.class, options); + } + + /** + * Returns a list of transactions that modified the customer’s cash balance. + */ + public CustomerCashBalanceTransactionCollection list( + CustomerCashBalanceTransactionCollectionListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** + * Returns a list of transactions that modified the customer’s cash balance. + */ + public CustomerCashBalanceTransactionCollection list( + CustomerCashBalanceTransactionCollectionListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); + return ApiResource.requestCollection( + url, params, CustomerCashBalanceTransactionCollection.class, options); + } + + /** + * Retrieves a specific cash balance transaction, which updated the customer’s cash balance. + */ + public CustomerCashBalanceTransaction retrieve(String id) throws StripeException { + return retrieve(id, (Map) null, (RequestOptions) null); + } + + /** + * Retrieves a specific cash balance transaction, which updated the customer’s cash balance. + */ + public CustomerCashBalanceTransaction retrieve(String id, RequestOptions options) + throws StripeException { + return retrieve(id, (Map) null, options); + } + + /** + * Retrieves a specific cash balance transaction, which updated the customer’s cash balance. + */ + public CustomerCashBalanceTransaction retrieve( + String id, Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("%s/%s", this.getUrl(), ApiResource.urlEncodeId(id))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, CustomerCashBalanceTransaction.class, options); + } + + /** + * Retrieves a specific cash balance transaction, which updated the customer’s cash balance. + */ + public CustomerCashBalanceTransaction retrieve( + String id, + CustomerCashBalanceTransactionCollectionRetrieveParams params, + RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("%s/%s", this.getUrl(), ApiResource.urlEncodeId(id))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, CustomerCashBalanceTransaction.class, options); + } +} diff --git a/src/main/java/com/stripe/model/Discount.java b/src/main/java/com/stripe/model/Discount.java index a6284071bbf..4842a8e123f 100644 --- a/src/main/java/com/stripe/model/Discount.java +++ b/src/main/java/com/stripe/model/Discount.java @@ -7,6 +7,15 @@ import lombok.Getter; import lombok.Setter; +/** + * A discount represents the actual application of a coupon or promotion code. It contains information + * about when the discount began, when it will end, and what it is applied to. + * + *

Related guide: Applying + * Discounts to Subscriptions. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Dispute.java b/src/main/java/com/stripe/model/Dispute.java index 1c2f9a6a82c..b61ea7bc863 100644 --- a/src/main/java/com/stripe/model/Dispute.java +++ b/src/main/java/com/stripe/model/Dispute.java @@ -16,6 +16,14 @@ import lombok.Getter; import lombok.Setter; +/** + * A dispute occurs when a customer questions your charge with their card issuer. When this happens, + * you're given the opportunity to respond to the dispute with evidence that shows that the charge + * is legitimate. You can find more information about the dispute process in our Disputes and Fraud documentation. + * + *

Related guide: Disputes and Fraud. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -165,6 +173,82 @@ public void setPaymentIntentObject(PaymentIntent expandableObject) { new ExpandableField(expandableObject.getId(), expandableObject); } + /** + * Closing the dispute for a charge indicates that you do not have any evidence to submit and are + * essentially dismissing the dispute, acknowledging it as lost. + * + *

The status of the dispute will change from needs_response to lost. + * Closing a dispute is irreversible. + */ + public Dispute close() throws StripeException { + return close((Map) null, (RequestOptions) null); + } + + /** + * Closing the dispute for a charge indicates that you do not have any evidence to submit and are + * essentially dismissing the dispute, acknowledging it as lost. + * + *

The status of the dispute will change from needs_response to lost. + * Closing a dispute is irreversible. + */ + public Dispute close(RequestOptions options) throws StripeException { + return close((Map) null, options); + } + + /** + * Closing the dispute for a charge indicates that you do not have any evidence to submit and are + * essentially dismissing the dispute, acknowledging it as lost. + * + *

The status of the dispute will change from needs_response to lost. + * Closing a dispute is irreversible. + */ + public Dispute close(Map params) throws StripeException { + return close(params, (RequestOptions) null); + } + + /** + * Closing the dispute for a charge indicates that you do not have any evidence to submit and are + * essentially dismissing the dispute, acknowledging it as lost. + * + *

The status of the dispute will change from needs_response to lost. + * Closing a dispute is irreversible. + */ + public Dispute close(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/disputes/%s/close", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Dispute.class, options); + } + + /** + * Closing the dispute for a charge indicates that you do not have any evidence to submit and are + * essentially dismissing the dispute, acknowledging it as lost. + * + *

The status of the dispute will change from needs_response to lost. + * Closing a dispute is irreversible. + */ + public Dispute close(DisputeCloseParams params) throws StripeException { + return close(params, (RequestOptions) null); + } + + /** + * Closing the dispute for a charge indicates that you do not have any evidence to submit and are + * essentially dismissing the dispute, acknowledging it as lost. + * + *

The status of the dispute will change from needs_response to lost. + * Closing a dispute is irreversible. + */ + public Dispute close(DisputeCloseParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/disputes/%s/close", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Dispute.class, options); + } + /** Returns a list of your disputes. */ public static DisputeCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); @@ -289,82 +373,6 @@ public Dispute update(DisputeUpdateParams params, RequestOptions options) throws return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Dispute.class, options); } - /** - * Closing the dispute for a charge indicates that you do not have any evidence to submit and are - * essentially dismissing the dispute, acknowledging it as lost. - * - *

The status of the dispute will change from needs_response to lost. - * Closing a dispute is irreversible. - */ - public Dispute close() throws StripeException { - return close((Map) null, (RequestOptions) null); - } - - /** - * Closing the dispute for a charge indicates that you do not have any evidence to submit and are - * essentially dismissing the dispute, acknowledging it as lost. - * - *

The status of the dispute will change from needs_response to lost. - * Closing a dispute is irreversible. - */ - public Dispute close(RequestOptions options) throws StripeException { - return close((Map) null, options); - } - - /** - * Closing the dispute for a charge indicates that you do not have any evidence to submit and are - * essentially dismissing the dispute, acknowledging it as lost. - * - *

The status of the dispute will change from needs_response to lost. - * Closing a dispute is irreversible. - */ - public Dispute close(Map params) throws StripeException { - return close(params, (RequestOptions) null); - } - - /** - * Closing the dispute for a charge indicates that you do not have any evidence to submit and are - * essentially dismissing the dispute, acknowledging it as lost. - * - *

The status of the dispute will change from needs_response to lost. - * Closing a dispute is irreversible. - */ - public Dispute close(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/disputes/%s/close", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Dispute.class, options); - } - - /** - * Closing the dispute for a charge indicates that you do not have any evidence to submit and are - * essentially dismissing the dispute, acknowledging it as lost. - * - *

The status of the dispute will change from needs_response to lost. - * Closing a dispute is irreversible. - */ - public Dispute close(DisputeCloseParams params) throws StripeException { - return close(params, (RequestOptions) null); - } - - /** - * Closing the dispute for a charge indicates that you do not have any evidence to submit and are - * essentially dismissing the dispute, acknowledging it as lost. - * - *

The status of the dispute will change from needs_response to lost. - * Closing a dispute is irreversible. - */ - public Dispute close(DisputeCloseParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/disputes/%s/close", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Dispute.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Event.java b/src/main/java/com/stripe/model/Event.java index d1c8a4c91ec..9ab4abc77e8 100644 --- a/src/main/java/com/stripe/model/Event.java +++ b/src/main/java/com/stripe/model/Event.java @@ -13,6 +13,34 @@ import lombok.Getter; import lombok.Setter; +/** + * Events are our way of letting you know when something interesting happens in your account. When + * an interesting event occurs, we create a new {@code Event} object. For example, when a charge + * succeeds, we create a {@code charge.succeeded} event; and when an invoice payment attempt fails, + * we create an {@code invoice.payment_failed} event. Note that many API requests may cause multiple + * events to be created. For example, if you create a new subscription for a customer, you will + * receive both a {@code customer.subscription.created} event and a {@code charge.succeeded} event. + * + *

Events occur when the state of another API resource changes. The state of that resource at the + * time of the change is embedded in the event's data field. For example, a {@code charge.succeeded} + * event will contain a charge, and an {@code invoice.payment_failed} event will contain an invoice. + * + *

As with other API resources, you can use endpoints to retrieve an individual event or a list of events from the API. We also have a + * separate webhooks system for sending the + * {@code Event} objects directly to an endpoint on your server. Webhooks are managed in your account settings, and our Using Webhooks guide will help you get set up. + * + *

When using Connect, you can also receive + * notifications of events that occur in connected accounts. For these events, there will be an + * additional {@code account} attribute in the received {@code Event} object. + * + *

NOTE: Right now, access to events through the Retrieve Event API is guaranteed only for + * 30 days. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/EventDataClassLookup.java b/src/main/java/com/stripe/model/EventDataClassLookup.java index 779c21b0dc4..f13a7d8fb91 100644 --- a/src/main/java/com/stripe/model/EventDataClassLookup.java +++ b/src/main/java/com/stripe/model/EventDataClassLookup.java @@ -31,6 +31,7 @@ final class EventDataClassLookup { classLookup.put("credit_note_line_item", CreditNoteLineItem.class); classLookup.put("customer", Customer.class); classLookup.put("customer_balance_transaction", CustomerBalanceTransaction.class); + classLookup.put("customer_cash_balance_transaction", CustomerCashBalanceTransaction.class); classLookup.put("discount", Discount.class); classLookup.put("dispute", Dispute.class); classLookup.put("ephemeral_key", EphemeralKey.class); diff --git a/src/main/java/com/stripe/model/ExchangeRate.java b/src/main/java/com/stripe/model/ExchangeRate.java index 6a04d03e1f1..94a78dd2b72 100644 --- a/src/main/java/com/stripe/model/ExchangeRate.java +++ b/src/main/java/com/stripe/model/ExchangeRate.java @@ -14,6 +14,17 @@ import lombok.Getter; import lombok.Setter; +/** + * {@code Exchange Rate} objects allow you to determine the rates that Stripe is currently using to + * convert from one currency to another. Since this number is variable throughout the day, there are + * various reasons why you might want to know the current rate (for example, to dynamically price an + * item for a user with a default payment in a foreign currency). + * + *

If you want a guarantee that the charge is made with a certain exchange rate you expect is + * current, you can pass in {@code exchange_rate} to charges endpoints. If the value is no longer up + * to date, the charge won't go through. Please refer to our Exchange Rates API guide for more details. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/ExternalAccountCollection.java b/src/main/java/com/stripe/model/ExternalAccountCollection.java index c9ccd7a9946..7369625969e 100644 --- a/src/main/java/com/stripe/model/ExternalAccountCollection.java +++ b/src/main/java/com/stripe/model/ExternalAccountCollection.java @@ -11,6 +11,33 @@ import java.util.Map; public class ExternalAccountCollection extends StripeCollection { + /** Create an external account for a given account. */ + public ExternalAccount create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Create an external account for a given account. */ + public ExternalAccount create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, ExternalAccount.class, options); + } + + /** Create an external account for a given account. */ + public ExternalAccount create(ExternalAccountCollectionCreateParams params) + throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Create an external account for a given account. */ + public ExternalAccount create( + ExternalAccountCollectionCreateParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, ExternalAccount.class, options); + } + /** List external accounts for an account. */ public ExternalAccountCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); @@ -70,31 +97,4 @@ public ExternalAccount retrieve( return ApiResource.request( ApiResource.RequestMethod.GET, url, params, ExternalAccount.class, options); } - - /** Create an external account for a given account. */ - public ExternalAccount create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Create an external account for a given account. */ - public ExternalAccount create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, ExternalAccount.class, options); - } - - /** Create an external account for a given account. */ - public ExternalAccount create(ExternalAccountCollectionCreateParams params) - throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Create an external account for a given account. */ - public ExternalAccount create( - ExternalAccountCollectionCreateParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, ExternalAccount.class, options); - } } diff --git a/src/main/java/com/stripe/model/FeeRefund.java b/src/main/java/com/stripe/model/FeeRefund.java index cc61c813341..a750ce8c92c 100644 --- a/src/main/java/com/stripe/model/FeeRefund.java +++ b/src/main/java/com/stripe/model/FeeRefund.java @@ -12,6 +12,15 @@ import lombok.Getter; import lombok.Setter; +/** + * {@code Application Fee Refund} objects allow you to refund an application fee that has previously + * been created but not yet refunded. Funds will be refunded to the Stripe account from which the + * fee was originally collected. + * + *

Related guide: Refunding + * Application Fees. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/FileLink.java b/src/main/java/com/stripe/model/FileLink.java index 00f8fb0d41a..249c79803f8 100644 --- a/src/main/java/com/stripe/model/FileLink.java +++ b/src/main/java/com/stripe/model/FileLink.java @@ -15,6 +15,11 @@ import lombok.Getter; import lombok.Setter; +/** + * To share the contents of a {@code File} object with non-Stripe users, you can create a {@code + * FileLink}. {@code FileLink}s contain a URL that can be used to retrieve the contents of the file + * without authentication. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -88,6 +93,56 @@ public void setFileObject(File expandableObject) { this.file = new ExpandableField(expandableObject.getId(), expandableObject); } + /** Creates a new file link object. */ + public static FileLink create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new file link object. */ + public static FileLink create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/file_links"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, FileLink.class, options); + } + + /** Creates a new file link object. */ + public static FileLink create(FileLinkCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new file link object. */ + public static FileLink create(FileLinkCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/file_links"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, FileLink.class, options); + } + + /** Returns a list of file links. */ + public static FileLinkCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of file links. */ + public static FileLinkCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/file_links"); + return ApiResource.requestCollection(url, params, FileLinkCollection.class, options); + } + + /** Returns a list of file links. */ + public static FileLinkCollection list(FileLinkListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of file links. */ + public static FileLinkCollection list(FileLinkListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/file_links"); + return ApiResource.requestCollection(url, params, FileLinkCollection.class, options); + } + /** Retrieves the file link with the given ID. */ public static FileLink retrieve(String link) throws StripeException { return retrieve(link, (Map) null, (RequestOptions) null); @@ -118,32 +173,6 @@ public static FileLink retrieve( return ApiResource.request(ApiResource.RequestMethod.GET, url, params, FileLink.class, options); } - /** Creates a new file link object. */ - public static FileLink create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new file link object. */ - public static FileLink create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/file_links"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, FileLink.class, options); - } - - /** Creates a new file link object. */ - public static FileLink create(FileLinkCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new file link object. */ - public static FileLink create(FileLinkCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/file_links"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, FileLink.class, options); - } - /** Updates an existing file link object. Expired links can no longer be updated. */ @Override public FileLink update(Map params) throws StripeException { @@ -179,28 +208,4 @@ public FileLink update(FileLinkUpdateParams params, RequestOptions options) return ApiResource.request( ApiResource.RequestMethod.POST, url, params, FileLink.class, options); } - - /** Returns a list of file links. */ - public static FileLinkCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of file links. */ - public static FileLinkCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/file_links"); - return ApiResource.requestCollection(url, params, FileLinkCollection.class, options); - } - - /** Returns a list of file links. */ - public static FileLinkCollection list(FileLinkListParams params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of file links. */ - public static FileLinkCollection list(FileLinkListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/file_links"); - return ApiResource.requestCollection(url, params, FileLinkCollection.class, options); - } } diff --git a/src/main/java/com/stripe/model/FundingInstructions.java b/src/main/java/com/stripe/model/FundingInstructions.java index a38c01b0911..80f13b4d412 100644 --- a/src/main/java/com/stripe/model/FundingInstructions.java +++ b/src/main/java/com/stripe/model/FundingInstructions.java @@ -7,6 +7,15 @@ import lombok.Getter; import lombok.Setter; +/** + * Each customer has a {@code balance} + * that is automatically applied to future invoices and payments using the {@code customer_balance} + * payment method. Customers can fund this balance by initiating a bank transfer to any account in + * the {@code financial_addresses} field. Related guide: Customer Balance - + * Funding Instructions to learn more + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -64,6 +73,7 @@ public static class BankTransfer extends StripeObject { @SerializedName("type") String type; + /** FinancialAddresses contain identifying information that resolves to a FinancialAccount. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -96,6 +106,7 @@ public static class FinancialAddress extends StripeObject { @SerializedName("zengin") Zengin zengin; + /** Iban Records contain E.U. bank account details per the SEPA format. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -120,6 +131,7 @@ public static class Iban extends StripeObject { String iban; } + /** Sort Code Records contain U.K. bank account details per the sort code format. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -137,6 +149,7 @@ public static class SortCode extends StripeObject { String sortCode; } + /** SPEI Records contain Mexico bank account details per the SPEI format. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -154,6 +167,7 @@ public static class Spei extends StripeObject { String clabe; } + /** Zengin Records contain Japan bank account details per the Zengin format. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Invoice.java b/src/main/java/com/stripe/model/Invoice.java index a5f5097b0cc..247b7f769d6 100644 --- a/src/main/java/com/stripe/model/Invoice.java +++ b/src/main/java/com/stripe/model/Invoice.java @@ -25,6 +25,39 @@ import lombok.Getter; import lombok.Setter; +/** + * Invoices are statements of amounts owed by a customer, and are either generated one-off, or + * generated periodically from a subscription. + * + *

They contain invoice items, and + * proration adjustments that may be caused by subscription upgrades/downgrades (if necessary). + * + *

If your invoice is configured to be billed through automatic charges, Stripe automatically + * finalizes your invoice and attempts payment. Note that finalizing the invoice, when automatic, does + * not happen immediately as the invoice is created. Stripe waits until one hour after the last + * webhook was successfully sent (or the last webhook timed out after failing). If you (and the + * platforms you may have connected to) have no webhooks configured, Stripe waits one hour after + * creation to finalize the invoice. + * + *

If your invoice is configured to be billed by sending an email, then based on your email settings, Stripe will + * email the invoice to your customer and await payment. These emails can contain a link to a hosted + * page to pay the invoice. + * + *

Stripe applies any customer credit on the account before determining the amount due for the + * invoice (i.e., the amount that will be actually charged). If the amount due for the invoice is + * less than Stripe's minimum allowed + * charge per currency, the invoice is automatically marked paid, and we add the amount due to + * the customer's credit balance which is applied to the next invoice. + * + *

More details on the customer's credit balance are here. + * + *

Related guide: Send Invoices to + * Customers. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -153,6 +186,10 @@ public class Invoice extends ApiResource implements HasId, MetadataStore customFields; + /** The ID of the customer who will be billed. */ @SerializedName("customer") @Getter(lombok.AccessLevel.NONE) @@ -211,10 +248,6 @@ public class Invoice extends ApiResource implements HasId, MetadataStore customerTaxIds; - /** Custom fields displayed on the invoice. */ - @SerializedName("custom_fields") - List customFields; - /** * ID of the default payment method for the invoice. It must belong to the customer associated * with the invoice. If not set, defaults to the subscription's default payment method, if any, or @@ -789,55 +822,157 @@ public void setDiscountObjects(List objs) { } /** - * Search for invoices you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * This endpoint creates a draft invoice for a given customer. The draft invoice created pulls in + * all pending invoice items on that customer, including prorations. The invoice remains a draft + * until you finalize the invoice, + * which allows you to pay or send the invoice to your customers. */ - public static InvoiceSearchResult search(Map params) throws StripeException { - return search(params, (RequestOptions) null); + public static Invoice create(Map params) throws StripeException { + return create(params, (RequestOptions) null); } /** - * Search for invoices you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * This endpoint creates a draft invoice for a given customer. The draft invoice created pulls in + * all pending invoice items on that customer, including prorations. The invoice remains a draft + * until you finalize the invoice, + * which allows you to pay or send the invoice to your customers. */ - public static InvoiceSearchResult search(Map params, RequestOptions options) + public static Invoice create(Map params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoices/search"); - return ApiResource.requestSearchResult(url, params, InvoiceSearchResult.class, options); + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoices"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Invoice.class, options); } /** - * Search for invoices you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * This endpoint creates a draft invoice for a given customer. The draft invoice created pulls in + * all pending invoice items on that customer, including prorations. The invoice remains a draft + * until you finalize the invoice, + * which allows you to pay or send the invoice to your customers. */ - public static InvoiceSearchResult search(InvoiceSearchParams params) throws StripeException { - return search(params, (RequestOptions) null); + public static Invoice create(InvoiceCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); } /** - * Search for invoices you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * This endpoint creates a draft invoice for a given customer. The draft invoice created pulls in + * all pending invoice items on that customer, including prorations. The invoice remains a draft + * until you finalize the invoice, + * which allows you to pay or send the invoice to your customers. */ - public static InvoiceSearchResult search(InvoiceSearchParams params, RequestOptions options) + public static Invoice create(InvoiceCreateParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoices/search"); - return ApiResource.requestSearchResult(url, params, InvoiceSearchResult.class, options); + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoices"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Invoice.class, options); + } + + /** + * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices + * that are no longer in a draft state will fail; once an invoice has been finalized or if an + * invoice is for a subscription, it must be voided. + */ + public Invoice delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); + } + + /** + * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices + * that are no longer in a draft state will fail; once an invoice has been finalized or if an + * invoice is for a subscription, it must be voided. + */ + public Invoice delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); + } + + /** + * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices + * that are no longer in a draft state will fail; once an invoice has been finalized or if an + * invoice is for a subscription, it must be voided. + */ + public Invoice delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); + } + + /** + * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices + * that are no longer in a draft state will fail; once an invoice has been finalized or if an + * invoice is for a subscription, it must be voided. + */ + public Invoice delete(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/invoices/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, Invoice.class, options); + } + + /** + * Stripe automatically finalizes drafts before sending and attempting payment on invoices. + * However, if you’d like to finalize a draft invoice manually, you can do so using this method. + */ + public Invoice finalizeInvoice() throws StripeException { + return finalizeInvoice((Map) null, (RequestOptions) null); + } + + /** + * Stripe automatically finalizes drafts before sending and attempting payment on invoices. + * However, if you’d like to finalize a draft invoice manually, you can do so using this method. + */ + public Invoice finalizeInvoice(RequestOptions options) throws StripeException { + return finalizeInvoice((Map) null, options); + } + + /** + * Stripe automatically finalizes drafts before sending and attempting payment on invoices. + * However, if you’d like to finalize a draft invoice manually, you can do so using this method. + */ + public Invoice finalizeInvoice(Map params) throws StripeException { + return finalizeInvoice(params, (RequestOptions) null); + } + + /** + * Stripe automatically finalizes drafts before sending and attempting payment on invoices. + * However, if you’d like to finalize a draft invoice manually, you can do so using this method. + */ + public Invoice finalizeInvoice(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/invoices/%s/finalize", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Invoice.class, options); + } + + /** + * Stripe automatically finalizes drafts before sending and attempting payment on invoices. + * However, if you’d like to finalize a draft invoice manually, you can do so using this method. + */ + public Invoice finalizeInvoice(InvoiceFinalizeInvoiceParams params) throws StripeException { + return finalizeInvoice(params, (RequestOptions) null); + } + + /** + * Stripe automatically finalizes drafts before sending and attempting payment on invoices. + * However, if you’d like to finalize a draft invoice manually, you can do so using this method. + */ + public Invoice finalizeInvoice(InvoiceFinalizeInvoiceParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/invoices/%s/finalize", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Invoice.class, options); } /** @@ -877,323 +1012,67 @@ public static InvoiceCollection list(InvoiceListParams params, RequestOptions op } /** - * At any time, you can preview the upcoming invoice for a customer. This will show you all the - * charges that are pending, including subscription renewal charges, invoice item charges, etc. It - * will also show you any discounts that are applicable to the invoice. - * - *

Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the - * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice - * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the - * amount that your customer will be billed, you can add, remove, or update pending invoice items, - * or update the customer’s discount. - * - *

You can preview the effects of updating a subscription, including a preview of what - * proration will take place. To ensure that the actual proration is calculated exactly the same - * as the previewed proration, you should pass a proration_date parameter when doing - * the actual subscription update. The value passed in should be the same as the - * subscription_proration_date returned on the upcoming invoice resource. The recommended - * way to get only the prorations being previewed is to consider only proration line items where - * period[start] is equal to the subscription_proration_date on the - * upcoming invoice resource. + * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be + * written off for accounting purposes. */ - public static Invoice upcoming() throws StripeException { - return upcoming((Map) null, (RequestOptions) null); + public Invoice markUncollectible() throws StripeException { + return markUncollectible((Map) null, (RequestOptions) null); } /** - * At any time, you can preview the upcoming invoice for a customer. This will show you all the - * charges that are pending, including subscription renewal charges, invoice item charges, etc. It - * will also show you any discounts that are applicable to the invoice. - * - *

Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the - * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice - * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the - * amount that your customer will be billed, you can add, remove, or update pending invoice items, - * or update the customer’s discount. - * - *

You can preview the effects of updating a subscription, including a preview of what - * proration will take place. To ensure that the actual proration is calculated exactly the same - * as the previewed proration, you should pass a proration_date parameter when doing - * the actual subscription update. The value passed in should be the same as the - * subscription_proration_date returned on the upcoming invoice resource. The recommended - * way to get only the prorations being previewed is to consider only proration line items where - * period[start] is equal to the subscription_proration_date on the - * upcoming invoice resource. + * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be + * written off for accounting purposes. */ - public static Invoice upcoming(Map params) throws StripeException { - return upcoming(params, (RequestOptions) null); + public Invoice markUncollectible(RequestOptions options) throws StripeException { + return markUncollectible((Map) null, options); } /** - * At any time, you can preview the upcoming invoice for a customer. This will show you all the - * charges that are pending, including subscription renewal charges, invoice item charges, etc. It - * will also show you any discounts that are applicable to the invoice. - * - *

Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the - * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice - * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the - * amount that your customer will be billed, you can add, remove, or update pending invoice items, - * or update the customer’s discount. - * - *

You can preview the effects of updating a subscription, including a preview of what - * proration will take place. To ensure that the actual proration is calculated exactly the same - * as the previewed proration, you should pass a proration_date parameter when doing - * the actual subscription update. The value passed in should be the same as the - * subscription_proration_date returned on the upcoming invoice resource. The recommended - * way to get only the prorations being previewed is to consider only proration line items where - * period[start] is equal to the subscription_proration_date on the - * upcoming invoice resource. + * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be + * written off for accounting purposes. */ - public static Invoice upcoming(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoices/upcoming"); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Invoice.class, options); + public Invoice markUncollectible(Map params) throws StripeException { + return markUncollectible(params, (RequestOptions) null); } /** - * At any time, you can preview the upcoming invoice for a customer. This will show you all the - * charges that are pending, including subscription renewal charges, invoice item charges, etc. It - * will also show you any discounts that are applicable to the invoice. - * - *

Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the - * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice - * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the - * amount that your customer will be billed, you can add, remove, or update pending invoice items, - * or update the customer’s discount. - * - *

You can preview the effects of updating a subscription, including a preview of what - * proration will take place. To ensure that the actual proration is calculated exactly the same - * as the previewed proration, you should pass a proration_date parameter when doing - * the actual subscription update. The value passed in should be the same as the - * subscription_proration_date returned on the upcoming invoice resource. The recommended - * way to get only the prorations being previewed is to consider only proration line items where - * period[start] is equal to the subscription_proration_date on the - * upcoming invoice resource. - */ - public static Invoice upcoming(InvoiceUpcomingParams params) throws StripeException { - return upcoming(params, (RequestOptions) null); - } - - /** - * At any time, you can preview the upcoming invoice for a customer. This will show you all the - * charges that are pending, including subscription renewal charges, invoice item charges, etc. It - * will also show you any discounts that are applicable to the invoice. - * - *

Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the - * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice - * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the - * amount that your customer will be billed, you can add, remove, or update pending invoice items, - * or update the customer’s discount. - * - *

You can preview the effects of updating a subscription, including a preview of what - * proration will take place. To ensure that the actual proration is calculated exactly the same - * as the previewed proration, you should pass a proration_date parameter when doing - * the actual subscription update. The value passed in should be the same as the - * subscription_proration_date returned on the upcoming invoice resource. The recommended - * way to get only the prorations being previewed is to consider only proration line items where - * period[start] is equal to the subscription_proration_date on the - * upcoming invoice resource. - */ - public static Invoice upcoming(InvoiceUpcomingParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoices/upcoming"); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Invoice.class, options); - } - - /** - * This endpoint creates a draft invoice for a given customer. The draft invoice created pulls in - * all pending invoice items on that customer, including prorations. The invoice remains a draft - * until you finalize the invoice, - * which allows you to pay or send the invoice to your customers. - */ - public static Invoice create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * This endpoint creates a draft invoice for a given customer. The draft invoice created pulls in - * all pending invoice items on that customer, including prorations. The invoice remains a draft - * until you finalize the invoice, - * which allows you to pay or send the invoice to your customers. - */ - public static Invoice create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoices"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Invoice.class, options); - } - - /** - * This endpoint creates a draft invoice for a given customer. The draft invoice created pulls in - * all pending invoice items on that customer, including prorations. The invoice remains a draft - * until you finalize the invoice, - * which allows you to pay or send the invoice to your customers. - */ - public static Invoice create(InvoiceCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * This endpoint creates a draft invoice for a given customer. The draft invoice created pulls in - * all pending invoice items on that customer, including prorations. The invoice remains a draft - * until you finalize the invoice, - * which allows you to pay or send the invoice to your customers. + * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be + * written off for accounting purposes. */ - public static Invoice create(InvoiceCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoices"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Invoice.class, options); - } - - /** Retrieves the invoice with the given ID. */ - public static Invoice retrieve(String invoice) throws StripeException { - return retrieve(invoice, (Map) null, (RequestOptions) null); - } - - /** Retrieves the invoice with the given ID. */ - public static Invoice retrieve(String invoice, RequestOptions options) throws StripeException { - return retrieve(invoice, (Map) null, options); - } - - /** Retrieves the invoice with the given ID. */ - public static Invoice retrieve(String invoice, Map params, RequestOptions options) + public Invoice markUncollectible(Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/invoices/%s", ApiResource.urlEncodeId(invoice))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Invoice.class, options); - } - - /** Retrieves the invoice with the given ID. */ - public static Invoice retrieve( - String invoice, InvoiceRetrieveParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/invoices/%s", ApiResource.urlEncodeId(invoice))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Invoice.class, options); - } - - /** - * Draft invoices are fully editable. Once an invoice is finalized, monetary - * values, as well as collection_method, become uneditable. - * - *

If you would like to stop the Stripe Billing engine from automatically finalizing, - * reattempting payments on, sending reminders for, or automatically reconciling - * invoices, pass auto_advance=false. - */ - @Override - public Invoice update(Map params) throws StripeException { - return update(params, (RequestOptions) null); - } - - /** - * Draft invoices are fully editable. Once an invoice is finalized, monetary - * values, as well as collection_method, become uneditable. - * - *

If you would like to stop the Stripe Billing engine from automatically finalizing, - * reattempting payments on, sending reminders for, or automatically reconciling - * invoices, pass auto_advance=false. - */ - @Override - public Invoice update(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/invoices/%s", ApiResource.urlEncodeId(this.getId()))); + String.format( + "/v1/invoices/%s/mark_uncollectible", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Invoice.class, options); } /** - * Draft invoices are fully editable. Once an invoice is finalized, monetary - * values, as well as collection_method, become uneditable. - * - *

If you would like to stop the Stripe Billing engine from automatically finalizing, - * reattempting payments on, sending reminders for, or automatically reconciling - * invoices, pass auto_advance=false. + * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be + * written off for accounting purposes. */ - public Invoice update(InvoiceUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + public Invoice markUncollectible(InvoiceMarkUncollectibleParams params) throws StripeException { + return markUncollectible(params, (RequestOptions) null); } /** - * Draft invoices are fully editable. Once an invoice is finalized, monetary - * values, as well as collection_method, become uneditable. - * - *

If you would like to stop the Stripe Billing engine from automatically finalizing, - * reattempting payments on, sending reminders for, or automatically reconciling - * invoices, pass auto_advance=false. + * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be + * written off for accounting purposes. */ - public Invoice update(InvoiceUpdateParams params, RequestOptions options) throws StripeException { + public Invoice markUncollectible(InvoiceMarkUncollectibleParams params, RequestOptions options) + throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/invoices/%s", ApiResource.urlEncodeId(this.getId()))); + String.format( + "/v1/invoices/%s/mark_uncollectible", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Invoice.class, options); } - /** - * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices - * that are no longer in a draft state will fail; once an invoice has been finalized or if an - * invoice is for a subscription, it must be voided. - */ - public Invoice delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); - } - - /** - * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices - * that are no longer in a draft state will fail; once an invoice has been finalized or if an - * invoice is for a subscription, it must be voided. - */ - public Invoice delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); - } - - /** - * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices - * that are no longer in a draft state will fail; once an invoice has been finalized or if an - * invoice is for a subscription, it must be voided. - */ - public Invoice delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** - * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices - * that are no longer in a draft state will fail; once an invoice has been finalized or if an - * invoice is for a subscription, it must be voided. - */ - public Invoice delete(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/invoices/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, Invoice.class, options); - } - /** * Stripe automatically creates and then attempts to collect payment on invoices for customers on * subscriptions according to your ) null, (RequestOptions) null); + /** Retrieves the invoice with the given ID. */ + public static Invoice retrieve(String invoice) throws StripeException { + return retrieve(invoice, (Map) null, (RequestOptions) null); } - /** - * Stripe automatically finalizes drafts before sending and attempting payment on invoices. - * However, if you’d like to finalize a draft invoice manually, you can do so using this method. - */ - public Invoice finalizeInvoice(RequestOptions options) throws StripeException { - return finalizeInvoice((Map) null, options); + /** Retrieves the invoice with the given ID. */ + public static Invoice retrieve(String invoice, RequestOptions options) throws StripeException { + return retrieve(invoice, (Map) null, options); + } + + /** Retrieves the invoice with the given ID. */ + public static Invoice retrieve(String invoice, Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/invoices/%s", ApiResource.urlEncodeId(invoice))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Invoice.class, options); + } + + /** Retrieves the invoice with the given ID. */ + public static Invoice retrieve( + String invoice, InvoiceRetrieveParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/invoices/%s", ApiResource.urlEncodeId(invoice))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Invoice.class, options); } /** - * Stripe automatically finalizes drafts before sending and attempting payment on invoices. - * However, if you’d like to finalize a draft invoice manually, you can do so using this method. + * Search for invoices you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public Invoice finalizeInvoice(Map params) throws StripeException { - return finalizeInvoice(params, (RequestOptions) null); + public static InvoiceSearchResult search(Map params) throws StripeException { + return search(params, (RequestOptions) null); } /** - * Stripe automatically finalizes drafts before sending and attempting payment on invoices. - * However, if you’d like to finalize a draft invoice manually, you can do so using this method. + * Search for invoices you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public Invoice finalizeInvoice(Map params, RequestOptions options) + public static InvoiceSearchResult search(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/invoices/%s/finalize", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Invoice.class, options); + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoices/search"); + return ApiResource.requestSearchResult(url, params, InvoiceSearchResult.class, options); } /** - * Stripe automatically finalizes drafts before sending and attempting payment on invoices. - * However, if you’d like to finalize a draft invoice manually, you can do so using this method. + * Search for invoices you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public Invoice finalizeInvoice(InvoiceFinalizeInvoiceParams params) throws StripeException { - return finalizeInvoice(params, (RequestOptions) null); + public static InvoiceSearchResult search(InvoiceSearchParams params) throws StripeException { + return search(params, (RequestOptions) null); } /** - * Stripe automatically finalizes drafts before sending and attempting payment on invoices. - * However, if you’d like to finalize a draft invoice manually, you can do so using this method. + * Search for invoices you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public Invoice finalizeInvoice(InvoiceFinalizeInvoiceParams params, RequestOptions options) + public static InvoiceSearchResult search(InvoiceSearchParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/invoices/%s/finalize", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Invoice.class, options); + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoices/search"); + return ApiResource.requestSearchResult(url, params, InvoiceSearchResult.class, options); } /** @@ -1427,64 +1330,194 @@ public Invoice sendInvoice(InvoiceSendInvoiceParams params, RequestOptions optio } /** - * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be - * written off for accounting purposes. + * At any time, you can preview the upcoming invoice for a customer. This will show you all the + * charges that are pending, including subscription renewal charges, invoice item charges, etc. It + * will also show you any discounts that are applicable to the invoice. + * + *

Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the + * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice + * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the + * amount that your customer will be billed, you can add, remove, or update pending invoice items, + * or update the customer’s discount. + * + *

You can preview the effects of updating a subscription, including a preview of what + * proration will take place. To ensure that the actual proration is calculated exactly the same + * as the previewed proration, you should pass a proration_date parameter when doing + * the actual subscription update. The value passed in should be the same as the + * subscription_proration_date returned on the upcoming invoice resource. The recommended + * way to get only the prorations being previewed is to consider only proration line items where + * period[start] is equal to the subscription_proration_date on the + * upcoming invoice resource. */ - public Invoice markUncollectible() throws StripeException { - return markUncollectible((Map) null, (RequestOptions) null); + public static Invoice upcoming() throws StripeException { + return upcoming((Map) null, (RequestOptions) null); } /** - * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be - * written off for accounting purposes. + * At any time, you can preview the upcoming invoice for a customer. This will show you all the + * charges that are pending, including subscription renewal charges, invoice item charges, etc. It + * will also show you any discounts that are applicable to the invoice. + * + *

Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the + * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice + * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the + * amount that your customer will be billed, you can add, remove, or update pending invoice items, + * or update the customer’s discount. + * + *

You can preview the effects of updating a subscription, including a preview of what + * proration will take place. To ensure that the actual proration is calculated exactly the same + * as the previewed proration, you should pass a proration_date parameter when doing + * the actual subscription update. The value passed in should be the same as the + * subscription_proration_date returned on the upcoming invoice resource. The recommended + * way to get only the prorations being previewed is to consider only proration line items where + * period[start] is equal to the subscription_proration_date on the + * upcoming invoice resource. */ - public Invoice markUncollectible(RequestOptions options) throws StripeException { - return markUncollectible((Map) null, options); + public static Invoice upcoming(Map params) throws StripeException { + return upcoming(params, (RequestOptions) null); } /** - * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be - * written off for accounting purposes. + * At any time, you can preview the upcoming invoice for a customer. This will show you all the + * charges that are pending, including subscription renewal charges, invoice item charges, etc. It + * will also show you any discounts that are applicable to the invoice. + * + *

Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the + * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice + * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the + * amount that your customer will be billed, you can add, remove, or update pending invoice items, + * or update the customer’s discount. + * + *

You can preview the effects of updating a subscription, including a preview of what + * proration will take place. To ensure that the actual proration is calculated exactly the same + * as the previewed proration, you should pass a proration_date parameter when doing + * the actual subscription update. The value passed in should be the same as the + * subscription_proration_date returned on the upcoming invoice resource. The recommended + * way to get only the prorations being previewed is to consider only proration line items where + * period[start] is equal to the subscription_proration_date on the + * upcoming invoice resource. */ - public Invoice markUncollectible(Map params) throws StripeException { - return markUncollectible(params, (RequestOptions) null); + public static Invoice upcoming(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoices/upcoming"); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Invoice.class, options); } /** - * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be - * written off for accounting purposes. + * At any time, you can preview the upcoming invoice for a customer. This will show you all the + * charges that are pending, including subscription renewal charges, invoice item charges, etc. It + * will also show you any discounts that are applicable to the invoice. + * + *

Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the + * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice + * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the + * amount that your customer will be billed, you can add, remove, or update pending invoice items, + * or update the customer’s discount. + * + *

You can preview the effects of updating a subscription, including a preview of what + * proration will take place. To ensure that the actual proration is calculated exactly the same + * as the previewed proration, you should pass a proration_date parameter when doing + * the actual subscription update. The value passed in should be the same as the + * subscription_proration_date returned on the upcoming invoice resource. The recommended + * way to get only the prorations being previewed is to consider only proration line items where + * period[start] is equal to the subscription_proration_date on the + * upcoming invoice resource. */ - public Invoice markUncollectible(Map params, RequestOptions options) + public static Invoice upcoming(InvoiceUpcomingParams params) throws StripeException { + return upcoming(params, (RequestOptions) null); + } + + /** + * At any time, you can preview the upcoming invoice for a customer. This will show you all the + * charges that are pending, including subscription renewal charges, invoice item charges, etc. It + * will also show you any discounts that are applicable to the invoice. + * + *

Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the + * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice + * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the + * amount that your customer will be billed, you can add, remove, or update pending invoice items, + * or update the customer’s discount. + * + *

You can preview the effects of updating a subscription, including a preview of what + * proration will take place. To ensure that the actual proration is calculated exactly the same + * as the previewed proration, you should pass a proration_date parameter when doing + * the actual subscription update. The value passed in should be the same as the + * subscription_proration_date returned on the upcoming invoice resource. The recommended + * way to get only the prorations being previewed is to consider only proration line items where + * period[start] is equal to the subscription_proration_date on the + * upcoming invoice resource. + */ + public static Invoice upcoming(InvoiceUpcomingParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoices/upcoming"); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Invoice.class, options); + } + + /** + * Draft invoices are fully editable. Once an invoice is finalized, monetary + * values, as well as collection_method, become uneditable. + * + *

If you would like to stop the Stripe Billing engine from automatically finalizing, + * reattempting payments on, sending reminders for, or automatically reconciling + * invoices, pass auto_advance=false. + */ + @Override + public Invoice update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Draft invoices are fully editable. Once an invoice is finalized, monetary + * values, as well as collection_method, become uneditable. + * + *

If you would like to stop the Stripe Billing engine from automatically finalizing, + * reattempting payments on, sending reminders for, or automatically reconciling + * invoices, pass auto_advance=false. + */ + @Override + public Invoice update(Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format( - "/v1/invoices/%s/mark_uncollectible", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/invoices/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Invoice.class, options); } /** - * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be - * written off for accounting purposes. + * Draft invoices are fully editable. Once an invoice is finalized, monetary + * values, as well as collection_method, become uneditable. + * + *

If you would like to stop the Stripe Billing engine from automatically finalizing, + * reattempting payments on, sending reminders for, or automatically reconciling + * invoices, pass auto_advance=false. */ - public Invoice markUncollectible(InvoiceMarkUncollectibleParams params) throws StripeException { - return markUncollectible(params, (RequestOptions) null); + public Invoice update(InvoiceUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); } /** - * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be - * written off for accounting purposes. + * Draft invoices are fully editable. Once an invoice is finalized, monetary + * values, as well as collection_method, become uneditable. + * + *

If you would like to stop the Stripe Billing engine from automatically finalizing, + * reattempting payments on, sending reminders for, or automatically reconciling + * invoices, pass auto_advance=false. */ - public Invoice markUncollectible(InvoiceMarkUncollectibleParams params, RequestOptions options) - throws StripeException { + public Invoice update(InvoiceUpdateParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format( - "/v1/invoices/%s/mark_uncollectible", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/invoices/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Invoice.class, options); } diff --git a/src/main/java/com/stripe/model/InvoiceItem.java b/src/main/java/com/stripe/model/InvoiceItem.java index c258f82c247..6188b1714ca 100644 --- a/src/main/java/com/stripe/model/InvoiceItem.java +++ b/src/main/java/com/stripe/model/InvoiceItem.java @@ -19,6 +19,16 @@ import lombok.Getter; import lombok.Setter; +/** + * Sometimes you want to add a charge or credit to a customer, but actually charge or credit the + * customer's card only at the end of a regular billing cycle. This is useful for combining several + * charges (to minimize per-transaction fees), or for having Stripe tabulate your usage-based + * billing totals. + * + *

Related guide: Subscription + * Invoices. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -275,77 +285,116 @@ public void setDiscountObjects(List objs) { } /** - * Returns a list of your invoice items. Invoice items are returned sorted by creation date, with - * the most recently created invoice items appearing first. + * Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is + * specified, the item will be on the next invoice created for the customer specified. */ - public static InvoiceItemCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); + public static InvoiceItem create(Map params) throws StripeException { + return create(params, (RequestOptions) null); } /** - * Returns a list of your invoice items. Invoice items are returned sorted by creation date, with - * the most recently created invoice items appearing first. + * Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is + * specified, the item will be on the next invoice created for the customer specified. */ - public static InvoiceItemCollection list(Map params, RequestOptions options) + public static InvoiceItem create(Map params, RequestOptions options) throws StripeException { String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoiceitems"); - return ApiResource.requestCollection(url, params, InvoiceItemCollection.class, options); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, InvoiceItem.class, options); } /** - * Returns a list of your invoice items. Invoice items are returned sorted by creation date, with - * the most recently created invoice items appearing first. + * Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is + * specified, the item will be on the next invoice created for the customer specified. */ - public static InvoiceItemCollection list(InvoiceItemListParams params) throws StripeException { - return list(params, (RequestOptions) null); + public static InvoiceItem create(InvoiceItemCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); } /** - * Returns a list of your invoice items. Invoice items are returned sorted by creation date, with - * the most recently created invoice items appearing first. + * Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is + * specified, the item will be on the next invoice created for the customer specified. */ - public static InvoiceItemCollection list(InvoiceItemListParams params, RequestOptions options) + public static InvoiceItem create(InvoiceItemCreateParams params, RequestOptions options) throws StripeException { String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoiceitems"); - return ApiResource.requestCollection(url, params, InvoiceItemCollection.class, options); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, InvoiceItem.class, options); } /** - * Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is - * specified, the item will be on the next invoice created for the customer specified. + * Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible + * when they’re not attached to invoices, or if it’s attached to a draft invoice. */ - public static InvoiceItem create(Map params) throws StripeException { - return create(params, (RequestOptions) null); + public InvoiceItem delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); } /** - * Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is - * specified, the item will be on the next invoice created for the customer specified. + * Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible + * when they’re not attached to invoices, or if it’s attached to a draft invoice. */ - public static InvoiceItem create(Map params, RequestOptions options) + public InvoiceItem delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); + } + + /** + * Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible + * when they’re not attached to invoices, or if it’s attached to a draft invoice. + */ + public InvoiceItem delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); + } + + /** + * Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible + * when they’re not attached to invoices, or if it’s attached to a draft invoice. + */ + public InvoiceItem delete(Map params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoiceitems"); + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/invoiceitems/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, InvoiceItem.class, options); + ApiResource.RequestMethod.DELETE, url, params, InvoiceItem.class, options); } /** - * Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is - * specified, the item will be on the next invoice created for the customer specified. + * Returns a list of your invoice items. Invoice items are returned sorted by creation date, with + * the most recently created invoice items appearing first. */ - public static InvoiceItem create(InvoiceItemCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); + public static InvoiceItemCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); } /** - * Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is - * specified, the item will be on the next invoice created for the customer specified. + * Returns a list of your invoice items. Invoice items are returned sorted by creation date, with + * the most recently created invoice items appearing first. */ - public static InvoiceItem create(InvoiceItemCreateParams params, RequestOptions options) + public static InvoiceItemCollection list(Map params, RequestOptions options) throws StripeException { String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoiceitems"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, InvoiceItem.class, options); + return ApiResource.requestCollection(url, params, InvoiceItemCollection.class, options); + } + + /** + * Returns a list of your invoice items. Invoice items are returned sorted by creation date, with + * the most recently created invoice items appearing first. + */ + public static InvoiceItemCollection list(InvoiceItemListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** + * Returns a list of your invoice items. Invoice items are returned sorted by creation date, with + * the most recently created invoice items appearing first. + */ + public static InvoiceItemCollection list(InvoiceItemListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/invoiceitems"); + return ApiResource.requestCollection(url, params, InvoiceItemCollection.class, options); } /** Retrieves the invoice item with the given ID. */ @@ -432,43 +481,4 @@ public InvoiceItem update(InvoiceItemUpdateParams params, RequestOptions options return ApiResource.request( ApiResource.RequestMethod.POST, url, params, InvoiceItem.class, options); } - - /** - * Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible - * when they’re not attached to invoices, or if it’s attached to a draft invoice. - */ - public InvoiceItem delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); - } - - /** - * Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible - * when they’re not attached to invoices, or if it’s attached to a draft invoice. - */ - public InvoiceItem delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); - } - - /** - * Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible - * when they’re not attached to invoices, or if it’s attached to a draft invoice. - */ - public InvoiceItem delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** - * Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible - * when they’re not attached to invoices, or if it’s attached to a draft invoice. - */ - public InvoiceItem delete(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/invoiceitems/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, InvoiceItem.class, options); - } } diff --git a/src/main/java/com/stripe/model/InvoiceLineItem.java b/src/main/java/com/stripe/model/InvoiceLineItem.java index f61b46a02d3..93910ca6d3e 100644 --- a/src/main/java/com/stripe/model/InvoiceLineItem.java +++ b/src/main/java/com/stripe/model/InvoiceLineItem.java @@ -37,14 +37,14 @@ public class InvoiceLineItem extends StripeObject implements HasId { @SerializedName("description") String description; - /** If true, discounts will apply to this line item. Always false for prorations. */ - @SerializedName("discountable") - Boolean discountable; - /** The amount of discount calculated per discount for this line item. */ @SerializedName("discount_amounts") List discountAmounts; + /** If true, discounts will apply to this line item. Always false for prorations. */ + @SerializedName("discountable") + Boolean discountable; + /** * The discounts applied to the invoice line item. Line item discounts are applied before invoice * discounts. Use {@code expand[]=discounts} to expand each discount. diff --git a/src/main/java/com/stripe/model/LineItem.java b/src/main/java/com/stripe/model/LineItem.java index 4c1370f76de..a184ef57847 100644 --- a/src/main/java/com/stripe/model/LineItem.java +++ b/src/main/java/com/stripe/model/LineItem.java @@ -8,6 +8,7 @@ import lombok.Getter; import lombok.Setter; +/** A line item. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Mandate.java b/src/main/java/com/stripe/model/Mandate.java index 80387a89b99..c2aa006c55b 100644 --- a/src/main/java/com/stripe/model/Mandate.java +++ b/src/main/java/com/stripe/model/Mandate.java @@ -13,6 +13,9 @@ import lombok.Getter; import lombok.Setter; +/** + * A Mandate is a record of the permission a customer has given you to debit their payment method. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/PaymentIntent.java b/src/main/java/com/stripe/model/PaymentIntent.java index 21a1da37278..493694520c3 100644 --- a/src/main/java/com/stripe/model/PaymentIntent.java +++ b/src/main/java/com/stripe/model/PaymentIntent.java @@ -23,6 +23,20 @@ import lombok.Getter; import lombok.Setter; +/** + * A PaymentIntent guides you through the process of collecting a payment from your customer. We + * recommend that you create exactly one PaymentIntent for each order or customer session in your + * system. You can reference the PaymentIntent later to see the history of payment attempts for a + * particular session. + * + *

A PaymentIntent transitions through multiple statuses throughout + * its lifetime as it interfaces with Stripe.js to perform authentication flows and ultimately + * creates at most one successful charge. + * + *

Related guide: Payment Intents + * API. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -442,295 +456,272 @@ public void setSourceObject(PaymentSource expandableObject) { this.source = new ExpandableField(expandableObject.getId(), expandableObject); } - /** - * Search for PaymentIntents you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static PaymentIntentSearchResult search(Map params) - throws StripeException { - return search(params, (RequestOptions) null); + /** Manually reconcile the remaining amount for a customer_balance PaymentIntent. */ + public PaymentIntent applyCustomerBalance() throws StripeException { + return applyCustomerBalance((Map) null, (RequestOptions) null); } - /** - * Search for PaymentIntents you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static PaymentIntentSearchResult search(Map params, RequestOptions options) + /** Manually reconcile the remaining amount for a customer_balance PaymentIntent. */ + public PaymentIntent applyCustomerBalance(RequestOptions options) throws StripeException { + return applyCustomerBalance((Map) null, options); + } + + /** Manually reconcile the remaining amount for a customer_balance PaymentIntent. */ + public PaymentIntent applyCustomerBalance(Map params) throws StripeException { + return applyCustomerBalance(params, (RequestOptions) null); + } + + /** Manually reconcile the remaining amount for a customer_balance PaymentIntent. */ + public PaymentIntent applyCustomerBalance(Map params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_intents/search"); - return ApiResource.requestSearchResult(url, params, PaymentIntentSearchResult.class, options); + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/payment_intents/%s/apply_customer_balance", + ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); } - /** - * Search for PaymentIntents you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static PaymentIntentSearchResult search(PaymentIntentSearchParams params) + /** Manually reconcile the remaining amount for a customer_balance PaymentIntent. */ + public PaymentIntent applyCustomerBalance(PaymentIntentApplyCustomerBalanceParams params) throws StripeException { - return search(params, (RequestOptions) null); + return applyCustomerBalance(params, (RequestOptions) null); } - /** - * Search for PaymentIntents you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static PaymentIntentSearchResult search( - PaymentIntentSearchParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_intents/search"); - return ApiResource.requestSearchResult(url, params, PaymentIntentSearchResult.class, options); + /** Manually reconcile the remaining amount for a customer_balance PaymentIntent. */ + public PaymentIntent applyCustomerBalance( + PaymentIntentApplyCustomerBalanceParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/payment_intents/%s/apply_customer_balance", + ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); } /** - * Creates a PaymentIntent object. + * A PaymentIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_capture, requires_confirmation + * , requires_action, or processing. * - *

After the PaymentIntent is created, attach a payment method and confirm to continue the payment. - * You can read more about the different payment flows available via the Payment Intents API here. + *

Once canceled, no additional charges will be made by the PaymentIntent and any operations on + * the PaymentIntent will fail with an error. For PaymentIntents with + * status=’requires_capture’, the remaining amount_capturable will + * automatically be refunded. * - *

When confirm=true is used during creation, it is equivalent to creating and - * confirming the PaymentIntent in the same call. You may use any parameters available in the confirm API when - * confirm=true is supplied. + *

You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session + * instead */ - public static PaymentIntent create(Map params) throws StripeException { - return create(params, (RequestOptions) null); + public PaymentIntent cancel() throws StripeException { + return cancel((Map) null, (RequestOptions) null); } /** - * Creates a PaymentIntent object. + * A PaymentIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_capture, requires_confirmation + * , requires_action, or processing. * - *

After the PaymentIntent is created, attach a payment method and confirm to continue the payment. - * You can read more about the different payment flows available via the Payment Intents API here. + *

Once canceled, no additional charges will be made by the PaymentIntent and any operations on + * the PaymentIntent will fail with an error. For PaymentIntents with + * status=’requires_capture’, the remaining amount_capturable will + * automatically be refunded. * - *

When confirm=true is used during creation, it is equivalent to creating and - * confirming the PaymentIntent in the same call. You may use any parameters available in the confirm API when - * confirm=true is supplied. + *

You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session + * instead */ - public static PaymentIntent create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_intents"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); + public PaymentIntent cancel(RequestOptions options) throws StripeException { + return cancel((Map) null, options); } /** - * Creates a PaymentIntent object. + * A PaymentIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_capture, requires_confirmation + * , requires_action, or processing. * - *

After the PaymentIntent is created, attach a payment method and confirm to continue the payment. - * You can read more about the different payment flows available via the Payment Intents API here. + *

Once canceled, no additional charges will be made by the PaymentIntent and any operations on + * the PaymentIntent will fail with an error. For PaymentIntents with + * status=’requires_capture’, the remaining amount_capturable will + * automatically be refunded. * - *

When confirm=true is used during creation, it is equivalent to creating and - * confirming the PaymentIntent in the same call. You may use any parameters available in the confirm API when - * confirm=true is supplied. + *

You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session + * instead */ - public static PaymentIntent create(PaymentIntentCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); + public PaymentIntent cancel(Map params) throws StripeException { + return cancel(params, (RequestOptions) null); } /** - * Creates a PaymentIntent object. + * A PaymentIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_capture, requires_confirmation + * , requires_action, or processing. * - *

After the PaymentIntent is created, attach a payment method and confirm to continue the payment. - * You can read more about the different payment flows available via the Payment Intents API here. + *

Once canceled, no additional charges will be made by the PaymentIntent and any operations on + * the PaymentIntent will fail with an error. For PaymentIntents with + * status=’requires_capture’, the remaining amount_capturable will + * automatically be refunded. * - *

When confirm=true is used during creation, it is equivalent to creating and - * confirming the PaymentIntent in the same call. You may use any parameters available in the confirm API when - * confirm=true is supplied. + *

You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session + * instead */ - public static PaymentIntent create(PaymentIntentCreateParams params, RequestOptions options) + public PaymentIntent cancel(Map params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_intents"); + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/payment_intents/%s/cancel", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); } - /** Returns a list of PaymentIntents. */ - public static PaymentIntentCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of PaymentIntents. */ - public static PaymentIntentCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_intents"); - return ApiResource.requestCollection(url, params, PaymentIntentCollection.class, options); - } - - /** Returns a list of PaymentIntents. */ - public static PaymentIntentCollection list(PaymentIntentListParams params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of PaymentIntents. */ - public static PaymentIntentCollection list(PaymentIntentListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_intents"); - return ApiResource.requestCollection(url, params, PaymentIntentCollection.class, options); - } - /** - * Retrieves the details of a PaymentIntent that has previously been created. + * A PaymentIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_capture, requires_confirmation + * , requires_action, or processing. * - *

Client-side retrieval using a publishable key is allowed when the client_secret - * is provided in the query string. + *

Once canceled, no additional charges will be made by the PaymentIntent and any operations on + * the PaymentIntent will fail with an error. For PaymentIntents with + * status=’requires_capture’, the remaining amount_capturable will + * automatically be refunded. * - *

When retrieved with a publishable key, only a subset of properties will be returned. Please - * refer to the payment intent - * object reference for more details. + *

You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session + * instead */ - public static PaymentIntent retrieve(String intent) throws StripeException { - return retrieve(intent, (Map) null, (RequestOptions) null); + public PaymentIntent cancel(PaymentIntentCancelParams params) throws StripeException { + return cancel(params, (RequestOptions) null); } /** - * Retrieves the details of a PaymentIntent that has previously been created. + * A PaymentIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_capture, requires_confirmation + * , requires_action, or processing. * - *

Client-side retrieval using a publishable key is allowed when the client_secret - * is provided in the query string. + *

Once canceled, no additional charges will be made by the PaymentIntent and any operations on + * the PaymentIntent will fail with an error. For PaymentIntents with + * status=’requires_capture’, the remaining amount_capturable will + * automatically be refunded. * - *

When retrieved with a publishable key, only a subset of properties will be returned. Please - * refer to the payment intent - * object reference for more details. + *

You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session + * instead */ - public static PaymentIntent retrieve(String intent, RequestOptions options) + public PaymentIntent cancel(PaymentIntentCancelParams params, RequestOptions options) throws StripeException { - return retrieve(intent, (Map) null, options); + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/payment_intents/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); } /** - * Retrieves the details of a PaymentIntent that has previously been created. + * Capture the funds of an existing uncaptured PaymentIntent when its status is + * requires_capture. * - *

Client-side retrieval using a publishable key is allowed when the client_secret - * is provided in the query string. + *

Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by + * default). * - *

When retrieved with a publishable key, only a subset of properties will be returned. Please - * refer to the payment intent - * object reference for more details. + *

Learn more about separate + * authorization and capture. */ - public static PaymentIntent retrieve( - String intent, Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/payment_intents/%s", ApiResource.urlEncodeId(intent))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, PaymentIntent.class, options); + public PaymentIntent capture() throws StripeException { + return capture((Map) null, (RequestOptions) null); } /** - * Retrieves the details of a PaymentIntent that has previously been created. + * Capture the funds of an existing uncaptured PaymentIntent when its status is + * requires_capture. * - *

Client-side retrieval using a publishable key is allowed when the client_secret - * is provided in the query string. + *

Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by + * default). * - *

When retrieved with a publishable key, only a subset of properties will be returned. Please - * refer to the payment intent - * object reference for more details. + *

Learn more about separate + * authorization and capture. */ - public static PaymentIntent retrieve( - String intent, PaymentIntentRetrieveParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/payment_intents/%s", ApiResource.urlEncodeId(intent))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, PaymentIntent.class, options); + public PaymentIntent capture(RequestOptions options) throws StripeException { + return capture((Map) null, options); } /** - * Updates properties on a PaymentIntent object without confirming. + * Capture the funds of an existing uncaptured PaymentIntent when its status is + * requires_capture. * - *

Depending on which properties you update, you may need to confirm the PaymentIntent again. - * For example, updating the payment_method will always require you to confirm the - * PaymentIntent again. If you prefer to update and confirm at the same time, we recommend - * updating properties via the confirm API instead. + *

Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by + * default). + * + *

Learn more about separate + * authorization and capture. */ - @Override - public PaymentIntent update(Map params) throws StripeException { - return update(params, (RequestOptions) null); + public PaymentIntent capture(Map params) throws StripeException { + return capture(params, (RequestOptions) null); } /** - * Updates properties on a PaymentIntent object without confirming. + * Capture the funds of an existing uncaptured PaymentIntent when its status is + * requires_capture. * - *

Depending on which properties you update, you may need to confirm the PaymentIntent again. - * For example, updating the payment_method will always require you to confirm the - * PaymentIntent again. If you prefer to update and confirm at the same time, we recommend - * updating properties via the confirm API instead. + *

Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by + * default). + * + *

Learn more about separate + * authorization and capture. */ - @Override - public PaymentIntent update(Map params, RequestOptions options) + public PaymentIntent capture(Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/payment_intents/%s", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/payment_intents/%s/capture", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); } /** - * Updates properties on a PaymentIntent object without confirming. + * Capture the funds of an existing uncaptured PaymentIntent when its status is + * requires_capture. * - *

Depending on which properties you update, you may need to confirm the PaymentIntent again. - * For example, updating the payment_method will always require you to confirm the - * PaymentIntent again. If you prefer to update and confirm at the same time, we recommend - * updating properties via the confirm API instead. + *

Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by + * default). + * + *

Learn more about separate + * authorization and capture. */ - public PaymentIntent update(PaymentIntentUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + public PaymentIntent capture(PaymentIntentCaptureParams params) throws StripeException { + return capture(params, (RequestOptions) null); } /** - * Updates properties on a PaymentIntent object without confirming. + * Capture the funds of an existing uncaptured PaymentIntent when its status is + * requires_capture. * - *

Depending on which properties you update, you may need to confirm the PaymentIntent again. - * For example, updating the payment_method will always require you to confirm the - * PaymentIntent again. If you prefer to update and confirm at the same time, we recommend - * updating properties via the confirm API instead. + *

Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by + * default). + * + *

Learn more about separate + * authorization and capture. */ - public PaymentIntent update(PaymentIntentUpdateParams params, RequestOptions options) + public PaymentIntent capture(PaymentIntentCaptureParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/payment_intents/%s", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/payment_intents/%s/capture", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); } @@ -898,403 +889,476 @@ public PaymentIntent confirm(PaymentIntentConfirmParams params) throws StripeExc } /** - * Confirm that your customer intends to pay with current or provided payment method. Upon - * confirmation, the PaymentIntent will attempt to initiate a payment. + * Confirm that your customer intends to pay with current or provided payment method. Upon + * confirmation, the PaymentIntent will attempt to initiate a payment. + * + *

If the selected payment method requires additional authentication steps, the PaymentIntent + * will transition to the requires_action status and suggest additional actions via + * next_action. If payment fails, the PaymentIntent will transition to the + * requires_payment_method status. If payment succeeds, the PaymentIntent will transition + * to the succeeded status (or requires_capture, if capture_method + * is set to manual). + * + *

If the confirmation_method is automatic, payment may be attempted + * using our client SDKs + * and the PaymentIntent’s client_secret. After + * next_actions are handled by the client, no additional confirmation is required to + * complete the payment. + * + *

If the confirmation_method is manual, all payment attempts must be + * initiated using a secret key. If any actions are required for the payment, the PaymentIntent + * will return to the requires_confirmation state after those actions are completed. + * Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment + * attempt. Read the expanded documentation + * to learn more about manual confirmation. + */ + public PaymentIntent confirm(PaymentIntentConfirmParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/payment_intents/%s/confirm", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); + } + + /** + * Creates a PaymentIntent object. + * + *

After the PaymentIntent is created, attach a payment method and confirm to continue the payment. + * You can read more about the different payment flows available via the Payment Intents API here. + * + *

When confirm=true is used during creation, it is equivalent to creating and + * confirming the PaymentIntent in the same call. You may use any parameters available in the confirm API when + * confirm=true is supplied. + */ + public static PaymentIntent create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * Creates a PaymentIntent object. + * + *

After the PaymentIntent is created, attach a payment method and confirm to continue the payment. + * You can read more about the different payment flows available via the Payment Intents API here. + * + *

When confirm=true is used during creation, it is equivalent to creating and + * confirming the PaymentIntent in the same call. You may use any parameters available in the confirm API when + * confirm=true is supplied. + */ + public static PaymentIntent create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_intents"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); + } + + /** + * Creates a PaymentIntent object. + * + *

After the PaymentIntent is created, attach a payment method and confirm to continue the payment. + * You can read more about the different payment flows available via the Payment Intents API here. + * + *

When confirm=true is used during creation, it is equivalent to creating and + * confirming the PaymentIntent in the same call. You may use any parameters available in the confirm API when + * confirm=true is supplied. + */ + public static PaymentIntent create(PaymentIntentCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * Creates a PaymentIntent object. + * + *

After the PaymentIntent is created, attach a payment method and confirm to continue the payment. + * You can read more about the different payment flows available via the Payment Intents API here. + * + *

When confirm=true is used during creation, it is equivalent to creating and + * confirming the PaymentIntent in the same call. You may use any parameters available in the confirm API when + * confirm=true is supplied. + */ + public static PaymentIntent create(PaymentIntentCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_intents"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); + } + + /** + * Perform an incremental authorization on an eligible PaymentIntent. To be eligible, + * the PaymentIntent’s status must be requires_capture and incremental_authorization_supported + * must be true. + * + *

Incremental authorizations attempt to increase the authorized amount on your customer’s card + * to the new, higher amount provided. As with the initial authorization, incremental + * authorizations may be declined. A single PaymentIntent can call this endpoint multiple times to + * further increase the authorized amount. + * + *

If the incremental authorization succeeds, the PaymentIntent object is returned with the + * updated amount. + * If the incremental authorization fails, a card_declined error is returned, + * and no fields on the PaymentIntent or Charge are updated. The PaymentIntent object remains + * capturable for the previously authorized amount. + * + *

Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including + * declines. Once captured, a PaymentIntent can no longer be incremented. + * + *

Learn more about incremental + * authorizations. + */ + public PaymentIntent incrementAuthorization(Map params) throws StripeException { + return incrementAuthorization(params, (RequestOptions) null); + } + + /** + * Perform an incremental authorization on an eligible PaymentIntent. To be eligible, + * the PaymentIntent’s status must be requires_capture and incremental_authorization_supported + * must be true. + * + *

Incremental authorizations attempt to increase the authorized amount on your customer’s card + * to the new, higher amount provided. As with the initial authorization, incremental + * authorizations may be declined. A single PaymentIntent can call this endpoint multiple times to + * further increase the authorized amount. + * + *

If the incremental authorization succeeds, the PaymentIntent object is returned with the + * updated amount. + * If the incremental authorization fails, a card_declined error is returned, + * and no fields on the PaymentIntent or Charge are updated. The PaymentIntent object remains + * capturable for the previously authorized amount. + * + *

Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including + * declines. Once captured, a PaymentIntent can no longer be incremented. + * + *

Learn more about incremental + * authorizations. + */ + public PaymentIntent incrementAuthorization(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/payment_intents/%s/increment_authorization", + ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); + } + + /** + * Perform an incremental authorization on an eligible PaymentIntent. To be eligible, + * the PaymentIntent’s status must be requires_capture and incremental_authorization_supported + * must be true. + * + *

Incremental authorizations attempt to increase the authorized amount on your customer’s card + * to the new, higher amount provided. As with the initial authorization, incremental + * authorizations may be declined. A single PaymentIntent can call this endpoint multiple times to + * further increase the authorized amount. + * + *

If the incremental authorization succeeds, the PaymentIntent object is returned with the + * updated amount. + * If the incremental authorization fails, a card_declined error is returned, + * and no fields on the PaymentIntent or Charge are updated. The PaymentIntent object remains + * capturable for the previously authorized amount. + * + *

Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including + * declines. Once captured, a PaymentIntent can no longer be incremented. + * + *

Learn more about incremental + * authorizations. + */ + public PaymentIntent incrementAuthorization(PaymentIntentIncrementAuthorizationParams params) + throws StripeException { + return incrementAuthorization(params, (RequestOptions) null); + } + + /** + * Perform an incremental authorization on an eligible PaymentIntent. To be eligible, + * the PaymentIntent’s status must be requires_capture and incremental_authorization_supported + * must be true. * - *

If the selected payment method requires additional authentication steps, the PaymentIntent - * will transition to the requires_action status and suggest additional actions via - * next_action. If payment fails, the PaymentIntent will transition to the - * requires_payment_method status. If payment succeeds, the PaymentIntent will transition - * to the succeeded status (or requires_capture, if capture_method - * is set to manual). + *

Incremental authorizations attempt to increase the authorized amount on your customer’s card + * to the new, higher amount provided. As with the initial authorization, incremental + * authorizations may be declined. A single PaymentIntent can call this endpoint multiple times to + * further increase the authorized amount. * - *

If the confirmation_method is automatic, payment may be attempted - * using our client SDKs - * and the PaymentIntent’s client_secret. After - * next_actions are handled by the client, no additional confirmation is required to - * complete the payment. + *

If the incremental authorization succeeds, the PaymentIntent object is returned with the + * updated amount. + * If the incremental authorization fails, a card_declined error is returned, + * and no fields on the PaymentIntent or Charge are updated. The PaymentIntent object remains + * capturable for the previously authorized amount. * - *

If the confirmation_method is manual, all payment attempts must be - * initiated using a secret key. If any actions are required for the payment, the PaymentIntent - * will return to the requires_confirmation state after those actions are completed. - * Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment - * attempt. Read the expanded documentation - * to learn more about manual confirmation. + *

Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including + * declines. Once captured, a PaymentIntent can no longer be incremented. + * + *

Learn more about incremental + * authorizations. */ - public PaymentIntent confirm(PaymentIntentConfirmParams params, RequestOptions options) + public PaymentIntent incrementAuthorization( + PaymentIntentIncrementAuthorizationParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/payment_intents/%s/confirm", ApiResource.urlEncodeId(this.getId()))); + String.format( + "/v1/payment_intents/%s/increment_authorization", + ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); } - /** - * A PaymentIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_capture, requires_confirmation - * , requires_action, or processing. - * - *

Once canceled, no additional charges will be made by the PaymentIntent and any operations on - * the PaymentIntent will fail with an error. For PaymentIntents with - * status=’requires_capture’, the remaining amount_capturable will - * automatically be refunded. - * - *

You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session - * instead - */ - public PaymentIntent cancel() throws StripeException { - return cancel((Map) null, (RequestOptions) null); + /** Returns a list of PaymentIntents. */ + public static PaymentIntentCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of PaymentIntents. */ + public static PaymentIntentCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_intents"); + return ApiResource.requestCollection(url, params, PaymentIntentCollection.class, options); + } + + /** Returns a list of PaymentIntents. */ + public static PaymentIntentCollection list(PaymentIntentListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of PaymentIntents. */ + public static PaymentIntentCollection list(PaymentIntentListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_intents"); + return ApiResource.requestCollection(url, params, PaymentIntentCollection.class, options); } /** - * A PaymentIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_capture, requires_confirmation - * , requires_action, or processing. + * Retrieves the details of a PaymentIntent that has previously been created. * - *

Once canceled, no additional charges will be made by the PaymentIntent and any operations on - * the PaymentIntent will fail with an error. For PaymentIntents with - * status=’requires_capture’, the remaining amount_capturable will - * automatically be refunded. + *

Client-side retrieval using a publishable key is allowed when the client_secret + * is provided in the query string. * - *

You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session - * instead + *

When retrieved with a publishable key, only a subset of properties will be returned. Please + * refer to the payment intent + * object reference for more details. */ - public PaymentIntent cancel(RequestOptions options) throws StripeException { - return cancel((Map) null, options); + public static PaymentIntent retrieve(String intent) throws StripeException { + return retrieve(intent, (Map) null, (RequestOptions) null); } /** - * A PaymentIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_capture, requires_confirmation - * , requires_action, or processing. + * Retrieves the details of a PaymentIntent that has previously been created. * - *

Once canceled, no additional charges will be made by the PaymentIntent and any operations on - * the PaymentIntent will fail with an error. For PaymentIntents with - * status=’requires_capture’, the remaining amount_capturable will - * automatically be refunded. + *

Client-side retrieval using a publishable key is allowed when the client_secret + * is provided in the query string. * - *

You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session - * instead + *

When retrieved with a publishable key, only a subset of properties will be returned. Please + * refer to the payment intent + * object reference for more details. */ - public PaymentIntent cancel(Map params) throws StripeException { - return cancel(params, (RequestOptions) null); + public static PaymentIntent retrieve(String intent, RequestOptions options) + throws StripeException { + return retrieve(intent, (Map) null, options); } /** - * A PaymentIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_capture, requires_confirmation - * , requires_action, or processing. + * Retrieves the details of a PaymentIntent that has previously been created. * - *

Once canceled, no additional charges will be made by the PaymentIntent and any operations on - * the PaymentIntent will fail with an error. For PaymentIntents with - * status=’requires_capture’, the remaining amount_capturable will - * automatically be refunded. + *

Client-side retrieval using a publishable key is allowed when the client_secret + * is provided in the query string. * - *

You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session - * instead + *

When retrieved with a publishable key, only a subset of properties will be returned. Please + * refer to the payment intent + * object reference for more details. */ - public PaymentIntent cancel(Map params, RequestOptions options) - throws StripeException { + public static PaymentIntent retrieve( + String intent, Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/payment_intents/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/payment_intents/%s", ApiResource.urlEncodeId(intent))); return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); - } - - /** - * A PaymentIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_capture, requires_confirmation - * , requires_action, or processing. - * - *

Once canceled, no additional charges will be made by the PaymentIntent and any operations on - * the PaymentIntent will fail with an error. For PaymentIntents with - * status=’requires_capture’, the remaining amount_capturable will - * automatically be refunded. - * - *

You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session - * instead - */ - public PaymentIntent cancel(PaymentIntentCancelParams params) throws StripeException { - return cancel(params, (RequestOptions) null); + ApiResource.RequestMethod.GET, url, params, PaymentIntent.class, options); } /** - * A PaymentIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_capture, requires_confirmation - * , requires_action, or processing. + * Retrieves the details of a PaymentIntent that has previously been created. * - *

Once canceled, no additional charges will be made by the PaymentIntent and any operations on - * the PaymentIntent will fail with an error. For PaymentIntents with - * status=’requires_capture’, the remaining amount_capturable will - * automatically be refunded. + *

Client-side retrieval using a publishable key is allowed when the client_secret + * is provided in the query string. * - *

You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session - * instead + *

When retrieved with a publishable key, only a subset of properties will be returned. Please + * refer to the payment intent + * object reference for more details. */ - public PaymentIntent cancel(PaymentIntentCancelParams params, RequestOptions options) + public static PaymentIntent retrieve( + String intent, PaymentIntentRetrieveParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/payment_intents/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/payment_intents/%s", ApiResource.urlEncodeId(intent))); return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); - } - - /** - * Capture the funds of an existing uncaptured PaymentIntent when its status is - * requires_capture. - * - *

Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by - * default). - * - *

Learn more about separate - * authorization and capture. - */ - public PaymentIntent capture() throws StripeException { - return capture((Map) null, (RequestOptions) null); - } - - /** - * Capture the funds of an existing uncaptured PaymentIntent when its status is - * requires_capture. - * - *

Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by - * default). - * - *

Learn more about separate - * authorization and capture. - */ - public PaymentIntent capture(RequestOptions options) throws StripeException { - return capture((Map) null, options); + ApiResource.RequestMethod.GET, url, params, PaymentIntent.class, options); } /** - * Capture the funds of an existing uncaptured PaymentIntent when its status is - * requires_capture. - * - *

Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by - * default). - * - *

Learn more about separate - * authorization and capture. + * Search for PaymentIntents you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public PaymentIntent capture(Map params) throws StripeException { - return capture(params, (RequestOptions) null); + public static PaymentIntentSearchResult search(Map params) + throws StripeException { + return search(params, (RequestOptions) null); } /** - * Capture the funds of an existing uncaptured PaymentIntent when its status is - * requires_capture. - * - *

Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by - * default). - * - *

Learn more about separate - * authorization and capture. + * Search for PaymentIntents you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public PaymentIntent capture(Map params, RequestOptions options) + public static PaymentIntentSearchResult search(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/payment_intents/%s/capture", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_intents/search"); + return ApiResource.requestSearchResult(url, params, PaymentIntentSearchResult.class, options); } /** - * Capture the funds of an existing uncaptured PaymentIntent when its status is - * requires_capture. - * - *

Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by - * default). - * - *

Learn more about separate - * authorization and capture. + * Search for PaymentIntents you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public PaymentIntent capture(PaymentIntentCaptureParams params) throws StripeException { - return capture(params, (RequestOptions) null); + public static PaymentIntentSearchResult search(PaymentIntentSearchParams params) + throws StripeException { + return search(params, (RequestOptions) null); } /** - * Capture the funds of an existing uncaptured PaymentIntent when its status is - * requires_capture. - * - *

Uncaptured PaymentIntents will be canceled a set number of days after they are created (7 by - * default). - * - *

Learn more about separate - * authorization and capture. + * Search for PaymentIntents you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public PaymentIntent capture(PaymentIntentCaptureParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/payment_intents/%s/capture", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); + public static PaymentIntentSearchResult search( + PaymentIntentSearchParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_intents/search"); + return ApiResource.requestSearchResult(url, params, PaymentIntentSearchResult.class, options); } /** - * Perform an incremental authorization on an eligible PaymentIntent. To be eligible, - * the PaymentIntent’s status must be requires_capture and incremental_authorization_supported - * must be true. - * - *

Incremental authorizations attempt to increase the authorized amount on your customer’s card - * to the new, higher amount provided. As with the initial authorization, incremental - * authorizations may be declined. A single PaymentIntent can call this endpoint multiple times to - * further increase the authorized amount. - * - *

If the incremental authorization succeeds, the PaymentIntent object is returned with the - * updated amount. - * If the incremental authorization fails, a card_declined error is returned, - * and no fields on the PaymentIntent or Charge are updated. The PaymentIntent object remains - * capturable for the previously authorized amount. - * - *

Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including - * declines. Once captured, a PaymentIntent can no longer be incremented. + * Updates properties on a PaymentIntent object without confirming. * - *

Learn more about incremental - * authorizations. + *

Depending on which properties you update, you may need to confirm the PaymentIntent again. + * For example, updating the payment_method will always require you to confirm the + * PaymentIntent again. If you prefer to update and confirm at the same time, we recommend + * updating properties via the confirm API instead. */ - public PaymentIntent incrementAuthorization(Map params) throws StripeException { - return incrementAuthorization(params, (RequestOptions) null); + @Override + public PaymentIntent update(Map params) throws StripeException { + return update(params, (RequestOptions) null); } /** - * Perform an incremental authorization on an eligible PaymentIntent. To be eligible, - * the PaymentIntent’s status must be requires_capture and incremental_authorization_supported - * must be true. - * - *

Incremental authorizations attempt to increase the authorized amount on your customer’s card - * to the new, higher amount provided. As with the initial authorization, incremental - * authorizations may be declined. A single PaymentIntent can call this endpoint multiple times to - * further increase the authorized amount. - * - *

If the incremental authorization succeeds, the PaymentIntent object is returned with the - * updated amount. - * If the incremental authorization fails, a card_declined error is returned, - * and no fields on the PaymentIntent or Charge are updated. The PaymentIntent object remains - * capturable for the previously authorized amount. - * - *

Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including - * declines. Once captured, a PaymentIntent can no longer be incremented. + * Updates properties on a PaymentIntent object without confirming. * - *

Learn more about incremental - * authorizations. + *

Depending on which properties you update, you may need to confirm the PaymentIntent again. + * For example, updating the payment_method will always require you to confirm the + * PaymentIntent again. If you prefer to update and confirm at the same time, we recommend + * updating properties via the confirm API instead. */ - public PaymentIntent incrementAuthorization(Map params, RequestOptions options) + @Override + public PaymentIntent update(Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format( - "/v1/payment_intents/%s/increment_authorization", - ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/payment_intents/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); } /** - * Perform an incremental authorization on an eligible PaymentIntent. To be eligible, - * the PaymentIntent’s status must be requires_capture and incremental_authorization_supported - * must be true. - * - *

Incremental authorizations attempt to increase the authorized amount on your customer’s card - * to the new, higher amount provided. As with the initial authorization, incremental - * authorizations may be declined. A single PaymentIntent can call this endpoint multiple times to - * further increase the authorized amount. - * - *

If the incremental authorization succeeds, the PaymentIntent object is returned with the - * updated amount. - * If the incremental authorization fails, a card_declined error is returned, - * and no fields on the PaymentIntent or Charge are updated. The PaymentIntent object remains - * capturable for the previously authorized amount. - * - *

Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including - * declines. Once captured, a PaymentIntent can no longer be incremented. + * Updates properties on a PaymentIntent object without confirming. * - *

Learn more about incremental - * authorizations. + *

Depending on which properties you update, you may need to confirm the PaymentIntent again. + * For example, updating the payment_method will always require you to confirm the + * PaymentIntent again. If you prefer to update and confirm at the same time, we recommend + * updating properties via the confirm API instead. */ - public PaymentIntent incrementAuthorization(PaymentIntentIncrementAuthorizationParams params) - throws StripeException { - return incrementAuthorization(params, (RequestOptions) null); + public PaymentIntent update(PaymentIntentUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); } /** - * Perform an incremental authorization on an eligible PaymentIntent. To be eligible, - * the PaymentIntent’s status must be requires_capture and incremental_authorization_supported - * must be true. - * - *

Incremental authorizations attempt to increase the authorized amount on your customer’s card - * to the new, higher amount provided. As with the initial authorization, incremental - * authorizations may be declined. A single PaymentIntent can call this endpoint multiple times to - * further increase the authorized amount. - * - *

If the incremental authorization succeeds, the PaymentIntent object is returned with the - * updated amount. - * If the incremental authorization fails, a card_declined error is returned, - * and no fields on the PaymentIntent or Charge are updated. The PaymentIntent object remains - * capturable for the previously authorized amount. - * - *

Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including - * declines. Once captured, a PaymentIntent can no longer be incremented. + * Updates properties on a PaymentIntent object without confirming. * - *

Learn more about incremental - * authorizations. + *

Depending on which properties you update, you may need to confirm the PaymentIntent again. + * For example, updating the payment_method will always require you to confirm the + * PaymentIntent again. If you prefer to update and confirm at the same time, we recommend + * updating properties via the confirm API instead. */ - public PaymentIntent incrementAuthorization( - PaymentIntentIncrementAuthorizationParams params, RequestOptions options) + public PaymentIntent update(PaymentIntentUpdateParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format( - "/v1/payment_intents/%s/increment_authorization", - ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/payment_intents/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); } @@ -1349,56 +1413,6 @@ public PaymentIntent verifyMicrodeposits( ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); } - /** Manually reconcile the remaining amount for a customer_balance PaymentIntent. */ - public PaymentIntent applyCustomerBalance() throws StripeException { - return applyCustomerBalance((Map) null, (RequestOptions) null); - } - - /** Manually reconcile the remaining amount for a customer_balance PaymentIntent. */ - public PaymentIntent applyCustomerBalance(RequestOptions options) throws StripeException { - return applyCustomerBalance((Map) null, options); - } - - /** Manually reconcile the remaining amount for a customer_balance PaymentIntent. */ - public PaymentIntent applyCustomerBalance(Map params) throws StripeException { - return applyCustomerBalance(params, (RequestOptions) null); - } - - /** Manually reconcile the remaining amount for a customer_balance PaymentIntent. */ - public PaymentIntent applyCustomerBalance(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/payment_intents/%s/apply_customer_balance", - ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); - } - - /** Manually reconcile the remaining amount for a customer_balance PaymentIntent. */ - public PaymentIntent applyCustomerBalance(PaymentIntentApplyCustomerBalanceParams params) - throws StripeException { - return applyCustomerBalance(params, (RequestOptions) null); - } - - /** Manually reconcile the remaining amount for a customer_balance PaymentIntent. */ - public PaymentIntent applyCustomerBalance( - PaymentIntentApplyCustomerBalanceParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/payment_intents/%s/apply_customer_balance", - ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentIntent.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -1717,6 +1731,7 @@ public static class NextActionDisplayBankTransferInstructions extends StripeObje @SerializedName("type") String type; + /** FinancialAddresses contain identifying information that resolves to a FinancialAccount. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -1749,6 +1764,7 @@ public static class FinancialAddress extends StripeObject { @SerializedName("zengin") Zengin zengin; + /** Iban Records contain E.U. bank account details per the SEPA format. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -1773,6 +1789,7 @@ public static class Iban extends StripeObject { String iban; } + /** Sort Code Records contain U.K. bank account details per the sort code format. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -1790,6 +1807,7 @@ public static class SortCode extends StripeObject { String sortCode; } + /** SPEI Records contain Mexico bank account details per the SPEI format. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -1807,6 +1825,7 @@ public static class Spei extends StripeObject { String clabe; } + /** Zengin Records contain Japan bank account details per the Zengin format. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/PaymentLink.java b/src/main/java/com/stripe/model/PaymentLink.java index ffe6434f026..50d86c74f38 100644 --- a/src/main/java/com/stripe/model/PaymentLink.java +++ b/src/main/java/com/stripe/model/PaymentLink.java @@ -18,6 +18,19 @@ import lombok.Getter; import lombok.Setter; +/** + * A payment link is a shareable URL that will take your customers to a hosted payment page. A + * payment link can be shared and used multiple times. + * + *

When a customer opens a payment link it will open a new checkout session to render the payment + * page. You can use checkout + * session events to track payments through payment links. + * + *

Related guide: Payment Links + * API + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -65,6 +78,13 @@ public class PaymentLink extends ApiResource implements HasId, MetadataStoreISO currency code, + * in lowercase. Must be a supported currency. + */ + @SerializedName("currency") + String currency; + /** * Configuration for Customer creation during checkout. * @@ -195,6 +215,32 @@ public void setOnBehalfOfObject(Account expandableObject) { this.onBehalfOf = new ExpandableField(expandableObject.getId(), expandableObject); } + /** Creates a payment link. */ + public static PaymentLink create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a payment link. */ + public static PaymentLink create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_links"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentLink.class, options); + } + + /** Creates a payment link. */ + public static PaymentLink create(PaymentLinkCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a payment link. */ + public static PaymentLink create(PaymentLinkCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_links"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentLink.class, options); + } + /** Returns a list of your payment links. */ public static PaymentLinkCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); @@ -219,43 +265,6 @@ public static PaymentLinkCollection list(PaymentLinkListParams params, RequestOp return ApiResource.requestCollection(url, params, PaymentLinkCollection.class, options); } - /** Retrieve a payment link. */ - public static PaymentLink retrieve(String paymentLink) throws StripeException { - return retrieve(paymentLink, (Map) null, (RequestOptions) null); - } - - /** Retrieve a payment link. */ - public static PaymentLink retrieve(String paymentLink, RequestOptions options) - throws StripeException { - return retrieve(paymentLink, (Map) null, options); - } - - /** Retrieve a payment link. */ - public static PaymentLink retrieve( - String paymentLink, Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/payment_links/%s", ApiResource.urlEncodeId(paymentLink))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, PaymentLink.class, options); - } - - /** Retrieve a payment link. */ - public static PaymentLink retrieve( - String paymentLink, PaymentLinkRetrieveParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/payment_links/%s", ApiResource.urlEncodeId(paymentLink))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, PaymentLink.class, options); - } - /** * When retrieving a payment link, there is an includable line_items property * containing the first handful of those items. There is also a URL where you can retrieve the @@ -316,30 +325,41 @@ public LineItemCollection listLineItems( return ApiResource.requestCollection(url, params, LineItemCollection.class, options); } - /** Creates a payment link. */ - public static PaymentLink create(Map params) throws StripeException { - return create(params, (RequestOptions) null); + /** Retrieve a payment link. */ + public static PaymentLink retrieve(String paymentLink) throws StripeException { + return retrieve(paymentLink, (Map) null, (RequestOptions) null); } - /** Creates a payment link. */ - public static PaymentLink create(Map params, RequestOptions options) + /** Retrieve a payment link. */ + public static PaymentLink retrieve(String paymentLink, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_links"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentLink.class, options); + return retrieve(paymentLink, (Map) null, options); } - /** Creates a payment link. */ - public static PaymentLink create(PaymentLinkCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); + /** Retrieve a payment link. */ + public static PaymentLink retrieve( + String paymentLink, Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/payment_links/%s", ApiResource.urlEncodeId(paymentLink))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, PaymentLink.class, options); } - /** Creates a payment link. */ - public static PaymentLink create(PaymentLinkCreateParams params, RequestOptions options) + /** Retrieve a payment link. */ + public static PaymentLink retrieve( + String paymentLink, PaymentLinkRetrieveParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payment_links"); + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/payment_links/%s", ApiResource.urlEncodeId(paymentLink))); return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentLink.class, options); + ApiResource.RequestMethod.GET, url, params, PaymentLink.class, options); } /** Updates a payment link. */ diff --git a/src/main/java/com/stripe/model/PaymentMethod.java b/src/main/java/com/stripe/model/PaymentMethod.java index ea7dd6699b9..9d9b727a7bb 100644 --- a/src/main/java/com/stripe/model/PaymentMethod.java +++ b/src/main/java/com/stripe/model/PaymentMethod.java @@ -18,6 +18,14 @@ import lombok.Getter; import lombok.Setter; +/** + * PaymentMethod objects represent your customer's payment instruments. You can use them with PaymentIntents to collect payments or + * save them to Customer objects to store instrument details for future payments. + * + *

Related guides: Payment Methods + * and More Payment Scenarios. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -193,6 +201,108 @@ public void setCustomerObject(Customer expandableObject) { this.customer = new ExpandableField(expandableObject.getId(), expandableObject); } + /** + * Attaches a PaymentMethod object to a Customer. + * + *

To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntent or a PaymentIntent with setup_future_usage. + * These approaches will perform any necessary steps to set up the PaymentMethod for future + * payments. Using the /v1/payment_methods/:id/attach endpoint without first using a + * SetupIntent or PaymentIntent with setup_future_usage does not optimize the + * PaymentMethod for future use, which makes later declines and payment friction more likely. See + * Optimizing cards for + * future payments for more information about setting up future payments. + * + *

To use this PaymentMethod as the default for invoice or subscription payments, set + * invoice_settings.default_payment_method, on the Customer to the + * PaymentMethod’s ID. + */ + public PaymentMethod attach(Map params) throws StripeException { + return attach(params, (RequestOptions) null); + } + + /** + * Attaches a PaymentMethod object to a Customer. + * + *

To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntent or a PaymentIntent with setup_future_usage. + * These approaches will perform any necessary steps to set up the PaymentMethod for future + * payments. Using the /v1/payment_methods/:id/attach endpoint without first using a + * SetupIntent or PaymentIntent with setup_future_usage does not optimize the + * PaymentMethod for future use, which makes later declines and payment friction more likely. See + * Optimizing cards for + * future payments for more information about setting up future payments. + * + *

To use this PaymentMethod as the default for invoice or subscription payments, set + * invoice_settings.default_payment_method, on the Customer to the + * PaymentMethod’s ID. + */ + public PaymentMethod attach(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/payment_methods/%s/attach", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options); + } + + /** + * Attaches a PaymentMethod object to a Customer. + * + *

To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntent or a PaymentIntent with setup_future_usage. + * These approaches will perform any necessary steps to set up the PaymentMethod for future + * payments. Using the /v1/payment_methods/:id/attach endpoint without first using a + * SetupIntent or PaymentIntent with setup_future_usage does not optimize the + * PaymentMethod for future use, which makes later declines and payment friction more likely. See + * Optimizing cards for + * future payments for more information about setting up future payments. + * + *

To use this PaymentMethod as the default for invoice or subscription payments, set + * invoice_settings.default_payment_method, on the Customer to the + * PaymentMethod’s ID. + */ + public PaymentMethod attach(PaymentMethodAttachParams params) throws StripeException { + return attach(params, (RequestOptions) null); + } + + /** + * Attaches a PaymentMethod object to a Customer. + * + *

To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntent or a PaymentIntent with setup_future_usage. + * These approaches will perform any necessary steps to set up the PaymentMethod for future + * payments. Using the /v1/payment_methods/:id/attach endpoint without first using a + * SetupIntent or PaymentIntent with setup_future_usage does not optimize the + * PaymentMethod for future use, which makes later declines and payment friction more likely. See + * Optimizing cards for + * future payments for more information about setting up future payments. + * + *

To use this PaymentMethod as the default for invoice or subscription payments, set + * invoice_settings.default_payment_method, on the Customer to the + * PaymentMethod’s ID. + */ + public PaymentMethod attach(PaymentMethodAttachParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/payment_methods/%s/attach", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options); + } + /** * Creates a PaymentMethod object. Read the Stripe.js @@ -260,94 +370,63 @@ public static PaymentMethod create(PaymentMethodCreateParams params, RequestOpti } /** - * Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method - * attached to a Customer, you should use Retrieve a Customer’s - * PaymentMethods + * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no + * longer be used for a payment or re-attached to a Customer. */ - public static PaymentMethod retrieve(String paymentMethod) throws StripeException { - return retrieve(paymentMethod, (Map) null, (RequestOptions) null); + public PaymentMethod detach() throws StripeException { + return detach((Map) null, (RequestOptions) null); } /** - * Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method - * attached to a Customer, you should use Retrieve a Customer’s - * PaymentMethods + * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no + * longer be used for a payment or re-attached to a Customer. */ - public static PaymentMethod retrieve(String paymentMethod, RequestOptions options) - throws StripeException { - return retrieve(paymentMethod, (Map) null, options); + public PaymentMethod detach(RequestOptions options) throws StripeException { + return detach((Map) null, options); } /** - * Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method - * attached to a Customer, you should use Retrieve a Customer’s - * PaymentMethods + * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no + * longer be used for a payment or re-attached to a Customer. */ - public static PaymentMethod retrieve( - String paymentMethod, Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/payment_methods/%s", ApiResource.urlEncodeId(paymentMethod))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, PaymentMethod.class, options); + public PaymentMethod detach(Map params) throws StripeException { + return detach(params, (RequestOptions) null); } /** - * Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method - * attached to a Customer, you should use Retrieve a Customer’s - * PaymentMethods + * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no + * longer be used for a payment or re-attached to a Customer. */ - public static PaymentMethod retrieve( - String paymentMethod, PaymentMethodRetrieveParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/payment_methods/%s", ApiResource.urlEncodeId(paymentMethod))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, PaymentMethod.class, options); - } - - /** Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. */ - @Override - public PaymentMethod update(Map params) throws StripeException { - return update(params, (RequestOptions) null); - } - - /** Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. */ - @Override - public PaymentMethod update(Map params, RequestOptions options) + public PaymentMethod detach(Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/payment_methods/%s", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/payment_methods/%s/detach", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options); } - /** Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. */ - public PaymentMethod update(PaymentMethodUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + /** + * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no + * longer be used for a payment or re-attached to a Customer. + */ + public PaymentMethod detach(PaymentMethodDetachParams params) throws StripeException { + return detach(params, (RequestOptions) null); } - /** Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. */ - public PaymentMethod update(PaymentMethodUpdateParams params, RequestOptions options) + /** + * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no + * longer be used for a payment or re-attached to a Customer. + */ + public PaymentMethod detach(PaymentMethodDetachParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/payment_methods/%s", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/payment_methods/%s/detach", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options); } @@ -398,165 +477,94 @@ public static PaymentMethodCollection list(PaymentMethodListParams params, Reque } /** - * Attaches a PaymentMethod object to a Customer. - * - *

To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntent or a PaymentIntent with setup_future_usage. - * These approaches will perform any necessary steps to set up the PaymentMethod for future - * payments. Using the /v1/payment_methods/:id/attach endpoint without first using a - * SetupIntent or PaymentIntent with setup_future_usage does not optimize the - * PaymentMethod for future use, which makes later declines and payment friction more likely. See - * Optimizing cards for - * future payments for more information about setting up future payments. - * - *

To use this PaymentMethod as the default for invoice or subscription payments, set - * invoice_settings.default_payment_method, on the Customer to the - * PaymentMethod’s ID. + * Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method + * attached to a Customer, you should use Retrieve a Customer’s + * PaymentMethods */ - public PaymentMethod attach(Map params) throws StripeException { - return attach(params, (RequestOptions) null); + public static PaymentMethod retrieve(String paymentMethod) throws StripeException { + return retrieve(paymentMethod, (Map) null, (RequestOptions) null); } /** - * Attaches a PaymentMethod object to a Customer. - * - *

To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntent or a PaymentIntent with setup_future_usage. - * These approaches will perform any necessary steps to set up the PaymentMethod for future - * payments. Using the /v1/payment_methods/:id/attach endpoint without first using a - * SetupIntent or PaymentIntent with setup_future_usage does not optimize the - * PaymentMethod for future use, which makes later declines and payment friction more likely. See - * Optimizing cards for - * future payments for more information about setting up future payments. - * - *

To use this PaymentMethod as the default for invoice or subscription payments, set - * invoice_settings.default_payment_method, on the Customer to the - * PaymentMethod’s ID. + * Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method + * attached to a Customer, you should use Retrieve a Customer’s + * PaymentMethods */ - public PaymentMethod attach(Map params, RequestOptions options) + public static PaymentMethod retrieve(String paymentMethod, RequestOptions options) + throws StripeException { + return retrieve(paymentMethod, (Map) null, options); + } + + /** + * Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method + * attached to a Customer, you should use Retrieve a Customer’s + * PaymentMethods + */ + public static PaymentMethod retrieve( + String paymentMethod, Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/payment_methods/%s/attach", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/payment_methods/%s", ApiResource.urlEncodeId(paymentMethod))); return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options); - } - - /** - * Attaches a PaymentMethod object to a Customer. - * - *

To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntent or a PaymentIntent with setup_future_usage. - * These approaches will perform any necessary steps to set up the PaymentMethod for future - * payments. Using the /v1/payment_methods/:id/attach endpoint without first using a - * SetupIntent or PaymentIntent with setup_future_usage does not optimize the - * PaymentMethod for future use, which makes later declines and payment friction more likely. See - * Optimizing cards for - * future payments for more information about setting up future payments. - * - *

To use this PaymentMethod as the default for invoice or subscription payments, set - * invoice_settings.default_payment_method, on the Customer to the - * PaymentMethod’s ID. - */ - public PaymentMethod attach(PaymentMethodAttachParams params) throws StripeException { - return attach(params, (RequestOptions) null); + ApiResource.RequestMethod.GET, url, params, PaymentMethod.class, options); } /** - * Attaches a PaymentMethod object to a Customer. - * - *

To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntent or a PaymentIntent with setup_future_usage. - * These approaches will perform any necessary steps to set up the PaymentMethod for future - * payments. Using the /v1/payment_methods/:id/attach endpoint without first using a - * SetupIntent or PaymentIntent with setup_future_usage does not optimize the - * PaymentMethod for future use, which makes later declines and payment friction more likely. See - * Optimizing cards for - * future payments for more information about setting up future payments. - * - *

To use this PaymentMethod as the default for invoice or subscription payments, set - * invoice_settings.default_payment_method, on the Customer to the - * PaymentMethod’s ID. + * Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method + * attached to a Customer, you should use Retrieve a Customer’s + * PaymentMethods */ - public PaymentMethod attach(PaymentMethodAttachParams params, RequestOptions options) + public static PaymentMethod retrieve( + String paymentMethod, PaymentMethodRetrieveParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/payment_methods/%s/attach", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/payment_methods/%s", ApiResource.urlEncodeId(paymentMethod))); return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options); - } - - /** - * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no - * longer be used for a payment or re-attached to a Customer. - */ - public PaymentMethod detach() throws StripeException { - return detach((Map) null, (RequestOptions) null); - } - - /** - * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no - * longer be used for a payment or re-attached to a Customer. - */ - public PaymentMethod detach(RequestOptions options) throws StripeException { - return detach((Map) null, options); + ApiResource.RequestMethod.GET, url, params, PaymentMethod.class, options); } - /** - * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no - * longer be used for a payment or re-attached to a Customer. - */ - public PaymentMethod detach(Map params) throws StripeException { - return detach(params, (RequestOptions) null); + /** Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. */ + @Override + public PaymentMethod update(Map params) throws StripeException { + return update(params, (RequestOptions) null); } - /** - * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no - * longer be used for a payment or re-attached to a Customer. - */ - public PaymentMethod detach(Map params, RequestOptions options) + /** Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. */ + @Override + public PaymentMethod update(Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/payment_methods/%s/detach", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/payment_methods/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options); } - /** - * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no - * longer be used for a payment or re-attached to a Customer. - */ - public PaymentMethod detach(PaymentMethodDetachParams params) throws StripeException { - return detach(params, (RequestOptions) null); + /** Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. */ + public PaymentMethod update(PaymentMethodUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); } - /** - * Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no - * longer be used for a payment or re-attached to a Customer. - */ - public PaymentMethod detach(PaymentMethodDetachParams params, RequestOptions options) + /** Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. */ + public PaymentMethod update(PaymentMethodUpdateParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/payment_methods/%s/detach", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/payment_methods/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, PaymentMethod.class, options); } @@ -1108,6 +1116,10 @@ public static class Paynow extends StripeObject {} @EqualsAndHashCode(callSuper = false) public static class Promptpay extends StripeObject {} + /** + * Options to configure Radar. See Radar + * Session for more information. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/PaymentSourceCollection.java b/src/main/java/com/stripe/model/PaymentSourceCollection.java index e65bd47e050..1a1d31d0e7d 100644 --- a/src/main/java/com/stripe/model/PaymentSourceCollection.java +++ b/src/main/java/com/stripe/model/PaymentSourceCollection.java @@ -11,6 +11,64 @@ import java.util.Map; public class PaymentSourceCollection extends StripeCollection { + /** + * When you create a new credit card, you must specify a customer or recipient on which to create + * it. + * + *

If the card’s owner has no default card, then the new card will become the default. However, + * if the owner already has a default, then it will not change. To change the default, you should + * update the customer to have a new + * default_source. + */ + public PaymentSource create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * When you create a new credit card, you must specify a customer or recipient on which to create + * it. + * + *

If the card’s owner has no default card, then the new card will become the default. However, + * if the owner already has a default, then it will not change. To change the default, you should + * update the customer to have a new + * default_source. + */ + public PaymentSource create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentSource.class, options); + } + + /** + * When you create a new credit card, you must specify a customer or recipient on which to create + * it. + * + *

If the card’s owner has no default card, then the new card will become the default. However, + * if the owner already has a default, then it will not change. To change the default, you should + * update the customer to have a new + * default_source. + */ + public PaymentSource create(PaymentSourceCollectionCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * When you create a new credit card, you must specify a customer or recipient on which to create + * it. + * + *

If the card’s owner has no default card, then the new card will become the default. However, + * if the owner already has a default, then it will not change. To change the default, you should + * update the customer to have a new + * default_source. + */ + public PaymentSource create(PaymentSourceCollectionCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PaymentSource.class, options); + } + /** List sources for a specified customer. */ public PaymentSourceCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); @@ -70,62 +128,4 @@ public PaymentSource retrieve( return ApiResource.request( ApiResource.RequestMethod.GET, url, params, PaymentSource.class, options); } - - /** - * When you create a new credit card, you must specify a customer or recipient on which to create - * it. - * - *

If the card’s owner has no default card, then the new card will become the default. However, - * if the owner already has a default, then it will not change. To change the default, you should - * update the customer to have a new - * default_source. - */ - public PaymentSource create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * When you create a new credit card, you must specify a customer or recipient on which to create - * it. - * - *

If the card’s owner has no default card, then the new card will become the default. However, - * if the owner already has a default, then it will not change. To change the default, you should - * update the customer to have a new - * default_source. - */ - public PaymentSource create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentSource.class, options); - } - - /** - * When you create a new credit card, you must specify a customer or recipient on which to create - * it. - * - *

If the card’s owner has no default card, then the new card will become the default. However, - * if the owner already has a default, then it will not change. To change the default, you should - * update the customer to have a new - * default_source. - */ - public PaymentSource create(PaymentSourceCollectionCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * When you create a new credit card, you must specify a customer or recipient on which to create - * it. - * - *

If the card’s owner has no default card, then the new card will become the default. However, - * if the owner already has a default, then it will not change. To change the default, you should - * update the customer to have a new - * default_source. - */ - public PaymentSource create(PaymentSourceCollectionCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PaymentSource.class, options); - } } diff --git a/src/main/java/com/stripe/model/Payout.java b/src/main/java/com/stripe/model/Payout.java index 40ae5a27587..5d921e61284 100644 --- a/src/main/java/com/stripe/model/Payout.java +++ b/src/main/java/com/stripe/model/Payout.java @@ -17,6 +17,16 @@ import lombok.Getter; import lombok.Setter; +/** + * A {@code Payout} object is created when you receive funds from Stripe, or when you initiate a + * payout to either a bank account or debit card of a connected Stripe account. You + * can retrieve individual payouts, as well as list all payouts. Payouts are made on varying schedules, depending on + * your country and industry. + * + *

Related guide: Receiving Payouts. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -264,89 +274,61 @@ public void setReversedByObject(Payout expandableObject) { } /** - * Retrieves the details of an existing payout. Supply the unique payout ID from either a payout - * creation request or the payout list, and Stripe will return the corresponding payout - * information. + * A previously created payout can be canceled if it has not yet been paid out. Funds will be + * refunded to your available balance. You may not cancel automatic Stripe payouts. */ - public static Payout retrieve(String payout) throws StripeException { - return retrieve(payout, (Map) null, (RequestOptions) null); + public Payout cancel() throws StripeException { + return cancel((Map) null, (RequestOptions) null); } /** - * Retrieves the details of an existing payout. Supply the unique payout ID from either a payout - * creation request or the payout list, and Stripe will return the corresponding payout - * information. + * A previously created payout can be canceled if it has not yet been paid out. Funds will be + * refunded to your available balance. You may not cancel automatic Stripe payouts. */ - public static Payout retrieve(String payout, RequestOptions options) throws StripeException { - return retrieve(payout, (Map) null, options); + public Payout cancel(RequestOptions options) throws StripeException { + return cancel((Map) null, options); } /** - * Retrieves the details of an existing payout. Supply the unique payout ID from either a payout - * creation request or the payout list, and Stripe will return the corresponding payout - * information. + * A previously created payout can be canceled if it has not yet been paid out. Funds will be + * refunded to your available balance. You may not cancel automatic Stripe payouts. */ - public static Payout retrieve(String payout, Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), String.format("/v1/payouts/%s", ApiResource.urlEncodeId(payout))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Payout.class, options); + public Payout cancel(Map params) throws StripeException { + return cancel(params, (RequestOptions) null); } /** - * Retrieves the details of an existing payout. Supply the unique payout ID from either a payout - * creation request or the payout list, and Stripe will return the corresponding payout - * information. + * A previously created payout can be canceled if it has not yet been paid out. Funds will be + * refunded to your available balance. You may not cancel automatic Stripe payouts. */ - public static Payout retrieve(String payout, PayoutRetrieveParams params, RequestOptions options) - throws StripeException { + public Payout cancel(Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", - Stripe.getApiBase(), String.format("/v1/payouts/%s", ApiResource.urlEncodeId(payout))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Payout.class, options); - } - - /** - * Returns a list of existing payouts sent to third-party bank accounts or that Stripe has sent - * you. The payouts are returned in sorted order, with the most recently created payouts appearing - * first. - */ - public static PayoutCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** - * Returns a list of existing payouts sent to third-party bank accounts or that Stripe has sent - * you. The payouts are returned in sorted order, with the most recently created payouts appearing - * first. - */ - public static PayoutCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payouts"); - return ApiResource.requestCollection(url, params, PayoutCollection.class, options); + Stripe.getApiBase(), + String.format("/v1/payouts/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options); } /** - * Returns a list of existing payouts sent to third-party bank accounts or that Stripe has sent - * you. The payouts are returned in sorted order, with the most recently created payouts appearing - * first. + * A previously created payout can be canceled if it has not yet been paid out. Funds will be + * refunded to your available balance. You may not cancel automatic Stripe payouts. */ - public static PayoutCollection list(PayoutListParams params) throws StripeException { - return list(params, (RequestOptions) null); + public Payout cancel(PayoutCancelParams params) throws StripeException { + return cancel(params, (RequestOptions) null); } /** - * Returns a list of existing payouts sent to third-party bank accounts or that Stripe has sent - * you. The payouts are returned in sorted order, with the most recently created payouts appearing - * first. + * A previously created payout can be canceled if it has not yet been paid out. Funds will be + * refunded to your available balance. You may not cancel automatic Stripe payouts. */ - public static PayoutCollection list(PayoutListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payouts"); - return ApiResource.requestCollection(url, params, PayoutCollection.class, options); + public Payout cancel(PayoutCancelParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/payouts/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options); } /** @@ -422,105 +404,89 @@ public static Payout create(PayoutCreateParams params, RequestOptions options) } /** - * Updates the specified payout by setting the values of the parameters passed. Any parameters not - * provided will be left unchanged. This request accepts only the metadata as arguments. - */ - @Override - public Payout update(Map params) throws StripeException { - return update(params, (RequestOptions) null); - } - - /** - * Updates the specified payout by setting the values of the parameters passed. Any parameters not - * provided will be left unchanged. This request accepts only the metadata as arguments. + * Returns a list of existing payouts sent to third-party bank accounts or that Stripe has sent + * you. The payouts are returned in sorted order, with the most recently created payouts appearing + * first. */ - @Override - public Payout update(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/payouts/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options); + public static PayoutCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); } /** - * Updates the specified payout by setting the values of the parameters passed. Any parameters not - * provided will be left unchanged. This request accepts only the metadata as arguments. + * Returns a list of existing payouts sent to third-party bank accounts or that Stripe has sent + * you. The payouts are returned in sorted order, with the most recently created payouts appearing + * first. */ - public Payout update(PayoutUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + public static PayoutCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payouts"); + return ApiResource.requestCollection(url, params, PayoutCollection.class, options); } /** - * Updates the specified payout by setting the values of the parameters passed. Any parameters not - * provided will be left unchanged. This request accepts only the metadata as arguments. + * Returns a list of existing payouts sent to third-party bank accounts or that Stripe has sent + * you. The payouts are returned in sorted order, with the most recently created payouts appearing + * first. */ - public Payout update(PayoutUpdateParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/payouts/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options); + public static PayoutCollection list(PayoutListParams params) throws StripeException { + return list(params, (RequestOptions) null); } /** - * A previously created payout can be canceled if it has not yet been paid out. Funds will be - * refunded to your available balance. You may not cancel automatic Stripe payouts. + * Returns a list of existing payouts sent to third-party bank accounts or that Stripe has sent + * you. The payouts are returned in sorted order, with the most recently created payouts appearing + * first. */ - public Payout cancel() throws StripeException { - return cancel((Map) null, (RequestOptions) null); + public static PayoutCollection list(PayoutListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/payouts"); + return ApiResource.requestCollection(url, params, PayoutCollection.class, options); } /** - * A previously created payout can be canceled if it has not yet been paid out. Funds will be - * refunded to your available balance. You may not cancel automatic Stripe payouts. + * Retrieves the details of an existing payout. Supply the unique payout ID from either a payout + * creation request or the payout list, and Stripe will return the corresponding payout + * information. */ - public Payout cancel(RequestOptions options) throws StripeException { - return cancel((Map) null, options); + public static Payout retrieve(String payout) throws StripeException { + return retrieve(payout, (Map) null, (RequestOptions) null); } /** - * A previously created payout can be canceled if it has not yet been paid out. Funds will be - * refunded to your available balance. You may not cancel automatic Stripe payouts. + * Retrieves the details of an existing payout. Supply the unique payout ID from either a payout + * creation request or the payout list, and Stripe will return the corresponding payout + * information. */ - public Payout cancel(Map params) throws StripeException { - return cancel(params, (RequestOptions) null); + public static Payout retrieve(String payout, RequestOptions options) throws StripeException { + return retrieve(payout, (Map) null, options); } /** - * A previously created payout can be canceled if it has not yet been paid out. Funds will be - * refunded to your available balance. You may not cancel automatic Stripe payouts. + * Retrieves the details of an existing payout. Supply the unique payout ID from either a payout + * creation request or the payout list, and Stripe will return the corresponding payout + * information. */ - public Payout cancel(Map params, RequestOptions options) throws StripeException { + public static Payout retrieve(String payout, Map params, RequestOptions options) + throws StripeException { String url = String.format( "%s%s", - Stripe.getApiBase(), - String.format("/v1/payouts/%s/cancel", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options); - } - - /** - * A previously created payout can be canceled if it has not yet been paid out. Funds will be - * refunded to your available balance. You may not cancel automatic Stripe payouts. - */ - public Payout cancel(PayoutCancelParams params) throws StripeException { - return cancel(params, (RequestOptions) null); + Stripe.getApiBase(), String.format("/v1/payouts/%s", ApiResource.urlEncodeId(payout))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Payout.class, options); } /** - * A previously created payout can be canceled if it has not yet been paid out. Funds will be - * refunded to your available balance. You may not cancel automatic Stripe payouts. + * Retrieves the details of an existing payout. Supply the unique payout ID from either a payout + * creation request or the payout list, and Stripe will return the corresponding payout + * information. */ - public Payout cancel(PayoutCancelParams params, RequestOptions options) throws StripeException { + public static Payout retrieve(String payout, PayoutRetrieveParams params, RequestOptions options) + throws StripeException { String url = String.format( "%s%s", - Stripe.getApiBase(), - String.format("/v1/payouts/%s/cancel", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options); + Stripe.getApiBase(), String.format("/v1/payouts/%s", ApiResource.urlEncodeId(payout))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Payout.class, options); } /** @@ -610,4 +576,48 @@ public Payout reverse(PayoutReverseParams params, RequestOptions options) throws String.format("/v1/payouts/%s/reverse", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options); } + + /** + * Updates the specified payout by setting the values of the parameters passed. Any parameters not + * provided will be left unchanged. This request accepts only the metadata as arguments. + */ + @Override + public Payout update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Updates the specified payout by setting the values of the parameters passed. Any parameters not + * provided will be left unchanged. This request accepts only the metadata as arguments. + */ + @Override + public Payout update(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/payouts/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options); + } + + /** + * Updates the specified payout by setting the values of the parameters passed. Any parameters not + * provided will be left unchanged. This request accepts only the metadata as arguments. + */ + public Payout update(PayoutUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Updates the specified payout by setting the values of the parameters passed. Any parameters not + * provided will be left unchanged. This request accepts only the metadata as arguments. + */ + public Payout update(PayoutUpdateParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/payouts/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Payout.class, options); + } } diff --git a/src/main/java/com/stripe/model/Person.java b/src/main/java/com/stripe/model/Person.java index 3a71c40d1e9..e5d7dec8fae 100644 --- a/src/main/java/com/stripe/model/Person.java +++ b/src/main/java/com/stripe/model/Person.java @@ -14,6 +14,19 @@ import lombok.Getter; import lombok.Setter; +/** + * This is an object representing a person associated with a Stripe account. + * + *

A platform cannot access a Standard or Express account's persons after the account starts + * onboarding, such as after generating an account link for the account. See the Standard onboarding or Express onboarding documentation for + * information about platform pre-filling and account onboarding steps. + * + *

Related guide: Handling + * Identity Verification with the API. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -165,42 +178,6 @@ public class Person extends ApiResource implements HasId, MetadataStore @SerializedName("verification") Verification verification; - /** Updates an existing person. */ - @Override - public Person update(Map params) throws StripeException { - return update(params, (RequestOptions) null); - } - - /** Updates an existing person. */ - @Override - public Person update(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/accounts/%s/persons/%s", - ApiResource.urlEncodeId(this.getAccount()), ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Person.class, options); - } - - /** Updates an existing person. */ - public Person update(PersonUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); - } - - /** Updates an existing person. */ - public Person update(PersonUpdateParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/accounts/%s/persons/%s", - ApiResource.urlEncodeId(this.getAccount()), ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Person.class, options); - } - /** * Deletes an existing person’s relationship to the account’s legal entity. Any person with a * relationship for an account can be deleted through the API, except if the person is the @@ -249,6 +226,42 @@ public Person delete(Map params, RequestOptions options) throws ApiResource.RequestMethod.DELETE, url, params, Person.class, options); } + /** Updates an existing person. */ + @Override + public Person update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates an existing person. */ + @Override + public Person update(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/accounts/%s/persons/%s", + ApiResource.urlEncodeId(this.getAccount()), ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Person.class, options); + } + + /** Updates an existing person. */ + public Person update(PersonUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates an existing person. */ + public Person update(PersonUpdateParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/accounts/%s/persons/%s", + ApiResource.urlEncodeId(this.getAccount()), ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Person.class, options); + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/PersonCollection.java b/src/main/java/com/stripe/model/PersonCollection.java index 66fc07bd84d..fcd93242fe8 100644 --- a/src/main/java/com/stripe/model/PersonCollection.java +++ b/src/main/java/com/stripe/model/PersonCollection.java @@ -11,6 +11,29 @@ import java.util.Map; public class PersonCollection extends StripeCollection { + /** Creates a new person. */ + public Person create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new person. */ + public Person create(Map params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Person.class, options); + } + + /** Creates a new person. */ + public Person create(PersonCollectionCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new person. */ + public Person create(PersonCollectionCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Person.class, options); + } + /** * Returns a list of people associated with the account’s legal entity. The people are returned * sorted by creation date, with the most recent people appearing first. @@ -78,27 +101,4 @@ public Person retrieve(String id, PersonCollectionRetrieveParams params, Request String.format("%s/%s", this.getUrl(), ApiResource.urlEncodeId(id))); return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Person.class, options); } - - /** Creates a new person. */ - public Person create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new person. */ - public Person create(Map params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Person.class, options); - } - - /** Creates a new person. */ - public Person create(PersonCollectionCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new person. */ - public Person create(PersonCollectionCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Person.class, options); - } } diff --git a/src/main/java/com/stripe/model/Plan.java b/src/main/java/com/stripe/model/Plan.java index 6401ac04c61..8647503b058 100644 --- a/src/main/java/com/stripe/model/Plan.java +++ b/src/main/java/com/stripe/model/Plan.java @@ -17,6 +17,25 @@ import lombok.Getter; import lombok.Setter; +/** + * You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is + * backwards compatible to simplify your migration. + * + *

Plans define the base price, currency, and billing cycle for recurring purchases of products. + * Products help you track inventory or + * provisioning, and plans help you track pricing. Different physical goods or levels of service + * should be represented by products, and pricing options should be represented by plans. This + * approach lets you change prices without having to change your provisioning scheme. + * + *

For example, you might have a single "gold" product that has plans for $10/month, + * $100/year, €9/month, and €90/year. + * + *

Related guides: Set up a + * subscription and more about products and prices. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -192,30 +211,6 @@ public void setProductObject(Product expandableObject) { this.product = new ExpandableField(expandableObject.getId(), expandableObject); } - /** Returns a list of your plans. */ - public static PlanCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of your plans. */ - public static PlanCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/plans"); - return ApiResource.requestCollection(url, params, PlanCollection.class, options); - } - - /** Returns a list of your plans. */ - public static PlanCollection list(PlanListParams params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of your plans. */ - public static PlanCollection list(PlanListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/plans"); - return ApiResource.requestCollection(url, params, PlanCollection.class, options); - } - /** * You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is @@ -256,6 +251,55 @@ public static Plan create(PlanCreateParams params, RequestOptions options) return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Plan.class, options); } + /** Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected. */ + public Plan delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); + } + + /** Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected. */ + public Plan delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); + } + + /** Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected. */ + public Plan delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); + } + + /** Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected. */ + public Plan delete(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/plans/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.DELETE, url, params, Plan.class, options); + } + + /** Returns a list of your plans. */ + public static PlanCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of your plans. */ + public static PlanCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/plans"); + return ApiResource.requestCollection(url, params, PlanCollection.class, options); + } + + /** Returns a list of your plans. */ + public static PlanCollection list(PlanListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of your plans. */ + public static PlanCollection list(PlanListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/plans"); + return ApiResource.requestCollection(url, params, PlanCollection.class, options); + } + /** Retrieves the plan with the given ID. */ public static Plan retrieve(String plan) throws StripeException { return retrieve(plan, (Map) null, (RequestOptions) null); @@ -334,31 +378,6 @@ public Plan update(PlanUpdateParams params, RequestOptions options) throws Strip return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Plan.class, options); } - /** Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected. */ - public Plan delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); - } - - /** Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected. */ - public Plan delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); - } - - /** Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected. */ - public Plan delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected. */ - public Plan delete(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/plans/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.DELETE, url, params, Plan.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Price.java b/src/main/java/com/stripe/model/Price.java index 683b09fea93..fa29658da85 100644 --- a/src/main/java/com/stripe/model/Price.java +++ b/src/main/java/com/stripe/model/Price.java @@ -18,6 +18,23 @@ import lombok.Getter; import lombok.Setter; +/** + * Prices define the unit cost, currency, and (optional) billing cycle for both recurring and + * one-time purchases of products. Products help + * you track inventory or provisioning, and prices help you track payment terms. Different physical + * goods or levels of service should be represented by products, and pricing options should be + * represented by prices. This approach lets you change prices without having to change your + * provisioning scheme. + * + *

For example, you might have a single "gold" product that has prices for $10/month, + * $100/year, and €9 once. + * + *

Related guides: Set up a + * subscription, create an + * invoice, and more about products + * and prices. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -190,56 +207,28 @@ public void setProductObject(Product expandableObject) { this.product = new ExpandableField(expandableObject.getId(), expandableObject); } - /** - * Search for prices you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static PriceSearchResult search(Map params) throws StripeException { - return search(params, (RequestOptions) null); + /** Creates a new price for an existing product. The price can be recurring or one-time. */ + public static Price create(Map params) throws StripeException { + return create(params, (RequestOptions) null); } - /** - * Search for prices you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static PriceSearchResult search(Map params, RequestOptions options) + /** Creates a new price for an existing product. The price can be recurring or one-time. */ + public static Price create(Map params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/prices/search"); - return ApiResource.requestSearchResult(url, params, PriceSearchResult.class, options); + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/prices"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Price.class, options); } - /** - * Search for prices you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static PriceSearchResult search(PriceSearchParams params) throws StripeException { - return search(params, (RequestOptions) null); + /** Creates a new price for an existing product. The price can be recurring or one-time. */ + public static Price create(PriceCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); } - /** - * Search for prices you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static PriceSearchResult search(PriceSearchParams params, RequestOptions options) + /** Creates a new price for an existing product. The price can be recurring or one-time. */ + public static Price create(PriceCreateParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/prices/search"); - return ApiResource.requestSearchResult(url, params, PriceSearchResult.class, options); + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/prices"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Price.class, options); } /** Returns a list of your prices. */ @@ -266,30 +255,6 @@ public static PriceCollection list(PriceListParams params, RequestOptions option return ApiResource.requestCollection(url, params, PriceCollection.class, options); } - /** Creates a new price for an existing product. The price can be recurring or one-time. */ - public static Price create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new price for an existing product. The price can be recurring or one-time. */ - public static Price create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/prices"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Price.class, options); - } - - /** Creates a new price for an existing product. The price can be recurring or one-time. */ - public static Price create(PriceCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new price for an existing product. The price can be recurring or one-time. */ - public static Price create(PriceCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/prices"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Price.class, options); - } - /** Retrieves the price with the given ID. */ public static Price retrieve(String price) throws StripeException { return retrieve(price, (Map) null, (RequestOptions) null); @@ -320,6 +285,58 @@ public static Price retrieve(String price, PriceRetrieveParams params, RequestOp return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Price.class, options); } + /** + * Search for prices you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. + */ + public static PriceSearchResult search(Map params) throws StripeException { + return search(params, (RequestOptions) null); + } + + /** + * Search for prices you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. + */ + public static PriceSearchResult search(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/prices/search"); + return ApiResource.requestSearchResult(url, params, PriceSearchResult.class, options); + } + + /** + * Search for prices you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. + */ + public static PriceSearchResult search(PriceSearchParams params) throws StripeException { + return search(params, (RequestOptions) null); + } + + /** + * Search for prices you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. + */ + public static PriceSearchResult search(PriceSearchParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/prices/search"); + return ApiResource.requestSearchResult(url, params, PriceSearchResult.class, options); + } + /** * Updates the specified price by setting the values of the parameters passed. Any parameters not * provided are left unchanged. diff --git a/src/main/java/com/stripe/model/Product.java b/src/main/java/com/stripe/model/Product.java index cf6ced92177..1110acabdd0 100644 --- a/src/main/java/com/stripe/model/Product.java +++ b/src/main/java/com/stripe/model/Product.java @@ -17,6 +17,21 @@ import lombok.Getter; import lombok.Setter; +/** + * Products describe the specific goods or services you offer to your customers. For example, you + * might offer a Standard and Premium version of your goods or service; each version would be a + * separate Product. They can be used in conjunction with Prices to configure pricing in Payment Links, + * Checkout, and Subscriptions. + * + *

Related guides: Set up a + * subscription, share a + * Payment Link, accept + * payments with Checkout, and more about Products and Prices + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -191,80 +206,106 @@ public void setTaxCodeObject(TaxCode expandableObject) { this.taxCode = new ExpandableField(expandableObject.getId(), expandableObject); } + /** Creates a new product object. */ + public static Product create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new product object. */ + public static Product create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/products"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Product.class, options); + } + + /** Creates a new product object. */ + public static Product create(ProductCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new product object. */ + public static Product create(ProductCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/products"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Product.class, options); + } + /** - * Search for products you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * Delete a product. Deleting a product is only possible if it has no prices associated with it. + * Additionally, deleting a product with type=good is only possible if it has no SKUs + * associated with it. */ - public static ProductSearchResult search(Map params) throws StripeException { - return search(params, (RequestOptions) null); + public Product delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); } /** - * Search for products you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * Delete a product. Deleting a product is only possible if it has no prices associated with it. + * Additionally, deleting a product with type=good is only possible if it has no SKUs + * associated with it. */ - public static ProductSearchResult search(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/products/search"); - return ApiResource.requestSearchResult(url, params, ProductSearchResult.class, options); + public Product delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); } /** - * Search for products you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * Delete a product. Deleting a product is only possible if it has no prices associated with it. + * Additionally, deleting a product with type=good is only possible if it has no SKUs + * associated with it. */ - public static ProductSearchResult search(ProductSearchParams params) throws StripeException { - return search(params, (RequestOptions) null); + public Product delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); } /** - * Search for products you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * Delete a product. Deleting a product is only possible if it has no prices associated with it. + * Additionally, deleting a product with type=good is only possible if it has no SKUs + * associated with it. */ - public static ProductSearchResult search(ProductSearchParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/products/search"); - return ApiResource.requestSearchResult(url, params, ProductSearchResult.class, options); + public Product delete(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/products/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, Product.class, options); } - /** Creates a new product object. */ - public static Product create(Map params) throws StripeException { - return create(params, (RequestOptions) null); + /** + * Returns a list of your products. The products are returned sorted by creation date, with the + * most recently created products appearing first. + */ + public static ProductCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); } - /** Creates a new product object. */ - public static Product create(Map params, RequestOptions options) + /** + * Returns a list of your products. The products are returned sorted by creation date, with the + * most recently created products appearing first. + */ + public static ProductCollection list(Map params, RequestOptions options) throws StripeException { String url = String.format("%s%s", Stripe.getApiBase(), "/v1/products"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Product.class, options); + return ApiResource.requestCollection(url, params, ProductCollection.class, options); } - /** Creates a new product object. */ - public static Product create(ProductCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); + /** + * Returns a list of your products. The products are returned sorted by creation date, with the + * most recently created products appearing first. + */ + public static ProductCollection list(ProductListParams params) throws StripeException { + return list(params, (RequestOptions) null); } - /** Creates a new product object. */ - public static Product create(ProductCreateParams params, RequestOptions options) + /** + * Returns a list of your products. The products are returned sorted by creation date, with the + * most recently created products appearing first. + */ + public static ProductCollection list(ProductListParams params, RequestOptions options) throws StripeException { String url = String.format("%s%s", Stripe.getApiBase(), "/v1/products"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Product.class, options); + return ApiResource.requestCollection(url, params, ProductCollection.class, options); } /** @@ -313,6 +354,58 @@ public static Product retrieve(String id, ProductRetrieveParams params, RequestO return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Product.class, options); } + /** + * Search for products you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. + */ + public static ProductSearchResult search(Map params) throws StripeException { + return search(params, (RequestOptions) null); + } + + /** + * Search for products you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. + */ + public static ProductSearchResult search(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/products/search"); + return ApiResource.requestSearchResult(url, params, ProductSearchResult.class, options); + } + + /** + * Search for products you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. + */ + public static ProductSearchResult search(ProductSearchParams params) throws StripeException { + return search(params, (RequestOptions) null); + } + + /** + * Search for products you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. + */ + public static ProductSearchResult search(ProductSearchParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/products/search"); + return ApiResource.requestSearchResult(url, params, ProductSearchResult.class, options); + } + /** * Updates the specific product by setting the values of the parameters passed. Any parameters not * provided will be left unchanged. @@ -356,82 +449,4 @@ public Product update(ProductUpdateParams params, RequestOptions options) throws String.format("/v1/products/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Product.class, options); } - - /** - * Returns a list of your products. The products are returned sorted by creation date, with the - * most recently created products appearing first. - */ - public static ProductCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** - * Returns a list of your products. The products are returned sorted by creation date, with the - * most recently created products appearing first. - */ - public static ProductCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/products"); - return ApiResource.requestCollection(url, params, ProductCollection.class, options); - } - - /** - * Returns a list of your products. The products are returned sorted by creation date, with the - * most recently created products appearing first. - */ - public static ProductCollection list(ProductListParams params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** - * Returns a list of your products. The products are returned sorted by creation date, with the - * most recently created products appearing first. - */ - public static ProductCollection list(ProductListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/products"); - return ApiResource.requestCollection(url, params, ProductCollection.class, options); - } - - /** - * Delete a product. Deleting a product is only possible if it has no prices associated with it. - * Additionally, deleting a product with type=good is only possible if it has no SKUs - * associated with it. - */ - public Product delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); - } - - /** - * Delete a product. Deleting a product is only possible if it has no prices associated with it. - * Additionally, deleting a product with type=good is only possible if it has no SKUs - * associated with it. - */ - public Product delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); - } - - /** - * Delete a product. Deleting a product is only possible if it has no prices associated with it. - * Additionally, deleting a product with type=good is only possible if it has no SKUs - * associated with it. - */ - public Product delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** - * Delete a product. Deleting a product is only possible if it has no prices associated with it. - * Additionally, deleting a product with type=good is only possible if it has no SKUs - * associated with it. - */ - public Product delete(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/products/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, Product.class, options); - } } diff --git a/src/main/java/com/stripe/model/PromotionCode.java b/src/main/java/com/stripe/model/PromotionCode.java index 40688c684ca..c81838dcdc8 100644 --- a/src/main/java/com/stripe/model/PromotionCode.java +++ b/src/main/java/com/stripe/model/PromotionCode.java @@ -15,6 +15,11 @@ import lombok.Getter; import lombok.Setter; +/** + * A Promotion Code represents a customer-redeemable code for a coupon. It can be used to create multiple codes + * for a single coupon. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -118,6 +123,69 @@ public void setCustomerObject(Customer expandableObject) { this.customer = new ExpandableField(expandableObject.getId(), expandableObject); } + /** + * A promotion code points to a coupon. You can optionally restrict the code to a specific + * customer, redemption limit, and expiration date. + */ + public static PromotionCode create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * A promotion code points to a coupon. You can optionally restrict the code to a specific + * customer, redemption limit, and expiration date. + */ + public static PromotionCode create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/promotion_codes"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PromotionCode.class, options); + } + + /** + * A promotion code points to a coupon. You can optionally restrict the code to a specific + * customer, redemption limit, and expiration date. + */ + public static PromotionCode create(PromotionCodeCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * A promotion code points to a coupon. You can optionally restrict the code to a specific + * customer, redemption limit, and expiration date. + */ + public static PromotionCode create(PromotionCodeCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/promotion_codes"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, PromotionCode.class, options); + } + + /** Returns a list of your promotion codes. */ + public static PromotionCodeCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of your promotion codes. */ + public static PromotionCodeCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/promotion_codes"); + return ApiResource.requestCollection(url, params, PromotionCodeCollection.class, options); + } + + /** Returns a list of your promotion codes. */ + public static PromotionCodeCollection list(PromotionCodeListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of your promotion codes. */ + public static PromotionCodeCollection list(PromotionCodeListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/promotion_codes"); + return ApiResource.requestCollection(url, params, PromotionCodeCollection.class, options); + } + /** * Retrieves the promotion code with the given ID. In order to retrieve a promotion code by the * customer-facing code use params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * A promotion code points to a coupon. You can optionally restrict the code to a specific - * customer, redemption limit, and expiration date. - */ - public static PromotionCode create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/promotion_codes"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PromotionCode.class, options); - } - - /** - * A promotion code points to a coupon. You can optionally restrict the code to a specific - * customer, redemption limit, and expiration date. - */ - public static PromotionCode create(PromotionCodeCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * A promotion code points to a coupon. You can optionally restrict the code to a specific - * customer, redemption limit, and expiration date. - */ - public static PromotionCode create(PromotionCodeCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/promotion_codes"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, PromotionCode.class, options); - } - /** * Updates the specified promotion code by setting the values of the parameters passed. Most * fields are, by design, not editable. @@ -261,31 +291,6 @@ public PromotionCode update(PromotionCodeUpdateParams params, RequestOptions opt ApiResource.RequestMethod.POST, url, params, PromotionCode.class, options); } - /** Returns a list of your promotion codes. */ - public static PromotionCodeCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of your promotion codes. */ - public static PromotionCodeCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/promotion_codes"); - return ApiResource.requestCollection(url, params, PromotionCodeCollection.class, options); - } - - /** Returns a list of your promotion codes. */ - public static PromotionCodeCollection list(PromotionCodeListParams params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of your promotion codes. */ - public static PromotionCodeCollection list(PromotionCodeListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/promotion_codes"); - return ApiResource.requestCollection(url, params, PromotionCodeCollection.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Quote.java b/src/main/java/com/stripe/model/Quote.java index fe040a267c1..1bbe0cbbde9 100644 --- a/src/main/java/com/stripe/model/Quote.java +++ b/src/main/java/com/stripe/model/Quote.java @@ -26,6 +26,10 @@ import lombok.Getter; import lombok.Setter; +/** + * A Quote is a way to model prices that you'd like to provide to a customer. Once accepted, it will + * automatically create an invoice, subscription or subscription schedule. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -448,109 +452,43 @@ public void setDiscountObjects(List objs) { : null; } - /** Retrieves the quote with the given ID. */ - public static Quote retrieve(String quote) throws StripeException { - return retrieve(quote, (Map) null, (RequestOptions) null); - } - - /** Retrieves the quote with the given ID. */ - public static Quote retrieve(String quote, RequestOptions options) throws StripeException { - return retrieve(quote, (Map) null, options); - } - - /** Retrieves the quote with the given ID. */ - public static Quote retrieve(String quote, Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), String.format("/v1/quotes/%s", ApiResource.urlEncodeId(quote))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Quote.class, options); - } - - /** Retrieves the quote with the given ID. */ - public static Quote retrieve(String quote, QuoteRetrieveParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), String.format("/v1/quotes/%s", ApiResource.urlEncodeId(quote))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Quote.class, options); - } - - /** - * A quote models prices and services for a customer. Default options for header, - * description, footer, and expires_at can be set in the - * dashboard via the quote - * template. - */ - public static Quote create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * A quote models prices and services for a customer. Default options for header, - * description, footer, and expires_at can be set in the - * dashboard via the quote - * template. - */ - public static Quote create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/quotes"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Quote.class, options); - } - - /** - * A quote models prices and services for a customer. Default options for header, - * description, footer, and expires_at can be set in the - * dashboard via the quote - * template. - */ - public static Quote create(QuoteCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); + /** Accepts the specified quote. */ + public Quote accept() throws StripeException { + return accept((Map) null, (RequestOptions) null); } - /** - * A quote models prices and services for a customer. Default options for header, - * description, footer, and expires_at can be set in the - * dashboard via the quote - * template. - */ - public static Quote create(QuoteCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/quotes"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Quote.class, options); + /** Accepts the specified quote. */ + public Quote accept(RequestOptions options) throws StripeException { + return accept((Map) null, options); } - /** A quote models prices and services for a customer. */ - @Override - public Quote update(Map params) throws StripeException { - return update(params, (RequestOptions) null); + /** Accepts the specified quote. */ + public Quote accept(Map params) throws StripeException { + return accept(params, (RequestOptions) null); } - /** A quote models prices and services for a customer. */ - @Override - public Quote update(Map params, RequestOptions options) throws StripeException { + /** Accepts the specified quote. */ + public Quote accept(Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/quotes/%s", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/quotes/%s/accept", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Quote.class, options); } - /** A quote models prices and services for a customer. */ - public Quote update(QuoteUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + /** Accepts the specified quote. */ + public Quote accept(QuoteAcceptParams params) throws StripeException { + return accept(params, (RequestOptions) null); } - /** A quote models prices and services for a customer. */ - public Quote update(QuoteUpdateParams params, RequestOptions options) throws StripeException { + /** Accepts the specified quote. */ + public Quote accept(QuoteAcceptParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/quotes/%s", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/quotes/%s/accept", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Quote.class, options); } @@ -594,6 +532,50 @@ public Quote cancel(QuoteCancelParams params, RequestOptions options) throws Str return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Quote.class, options); } + /** + * A quote models prices and services for a customer. Default options for header, + * description, footer, and expires_at can be set in the + * dashboard via the quote + * template. + */ + public static Quote create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * A quote models prices and services for a customer. Default options for header, + * description, footer, and expires_at can be set in the + * dashboard via the quote + * template. + */ + public static Quote create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/quotes"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Quote.class, options); + } + + /** + * A quote models prices and services for a customer. Default options for header, + * description, footer, and expires_at can be set in the + * dashboard via the quote + * template. + */ + public static Quote create(QuoteCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * A quote models prices and services for a customer. Default options for header, + * description, footer, and expires_at can be set in the + * dashboard via the quote + * template. + */ + public static Quote create(QuoteCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/quotes"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Quote.class, options); + } + /** Finalizes the quote. */ public Quote finalizeQuote() throws StripeException { return finalizeQuote((Map) null, (RequestOptions) null); @@ -636,46 +618,6 @@ public Quote finalizeQuote(QuoteFinalizeQuoteParams params, RequestOptions optio return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Quote.class, options); } - /** Accepts the specified quote. */ - public Quote accept() throws StripeException { - return accept((Map) null, (RequestOptions) null); - } - - /** Accepts the specified quote. */ - public Quote accept(RequestOptions options) throws StripeException { - return accept((Map) null, options); - } - - /** Accepts the specified quote. */ - public Quote accept(Map params) throws StripeException { - return accept(params, (RequestOptions) null); - } - - /** Accepts the specified quote. */ - public Quote accept(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/quotes/%s/accept", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Quote.class, options); - } - - /** Accepts the specified quote. */ - public Quote accept(QuoteAcceptParams params) throws StripeException { - return accept(params, (RequestOptions) null); - } - - /** Accepts the specified quote. */ - public Quote accept(QuoteAcceptParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/quotes/%s/accept", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Quote.class, options); - } - /** Returns a list of your quotes. */ public static QuoteCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); @@ -700,63 +642,6 @@ public static QuoteCollection list(QuoteListParams params, RequestOptions option return ApiResource.requestCollection(url, params, QuoteCollection.class, options); } - /** - * When retrieving a quote, there is an includable line_items property containing - * the first handful of those items. There is also a URL where you can retrieve the full - * (paginated) list of line items. - */ - public LineItemCollection listLineItems() throws StripeException { - return listLineItems((Map) null, (RequestOptions) null); - } - - /** - * When retrieving a quote, there is an includable line_items property containing - * the first handful of those items. There is also a URL where you can retrieve the full - * (paginated) list of line items. - */ - public LineItemCollection listLineItems(Map params) throws StripeException { - return listLineItems(params, (RequestOptions) null); - } - - /** - * When retrieving a quote, there is an includable line_items property containing - * the first handful of those items. There is also a URL where you can retrieve the full - * (paginated) list of line items. - */ - public LineItemCollection listLineItems(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/quotes/%s/line_items", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.requestCollection(url, params, LineItemCollection.class, options); - } - - /** - * When retrieving a quote, there is an includable line_items property containing - * the first handful of those items. There is also a URL where you can retrieve the full - * (paginated) list of line items. - */ - public LineItemCollection listLineItems(QuoteListLineItemsParams params) throws StripeException { - return listLineItems(params, (RequestOptions) null); - } - - /** - * When retrieving a quote, there is an includable line_items property containing - * the first handful of those items. There is also a URL where you can retrieve the full - * (paginated) list of line items. - */ - public LineItemCollection listLineItems(QuoteListLineItemsParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/quotes/%s/line_items", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.requestCollection(url, params, LineItemCollection.class, options); - } - /** * When retrieving a quote, there is an includable computed.upfront.line_items @@ -826,6 +711,63 @@ public LineItemCollection listComputedUpfrontLineItems( return ApiResource.requestCollection(url, params, LineItemCollection.class, options); } + /** + * When retrieving a quote, there is an includable line_items property containing + * the first handful of those items. There is also a URL where you can retrieve the full + * (paginated) list of line items. + */ + public LineItemCollection listLineItems() throws StripeException { + return listLineItems((Map) null, (RequestOptions) null); + } + + /** + * When retrieving a quote, there is an includable line_items property containing + * the first handful of those items. There is also a URL where you can retrieve the full + * (paginated) list of line items. + */ + public LineItemCollection listLineItems(Map params) throws StripeException { + return listLineItems(params, (RequestOptions) null); + } + + /** + * When retrieving a quote, there is an includable line_items property containing + * the first handful of those items. There is also a URL where you can retrieve the full + * (paginated) list of line items. + */ + public LineItemCollection listLineItems(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/quotes/%s/line_items", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.requestCollection(url, params, LineItemCollection.class, options); + } + + /** + * When retrieving a quote, there is an includable line_items property containing + * the first handful of those items. There is also a URL where you can retrieve the full + * (paginated) list of line items. + */ + public LineItemCollection listLineItems(QuoteListLineItemsParams params) throws StripeException { + return listLineItems(params, (RequestOptions) null); + } + + /** + * When retrieving a quote, there is an includable line_items property containing + * the first handful of those items. There is also a URL where you can retrieve the full + * (paginated) list of line items. + */ + public LineItemCollection listLineItems(QuoteListLineItemsParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/quotes/%s/line_items", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.requestCollection(url, params, LineItemCollection.class, options); + } + /** Download the PDF for a finalized quote. */ public InputStream pdf() throws StripeException { return pdf((Map) null, (RequestOptions) null); @@ -862,6 +804,68 @@ public InputStream pdf(QuotePdfParams params, RequestOptions options) throws Str return ApiResource.requestStream(ApiResource.RequestMethod.GET, url, params, options); } + /** Retrieves the quote with the given ID. */ + public static Quote retrieve(String quote) throws StripeException { + return retrieve(quote, (Map) null, (RequestOptions) null); + } + + /** Retrieves the quote with the given ID. */ + public static Quote retrieve(String quote, RequestOptions options) throws StripeException { + return retrieve(quote, (Map) null, options); + } + + /** Retrieves the quote with the given ID. */ + public static Quote retrieve(String quote, Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), String.format("/v1/quotes/%s", ApiResource.urlEncodeId(quote))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Quote.class, options); + } + + /** Retrieves the quote with the given ID. */ + public static Quote retrieve(String quote, QuoteRetrieveParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), String.format("/v1/quotes/%s", ApiResource.urlEncodeId(quote))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Quote.class, options); + } + + /** A quote models prices and services for a customer. */ + @Override + public Quote update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** A quote models prices and services for a customer. */ + @Override + public Quote update(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/quotes/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Quote.class, options); + } + + /** A quote models prices and services for a customer. */ + public Quote update(QuoteUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** A quote models prices and services for a customer. */ + public Quote update(QuoteUpdateParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/quotes/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Quote.class, options); + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Refund.java b/src/main/java/com/stripe/model/Refund.java index e6bcce2166b..a35907ebea5 100644 --- a/src/main/java/com/stripe/model/Refund.java +++ b/src/main/java/com/stripe/model/Refund.java @@ -17,6 +17,12 @@ import lombok.Getter; import lombok.Setter; +/** + * {@code Refund} objects allow you to refund a charge that has previously been created but not yet + * refunded. Funds will be refunded to the credit or debit card that was originally charged. + * + *

Related guide: Refunds. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -265,43 +271,73 @@ public void setTransferReversalObject(TransferReversal expandableObject) { } /** - * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted - * order, with the most recent refunds appearing first. For convenience, the 10 most recent - * refunds are always available by default on the charge object. + * Cancels a refund with a status of requires_action. + * + *

Refunds in other states cannot be canceled, and only refunds for payment methods that + * require customer action will enter the requires_action state. */ - public static RefundCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); + public Refund cancel() throws StripeException { + return cancel((Map) null, (RequestOptions) null); } /** - * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted - * order, with the most recent refunds appearing first. For convenience, the 10 most recent - * refunds are always available by default on the charge object. + * Cancels a refund with a status of requires_action. + * + *

Refunds in other states cannot be canceled, and only refunds for payment methods that + * require customer action will enter the requires_action state. */ - public static RefundCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/refunds"); - return ApiResource.requestCollection(url, params, RefundCollection.class, options); + public Refund cancel(RequestOptions options) throws StripeException { + return cancel((Map) null, options); } /** - * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted - * order, with the most recent refunds appearing first. For convenience, the 10 most recent - * refunds are always available by default on the charge object. + * Cancels a refund with a status of requires_action. + * + *

Refunds in other states cannot be canceled, and only refunds for payment methods that + * require customer action will enter the requires_action state. */ - public static RefundCollection list(RefundListParams params) throws StripeException { - return list(params, (RequestOptions) null); + public Refund cancel(Map params) throws StripeException { + return cancel(params, (RequestOptions) null); } /** - * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted - * order, with the most recent refunds appearing first. For convenience, the 10 most recent - * refunds are always available by default on the charge object. + * Cancels a refund with a status of requires_action. + * + *

Refunds in other states cannot be canceled, and only refunds for payment methods that + * require customer action will enter the requires_action state. */ - public static RefundCollection list(RefundListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/refunds"); - return ApiResource.requestCollection(url, params, RefundCollection.class, options); + public Refund cancel(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/refunds/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Refund.class, options); + } + + /** + * Cancels a refund with a status of requires_action. + * + *

Refunds in other states cannot be canceled, and only refunds for payment methods that + * require customer action will enter the requires_action state. + */ + public Refund cancel(RefundCancelParams params) throws StripeException { + return cancel(params, (RequestOptions) null); + } + + /** + * Cancels a refund with a status of requires_action. + * + *

Refunds in other states cannot be canceled, and only refunds for payment methods that + * require customer action will enter the requires_action state. + */ + public Refund cancel(RefundCancelParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/refunds/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Refund.class, options); } /** Create a refund. */ @@ -328,6 +364,46 @@ public static Refund create(RefundCreateParams params, RequestOptions options) return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Refund.class, options); } + /** + * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted + * order, with the most recent refunds appearing first. For convenience, the 10 most recent + * refunds are always available by default on the charge object. + */ + public static RefundCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** + * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted + * order, with the most recent refunds appearing first. For convenience, the 10 most recent + * refunds are always available by default on the charge object. + */ + public static RefundCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/refunds"); + return ApiResource.requestCollection(url, params, RefundCollection.class, options); + } + + /** + * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted + * order, with the most recent refunds appearing first. For convenience, the 10 most recent + * refunds are always available by default on the charge object. + */ + public static RefundCollection list(RefundListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** + * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted + * order, with the most recent refunds appearing first. For convenience, the 10 most recent + * refunds are always available by default on the charge object. + */ + public static RefundCollection list(RefundListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/refunds"); + return ApiResource.requestCollection(url, params, RefundCollection.class, options); + } + /** Retrieves the details of an existing refund. */ public static Refund retrieve(String refund) throws StripeException { return retrieve(refund, (Map) null, (RequestOptions) null); @@ -410,76 +486,6 @@ public Refund update(RefundUpdateParams params, RequestOptions options) throws S return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Refund.class, options); } - /** - * Cancels a refund with a status of requires_action. - * - *

Refunds in other states cannot be canceled, and only refunds for payment methods that - * require customer action will enter the requires_action state. - */ - public Refund cancel() throws StripeException { - return cancel((Map) null, (RequestOptions) null); - } - - /** - * Cancels a refund with a status of requires_action. - * - *

Refunds in other states cannot be canceled, and only refunds for payment methods that - * require customer action will enter the requires_action state. - */ - public Refund cancel(RequestOptions options) throws StripeException { - return cancel((Map) null, options); - } - - /** - * Cancels a refund with a status of requires_action. - * - *

Refunds in other states cannot be canceled, and only refunds for payment methods that - * require customer action will enter the requires_action state. - */ - public Refund cancel(Map params) throws StripeException { - return cancel(params, (RequestOptions) null); - } - - /** - * Cancels a refund with a status of requires_action. - * - *

Refunds in other states cannot be canceled, and only refunds for payment methods that - * require customer action will enter the requires_action state. - */ - public Refund cancel(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/refunds/%s/cancel", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Refund.class, options); - } - - /** - * Cancels a refund with a status of requires_action. - * - *

Refunds in other states cannot be canceled, and only refunds for payment methods that - * require customer action will enter the requires_action state. - */ - public Refund cancel(RefundCancelParams params) throws StripeException { - return cancel(params, (RequestOptions) null); - } - - /** - * Cancels a refund with a status of requires_action. - * - *

Refunds in other states cannot be canceled, and only refunds for payment methods that - * require customer action will enter the requires_action state. - */ - public Refund cancel(RefundCancelParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/refunds/%s/cancel", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Refund.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Review.java b/src/main/java/com/stripe/model/Review.java index 052855b177f..22cc1ecfc06 100644 --- a/src/main/java/com/stripe/model/Review.java +++ b/src/main/java/com/stripe/model/Review.java @@ -15,6 +15,12 @@ import lombok.Getter; import lombok.Setter; +/** + * Reviews can be used to supplement automated fraud detection with human expertise. + * + *

Learn more about Radar and reviewing payments here. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -134,6 +140,46 @@ public void setPaymentIntentObject(PaymentIntent expandableObject) { new ExpandableField(expandableObject.getId(), expandableObject); } + /** Approves a Review object, closing it and removing it from the list of reviews. */ + public Review approve() throws StripeException { + return approve((Map) null, (RequestOptions) null); + } + + /** Approves a Review object, closing it and removing it from the list of reviews. */ + public Review approve(RequestOptions options) throws StripeException { + return approve((Map) null, options); + } + + /** Approves a Review object, closing it and removing it from the list of reviews. */ + public Review approve(Map params) throws StripeException { + return approve(params, (RequestOptions) null); + } + + /** Approves a Review object, closing it and removing it from the list of reviews. */ + public Review approve(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/reviews/%s/approve", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Review.class, options); + } + + /** Approves a Review object, closing it and removing it from the list of reviews. */ + public Review approve(ReviewApproveParams params) throws StripeException { + return approve(params, (RequestOptions) null); + } + + /** Approves a Review object, closing it and removing it from the list of reviews. */ + public Review approve(ReviewApproveParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/reviews/%s/approve", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Review.class, options); + } + /** * Returns a list of Review objects that have open set to true * . The objects are sorted in descending order by creation date, with the most recently @@ -204,46 +250,6 @@ public static Review retrieve(String review, ReviewRetrieveParams params, Reques return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Review.class, options); } - /** Approves a Review object, closing it and removing it from the list of reviews. */ - public Review approve() throws StripeException { - return approve((Map) null, (RequestOptions) null); - } - - /** Approves a Review object, closing it and removing it from the list of reviews. */ - public Review approve(RequestOptions options) throws StripeException { - return approve((Map) null, options); - } - - /** Approves a Review object, closing it and removing it from the list of reviews. */ - public Review approve(Map params) throws StripeException { - return approve(params, (RequestOptions) null); - } - - /** Approves a Review object, closing it and removing it from the list of reviews. */ - public Review approve(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/reviews/%s/approve", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Review.class, options); - } - - /** Approves a Review object, closing it and removing it from the list of reviews. */ - public Review approve(ReviewApproveParams params) throws StripeException { - return approve(params, (RequestOptions) null); - } - - /** Approves a Review object, closing it and removing it from the list of reviews. */ - public Review approve(ReviewApproveParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/reviews/%s/approve", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Review.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/SetupAttempt.java b/src/main/java/com/stripe/model/SetupAttempt.java index 50fc6921cef..2b12feda790 100644 --- a/src/main/java/com/stripe/model/SetupAttempt.java +++ b/src/main/java/com/stripe/model/SetupAttempt.java @@ -13,6 +13,11 @@ import lombok.Getter; import lombok.Setter; +/** + * A SetupAttempt describes one attempted confirmation of a SetupIntent, whether that confirmation + * was successful or unsuccessful. You can use SetupAttempts to inspect details of a specific + * attempt at setting up a payment method using a SetupIntent. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/SetupIntent.java b/src/main/java/com/stripe/model/SetupIntent.java index b6f9ff6c7db..aaf6856e018 100644 --- a/src/main/java/com/stripe/model/SetupIntent.java +++ b/src/main/java/com/stripe/model/SetupIntent.java @@ -19,6 +19,37 @@ import lombok.Getter; import lombok.Setter; +/** + * A SetupIntent guides you through the process of setting up and saving a customer's payment + * credentials for future payments. For example, you could use a SetupIntent to set up and save your + * customer's card without immediately collecting a payment. Later, you can use PaymentIntents to drive the payment flow. + * + *

Create a SetupIntent as soon as you're ready to collect your customer's payment credentials. + * Do not maintain long-lived, unconfirmed SetupIntents as they may no longer be valid. The + * SetupIntent then transitions through multiple statuses as it guides you + * through the setup process. + * + *

Successful SetupIntents result in payment credentials that are optimized for future payments. + * For example, cardholders in certain regions may need to + * be run through Strong Customer + * Authentication at the time of payment method collection in order to streamline later off-session payments. If the + * SetupIntent is used with a Customer, upon success, it + * will automatically attach the resulting payment method to that Customer. We recommend using + * SetupIntents or setup_future_usage + * on PaymentIntents to save payment methods in order to prevent saving invalid or unoptimized + * payment methods. + * + *

By using SetupIntents, you ensure that your customers experience the minimum set of required + * friction, even as regulations change over time. + * + *

Related guide: Setup Intents API. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -312,182 +343,87 @@ public void setSingleUseMandateObject(Mandate expandableObject) { } /** - * Creates a SetupIntent object. + * A SetupIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_confirmation, or requires_action + * . * - *

After the SetupIntent is created, attach a payment method and confirm to collect any required - * permissions to charge the payment method later. + *

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an + * error. */ - public static SetupIntent create(Map params) throws StripeException { - return create(params, (RequestOptions) null); + public SetupIntent cancel() throws StripeException { + return cancel((Map) null, (RequestOptions) null); } /** - * Creates a SetupIntent object. + * A SetupIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_confirmation, or requires_action + * . * - *

After the SetupIntent is created, attach a payment method and confirm to collect any required - * permissions to charge the payment method later. + *

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an + * error. */ - public static SetupIntent create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/setup_intents"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, SetupIntent.class, options); + public SetupIntent cancel(RequestOptions options) throws StripeException { + return cancel((Map) null, options); } /** - * Creates a SetupIntent object. + * A SetupIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_confirmation, or requires_action + * . * - *

After the SetupIntent is created, attach a payment method and confirm to collect any required - * permissions to charge the payment method later. + *

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an + * error. */ - public static SetupIntent create(SetupIntentCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); + public SetupIntent cancel(Map params) throws StripeException { + return cancel(params, (RequestOptions) null); } /** - * Creates a SetupIntent object. + * A SetupIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_confirmation, or requires_action + * . * - *

After the SetupIntent is created, attach a payment method and confirm to collect any required - * permissions to charge the payment method later. + *

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an + * error. */ - public static SetupIntent create(SetupIntentCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/setup_intents"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, SetupIntent.class, options); - } - - /** Returns a list of SetupIntents. */ - public static SetupIntentCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of SetupIntents. */ - public static SetupIntentCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/setup_intents"); - return ApiResource.requestCollection(url, params, SetupIntentCollection.class, options); - } - - /** Returns a list of SetupIntents. */ - public static SetupIntentCollection list(SetupIntentListParams params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of SetupIntents. */ - public static SetupIntentCollection list(SetupIntentListParams params, RequestOptions options) + public SetupIntent cancel(Map params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/setup_intents"); - return ApiResource.requestCollection(url, params, SetupIntentCollection.class, options); - } - - /** - * Retrieves the details of a SetupIntent that has previously been created. - * - *

Client-side retrieval using a publishable key is allowed when the client_secret - * is provided in the query string. - * - *

When retrieved with a publishable key, only a subset of properties will be returned. Please - * refer to the SetupIntent object - * reference for more details. - */ - public static SetupIntent retrieve(String intent) throws StripeException { - return retrieve(intent, (Map) null, (RequestOptions) null); - } - - /** - * Retrieves the details of a SetupIntent that has previously been created. - * - *

Client-side retrieval using a publishable key is allowed when the client_secret - * is provided in the query string. - * - *

When retrieved with a publishable key, only a subset of properties will be returned. Please - * refer to the SetupIntent object - * reference for more details. - */ - public static SetupIntent retrieve(String intent, RequestOptions options) throws StripeException { - return retrieve(intent, (Map) null, options); - } - - /** - * Retrieves the details of a SetupIntent that has previously been created. - * - *

Client-side retrieval using a publishable key is allowed when the client_secret - * is provided in the query string. - * - *

When retrieved with a publishable key, only a subset of properties will be returned. Please - * refer to the SetupIntent object - * reference for more details. - */ - public static SetupIntent retrieve( - String intent, Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/setup_intents/%s", ApiResource.urlEncodeId(intent))); + String.format("/v1/setup_intents/%s/cancel", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, SetupIntent.class, options); + ApiResource.RequestMethod.POST, url, params, SetupIntent.class, options); } /** - * Retrieves the details of a SetupIntent that has previously been created. - * - *

Client-side retrieval using a publishable key is allowed when the client_secret - * is provided in the query string. + * A SetupIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_confirmation, or requires_action + * . * - *

When retrieved with a publishable key, only a subset of properties will be returned. Please - * refer to the SetupIntent object - * reference for more details. + *

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an + * error. */ - public static SetupIntent retrieve( - String intent, SetupIntentRetrieveParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/setup_intents/%s", ApiResource.urlEncodeId(intent))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, SetupIntent.class, options); - } - - /** Updates a SetupIntent object. */ - @Override - public SetupIntent update(Map params) throws StripeException { - return update(params, (RequestOptions) null); - } - - /** Updates a SetupIntent object. */ - @Override - public SetupIntent update(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/setup_intents/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, SetupIntent.class, options); - } - - /** Updates a SetupIntent object. */ - public SetupIntent update(SetupIntentUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + public SetupIntent cancel(SetupIntentCancelParams params) throws StripeException { + return cancel(params, (RequestOptions) null); } - /** Updates a SetupIntent object. */ - public SetupIntent update(SetupIntentUpdateParams params, RequestOptions options) + /** + * A SetupIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_confirmation, or requires_action + * . + * + *

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an + * error. + */ + public SetupIntent cancel(SetupIntentCancelParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/setup_intents/%s", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/setup_intents/%s/cancel", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, SetupIntent.class, options); } @@ -603,87 +539,182 @@ public SetupIntent confirm(SetupIntentConfirmParams params, RequestOptions optio } /** - * A SetupIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_confirmation, or requires_action - * . + * Creates a SetupIntent object. * - *

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an - * error. + *

After the SetupIntent is created, attach a payment method and confirm to collect any required + * permissions to charge the payment method later. */ - public SetupIntent cancel() throws StripeException { - return cancel((Map) null, (RequestOptions) null); + public static SetupIntent create(Map params) throws StripeException { + return create(params, (RequestOptions) null); } /** - * A SetupIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_confirmation, or requires_action - * . + * Creates a SetupIntent object. * - *

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an - * error. + *

After the SetupIntent is created, attach a payment method and confirm to collect any required + * permissions to charge the payment method later. */ - public SetupIntent cancel(RequestOptions options) throws StripeException { - return cancel((Map) null, options); + public static SetupIntent create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/setup_intents"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, SetupIntent.class, options); } /** - * A SetupIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_confirmation, or requires_action - * . + * Creates a SetupIntent object. * - *

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an - * error. + *

After the SetupIntent is created, attach a payment method and confirm to collect any required + * permissions to charge the payment method later. */ - public SetupIntent cancel(Map params) throws StripeException { - return cancel(params, (RequestOptions) null); + public static SetupIntent create(SetupIntentCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); } /** - * A SetupIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_confirmation, or requires_action - * . + * Creates a SetupIntent object. * - *

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an - * error. + *

After the SetupIntent is created, attach a payment method and confirm to collect any required + * permissions to charge the payment method later. */ - public SetupIntent cancel(Map params, RequestOptions options) + public static SetupIntent create(SetupIntentCreateParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/setup_intents/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/setup_intents"); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, SetupIntent.class, options); } + /** Returns a list of SetupIntents. */ + public static SetupIntentCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of SetupIntents. */ + public static SetupIntentCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/setup_intents"); + return ApiResource.requestCollection(url, params, SetupIntentCollection.class, options); + } + + /** Returns a list of SetupIntents. */ + public static SetupIntentCollection list(SetupIntentListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of SetupIntents. */ + public static SetupIntentCollection list(SetupIntentListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/setup_intents"); + return ApiResource.requestCollection(url, params, SetupIntentCollection.class, options); + } + /** - * A SetupIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_confirmation, or requires_action - * . + * Retrieves the details of a SetupIntent that has previously been created. * - *

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an - * error. + *

Client-side retrieval using a publishable key is allowed when the client_secret + * is provided in the query string. + * + *

When retrieved with a publishable key, only a subset of properties will be returned. Please + * refer to the SetupIntent object + * reference for more details. */ - public SetupIntent cancel(SetupIntentCancelParams params) throws StripeException { - return cancel(params, (RequestOptions) null); + public static SetupIntent retrieve(String intent) throws StripeException { + return retrieve(intent, (Map) null, (RequestOptions) null); } /** - * A SetupIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_confirmation, or requires_action - * . + * Retrieves the details of a SetupIntent that has previously been created. * - *

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an - * error. + *

Client-side retrieval using a publishable key is allowed when the client_secret + * is provided in the query string. + * + *

When retrieved with a publishable key, only a subset of properties will be returned. Please + * refer to the SetupIntent object + * reference for more details. */ - public SetupIntent cancel(SetupIntentCancelParams params, RequestOptions options) + public static SetupIntent retrieve(String intent, RequestOptions options) throws StripeException { + return retrieve(intent, (Map) null, options); + } + + /** + * Retrieves the details of a SetupIntent that has previously been created. + * + *

Client-side retrieval using a publishable key is allowed when the client_secret + * is provided in the query string. + * + *

When retrieved with a publishable key, only a subset of properties will be returned. Please + * refer to the SetupIntent object + * reference for more details. + */ + public static SetupIntent retrieve( + String intent, Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/setup_intents/%s", ApiResource.urlEncodeId(intent))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, SetupIntent.class, options); + } + + /** + * Retrieves the details of a SetupIntent that has previously been created. + * + *

Client-side retrieval using a publishable key is allowed when the client_secret + * is provided in the query string. + * + *

When retrieved with a publishable key, only a subset of properties will be returned. Please + * refer to the SetupIntent object + * reference for more details. + */ + public static SetupIntent retrieve( + String intent, SetupIntentRetrieveParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/setup_intents/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/setup_intents/%s", ApiResource.urlEncodeId(intent))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, SetupIntent.class, options); + } + + /** Updates a SetupIntent object. */ + @Override + public SetupIntent update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates a SetupIntent object. */ + @Override + public SetupIntent update(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/setup_intents/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, SetupIntent.class, options); + } + + /** Updates a SetupIntent object. */ + public SetupIntent update(SetupIntentUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates a SetupIntent object. */ + public SetupIntent update(SetupIntentUpdateParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/setup_intents/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( ApiResource.RequestMethod.POST, url, params, SetupIntent.class, options); } diff --git a/src/main/java/com/stripe/model/ShippingRate.java b/src/main/java/com/stripe/model/ShippingRate.java index b400018266a..549d596da1d 100644 --- a/src/main/java/com/stripe/model/ShippingRate.java +++ b/src/main/java/com/stripe/model/ShippingRate.java @@ -15,6 +15,11 @@ import lombok.Getter; import lombok.Setter; +/** + * Shipping rates describe the price of shipping presented to your customers and can be applied to + * Checkout Sessions and Orders to collect shipping costs. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -115,6 +120,32 @@ public void setTaxCodeObject(TaxCode expandableObject) { this.taxCode = new ExpandableField(expandableObject.getId(), expandableObject); } + /** Creates a new shipping rate object. */ + public static ShippingRate create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new shipping rate object. */ + public static ShippingRate create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/shipping_rates"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, ShippingRate.class, options); + } + + /** Creates a new shipping rate object. */ + public static ShippingRate create(ShippingRateCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new shipping rate object. */ + public static ShippingRate create(ShippingRateCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/shipping_rates"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, ShippingRate.class, options); + } + /** Returns a list of your shipping rates. */ public static ShippingRateCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); @@ -176,32 +207,6 @@ public static ShippingRate retrieve( ApiResource.RequestMethod.GET, url, params, ShippingRate.class, options); } - /** Creates a new shipping rate object. */ - public static ShippingRate create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new shipping rate object. */ - public static ShippingRate create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/shipping_rates"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, ShippingRate.class, options); - } - - /** Creates a new shipping rate object. */ - public static ShippingRate create(ShippingRateCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new shipping rate object. */ - public static ShippingRate create(ShippingRateCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/shipping_rates"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, ShippingRate.class, options); - } - /** Updates an existing shipping rate object. */ @Override public ShippingRate update(Map params) throws StripeException { diff --git a/src/main/java/com/stripe/model/Sku.java b/src/main/java/com/stripe/model/Sku.java index 7967c8427f1..5f5786648f3 100644 --- a/src/main/java/com/stripe/model/Sku.java +++ b/src/main/java/com/stripe/model/Sku.java @@ -15,6 +15,14 @@ import lombok.Getter; import lombok.Setter; +/** + * Stores representations of stock keeping + * units. SKUs describe specific product variations, taking into account any combination of: + * attributes, currency, and cost. For example, a product may be a T-shirt, whereas a specific SKU + * represents the {@code size: large}, {@code color: red} version of that shirt. + * + *

Can also be used to manage inventory. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -121,44 +129,52 @@ public void setProductObject(Product expandableObject) { this.product = new ExpandableField(expandableObject.getId(), expandableObject); } - /** - * Retrieves the details of an existing SKU. Supply the unique SKU identifier from either a SKU - * creation request or from the product, and Stripe will return the corresponding SKU information. - */ - public static Sku retrieve(String id) throws StripeException { - return retrieve(id, (Map) null, (RequestOptions) null); + /** Creates a new SKU associated with a product. */ + public static Sku create(Map params) throws StripeException { + return create(params, (RequestOptions) null); } - /** - * Retrieves the details of an existing SKU. Supply the unique SKU identifier from either a SKU - * creation request or from the product, and Stripe will return the corresponding SKU information. - */ - public static Sku retrieve(String id, RequestOptions options) throws StripeException { - return retrieve(id, (Map) null, options); + /** Creates a new SKU associated with a product. */ + public static Sku create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/skus"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Sku.class, options); } - /** - * Retrieves the details of an existing SKU. Supply the unique SKU identifier from either a SKU - * creation request or from the product, and Stripe will return the corresponding SKU information. - */ - public static Sku retrieve(String id, Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", Stripe.getApiBase(), String.format("/v1/skus/%s", ApiResource.urlEncodeId(id))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Sku.class, options); + /** Creates a new SKU associated with a product. */ + public static Sku create(SkuCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); } - /** - * Retrieves the details of an existing SKU. Supply the unique SKU identifier from either a SKU - * creation request or from the product, and Stripe will return the corresponding SKU information. - */ - public static Sku retrieve(String id, SkuRetrieveParams params, RequestOptions options) - throws StripeException { + /** Creates a new SKU associated with a product. */ + public static Sku create(SkuCreateParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/skus"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Sku.class, options); + } + + /** Delete a SKU. Deleting a SKU is only possible until it has been used in an order. */ + public Sku delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); + } + + /** Delete a SKU. Deleting a SKU is only possible until it has been used in an order. */ + public Sku delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); + } + + /** Delete a SKU. Deleting a SKU is only possible until it has been used in an order. */ + public Sku delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); + } + + /** Delete a SKU. Deleting a SKU is only possible until it has been used in an order. */ + public Sku delete(Map params, RequestOptions options) throws StripeException { String url = String.format( - "%s%s", Stripe.getApiBase(), String.format("/v1/skus/%s", ApiResource.urlEncodeId(id))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Sku.class, options); + "%s%s", + Stripe.getApiBase(), + String.format("/v1/skus/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.DELETE, url, params, Sku.class, options); } /** @@ -197,6 +213,46 @@ public static SkuCollection list(SkuListParams params, RequestOptions options) return ApiResource.requestCollection(url, params, SkuCollection.class, options); } + /** + * Retrieves the details of an existing SKU. Supply the unique SKU identifier from either a SKU + * creation request or from the product, and Stripe will return the corresponding SKU information. + */ + public static Sku retrieve(String id) throws StripeException { + return retrieve(id, (Map) null, (RequestOptions) null); + } + + /** + * Retrieves the details of an existing SKU. Supply the unique SKU identifier from either a SKU + * creation request or from the product, and Stripe will return the corresponding SKU information. + */ + public static Sku retrieve(String id, RequestOptions options) throws StripeException { + return retrieve(id, (Map) null, options); + } + + /** + * Retrieves the details of an existing SKU. Supply the unique SKU identifier from either a SKU + * creation request or from the product, and Stripe will return the corresponding SKU information. + */ + public static Sku retrieve(String id, Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", Stripe.getApiBase(), String.format("/v1/skus/%s", ApiResource.urlEncodeId(id))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Sku.class, options); + } + + /** + * Retrieves the details of an existing SKU. Supply the unique SKU identifier from either a SKU + * creation request or from the product, and Stripe will return the corresponding SKU information. + */ + public static Sku retrieve(String id, SkuRetrieveParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", Stripe.getApiBase(), String.format("/v1/skus/%s", ApiResource.urlEncodeId(id))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Sku.class, options); + } + /** * Updates the specific SKU by setting the values of the parameters passed. Any parameters not * provided will be left unchanged. @@ -253,54 +309,6 @@ public Sku update(SkuUpdateParams params, RequestOptions options) throws StripeE return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Sku.class, options); } - /** Creates a new SKU associated with a product. */ - public static Sku create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new SKU associated with a product. */ - public static Sku create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/skus"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Sku.class, options); - } - - /** Creates a new SKU associated with a product. */ - public static Sku create(SkuCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new SKU associated with a product. */ - public static Sku create(SkuCreateParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/skus"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Sku.class, options); - } - - /** Delete a SKU. Deleting a SKU is only possible until it has been used in an order. */ - public Sku delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); - } - - /** Delete a SKU. Deleting a SKU is only possible until it has been used in an order. */ - public Sku delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); - } - - /** Delete a SKU. Deleting a SKU is only possible until it has been used in an order. */ - public Sku delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** Delete a SKU. Deleting a SKU is only possible until it has been used in an order. */ - public Sku delete(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/skus/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.DELETE, url, params, Sku.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Source.java b/src/main/java/com/stripe/model/Source.java index e9d15669068..e404789df3e 100644 --- a/src/main/java/com/stripe/model/Source.java +++ b/src/main/java/com/stripe/model/Source.java @@ -18,6 +18,14 @@ import lombok.Getter; import lombok.Setter; +/** + * {@code Source} objects allow you to accept a variety of payment methods. They represent a + * customer's payment instrument, and can be used with the Stripe API just like a {@code Card} + * object: once chargeable, they can be charged, or can be attached to customers. + * + *

Related guides: Sources API and Sources & Customers. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -200,6 +208,30 @@ public class Source extends ApiResource implements MetadataStore, Paymen @SerializedName("wechat") Wechat wechat; + /** Creates a new source object. */ + public static Source create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new source object. */ + public static Source create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/sources"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Source.class, options); + } + + /** Creates a new source object. */ + public static Source create(SourceCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new source object. */ + public static Source create(SourceCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/sources"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Source.class, options); + } + /** Delete a specified source for a given customer. */ public Source detach() throws StripeException { return detach((Map) null, (RequestOptions) null); @@ -285,28 +317,45 @@ public static Source retrieve(String source, SourceRetrieveParams params, Reques return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Source.class, options); } - /** Creates a new source object. */ - public static Source create(Map params) throws StripeException { - return create(params, (RequestOptions) null); + /** List source transactions for a given source. */ + public SourceTransactionCollection sourceTransactions() throws StripeException { + return sourceTransactions((Map) null, (RequestOptions) null); } - /** Creates a new source object. */ - public static Source create(Map params, RequestOptions options) + /** List source transactions for a given source. */ + public SourceTransactionCollection sourceTransactions(Map params) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/sources"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Source.class, options); + return sourceTransactions(params, (RequestOptions) null); } - /** Creates a new source object. */ - public static Source create(SourceCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); + /** List source transactions for a given source. */ + public SourceTransactionCollection sourceTransactions( + Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/sources/%s/source_transactions", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.requestCollection(url, params, SourceTransactionCollection.class, options); } - /** Creates a new source object. */ - public static Source create(SourceCreateParams params, RequestOptions options) + /** List source transactions for a given source. */ + public SourceTransactionCollection sourceTransactions(SourceSourceTransactionsParams params) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/sources"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Source.class, options); + return sourceTransactions(params, (RequestOptions) null); + } + + /** List source transactions for a given source. */ + public SourceTransactionCollection sourceTransactions( + SourceSourceTransactionsParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/sources/%s/source_transactions", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.requestCollection(url, params, SourceTransactionCollection.class, options); } /** @@ -399,47 +448,6 @@ public Source verify(SourceVerifyParams params, RequestOptions options) throws S return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Source.class, options); } - /** List source transactions for a given source. */ - public SourceTransactionCollection sourceTransactions() throws StripeException { - return sourceTransactions((Map) null, (RequestOptions) null); - } - - /** List source transactions for a given source. */ - public SourceTransactionCollection sourceTransactions(Map params) - throws StripeException { - return sourceTransactions(params, (RequestOptions) null); - } - - /** List source transactions for a given source. */ - public SourceTransactionCollection sourceTransactions( - Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/sources/%s/source_transactions", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.requestCollection(url, params, SourceTransactionCollection.class, options); - } - - /** List source transactions for a given source. */ - public SourceTransactionCollection sourceTransactions(SourceSourceTransactionsParams params) - throws StripeException { - return sourceTransactions(params, (RequestOptions) null); - } - - /** List source transactions for a given source. */ - public SourceTransactionCollection sourceTransactions( - SourceSourceTransactionsParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/sources/%s/source_transactions", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.requestCollection(url, params, SourceTransactionCollection.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -704,12 +712,12 @@ public static class CardPresent extends StripeObject { @SerializedName("pos_entry_mode") String posEntryMode; - @SerializedName("reader") - String reader; - @SerializedName("read_method") String readMethod; + @SerializedName("reader") + String reader; + @SerializedName("terminal_verification_results") String terminalVerificationResults; @@ -819,9 +827,6 @@ public static class Klarna extends StripeObject { @SerializedName("pay_later_redirect_url") String payLaterRedirectUrl; - @SerializedName("payment_method_categories") - String paymentMethodCategories; - @SerializedName("pay_now_asset_urls_descriptive") String payNowAssetUrlsDescriptive; @@ -846,6 +851,9 @@ public static class Klarna extends StripeObject { @SerializedName("pay_over_time_redirect_url") String payOverTimeRedirectUrl; + @SerializedName("payment_method_categories") + String paymentMethodCategories; + @SerializedName("purchase_country") String purchaseCountry; diff --git a/src/main/java/com/stripe/model/SourceMandateNotification.java b/src/main/java/com/stripe/model/SourceMandateNotification.java index 7d3e3b1703c..84a8dd8977b 100644 --- a/src/main/java/com/stripe/model/SourceMandateNotification.java +++ b/src/main/java/com/stripe/model/SourceMandateNotification.java @@ -6,6 +6,10 @@ import lombok.Getter; import lombok.Setter; +/** + * Source mandate notifications should be created when a notification related to a source mandate + * must be sent to the payer. They will trigger a webhook or deliver an email to the customer. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/SourceTransaction.java b/src/main/java/com/stripe/model/SourceTransaction.java index 3d662a589cb..7151842b11c 100644 --- a/src/main/java/com/stripe/model/SourceTransaction.java +++ b/src/main/java/com/stripe/model/SourceTransaction.java @@ -6,6 +6,11 @@ import lombok.Getter; import lombok.Setter; +/** + * Some payment methods have no required amount that a customer must send. Customers can be + * instructed to send any amount, and it can be made up of multiple transactions. As such, sources + * can have multiple associated transactions. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/StripeErrorResponse.java b/src/main/java/com/stripe/model/StripeErrorResponse.java index 717e4bab6d5..aec92c02098 100644 --- a/src/main/java/com/stripe/model/StripeErrorResponse.java +++ b/src/main/java/com/stripe/model/StripeErrorResponse.java @@ -6,6 +6,7 @@ import lombok.Getter; import lombok.Setter; +/** An error response from the Stripe API. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/Subscription.java b/src/main/java/com/stripe/model/Subscription.java index 937d6c7a190..3179b5a0776 100644 --- a/src/main/java/com/stripe/model/Subscription.java +++ b/src/main/java/com/stripe/model/Subscription.java @@ -20,6 +20,12 @@ import lombok.Getter; import lombok.Setter; +/** + * Subscriptions allow you to charge a customer on a recurring basis. + * + *

Related guide: Creating + * Subscriptions. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -473,92 +479,122 @@ public void setTestClockObject(TestClock expandableObject) { } /** - * Search for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static SubscriptionSearchResult search(Map params) throws StripeException { - return search(params, (RequestOptions) null); - } - - /** - * Search for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static SubscriptionSearchResult search(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscriptions/search"); - return ApiResource.requestSearchResult(url, params, SubscriptionSearchResult.class, options); - } - - /** - * Search for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. - */ - public static SubscriptionSearchResult search(SubscriptionSearchParams params) - throws StripeException { - return search(params, (RequestOptions) null); - } - - /** - * Search for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t - * use search in read-after-write flows where strict consistency is necessary. Under normal - * operating conditions, data is searchable in less than a minute. Occasionally, propagation of - * new or updated data can be up to an hour behind during outages. Search functionality is not - * available to merchants in India. + * Cancels a customer’s subscription immediately. The customer will not be charged again for the + * subscription. + * + *

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

By default, upon subscription cancellation, Stripe will stop automatic collection of all + * finalized invoices for the customer. This is intended to prevent unexpected payment attempts + * after the customer has canceled a subscription. However, you can resume automatic collection of + * the invoices manually after subscription cancellation to have us proceed. Or, you could check + * for unpaid invoices before allowing the customer to cancel the subscription at all. */ - public static SubscriptionSearchResult search( - SubscriptionSearchParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscriptions/search"); - return ApiResource.requestSearchResult(url, params, SubscriptionSearchResult.class, options); + public Subscription cancel() throws StripeException { + return cancel((Map) null, (RequestOptions) null); } /** - * By default, returns a list of subscriptions that have not been canceled. In order to list - * canceled subscriptions, specify status=canceled. + * Cancels a customer’s subscription immediately. The customer will not be charged again for the + * subscription. + * + *

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

By default, upon subscription cancellation, Stripe will stop automatic collection of all + * finalized invoices for the customer. This is intended to prevent unexpected payment attempts + * after the customer has canceled a subscription. However, you can resume automatic collection of + * the invoices manually after subscription cancellation to have us proceed. Or, you could check + * for unpaid invoices before allowing the customer to cancel the subscription at all. */ - public static SubscriptionCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); + public Subscription cancel(Map params) throws StripeException { + return cancel(params, (RequestOptions) null); } /** - * By default, returns a list of subscriptions that have not been canceled. In order to list - * canceled subscriptions, specify status=canceled. + * Cancels a customer’s subscription immediately. The customer will not be charged again for the + * subscription. + * + *

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

By default, upon subscription cancellation, Stripe will stop automatic collection of all + * finalized invoices for the customer. This is intended to prevent unexpected payment attempts + * after the customer has canceled a subscription. However, you can resume automatic collection of + * the invoices manually after subscription cancellation to have us proceed. Or, you could check + * for unpaid invoices before allowing the customer to cancel the subscription at all. */ - public static SubscriptionCollection list(Map params, RequestOptions options) + public Subscription cancel(Map params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscriptions"); - return ApiResource.requestCollection(url, params, SubscriptionCollection.class, options); + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/subscriptions/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, Subscription.class, options); } /** - * By default, returns a list of subscriptions that have not been canceled. In order to list - * canceled subscriptions, specify status=canceled. + * Cancels a customer’s subscription immediately. The customer will not be charged again for the + * subscription. + * + *

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

By default, upon subscription cancellation, Stripe will stop automatic collection of all + * finalized invoices for the customer. This is intended to prevent unexpected payment attempts + * after the customer has canceled a subscription. However, you can resume automatic collection of + * the invoices manually after subscription cancellation to have us proceed. Or, you could check + * for unpaid invoices before allowing the customer to cancel the subscription at all. */ - public static SubscriptionCollection list(SubscriptionListParams params) throws StripeException { - return list(params, (RequestOptions) null); + public Subscription cancel(SubscriptionCancelParams params) throws StripeException { + return cancel(params, (RequestOptions) null); } /** - * By default, returns a list of subscriptions that have not been canceled. In order to list - * canceled subscriptions, specify status=canceled. + * Cancels a customer’s subscription immediately. The customer will not be charged again for the + * subscription. + * + *

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

By default, upon subscription cancellation, Stripe will stop automatic collection of all + * finalized invoices for the customer. This is intended to prevent unexpected payment attempts + * after the customer has canceled a subscription. However, you can resume automatic collection of + * the invoices manually after subscription cancellation to have us proceed. Or, you could check + * for unpaid invoices before allowing the customer to cancel the subscription at all. */ - public static SubscriptionCollection list(SubscriptionListParams params, RequestOptions options) + public Subscription cancel(SubscriptionCancelParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscriptions"); - return ApiResource.requestCollection(url, params, SubscriptionCollection.class, options); + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/subscriptions/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, Subscription.class, options); } /** @@ -639,60 +675,62 @@ public static Subscription create(SubscriptionCreateParams params, RequestOption ApiResource.RequestMethod.POST, url, params, Subscription.class, options); } - /** - * Updates an existing subscription on a customer to match the specified parameters. When changing - * plans or quantities, we will optionally prorate the price we charge next month to make up for - * any price changes. To preview how the proration will be calculated, use the upcoming invoice endpoint. - */ - @Override - public Subscription update(Map params) throws StripeException { - return update(params, (RequestOptions) null); + /** Removes the currently applied discount on a subscription. */ + public Discount deleteDiscount() throws StripeException { + return deleteDiscount((Map) null, (RequestOptions) null); } - /** - * Updates an existing subscription on a customer to match the specified parameters. When changing - * plans or quantities, we will optionally prorate the price we charge next month to make up for - * any price changes. To preview how the proration will be calculated, use the upcoming invoice endpoint. - */ - @Override - public Subscription update(Map params, RequestOptions options) + /** Removes the currently applied discount on a subscription. */ + public Discount deleteDiscount(Map params) throws StripeException { + return deleteDiscount(params, (RequestOptions) null); + } + + /** Removes the currently applied discount on a subscription. */ + public Discount deleteDiscount(Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/subscriptions/%s", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/subscriptions/%s/discount", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, Subscription.class, options); + ApiResource.RequestMethod.DELETE, url, params, Discount.class, options); } /** - * Updates an existing subscription on a customer to match the specified parameters. When changing - * plans or quantities, we will optionally prorate the price we charge next month to make up for - * any price changes. To preview how the proration will be calculated, use the upcoming invoice endpoint. + * By default, returns a list of subscriptions that have not been canceled. In order to list + * canceled subscriptions, specify status=canceled. */ - public Subscription update(SubscriptionUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + public static SubscriptionCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); } /** - * Updates an existing subscription on a customer to match the specified parameters. When changing - * plans or quantities, we will optionally prorate the price we charge next month to make up for - * any price changes. To preview how the proration will be calculated, use the upcoming invoice endpoint. + * By default, returns a list of subscriptions that have not been canceled. In order to list + * canceled subscriptions, specify status=canceled. */ - public Subscription update(SubscriptionUpdateParams params, RequestOptions options) + public static SubscriptionCollection list(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/subscriptions/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, Subscription.class, options); + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscriptions"); + return ApiResource.requestCollection(url, params, SubscriptionCollection.class, options); + } + + /** + * By default, returns a list of subscriptions that have not been canceled. In order to list + * canceled subscriptions, specify status=canceled. + */ + public static SubscriptionCollection list(SubscriptionListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** + * By default, returns a list of subscriptions that have not been canceled. In order to list + * canceled subscriptions, specify status=canceled. + */ + public static SubscriptionCollection list(SubscriptionListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscriptions"); + return ApiResource.requestCollection(url, params, SubscriptionCollection.class, options); } /** Retrieves the subscription with the given ID. */ @@ -733,114 +771,77 @@ public static Subscription retrieve( } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. - * - *

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

By default, upon subscription cancellation, Stripe will stop automatic collection of all - * finalized invoices for the customer. This is intended to prevent unexpected payment attempts - * after the customer has canceled a subscription. However, you can resume automatic collection of - * the invoices manually after subscription cancellation to have us proceed. Or, you could check - * for unpaid invoices before allowing the customer to cancel the subscription at all. + * Search for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public Subscription cancel() throws StripeException { - return cancel((Map) null, (RequestOptions) null); + public static SubscriptionSearchResult search(Map params) throws StripeException { + return search(params, (RequestOptions) null); } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. - * - *

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

By default, upon subscription cancellation, Stripe will stop automatic collection of all - * finalized invoices for the customer. This is intended to prevent unexpected payment attempts - * after the customer has canceled a subscription. However, you can resume automatic collection of - * the invoices manually after subscription cancellation to have us proceed. Or, you could check - * for unpaid invoices before allowing the customer to cancel the subscription at all. + * Search for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public Subscription cancel(Map params) throws StripeException { - return cancel(params, (RequestOptions) null); + public static SubscriptionSearchResult search(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscriptions/search"); + return ApiResource.requestSearchResult(url, params, SubscriptionSearchResult.class, options); } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. - * - *

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

By default, upon subscription cancellation, Stripe will stop automatic collection of all - * finalized invoices for the customer. This is intended to prevent unexpected payment attempts - * after the customer has canceled a subscription. However, you can resume automatic collection of - * the invoices manually after subscription cancellation to have us proceed. Or, you could check - * for unpaid invoices before allowing the customer to cancel the subscription at all. + * Search for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public Subscription cancel(Map params, RequestOptions options) + public static SubscriptionSearchResult search(SubscriptionSearchParams params) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/subscriptions/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, Subscription.class, options); + return search(params, (RequestOptions) null); } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. - * - *

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

By default, upon subscription cancellation, Stripe will stop automatic collection of all - * finalized invoices for the customer. This is intended to prevent unexpected payment attempts - * after the customer has canceled a subscription. However, you can resume automatic collection of - * the invoices manually after subscription cancellation to have us proceed. Or, you could check - * for unpaid invoices before allowing the customer to cancel the subscription at all. + * Search for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t + * use search in read-after-write flows where strict consistency is necessary. Under normal + * operating conditions, data is searchable in less than a minute. Occasionally, propagation of + * new or updated data can be up to an hour behind during outages. Search functionality is not + * available to merchants in India. */ - public Subscription cancel(SubscriptionCancelParams params) throws StripeException { - return cancel(params, (RequestOptions) null); + public static SubscriptionSearchResult search( + SubscriptionSearchParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscriptions/search"); + return ApiResource.requestSearchResult(url, params, SubscriptionSearchResult.class, options); } /** - * Cancels a customer’s subscription immediately. The customer will not be charged again for the - * subscription. - * - *

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

By default, upon subscription cancellation, Stripe will stop automatic collection of all - * finalized invoices for the customer. This is intended to prevent unexpected payment attempts - * after the customer has canceled a subscription. However, you can resume automatic collection of - * the invoices manually after subscription cancellation to have us proceed. Or, you could check - * for unpaid invoices before allowing the customer to cancel the subscription at all. + * Updates an existing subscription on a customer to match the specified parameters. When changing + * plans or quantities, we will optionally prorate the price we charge next month to make up for + * any price changes. To preview how the proration will be calculated, use the upcoming invoice endpoint. */ - public Subscription cancel(SubscriptionCancelParams params, RequestOptions options) + @Override + public Subscription update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Updates an existing subscription on a customer to match the specified parameters. When changing + * plans or quantities, we will optionally prorate the price we charge next month to make up for + * any price changes. To preview how the proration will be calculated, use the upcoming invoice endpoint. + */ + @Override + public Subscription update(Map params, RequestOptions options) throws StripeException { String url = String.format( @@ -848,29 +849,34 @@ public Subscription cancel(SubscriptionCancelParams params, RequestOptions optio Stripe.getApiBase(), String.format("/v1/subscriptions/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, Subscription.class, options); - } - - /** Removes the currently applied discount on a subscription. */ - public Discount deleteDiscount() throws StripeException { - return deleteDiscount((Map) null, (RequestOptions) null); + ApiResource.RequestMethod.POST, url, params, Subscription.class, options); } - /** Removes the currently applied discount on a subscription. */ - public Discount deleteDiscount(Map params) throws StripeException { - return deleteDiscount(params, (RequestOptions) null); + /** + * Updates an existing subscription on a customer to match the specified parameters. When changing + * plans or quantities, we will optionally prorate the price we charge next month to make up for + * any price changes. To preview how the proration will be calculated, use the upcoming invoice endpoint. + */ + public Subscription update(SubscriptionUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); } - /** Removes the currently applied discount on a subscription. */ - public Discount deleteDiscount(Map params, RequestOptions options) + /** + * Updates an existing subscription on a customer to match the specified parameters. When changing + * plans or quantities, we will optionally prorate the price we charge next month to make up for + * any price changes. To preview how the proration will be calculated, use the upcoming invoice endpoint. + */ + public Subscription update(SubscriptionUpdateParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/subscriptions/%s/discount", ApiResource.urlEncodeId(this.getId()))); + String.format("/v1/subscriptions/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, Discount.class, options); + ApiResource.RequestMethod.POST, url, params, Subscription.class, options); } @Getter @@ -900,6 +906,10 @@ public static class BillingThresholds extends StripeObject { Boolean resetBillingCycleAnchor; } + /** + * The Pause Collection settings determine how we will pause collection for this subscription and + * for how long the subscription should be paused. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -1011,6 +1021,13 @@ public static class Card extends StripeObject { @SerializedName("mandate_options") MandateOptions mandateOptions; + /** + * Selected network to process this Subscription on. Depends on the available networks of the + * card attached to the Subscription. Can be only set confirm-time. + */ + @SerializedName("network") + String network; + /** * We strongly recommend that you rely on our SCA Engine to automatically prompt your * customers for authentication based on risk level and taxRates; + /** Adds a new item to an existing subscription. No existing items will be changed or replaced. */ + public static SubscriptionItem create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Adds a new item to an existing subscription. No existing items will be changed or replaced. */ + public static SubscriptionItem create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscription_items"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, SubscriptionItem.class, options); + } + + /** Adds a new item to an existing subscription. No existing items will be changed or replaced. */ + public static SubscriptionItem create(SubscriptionItemCreateParams params) + throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Adds a new item to an existing subscription. No existing items will be changed or replaced. */ + public static SubscriptionItem create(SubscriptionItemCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscription_items"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, SubscriptionItem.class, options); + } + + /** + * Deletes an item from the subscription. Removing a subscription item from a subscription will + * not cancel the subscription. + */ + public SubscriptionItem delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); + } + + /** + * Deletes an item from the subscription. Removing a subscription item from a subscription will + * not cancel the subscription. + */ + public SubscriptionItem delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); + } + + /** + * Deletes an item from the subscription. Removing a subscription item from a subscription will + * not cancel the subscription. + */ + public SubscriptionItem delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); + } + + /** + * Deletes an item from the subscription. Removing a subscription item from a subscription will + * not cancel the subscription. + */ + public SubscriptionItem delete(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/subscription_items/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, SubscriptionItem.class, options); + } + + /** + * Deletes an item from the subscription. Removing a subscription item from a subscription will + * not cancel the subscription. + */ + public SubscriptionItem delete(SubscriptionItemDeleteParams params) throws StripeException { + return delete(params, (RequestOptions) null); + } + + /** + * Deletes an item from the subscription. Removing a subscription item from a subscription will + * not cancel the subscription. + */ + public SubscriptionItem delete(SubscriptionItemDeleteParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/subscription_items/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, SubscriptionItem.class, options); + } + /** Returns a list of your subscription items for a given subscription. */ public static SubscriptionItemCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); @@ -181,33 +274,6 @@ public static SubscriptionItem retrieve( ApiResource.RequestMethod.GET, url, params, SubscriptionItem.class, options); } - /** Adds a new item to an existing subscription. No existing items will be changed or replaced. */ - public static SubscriptionItem create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Adds a new item to an existing subscription. No existing items will be changed or replaced. */ - public static SubscriptionItem create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscription_items"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, SubscriptionItem.class, options); - } - - /** Adds a new item to an existing subscription. No existing items will be changed or replaced. */ - public static SubscriptionItem create(SubscriptionItemCreateParams params) - throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Adds a new item to an existing subscription. No existing items will be changed or replaced. */ - public static SubscriptionItem create(SubscriptionItemCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscription_items"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, SubscriptionItem.class, options); - } - /** Updates the plan or quantity of an item on a current subscription. */ @Override public SubscriptionItem update(Map params) throws StripeException { @@ -244,68 +310,6 @@ public SubscriptionItem update(SubscriptionItemUpdateParams params, RequestOptio ApiResource.RequestMethod.POST, url, params, SubscriptionItem.class, options); } - /** - * Deletes an item from the subscription. Removing a subscription item from a subscription will - * not cancel the subscription. - */ - public SubscriptionItem delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); - } - - /** - * Deletes an item from the subscription. Removing a subscription item from a subscription will - * not cancel the subscription. - */ - public SubscriptionItem delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); - } - - /** - * Deletes an item from the subscription. Removing a subscription item from a subscription will - * not cancel the subscription. - */ - public SubscriptionItem delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** - * Deletes an item from the subscription. Removing a subscription item from a subscription will - * not cancel the subscription. - */ - public SubscriptionItem delete(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/subscription_items/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, SubscriptionItem.class, options); - } - - /** - * Deletes an item from the subscription. Removing a subscription item from a subscription will - * not cancel the subscription. - */ - public SubscriptionItem delete(SubscriptionItemDeleteParams params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** - * Deletes an item from the subscription. Removing a subscription item from a subscription will - * not cancel the subscription. - */ - public SubscriptionItem delete(SubscriptionItemDeleteParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/subscription_items/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, SubscriptionItem.class, options); - } - /** * For the specified subscription item, returns a list of summary objects. Each object in the list * provides usage information that’s been summarized from multiple usage records and over a diff --git a/src/main/java/com/stripe/model/SubscriptionSchedule.java b/src/main/java/com/stripe/model/SubscriptionSchedule.java index 7cad85e3784..ce83096ef68 100644 --- a/src/main/java/com/stripe/model/SubscriptionSchedule.java +++ b/src/main/java/com/stripe/model/SubscriptionSchedule.java @@ -20,6 +20,14 @@ import lombok.Getter; import lombok.Setter; +/** + * A subscription schedule allows you to create and manage the lifecycle of a subscription by + * predefining expected changes. + * + *

Related guide: Subscription + * Schedules. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -213,158 +221,6 @@ public void setTestClockObject(TestClock expandableObject) { this.testClock = new ExpandableField(expandableObject.getId(), expandableObject); } - /** Retrieves the list of your subscription schedules. */ - public static SubscriptionScheduleCollection list(Map params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Retrieves the list of your subscription schedules. */ - public static SubscriptionScheduleCollection list( - Map params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscription_schedules"); - return ApiResource.requestCollection( - url, params, SubscriptionScheduleCollection.class, options); - } - - /** Retrieves the list of your subscription schedules. */ - public static SubscriptionScheduleCollection list(SubscriptionScheduleListParams params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Retrieves the list of your subscription schedules. */ - public static SubscriptionScheduleCollection list( - SubscriptionScheduleListParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscription_schedules"); - return ApiResource.requestCollection( - url, params, SubscriptionScheduleCollection.class, options); - } - - /** - * Creates a new subscription schedule object. Each customer can have up to 500 active or - * scheduled subscriptions. - */ - public static SubscriptionSchedule create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * Creates a new subscription schedule object. Each customer can have up to 500 active or - * scheduled subscriptions. - */ - public static SubscriptionSchedule create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscription_schedules"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, SubscriptionSchedule.class, options); - } - - /** - * Creates a new subscription schedule object. Each customer can have up to 500 active or - * scheduled subscriptions. - */ - public static SubscriptionSchedule create(SubscriptionScheduleCreateParams params) - throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * Creates a new subscription schedule object. Each customer can have up to 500 active or - * scheduled subscriptions. - */ - public static SubscriptionSchedule create( - SubscriptionScheduleCreateParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscription_schedules"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, SubscriptionSchedule.class, options); - } - - /** - * Retrieves the details of an existing subscription schedule. You only need to supply the unique - * subscription schedule identifier that was returned upon subscription schedule creation. - */ - public static SubscriptionSchedule retrieve(String schedule) throws StripeException { - return retrieve(schedule, (Map) null, (RequestOptions) null); - } - - /** - * Retrieves the details of an existing subscription schedule. You only need to supply the unique - * subscription schedule identifier that was returned upon subscription schedule creation. - */ - public static SubscriptionSchedule retrieve(String schedule, RequestOptions options) - throws StripeException { - return retrieve(schedule, (Map) null, options); - } - - /** - * Retrieves the details of an existing subscription schedule. You only need to supply the unique - * subscription schedule identifier that was returned upon subscription schedule creation. - */ - public static SubscriptionSchedule retrieve( - String schedule, Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/subscription_schedules/%s", ApiResource.urlEncodeId(schedule))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, SubscriptionSchedule.class, options); - } - - /** - * Retrieves the details of an existing subscription schedule. You only need to supply the unique - * subscription schedule identifier that was returned upon subscription schedule creation. - */ - public static SubscriptionSchedule retrieve( - String schedule, SubscriptionScheduleRetrieveParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/subscription_schedules/%s", ApiResource.urlEncodeId(schedule))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, SubscriptionSchedule.class, options); - } - - /** Updates an existing subscription schedule. */ - @Override - public SubscriptionSchedule update(Map params) throws StripeException { - return update(params, (RequestOptions) null); - } - - /** Updates an existing subscription schedule. */ - @Override - public SubscriptionSchedule update(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/subscription_schedules/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, SubscriptionSchedule.class, options); - } - - /** Updates an existing subscription schedule. */ - public SubscriptionSchedule update(SubscriptionScheduleUpdateParams params) - throws StripeException { - return update(params, (RequestOptions) null); - } - - /** Updates an existing subscription schedule. */ - public SubscriptionSchedule update( - SubscriptionScheduleUpdateParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/subscription_schedules/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, SubscriptionSchedule.class, options); - } - /** * Cancels a subscription schedule and its associated subscription immediately (if the * subscription schedule has an active subscription). A subscription schedule can only be canceled @@ -436,6 +292,73 @@ public SubscriptionSchedule cancel( ApiResource.RequestMethod.POST, url, params, SubscriptionSchedule.class, options); } + /** + * Creates a new subscription schedule object. Each customer can have up to 500 active or + * scheduled subscriptions. + */ + public static SubscriptionSchedule create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * Creates a new subscription schedule object. Each customer can have up to 500 active or + * scheduled subscriptions. + */ + public static SubscriptionSchedule create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscription_schedules"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, SubscriptionSchedule.class, options); + } + + /** + * Creates a new subscription schedule object. Each customer can have up to 500 active or + * scheduled subscriptions. + */ + public static SubscriptionSchedule create(SubscriptionScheduleCreateParams params) + throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * Creates a new subscription schedule object. Each customer can have up to 500 active or + * scheduled subscriptions. + */ + public static SubscriptionSchedule create( + SubscriptionScheduleCreateParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscription_schedules"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, SubscriptionSchedule.class, options); + } + + /** Retrieves the list of your subscription schedules. */ + public static SubscriptionScheduleCollection list(Map params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Retrieves the list of your subscription schedules. */ + public static SubscriptionScheduleCollection list( + Map params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscription_schedules"); + return ApiResource.requestCollection( + url, params, SubscriptionScheduleCollection.class, options); + } + + /** Retrieves the list of your subscription schedules. */ + public static SubscriptionScheduleCollection list(SubscriptionScheduleListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Retrieves the list of your subscription schedules. */ + public static SubscriptionScheduleCollection list( + SubscriptionScheduleListParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/subscription_schedules"); + return ApiResource.requestCollection( + url, params, SubscriptionScheduleCollection.class, options); + } + /** * Releases the subscription schedule immediately, which will stop scheduling of its phases, but * leave any existing subscription in place. A schedule can only be released if its status is @@ -519,6 +442,95 @@ public SubscriptionSchedule release( ApiResource.RequestMethod.POST, url, params, SubscriptionSchedule.class, options); } + /** + * Retrieves the details of an existing subscription schedule. You only need to supply the unique + * subscription schedule identifier that was returned upon subscription schedule creation. + */ + public static SubscriptionSchedule retrieve(String schedule) throws StripeException { + return retrieve(schedule, (Map) null, (RequestOptions) null); + } + + /** + * Retrieves the details of an existing subscription schedule. You only need to supply the unique + * subscription schedule identifier that was returned upon subscription schedule creation. + */ + public static SubscriptionSchedule retrieve(String schedule, RequestOptions options) + throws StripeException { + return retrieve(schedule, (Map) null, options); + } + + /** + * Retrieves the details of an existing subscription schedule. You only need to supply the unique + * subscription schedule identifier that was returned upon subscription schedule creation. + */ + public static SubscriptionSchedule retrieve( + String schedule, Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/subscription_schedules/%s", ApiResource.urlEncodeId(schedule))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, SubscriptionSchedule.class, options); + } + + /** + * Retrieves the details of an existing subscription schedule. You only need to supply the unique + * subscription schedule identifier that was returned upon subscription schedule creation. + */ + public static SubscriptionSchedule retrieve( + String schedule, SubscriptionScheduleRetrieveParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/subscription_schedules/%s", ApiResource.urlEncodeId(schedule))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, SubscriptionSchedule.class, options); + } + + /** Updates an existing subscription schedule. */ + @Override + public SubscriptionSchedule update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates an existing subscription schedule. */ + @Override + public SubscriptionSchedule update(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/subscription_schedules/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, SubscriptionSchedule.class, options); + } + + /** Updates an existing subscription schedule. */ + public SubscriptionSchedule update(SubscriptionScheduleUpdateParams params) + throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates an existing subscription schedule. */ + public SubscriptionSchedule update( + SubscriptionScheduleUpdateParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/subscription_schedules/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, SubscriptionSchedule.class, options); + } + + /** + * An Add Invoice Item describes the prices and quantities that will be added as pending invoice + * items when entering a phase. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -680,6 +692,10 @@ public static class InvoiceSettings extends StripeObject { Long daysUntilDue; } + /** + * A phase describes the plans, coupon, and trialing status of a subscription for a predefined + * time period. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -859,6 +875,7 @@ public static class AutomaticTax extends StripeObject { } } + /** A phase item describes the price and quantity of a phase. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/TaxCode.java b/src/main/java/com/stripe/model/TaxCode.java index 31e89a2b6f6..540e9625b68 100644 --- a/src/main/java/com/stripe/model/TaxCode.java +++ b/src/main/java/com/stripe/model/TaxCode.java @@ -13,6 +13,10 @@ import lombok.Getter; import lombok.Setter; +/** + * Tax codes classify goods and services + * for tax purposes. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/TaxId.java b/src/main/java/com/stripe/model/TaxId.java index e8bddfc8d63..9dd250d36c6 100644 --- a/src/main/java/com/stripe/model/TaxId.java +++ b/src/main/java/com/stripe/model/TaxId.java @@ -11,6 +11,14 @@ import lombok.Getter; import lombok.Setter; +/** + * You can add one or multiple tax IDs to a customer. A customer's tax IDs are displayed on + * invoices and credit notes issued for the customer. + * + *

Related guide: Customer Tax + * Identification Numbers. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/TaxIdCollection.java b/src/main/java/com/stripe/model/TaxIdCollection.java index 219767ee505..5936b098d5e 100644 --- a/src/main/java/com/stripe/model/TaxIdCollection.java +++ b/src/main/java/com/stripe/model/TaxIdCollection.java @@ -34,6 +34,30 @@ public TaxId create(TaxIdCollectionCreateParams params, RequestOptions options) return ApiResource.request(ApiResource.RequestMethod.POST, url, params, TaxId.class, options); } + /** Returns a list of tax IDs for a customer. */ + public TaxIdCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of tax IDs for a customer. */ + public TaxIdCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); + return ApiResource.requestCollection(url, params, TaxIdCollection.class, options); + } + + /** Returns a list of tax IDs for a customer. */ + public TaxIdCollection list(TaxIdCollectionListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of tax IDs for a customer. */ + public TaxIdCollection list(TaxIdCollectionListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); + return ApiResource.requestCollection(url, params, TaxIdCollection.class, options); + } + /** Retrieves the TaxID object with the given identifier. */ public TaxId retrieve(String id) throws StripeException { return retrieve(id, (Map) null, (RequestOptions) null); @@ -65,28 +89,4 @@ public TaxId retrieve(String id, TaxIdCollectionRetrieveParams params, RequestOp String.format("%s/%s", this.getUrl(), ApiResource.urlEncodeId(id))); return ApiResource.request(ApiResource.RequestMethod.GET, url, params, TaxId.class, options); } - - /** Returns a list of tax IDs for a customer. */ - public TaxIdCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of tax IDs for a customer. */ - public TaxIdCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); - return ApiResource.requestCollection(url, params, TaxIdCollection.class, options); - } - - /** Returns a list of tax IDs for a customer. */ - public TaxIdCollection list(TaxIdCollectionListParams params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of tax IDs for a customer. */ - public TaxIdCollection list(TaxIdCollectionListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); - return ApiResource.requestCollection(url, params, TaxIdCollection.class, options); - } } diff --git a/src/main/java/com/stripe/model/TaxRate.java b/src/main/java/com/stripe/model/TaxRate.java index ae582715661..17bd490ce36 100644 --- a/src/main/java/com/stripe/model/TaxRate.java +++ b/src/main/java/com/stripe/model/TaxRate.java @@ -16,6 +16,15 @@ import lombok.Getter; import lombok.Setter; +/** + * Tax rates can be applied to invoices, subscriptions and Checkout + * Sessions to collect tax. + * + *

Related guide: Tax Rates. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -113,6 +122,30 @@ public class TaxRate extends ApiResource implements HasId, MetadataStore params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new tax rate. */ + public static TaxRate create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/tax_rates"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, TaxRate.class, options); + } + + /** Creates a new tax rate. */ + public static TaxRate create(TaxRateCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new tax rate. */ + public static TaxRate create(TaxRateCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/tax_rates"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, TaxRate.class, options); + } + /** * Returns a list of your tax rates. Tax rates are returned sorted by creation date, with the most * recently created tax rates appearing first. @@ -181,30 +214,6 @@ public static TaxRate retrieve( return ApiResource.request(ApiResource.RequestMethod.GET, url, params, TaxRate.class, options); } - /** Creates a new tax rate. */ - public static TaxRate create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new tax rate. */ - public static TaxRate create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/tax_rates"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, TaxRate.class, options); - } - - /** Creates a new tax rate. */ - public static TaxRate create(TaxRateCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new tax rate. */ - public static TaxRate create(TaxRateCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/tax_rates"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, TaxRate.class, options); - } - /** Updates an existing tax rate. */ @Override public TaxRate update(Map params) throws StripeException { diff --git a/src/main/java/com/stripe/model/Token.java b/src/main/java/com/stripe/model/Token.java index df1f2fde190..fbc4a8ca4ec 100644 --- a/src/main/java/com/stripe/model/Token.java +++ b/src/main/java/com/stripe/model/Token.java @@ -13,6 +13,30 @@ import lombok.Getter; import lombok.Setter; +/** + * Tokenization is the process Stripe uses to collect sensitive card or bank account details, or + * personally identifiable information (PII), directly from your customers in a secure manner. A + * token representing this information is returned to your server to use. You should use our recommended payments integrations to perform this + * process client-side. This ensures that no sensitive card data touches your server, and allows + * your integration to operate in a PCI-compliant way. + * + *

If you cannot use client-side tokenization, you can also create tokens using the API with + * either your publishable or secret API key. Keep in mind that if your integration uses this + * method, you are responsible for any PCI compliance that may be required, and you must keep your + * secret API key safe. Unlike with client-side tokenization, your customer's information is not + * sent directly to Stripe, so we cannot determine how it is handled or stored. + * + *

Tokens cannot be stored or used more than once. To store card or bank account information for + * later use, you can create Customer objects or + * Custom accounts. Note that Radar, our integrated solution for automatic fraud + * protection, performs best with integrations that use client-side tokenization. + * + *

Related guide: Accept a + * payment + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -77,36 +101,6 @@ public class Token extends ApiResource implements HasId { @SerializedName("used") Boolean used; - /** Retrieves the token with the given ID. */ - public static Token retrieve(String token) throws StripeException { - return retrieve(token, (Map) null, (RequestOptions) null); - } - - /** Retrieves the token with the given ID. */ - public static Token retrieve(String token, RequestOptions options) throws StripeException { - return retrieve(token, (Map) null, options); - } - - /** Retrieves the token with the given ID. */ - public static Token retrieve(String token, Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), String.format("/v1/tokens/%s", ApiResource.urlEncodeId(token))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Token.class, options); - } - - /** Retrieves the token with the given ID. */ - public static Token retrieve(String token, TokenRetrieveParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), String.format("/v1/tokens/%s", ApiResource.urlEncodeId(token))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Token.class, options); - } - /** * Creates a single-use token that represents a bank account’s details. This token can be used * with any API method in place of a bank account dictionary. This token can be used only once, by @@ -146,4 +140,34 @@ public static Token create(TokenCreateParams params, RequestOptions options) String url = String.format("%s%s", Stripe.getApiBase(), "/v1/tokens"); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Token.class, options); } + + /** Retrieves the token with the given ID. */ + public static Token retrieve(String token) throws StripeException { + return retrieve(token, (Map) null, (RequestOptions) null); + } + + /** Retrieves the token with the given ID. */ + public static Token retrieve(String token, RequestOptions options) throws StripeException { + return retrieve(token, (Map) null, options); + } + + /** Retrieves the token with the given ID. */ + public static Token retrieve(String token, Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), String.format("/v1/tokens/%s", ApiResource.urlEncodeId(token))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Token.class, options); + } + + /** Retrieves the token with the given ID. */ + public static Token retrieve(String token, TokenRetrieveParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), String.format("/v1/tokens/%s", ApiResource.urlEncodeId(token))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Token.class, options); + } } diff --git a/src/main/java/com/stripe/model/Topup.java b/src/main/java/com/stripe/model/Topup.java index ec095554f6c..d299146b629 100644 --- a/src/main/java/com/stripe/model/Topup.java +++ b/src/main/java/com/stripe/model/Topup.java @@ -16,6 +16,13 @@ import lombok.Getter; import lombok.Setter; +/** + * To top up your Stripe balance, you create a top-up object. You can retrieve individual top-ups, + * as well as list all top-ups. Top-ups are identified by a unique, random ID. + * + *

Related guide: Topping Up your Platform + * Account. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -96,12 +103,9 @@ public class Topup extends ApiResource implements MetadataStore, BalanceT String object; /** - * {@code Source} objects allow you to accept a variety of payment methods. They represent a - * customer's payment instrument, and can be used with the Stripe API just like a {@code Card} - * object: once chargeable, they can be charged, or can be attached to customers. - * - *

Related guides: Sources API and Sources & Customers. + * For most Stripe users, the source of every top-up is a bank account. This hash is then the source object describing that bank + * account. */ @SerializedName("source") Source source; @@ -146,6 +150,46 @@ public void setBalanceTransactionObject(BalanceTransaction expandableObject) { new ExpandableField(expandableObject.getId(), expandableObject); } + /** Cancels a top-up. Only pending top-ups can be canceled. */ + public Topup cancel() throws StripeException { + return cancel((Map) null, (RequestOptions) null); + } + + /** Cancels a top-up. Only pending top-ups can be canceled. */ + public Topup cancel(RequestOptions options) throws StripeException { + return cancel((Map) null, options); + } + + /** Cancels a top-up. Only pending top-ups can be canceled. */ + public Topup cancel(Map params) throws StripeException { + return cancel(params, (RequestOptions) null); + } + + /** Cancels a top-up. Only pending top-ups can be canceled. */ + public Topup cancel(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/topups/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Topup.class, options); + } + + /** Cancels a top-up. Only pending top-ups can be canceled. */ + public Topup cancel(TopupCancelParams params) throws StripeException { + return cancel(params, (RequestOptions) null); + } + + /** Cancels a top-up. Only pending top-ups can be canceled. */ + public Topup cancel(TopupCancelParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/topups/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Topup.class, options); + } + /** Top up the balance of an account. */ public static Topup create(Map params) throws StripeException { return create(params, (RequestOptions) null); @@ -271,44 +315,4 @@ public Topup update(TopupUpdateParams params, RequestOptions options) throws Str String.format("/v1/topups/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Topup.class, options); } - - /** Cancels a top-up. Only pending top-ups can be canceled. */ - public Topup cancel() throws StripeException { - return cancel((Map) null, (RequestOptions) null); - } - - /** Cancels a top-up. Only pending top-ups can be canceled. */ - public Topup cancel(RequestOptions options) throws StripeException { - return cancel((Map) null, options); - } - - /** Cancels a top-up. Only pending top-ups can be canceled. */ - public Topup cancel(Map params) throws StripeException { - return cancel(params, (RequestOptions) null); - } - - /** Cancels a top-up. Only pending top-ups can be canceled. */ - public Topup cancel(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/topups/%s/cancel", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Topup.class, options); - } - - /** Cancels a top-up. Only pending top-ups can be canceled. */ - public Topup cancel(TopupCancelParams params) throws StripeException { - return cancel(params, (RequestOptions) null); - } - - /** Cancels a top-up. Only pending top-ups can be canceled. */ - public Topup cancel(TopupCancelParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/topups/%s/cancel", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Topup.class, options); - } } diff --git a/src/main/java/com/stripe/model/Transfer.java b/src/main/java/com/stripe/model/Transfer.java index 6ebe68e80f8..ae045cdf9e9 100644 --- a/src/main/java/com/stripe/model/Transfer.java +++ b/src/main/java/com/stripe/model/Transfer.java @@ -15,6 +15,19 @@ import lombok.Getter; import lombok.Setter; +/** + * A {@code Transfer} object is created when you move funds between Stripe accounts as part of + * Connect. + * + *

Before April 6, 2017, transfers also represented movement of funds from a Stripe account to a + * card or bank account. This behavior has since been split out into a Payout object, with corresponding payout + * endpoints. For more information, read about the transfer/payout split. + * + *

Related guide: Creating Separate + * Charges and Transfers. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/TransferReversal.java b/src/main/java/com/stripe/model/TransferReversal.java index 15fa58d4f05..94ad9a70107 100644 --- a/src/main/java/com/stripe/model/TransferReversal.java +++ b/src/main/java/com/stripe/model/TransferReversal.java @@ -12,6 +12,22 @@ import lombok.Getter; import lombok.Setter; +/** + * Stripe Connect platforms can reverse transfers made + * to a connected account, either entirely or partially, and can also specify whether to refund any + * related application fees. Transfer reversals add to the platform's balance and subtract from the + * destination account's balance. + * + *

Reversing a transfer that was made for a destination charge is allowed only + * up to the amount of the charge. It is possible to reverse a transfer_group + * transfer only if the destination account has enough balance to cover the reversal. + * + *

Related guide: Reversing + * Transfers. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/UsageRecord.java b/src/main/java/com/stripe/model/UsageRecord.java index 1fa8448a553..f951aae8882 100644 --- a/src/main/java/com/stripe/model/UsageRecord.java +++ b/src/main/java/com/stripe/model/UsageRecord.java @@ -12,6 +12,13 @@ import lombok.Getter; import lombok.Setter; +/** + * Usage records allow you to report customer usage and metrics to Stripe for metered billing of + * subscription prices. + * + *

Related guide: Metered + * Billing. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/WebhookEndpoint.java b/src/main/java/com/stripe/model/WebhookEndpoint.java index d5806dc6ea7..7bd18d0e8f0 100644 --- a/src/main/java/com/stripe/model/WebhookEndpoint.java +++ b/src/main/java/com/stripe/model/WebhookEndpoint.java @@ -16,6 +16,16 @@ import lombok.Getter; import lombok.Setter; +/** + * You can configure webhook endpoints via the API + * to be notified about events that happen in your Stripe account or connected accounts. + * + *

Most users configure webhooks from the + * dashboard, which provides a user interface for registering and testing your webhook + * endpoints. + * + *

Related guide: Setting up Webhooks. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -92,6 +102,107 @@ public class WebhookEndpoint extends ApiResource implements HasId, MetadataStore @SerializedName("url") String url; + /** + * A webhook endpoint must have a url and a list of enabled_events. You + * may optionally specify the Boolean connect parameter. If set to true, then a + * Connect webhook endpoint that notifies the specified url about events from all + * connected accounts is created; otherwise an account webhook endpoint that notifies the + * specified url only about events from your account is created. You can also create + * webhook endpoints in the webhooks + * settings section of the Dashboard. + */ + public static WebhookEndpoint create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * A webhook endpoint must have a url and a list of enabled_events. You + * may optionally specify the Boolean connect parameter. If set to true, then a + * Connect webhook endpoint that notifies the specified url about events from all + * connected accounts is created; otherwise an account webhook endpoint that notifies the + * specified url only about events from your account is created. You can also create + * webhook endpoints in the webhooks + * settings section of the Dashboard. + */ + public static WebhookEndpoint create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/webhook_endpoints"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, WebhookEndpoint.class, options); + } + + /** + * A webhook endpoint must have a url and a list of enabled_events. You + * may optionally specify the Boolean connect parameter. If set to true, then a + * Connect webhook endpoint that notifies the specified url about events from all + * connected accounts is created; otherwise an account webhook endpoint that notifies the + * specified url only about events from your account is created. You can also create + * webhook endpoints in the webhooks + * settings section of the Dashboard. + */ + public static WebhookEndpoint create(WebhookEndpointCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * A webhook endpoint must have a url and a list of enabled_events. You + * may optionally specify the Boolean connect parameter. If set to true, then a + * Connect webhook endpoint that notifies the specified url about events from all + * connected accounts is created; otherwise an account webhook endpoint that notifies the + * specified url only about events from your account is created. You can also create + * webhook endpoints in the webhooks + * settings section of the Dashboard. + */ + public static WebhookEndpoint create(WebhookEndpointCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/webhook_endpoints"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, WebhookEndpoint.class, options); + } + + /** + * You can also delete webhook endpoints via the webhook endpoint management page of + * the Stripe dashboard. + */ + public WebhookEndpoint delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); + } + + /** + * You can also delete webhook endpoints via the webhook endpoint management page of + * the Stripe dashboard. + */ + public WebhookEndpoint delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); + } + + /** + * You can also delete webhook endpoints via the webhook endpoint management page of + * the Stripe dashboard. + */ + public WebhookEndpoint delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); + } + + /** + * You can also delete webhook endpoints via the webhook endpoint management page of + * the Stripe dashboard. + */ + public WebhookEndpoint delete(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/webhook_endpoints/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, WebhookEndpoint.class, options); + } + /** Returns a list of your webhook endpoints. */ public static WebhookEndpointCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); @@ -154,64 +265,6 @@ public static WebhookEndpoint retrieve( ApiResource.RequestMethod.GET, url, params, WebhookEndpoint.class, options); } - /** - * A webhook endpoint must have a url and a list of enabled_events. You - * may optionally specify the Boolean connect parameter. If set to true, then a - * Connect webhook endpoint that notifies the specified url about events from all - * connected accounts is created; otherwise an account webhook endpoint that notifies the - * specified url only about events from your account is created. You can also create - * webhook endpoints in the webhooks - * settings section of the Dashboard. - */ - public static WebhookEndpoint create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * A webhook endpoint must have a url and a list of enabled_events. You - * may optionally specify the Boolean connect parameter. If set to true, then a - * Connect webhook endpoint that notifies the specified url about events from all - * connected accounts is created; otherwise an account webhook endpoint that notifies the - * specified url only about events from your account is created. You can also create - * webhook endpoints in the webhooks - * settings section of the Dashboard. - */ - public static WebhookEndpoint create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/webhook_endpoints"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, WebhookEndpoint.class, options); - } - - /** - * A webhook endpoint must have a url and a list of enabled_events. You - * may optionally specify the Boolean connect parameter. If set to true, then a - * Connect webhook endpoint that notifies the specified url about events from all - * connected accounts is created; otherwise an account webhook endpoint that notifies the - * specified url only about events from your account is created. You can also create - * webhook endpoints in the webhooks - * settings section of the Dashboard. - */ - public static WebhookEndpoint create(WebhookEndpointCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * A webhook endpoint must have a url and a list of enabled_events. You - * may optionally specify the Boolean connect parameter. If set to true, then a - * Connect webhook endpoint that notifies the specified url about events from all - * connected accounts is created; otherwise an account webhook endpoint that notifies the - * specified url only about events from your account is created. You can also create - * webhook endpoints in the webhooks - * settings section of the Dashboard. - */ - public static WebhookEndpoint create(WebhookEndpointCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/webhook_endpoints"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, WebhookEndpoint.class, options); - } - /** * Updates the webhook endpoint. You may edit the url, the list of * enabled_events, and the status of your endpoint. @@ -259,47 +312,4 @@ public WebhookEndpoint update(WebhookEndpointUpdateParams params, RequestOptions return ApiResource.request( ApiResource.RequestMethod.POST, url, params, WebhookEndpoint.class, options); } - - /** - * You can also delete webhook endpoints via the webhook endpoint management page of - * the Stripe dashboard. - */ - public WebhookEndpoint delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); - } - - /** - * You can also delete webhook endpoints via the webhook endpoint management page of - * the Stripe dashboard. - */ - public WebhookEndpoint delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); - } - - /** - * You can also delete webhook endpoints via the webhook endpoint management page of - * the Stripe dashboard. - */ - public WebhookEndpoint delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** - * You can also delete webhook endpoints via the webhook endpoint management page of - * the Stripe dashboard. - */ - public WebhookEndpoint delete(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/webhook_endpoints/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, WebhookEndpoint.class, options); - } } diff --git a/src/main/java/com/stripe/model/apps/Secret.java b/src/main/java/com/stripe/model/apps/Secret.java index 8a4b886bfcf..668896342cc 100644 --- a/src/main/java/com/stripe/model/apps/Secret.java +++ b/src/main/java/com/stripe/model/apps/Secret.java @@ -17,6 +17,24 @@ import lombok.Getter; import lombok.Setter; +/** + * Secret Store is an API that allows Stripe Apps developers to securely persist secrets for use by + * UI Extensions and app backends. + * + *

The primary resource in Secret Store is a {@code secret}. Other apps can't view secrets + * created by an app. Additionally, secrets are scoped to provide further permission control. + * + *

All Dashboard users and the app backend share {@code account} scoped secrets. Use the {@code + * account} scope for secrets that don't change per-user, like a third-party API key. + * + *

A {@code user} scoped secret is accessible by the app backend and one specific Dashboard user. + * Use the {@code user} scope for per-user secrets like per-user OAuth tokens, where different users + * might have different permissions. + * + *

Related guide: Store data between page + * reloads. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -64,30 +82,6 @@ public class Secret extends ApiResource implements HasId { @SerializedName("scope") Scope scope; - /** Finds a secret in the secret store by name and scope. */ - public static Secret find(Map params) throws StripeException { - return find(params, (RequestOptions) null); - } - - /** Finds a secret in the secret store by name and scope. */ - public static Secret find(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/apps/secrets/find"); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Secret.class, options); - } - - /** Finds a secret in the secret store by name and scope. */ - public static Secret find(SecretFindParams params) throws StripeException { - return find(params, (RequestOptions) null); - } - - /** Finds a secret in the secret store by name and scope. */ - public static Secret find(SecretFindParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/apps/secrets/find"); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Secret.class, options); - } - /** Create or replace a secret in the secret store. */ public static Secret create(Map params) throws StripeException { return create(params, (RequestOptions) null); @@ -136,6 +130,30 @@ public static Secret deleteWhere(SecretDeleteWhereParams params, RequestOptions return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Secret.class, options); } + /** Finds a secret in the secret store by name and scope. */ + public static Secret find(Map params) throws StripeException { + return find(params, (RequestOptions) null); + } + + /** Finds a secret in the secret store by name and scope. */ + public static Secret find(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/apps/secrets/find"); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Secret.class, options); + } + + /** Finds a secret in the secret store by name and scope. */ + public static Secret find(SecretFindParams params) throws StripeException { + return find(params, (RequestOptions) null); + } + + /** Finds a secret in the secret store by name and scope. */ + public static Secret find(SecretFindParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/apps/secrets/find"); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Secret.class, options); + } + /** List all secrets stored on the given scope. */ public static SecretCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); diff --git a/src/main/java/com/stripe/model/billingportal/Configuration.java b/src/main/java/com/stripe/model/billingportal/Configuration.java index 17502cf4e37..147017f5d88 100644 --- a/src/main/java/com/stripe/model/billingportal/Configuration.java +++ b/src/main/java/com/stripe/model/billingportal/Configuration.java @@ -21,6 +21,7 @@ import lombok.Getter; import lombok.Setter; +/** A portal configuration describes the functionality and behavior of a portal session. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -113,31 +114,6 @@ public void setApplicationObject(Application expandableObject) { this.application = new ExpandableField(expandableObject.getId(), expandableObject); } - /** Returns a list of configurations that describe the functionality of the customer portal. */ - public static ConfigurationCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of configurations that describe the functionality of the customer portal. */ - public static ConfigurationCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/billing_portal/configurations"); - return ApiResource.requestCollection(url, params, ConfigurationCollection.class, options); - } - - /** Returns a list of configurations that describe the functionality of the customer portal. */ - public static ConfigurationCollection list(ConfigurationListParams params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of configurations that describe the functionality of the customer portal. */ - public static ConfigurationCollection list(ConfigurationListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/billing_portal/configurations"); - return ApiResource.requestCollection(url, params, ConfigurationCollection.class, options); - } - /** Creates a configuration that describes the functionality and behavior of a PortalSession. */ public static Configuration create(Map params) throws StripeException { return create(params, (RequestOptions) null); @@ -164,42 +140,29 @@ public static Configuration create(ConfigurationCreateParams params, RequestOpti ApiResource.RequestMethod.POST, url, params, Configuration.class, options); } - /** Updates a configuration that describes the functionality of the customer portal. */ - @Override - public Configuration update(Map params) throws StripeException { - return update(params, (RequestOptions) null); + /** Returns a list of configurations that describe the functionality of the customer portal. */ + public static ConfigurationCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); } - /** Updates a configuration that describes the functionality of the customer portal. */ - @Override - public Configuration update(Map params, RequestOptions options) + /** Returns a list of configurations that describe the functionality of the customer portal. */ + public static ConfigurationCollection list(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/billing_portal/configurations/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, Configuration.class, options); + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/billing_portal/configurations"); + return ApiResource.requestCollection(url, params, ConfigurationCollection.class, options); } - /** Updates a configuration that describes the functionality of the customer portal. */ - public Configuration update(ConfigurationUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + /** Returns a list of configurations that describe the functionality of the customer portal. */ + public static ConfigurationCollection list(ConfigurationListParams params) + throws StripeException { + return list(params, (RequestOptions) null); } - /** Updates a configuration that describes the functionality of the customer portal. */ - public Configuration update(ConfigurationUpdateParams params, RequestOptions options) + /** Returns a list of configurations that describe the functionality of the customer portal. */ + public static ConfigurationCollection list(ConfigurationListParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/billing_portal/configurations/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, Configuration.class, options); + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/billing_portal/configurations"); + return ApiResource.requestCollection(url, params, ConfigurationCollection.class, options); } /** Retrieves a configuration that describes the functionality of the customer portal. */ @@ -241,6 +204,44 @@ public static Configuration retrieve( ApiResource.RequestMethod.GET, url, params, Configuration.class, options); } + /** Updates a configuration that describes the functionality of the customer portal. */ + @Override + public Configuration update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates a configuration that describes the functionality of the customer portal. */ + @Override + public Configuration update(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/billing_portal/configurations/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, Configuration.class, options); + } + + /** Updates a configuration that describes the functionality of the customer portal. */ + public Configuration update(ConfigurationUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates a configuration that describes the functionality of the customer portal. */ + public Configuration update(ConfigurationUpdateParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/billing_portal/configurations/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, Configuration.class, options); + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/billingportal/Session.java b/src/main/java/com/stripe/model/billingportal/Session.java index 30b028b6dda..3675ed7e9cc 100644 --- a/src/main/java/com/stripe/model/billingportal/Session.java +++ b/src/main/java/com/stripe/model/billingportal/Session.java @@ -14,6 +14,22 @@ import lombok.Getter; import lombok.Setter; +/** + * The Billing customer portal is a Stripe-hosted UI for subscription and billing management. + * + *

A portal configuration describes the functionality and features that you want to provide to + * your customers through the portal. + * + *

A portal session describes the instantiation of the customer portal for a particular customer. + * By visiting the session's URL, the customer can manage their subscriptions and billing details. + * For security reasons, sessions are short-lived and will expire if the customer does not visit the + * URL. Create sessions on-demand when customers intend to manage their subscriptions and billing + * details. + * + *

Learn more in the integration + * guide. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/checkout/Session.java b/src/main/java/com/stripe/model/checkout/Session.java index f88504299d9..8cd2af9b25d 100644 --- a/src/main/java/com/stripe/model/checkout/Session.java +++ b/src/main/java/com/stripe/model/checkout/Session.java @@ -30,6 +30,22 @@ import lombok.Getter; import lombok.Setter; +/** + * A Checkout Session represents your customer's session as they pay for one-time purchases or + * subscriptions through Checkout or Payment Links. We recommend creating a + * new Session each time your customer attempts to pay. + * + *

Once payment is successful, the Checkout Session will contain a reference to the Customer, and either the successful PaymentIntent or an active Subscription. + * + *

You can create a Checkout Session on your server and pass its ID to the client to begin + * Checkout. + * + *

Related guide: Checkout Quickstart. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -393,84 +409,124 @@ public void setSubscriptionObject(Subscription expandableObject) { new ExpandableField(expandableObject.getId(), expandableObject); } - /** Returns a list of Checkout Sessions. */ - public static SessionCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); + /** Creates a Session object. */ + public static Session create(Map params) throws StripeException { + return create(params, (RequestOptions) null); } - /** Returns a list of Checkout Sessions. */ - public static SessionCollection list(Map params, RequestOptions options) + /** Creates a Session object. */ + public static Session create(Map params, RequestOptions options) throws StripeException { String url = String.format("%s%s", Stripe.getApiBase(), "/v1/checkout/sessions"); - return ApiResource.requestCollection(url, params, SessionCollection.class, options); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Session.class, options); } - /** Returns a list of Checkout Sessions. */ - public static SessionCollection list(SessionListParams params) throws StripeException { - return list(params, (RequestOptions) null); + /** Creates a Session object. */ + public static Session create(SessionCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); } - /** Returns a list of Checkout Sessions. */ - public static SessionCollection list(SessionListParams params, RequestOptions options) + /** Creates a Session object. */ + public static Session create(SessionCreateParams params, RequestOptions options) throws StripeException { String url = String.format("%s%s", Stripe.getApiBase(), "/v1/checkout/sessions"); - return ApiResource.requestCollection(url, params, SessionCollection.class, options); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Session.class, options); } - /** Retrieves a Session object. */ - public static Session retrieve(String session) throws StripeException { - return retrieve(session, (Map) null, (RequestOptions) null); + /** + * A Session can be expired when it is in one of these statuses: open + * + *

After it expires, a customer can’t complete a Session and customers loading the Session see + * a message saying the Session is expired. + */ + public Session expire() throws StripeException { + return expire((Map) null, (RequestOptions) null); } - /** Retrieves a Session object. */ - public static Session retrieve(String session, RequestOptions options) throws StripeException { - return retrieve(session, (Map) null, options); + /** + * A Session can be expired when it is in one of these statuses: open + * + *

After it expires, a customer can’t complete a Session and customers loading the Session see + * a message saying the Session is expired. + */ + public Session expire(RequestOptions options) throws StripeException { + return expire((Map) null, options); } - /** Retrieves a Session object. */ - public static Session retrieve(String session, Map params, RequestOptions options) - throws StripeException { + /** + * A Session can be expired when it is in one of these statuses: open + * + *

After it expires, a customer can’t complete a Session and customers loading the Session see + * a message saying the Session is expired. + */ + public Session expire(Map params) throws StripeException { + return expire(params, (RequestOptions) null); + } + + /** + * A Session can be expired when it is in one of these statuses: open + * + *

After it expires, a customer can’t complete a Session and customers loading the Session see + * a message saying the Session is expired. + */ + public Session expire(Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/checkout/sessions/%s", ApiResource.urlEncodeId(session))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Session.class, options); + String.format( + "/v1/checkout/sessions/%s/expire", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Session.class, options); } - /** Retrieves a Session object. */ - public static Session retrieve( - String session, SessionRetrieveParams params, RequestOptions options) throws StripeException { + /** + * A Session can be expired when it is in one of these statuses: open + * + *

After it expires, a customer can’t complete a Session and customers loading the Session see + * a message saying the Session is expired. + */ + public Session expire(SessionExpireParams params) throws StripeException { + return expire(params, (RequestOptions) null); + } + + /** + * A Session can be expired when it is in one of these statuses: open + * + *

After it expires, a customer can’t complete a Session and customers loading the Session see + * a message saying the Session is expired. + */ + public Session expire(SessionExpireParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/checkout/sessions/%s", ApiResource.urlEncodeId(session))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Session.class, options); + String.format( + "/v1/checkout/sessions/%s/expire", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Session.class, options); } - /** Creates a Session object. */ - public static Session create(Map params) throws StripeException { - return create(params, (RequestOptions) null); + /** Returns a list of Checkout Sessions. */ + public static SessionCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); } - /** Creates a Session object. */ - public static Session create(Map params, RequestOptions options) + /** Returns a list of Checkout Sessions. */ + public static SessionCollection list(Map params, RequestOptions options) throws StripeException { String url = String.format("%s%s", Stripe.getApiBase(), "/v1/checkout/sessions"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Session.class, options); + return ApiResource.requestCollection(url, params, SessionCollection.class, options); } - /** Creates a Session object. */ - public static Session create(SessionCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); + /** Returns a list of Checkout Sessions. */ + public static SessionCollection list(SessionListParams params) throws StripeException { + return list(params, (RequestOptions) null); } - /** Creates a Session object. */ - public static Session create(SessionCreateParams params, RequestOptions options) + /** Returns a list of Checkout Sessions. */ + public static SessionCollection list(SessionListParams params, RequestOptions options) throws StripeException { String url = String.format("%s%s", Stripe.getApiBase(), "/v1/checkout/sessions"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Session.class, options); + return ApiResource.requestCollection(url, params, SessionCollection.class, options); } /** @@ -533,76 +589,36 @@ public LineItemCollection listLineItems(SessionListLineItemsParams params, Reque return ApiResource.requestCollection(url, params, LineItemCollection.class, options); } - /** - * A Session can be expired when it is in one of these statuses: open - * - *

After it expires, a customer can’t complete a Session and customers loading the Session see - * a message saying the Session is expired. - */ - public Session expire() throws StripeException { - return expire((Map) null, (RequestOptions) null); - } - - /** - * A Session can be expired when it is in one of these statuses: open - * - *

After it expires, a customer can’t complete a Session and customers loading the Session see - * a message saying the Session is expired. - */ - public Session expire(RequestOptions options) throws StripeException { - return expire((Map) null, options); + /** Retrieves a Session object. */ + public static Session retrieve(String session) throws StripeException { + return retrieve(session, (Map) null, (RequestOptions) null); } - /** - * A Session can be expired when it is in one of these statuses: open - * - *

After it expires, a customer can’t complete a Session and customers loading the Session see - * a message saying the Session is expired. - */ - public Session expire(Map params) throws StripeException { - return expire(params, (RequestOptions) null); + /** Retrieves a Session object. */ + public static Session retrieve(String session, RequestOptions options) throws StripeException { + return retrieve(session, (Map) null, options); } - /** - * A Session can be expired when it is in one of these statuses: open - * - *

After it expires, a customer can’t complete a Session and customers loading the Session see - * a message saying the Session is expired. - */ - public Session expire(Map params, RequestOptions options) throws StripeException { + /** Retrieves a Session object. */ + public static Session retrieve(String session, Map params, RequestOptions options) + throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format( - "/v1/checkout/sessions/%s/expire", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Session.class, options); - } - - /** - * A Session can be expired when it is in one of these statuses: open - * - *

After it expires, a customer can’t complete a Session and customers loading the Session see - * a message saying the Session is expired. - */ - public Session expire(SessionExpireParams params) throws StripeException { - return expire(params, (RequestOptions) null); + String.format("/v1/checkout/sessions/%s", ApiResource.urlEncodeId(session))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Session.class, options); } - /** - * A Session can be expired when it is in one of these statuses: open - * - *

After it expires, a customer can’t complete a Session and customers loading the Session see - * a message saying the Session is expired. - */ - public Session expire(SessionExpireParams params, RequestOptions options) throws StripeException { + /** Retrieves a Session object. */ + public static Session retrieve( + String session, SessionRetrieveParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format( - "/v1/checkout/sessions/%s/expire", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Session.class, options); + String.format("/v1/checkout/sessions/%s", ApiResource.urlEncodeId(session))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Session.class, options); } @Getter diff --git a/src/main/java/com/stripe/model/financialconnections/Account.java b/src/main/java/com/stripe/model/financialconnections/Account.java index a1f1c811576..461bb4f759c 100644 --- a/src/main/java/com/stripe/model/financialconnections/Account.java +++ b/src/main/java/com/stripe/model/financialconnections/Account.java @@ -21,6 +21,10 @@ import lombok.Getter; import lombok.Setter; +/** + * A Financial Connections Account represents an account that exists outside of Stripe, to which you + * have been granted some degree of access. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -147,76 +151,107 @@ public void setOwnershipObject(AccountOwnership expandableObject) { new ExpandableField(expandableObject.getId(), expandableObject); } - /** Returns a list of Financial Connections Account objects. */ - public static AccountCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of Financial Connections Account objects. */ - public static AccountCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/financial_connections/accounts"); - return ApiResource.requestCollection(url, params, AccountCollection.class, options); - } - - /** Returns a list of Financial Connections Account objects. */ - public static AccountCollection list(AccountListParams params) throws StripeException { - return list(params, (RequestOptions) null); + /** + * Disables your access to a Financial Connections Account. You will no longer be + * able to access data associated with the account (e.g. balances, transactions). + */ + public com.stripe.model.financialconnections.Account disconnect() throws StripeException { + return disconnect((Map) null, (RequestOptions) null); } - /** Returns a list of Financial Connections Account objects. */ - public static AccountCollection list(AccountListParams params, RequestOptions options) + /** + * Disables your access to a Financial Connections Account. You will no longer be + * able to access data associated with the account (e.g. balances, transactions). + */ + public com.stripe.model.financialconnections.Account disconnect(RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/financial_connections/accounts"); - return ApiResource.requestCollection(url, params, AccountCollection.class, options); + return disconnect((Map) null, options); } - /** Retrieves the details of an Financial Connections Account. */ - public static com.stripe.model.financialconnections.Account retrieve(String account) + /** + * Disables your access to a Financial Connections Account. You will no longer be + * able to access data associated with the account (e.g. balances, transactions). + */ + public com.stripe.model.financialconnections.Account disconnect(Map params) throws StripeException { - return retrieve(account, (Map) null, (RequestOptions) null); - } - - /** Retrieves the details of an Financial Connections Account. */ - public static com.stripe.model.financialconnections.Account retrieve( - String account, RequestOptions options) throws StripeException { - return retrieve(account, (Map) null, options); + return disconnect(params, (RequestOptions) null); } - /** Retrieves the details of an Financial Connections Account. */ - public static com.stripe.model.financialconnections.Account retrieve( - String account, Map params, RequestOptions options) throws StripeException { + /** + * Disables your access to a Financial Connections Account. You will no longer be + * able to access data associated with the account (e.g. balances, transactions). + */ + public com.stripe.model.financialconnections.Account disconnect( + Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), String.format( - "/v1/financial_connections/accounts/%s", ApiResource.urlEncodeId(account))); + "/v1/financial_connections/accounts/%s/disconnect", + ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.GET, + ApiResource.RequestMethod.POST, url, params, com.stripe.model.financialconnections.Account.class, options); } - /** Retrieves the details of an Financial Connections Account. */ - public static com.stripe.model.financialconnections.Account retrieve( - String account, AccountRetrieveParams params, RequestOptions options) throws StripeException { + /** + * Disables your access to a Financial Connections Account. You will no longer be + * able to access data associated with the account (e.g. balances, transactions). + */ + public com.stripe.model.financialconnections.Account disconnect(AccountDisconnectParams params) + throws StripeException { + return disconnect(params, (RequestOptions) null); + } + + /** + * Disables your access to a Financial Connections Account. You will no longer be + * able to access data associated with the account (e.g. balances, transactions). + */ + public com.stripe.model.financialconnections.Account disconnect( + AccountDisconnectParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), String.format( - "/v1/financial_connections/accounts/%s", ApiResource.urlEncodeId(account))); + "/v1/financial_connections/accounts/%s/disconnect", + ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.GET, + ApiResource.RequestMethod.POST, url, params, com.stripe.model.financialconnections.Account.class, options); } + /** Returns a list of Financial Connections Account objects. */ + public static AccountCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of Financial Connections Account objects. */ + public static AccountCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/financial_connections/accounts"); + return ApiResource.requestCollection(url, params, AccountCollection.class, options); + } + + /** Returns a list of Financial Connections Account objects. */ + public static AccountCollection list(AccountListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of Financial Connections Account objects. */ + public static AccountCollection list(AccountListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/financial_connections/accounts"); + return ApiResource.requestCollection(url, params, AccountCollection.class, options); + } + /** Lists all owners for a given Account. */ public AccountOwnerCollection listOwners(Map params) throws StripeException { return listOwners(params, (RequestOptions) null); @@ -301,77 +336,46 @@ public com.stripe.model.financialconnections.Account refresh( options); } - /** - * Disables your access to a Financial Connections Account. You will no longer be - * able to access data associated with the account (e.g. balances, transactions). - */ - public com.stripe.model.financialconnections.Account disconnect() throws StripeException { - return disconnect((Map) null, (RequestOptions) null); - } - - /** - * Disables your access to a Financial Connections Account. You will no longer be - * able to access data associated with the account (e.g. balances, transactions). - */ - public com.stripe.model.financialconnections.Account disconnect(RequestOptions options) + /** Retrieves the details of an Financial Connections Account. */ + public static com.stripe.model.financialconnections.Account retrieve(String account) throws StripeException { - return disconnect((Map) null, options); + return retrieve(account, (Map) null, (RequestOptions) null); } - /** - * Disables your access to a Financial Connections Account. You will no longer be - * able to access data associated with the account (e.g. balances, transactions). - */ - public com.stripe.model.financialconnections.Account disconnect(Map params) - throws StripeException { - return disconnect(params, (RequestOptions) null); + /** Retrieves the details of an Financial Connections Account. */ + public static com.stripe.model.financialconnections.Account retrieve( + String account, RequestOptions options) throws StripeException { + return retrieve(account, (Map) null, options); } - /** - * Disables your access to a Financial Connections Account. You will no longer be - * able to access data associated with the account (e.g. balances, transactions). - */ - public com.stripe.model.financialconnections.Account disconnect( - Map params, RequestOptions options) throws StripeException { + /** Retrieves the details of an Financial Connections Account. */ + public static com.stripe.model.financialconnections.Account retrieve( + String account, Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), String.format( - "/v1/financial_connections/accounts/%s/disconnect", - ApiResource.urlEncodeId(this.getId()))); + "/v1/financial_connections/accounts/%s", ApiResource.urlEncodeId(account))); return ApiResource.request( - ApiResource.RequestMethod.POST, + ApiResource.RequestMethod.GET, url, params, com.stripe.model.financialconnections.Account.class, options); } - /** - * Disables your access to a Financial Connections Account. You will no longer be - * able to access data associated with the account (e.g. balances, transactions). - */ - public com.stripe.model.financialconnections.Account disconnect(AccountDisconnectParams params) - throws StripeException { - return disconnect(params, (RequestOptions) null); - } - - /** - * Disables your access to a Financial Connections Account. You will no longer be - * able to access data associated with the account (e.g. balances, transactions). - */ - public com.stripe.model.financialconnections.Account disconnect( - AccountDisconnectParams params, RequestOptions options) throws StripeException { + /** Retrieves the details of an Financial Connections Account. */ + public static com.stripe.model.financialconnections.Account retrieve( + String account, AccountRetrieveParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), String.format( - "/v1/financial_connections/accounts/%s/disconnect", - ApiResource.urlEncodeId(this.getId()))); + "/v1/financial_connections/accounts/%s", ApiResource.urlEncodeId(account))); return ApiResource.request( - ApiResource.RequestMethod.POST, + ApiResource.RequestMethod.GET, url, params, com.stripe.model.financialconnections.Account.class, diff --git a/src/main/java/com/stripe/model/financialconnections/AccountOwnership.java b/src/main/java/com/stripe/model/financialconnections/AccountOwnership.java index 6f67a39d9f0..fc50dc5efb7 100644 --- a/src/main/java/com/stripe/model/financialconnections/AccountOwnership.java +++ b/src/main/java/com/stripe/model/financialconnections/AccountOwnership.java @@ -8,6 +8,7 @@ import lombok.Getter; import lombok.Setter; +/** Describes a snapshot of the owners of an account at a particular point in time. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/financialconnections/Session.java b/src/main/java/com/stripe/model/financialconnections/Session.java index 9998c494b50..98074d9ea51 100644 --- a/src/main/java/com/stripe/model/financialconnections/Session.java +++ b/src/main/java/com/stripe/model/financialconnections/Session.java @@ -19,6 +19,10 @@ import lombok.Getter; import lombok.Setter; +/** + * A Financial Connections Session is the secure way to programmatically launch the client-side + * Stripe.js modal that lets your users link their accounts. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/identity/VerificationReport.java b/src/main/java/com/stripe/model/identity/VerificationReport.java index e168132f4bb..45fdb83e9e3 100644 --- a/src/main/java/com/stripe/model/identity/VerificationReport.java +++ b/src/main/java/com/stripe/model/identity/VerificationReport.java @@ -17,6 +17,22 @@ import lombok.Getter; import lombok.Setter; +/** + * A VerificationReport is the result of an attempt to collect and verify data from a user. The + * collection of verification checks performed is determined from the {@code type} and {@code + * options} parameters used. You can find the result of each verification check performed in the + * appropriate sub-resource: {@code document}, {@code id_number}, {@code selfie}. + * + *

Each VerificationReport contains a copy of any data collected by the user as well as reference + * IDs which can be used to access collected images through the FileUpload API. To configure and create + * VerificationReports, use the VerificationSession API. + * + *

Related guides: Accessing verification + * results. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -72,6 +88,32 @@ public class VerificationReport extends ApiResource implements HasId { @SerializedName("verification_session") String verificationSession; + /** List all verification reports. */ + public static VerificationReportCollection list(Map params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** List all verification reports. */ + public static VerificationReportCollection list( + Map params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/identity/verification_reports"); + return ApiResource.requestCollection(url, params, VerificationReportCollection.class, options); + } + + /** List all verification reports. */ + public static VerificationReportCollection list(VerificationReportListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** List all verification reports. */ + public static VerificationReportCollection list( + VerificationReportListParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/identity/verification_reports"); + return ApiResource.requestCollection(url, params, VerificationReportCollection.class, options); + } + /** Retrieves an existing VerificationReport. */ public static VerificationReport retrieve(String report) throws StripeException { return retrieve(report, (Map) null, (RequestOptions) null); @@ -108,32 +150,7 @@ public static VerificationReport retrieve( ApiResource.RequestMethod.GET, url, params, VerificationReport.class, options); } - /** List all verification reports. */ - public static VerificationReportCollection list(Map params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** List all verification reports. */ - public static VerificationReportCollection list( - Map params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/identity/verification_reports"); - return ApiResource.requestCollection(url, params, VerificationReportCollection.class, options); - } - - /** List all verification reports. */ - public static VerificationReportCollection list(VerificationReportListParams params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** List all verification reports. */ - public static VerificationReportCollection list( - VerificationReportListParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/identity/verification_reports"); - return ApiResource.requestCollection(url, params, VerificationReportCollection.class, options); - } - + /** Result from a document check. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -197,6 +214,7 @@ public static class Document extends StripeObject { @SerializedName("type") String type; + /** Point in Time. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -235,6 +253,7 @@ public static class DocumentCheckError extends StripeObject { String reason; } + /** Point in Time. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -252,6 +271,7 @@ public static class ExpirationDate extends StripeObject { Long year; } + /** Point in Time. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -270,6 +290,7 @@ public static class IssuedDate extends StripeObject { } } + /** Result from an id_number check. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -310,6 +331,7 @@ public static class IdNumber extends StripeObject { @SerializedName("status") String status; + /** Point in Time. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -402,6 +424,7 @@ public static class Document extends StripeObject { public static class IdNumber extends StripeObject {} } + /** Result from a selfie check. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/identity/VerificationSession.java b/src/main/java/com/stripe/model/identity/VerificationSession.java index 02f46dd7d44..110ba36a53c 100644 --- a/src/main/java/com/stripe/model/identity/VerificationSession.java +++ b/src/main/java/com/stripe/model/identity/VerificationSession.java @@ -23,6 +23,20 @@ import lombok.Getter; import lombok.Setter; +/** + * A VerificationSession guides you through the process of collecting and verifying the identities + * of your users. It contains details about the type of verification, such as what verification check to perform. + * Only create one VerificationSession for each verification in your system. + * + *

A VerificationSession transitions through multiple statuses throughout its + * lifetime as it progresses through the verification flow. The VerificationSession contains the + * user's verified data after verification checks are complete. + * + *

Related guide: The + * Verification Sessions API + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -152,6 +166,90 @@ public void setLastVerificationReportObject(VerificationReport expandableObject) new ExpandableField(expandableObject.getId(), expandableObject); } + /** + * A VerificationSession object can be canceled when it is in requires_input status. + * + *

Once canceled, future submission attempts are disabled. This cannot be undone. Learn more. + */ + public VerificationSession cancel() throws StripeException { + return cancel((Map) null, (RequestOptions) null); + } + + /** + * A VerificationSession object can be canceled when it is in requires_input status. + * + *

Once canceled, future submission attempts are disabled. This cannot be undone. Learn more. + */ + public VerificationSession cancel(RequestOptions options) throws StripeException { + return cancel((Map) null, options); + } + + /** + * A VerificationSession object can be canceled when it is in requires_input status. + * + *

Once canceled, future submission attempts are disabled. This cannot be undone. Learn more. + */ + public VerificationSession cancel(Map params) throws StripeException { + return cancel(params, (RequestOptions) null); + } + + /** + * A VerificationSession object can be canceled when it is in requires_input status. + * + *

Once canceled, future submission attempts are disabled. This cannot be undone. Learn more. + */ + public VerificationSession cancel(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/identity/verification_sessions/%s/cancel", + ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, VerificationSession.class, options); + } + + /** + * A VerificationSession object can be canceled when it is in requires_input status. + * + *

Once canceled, future submission attempts are disabled. This cannot be undone. Learn more. + */ + public VerificationSession cancel(VerificationSessionCancelParams params) throws StripeException { + return cancel(params, (RequestOptions) null); + } + + /** + * A VerificationSession object can be canceled when it is in requires_input status. + * + *

Once canceled, future submission attempts are disabled. This cannot be undone. Learn more. + */ + public VerificationSession cancel(VerificationSessionCancelParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/identity/verification_sessions/%s/cancel", + ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, VerificationSession.class, options); + } + /** * Creates a VerificationSession object. * @@ -223,64 +321,6 @@ public static VerificationSession create( ApiResource.RequestMethod.POST, url, params, VerificationSession.class, options); } - /** - * Retrieves the details of a VerificationSession that was previously created. - * - *

When the session status is requires_input, you can use this method to retrieve - * a valid client_secret or url to allow re-submission. - */ - public static VerificationSession retrieve(String session) throws StripeException { - return retrieve(session, (Map) null, (RequestOptions) null); - } - - /** - * Retrieves the details of a VerificationSession that was previously created. - * - *

When the session status is requires_input, you can use this method to retrieve - * a valid client_secret or url to allow re-submission. - */ - public static VerificationSession retrieve(String session, RequestOptions options) - throws StripeException { - return retrieve(session, (Map) null, options); - } - - /** - * Retrieves the details of a VerificationSession that was previously created. - * - *

When the session status is requires_input, you can use this method to retrieve - * a valid client_secret or url to allow re-submission. - */ - public static VerificationSession retrieve( - String session, Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/identity/verification_sessions/%s", ApiResource.urlEncodeId(session))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, VerificationSession.class, options); - } - - /** - * Retrieves the details of a VerificationSession that was previously created. - * - *

When the session status is requires_input, you can use this method to retrieve - * a valid client_secret or url to allow re-submission. - */ - public static VerificationSession retrieve( - String session, VerificationSessionRetrieveParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/identity/verification_sessions/%s", ApiResource.urlEncodeId(session))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, VerificationSession.class, options); - } - /** Returns a list of VerificationSessions. */ public static VerificationSessionCollection list(Map params) throws StripeException { @@ -307,90 +347,6 @@ public static VerificationSessionCollection list( return ApiResource.requestCollection(url, params, VerificationSessionCollection.class, options); } - /** - * A VerificationSession object can be canceled when it is in requires_input status. - * - *

Once canceled, future submission attempts are disabled. This cannot be undone. Learn more. - */ - public VerificationSession cancel() throws StripeException { - return cancel((Map) null, (RequestOptions) null); - } - - /** - * A VerificationSession object can be canceled when it is in requires_input status. - * - *

Once canceled, future submission attempts are disabled. This cannot be undone. Learn more. - */ - public VerificationSession cancel(RequestOptions options) throws StripeException { - return cancel((Map) null, options); - } - - /** - * A VerificationSession object can be canceled when it is in requires_input status. - * - *

Once canceled, future submission attempts are disabled. This cannot be undone. Learn more. - */ - public VerificationSession cancel(Map params) throws StripeException { - return cancel(params, (RequestOptions) null); - } - - /** - * A VerificationSession object can be canceled when it is in requires_input status. - * - *

Once canceled, future submission attempts are disabled. This cannot be undone. Learn more. - */ - public VerificationSession cancel(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/identity/verification_sessions/%s/cancel", - ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, VerificationSession.class, options); - } - - /** - * A VerificationSession object can be canceled when it is in requires_input status. - * - *

Once canceled, future submission attempts are disabled. This cannot be undone. Learn more. - */ - public VerificationSession cancel(VerificationSessionCancelParams params) throws StripeException { - return cancel(params, (RequestOptions) null); - } - - /** - * A VerificationSession object can be canceled when it is in requires_input status. - * - *

Once canceled, future submission attempts are disabled. This cannot be undone. Learn more. - */ - public VerificationSession cancel(VerificationSessionCancelParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/identity/verification_sessions/%s/cancel", - ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, VerificationSession.class, options); - } - /** * Redact a VerificationSession to remove all collected information from Stripe. This will redact * the VerificationSession and all objects related to it, including VerificationReports, Events, @@ -565,6 +521,64 @@ public VerificationSession redact(VerificationSessionRedactParams params, Reques ApiResource.RequestMethod.POST, url, params, VerificationSession.class, options); } + /** + * Retrieves the details of a VerificationSession that was previously created. + * + *

When the session status is requires_input, you can use this method to retrieve + * a valid client_secret or url to allow re-submission. + */ + public static VerificationSession retrieve(String session) throws StripeException { + return retrieve(session, (Map) null, (RequestOptions) null); + } + + /** + * Retrieves the details of a VerificationSession that was previously created. + * + *

When the session status is requires_input, you can use this method to retrieve + * a valid client_secret or url to allow re-submission. + */ + public static VerificationSession retrieve(String session, RequestOptions options) + throws StripeException { + return retrieve(session, (Map) null, options); + } + + /** + * Retrieves the details of a VerificationSession that was previously created. + * + *

When the session status is requires_input, you can use this method to retrieve + * a valid client_secret or url to allow re-submission. + */ + public static VerificationSession retrieve( + String session, Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/identity/verification_sessions/%s", ApiResource.urlEncodeId(session))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, VerificationSession.class, options); + } + + /** + * Retrieves the details of a VerificationSession that was previously created. + * + *

When the session status is requires_input, you can use this method to retrieve + * a valid client_secret or url to allow re-submission. + */ + public static VerificationSession retrieve( + String session, VerificationSessionRetrieveParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/identity/verification_sessions/%s", ApiResource.urlEncodeId(session))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, VerificationSession.class, options); + } + /** * Updates a VerificationSession object. * @@ -623,6 +637,7 @@ public VerificationSession update(VerificationSessionUpdateParams params, Reques ApiResource.RequestMethod.POST, url, params, VerificationSession.class, options); } + /** Shows last VerificationSession error. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -744,6 +759,7 @@ public static class VerifiedOutputs extends StripeObject { @SerializedName("last_name") String lastName; + /** Point in Time. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/issuing/Authorization.java b/src/main/java/com/stripe/model/issuing/Authorization.java index 12a54ac1ccb..cd11bfc661f 100644 --- a/src/main/java/com/stripe/model/issuing/Authorization.java +++ b/src/main/java/com/stripe/model/issuing/Authorization.java @@ -22,6 +22,15 @@ import lombok.Getter; import lombok.Setter; +/** + * When an issued card is used to make a purchase, an + * Issuing {@code Authorization} object is created. Authorizations must be + * approved for the purchase to be completed successfully. + * + *

Related guide: Issued Card + * Authorizations. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -198,128 +207,6 @@ public void setCardholderObject(Cardholder expandableObject) { this.cardholder = new ExpandableField(expandableObject.getId(), expandableObject); } - /** - * Returns a list of Issuing Authorization objects. The objects are sorted in - * descending order by creation date, with the most recently created object appearing first. - */ - public static AuthorizationCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** - * Returns a list of Issuing Authorization objects. The objects are sorted in - * descending order by creation date, with the most recently created object appearing first. - */ - public static AuthorizationCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/authorizations"); - return ApiResource.requestCollection(url, params, AuthorizationCollection.class, options); - } - - /** - * Returns a list of Issuing Authorization objects. The objects are sorted in - * descending order by creation date, with the most recently created object appearing first. - */ - public static AuthorizationCollection list(AuthorizationListParams params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** - * Returns a list of Issuing Authorization objects. The objects are sorted in - * descending order by creation date, with the most recently created object appearing first. - */ - public static AuthorizationCollection list(AuthorizationListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/authorizations"); - return ApiResource.requestCollection(url, params, AuthorizationCollection.class, options); - } - - /** Retrieves an Issuing Authorization object. */ - public static Authorization retrieve(String authorization) throws StripeException { - return retrieve(authorization, (Map) null, (RequestOptions) null); - } - - /** Retrieves an Issuing Authorization object. */ - public static Authorization retrieve(String authorization, RequestOptions options) - throws StripeException { - return retrieve(authorization, (Map) null, options); - } - - /** Retrieves an Issuing Authorization object. */ - public static Authorization retrieve( - String authorization, Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/issuing/authorizations/%s", ApiResource.urlEncodeId(authorization))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, Authorization.class, options); - } - - /** Retrieves an Issuing Authorization object. */ - public static Authorization retrieve( - String authorization, AuthorizationRetrieveParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/issuing/authorizations/%s", ApiResource.urlEncodeId(authorization))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, Authorization.class, options); - } - - /** - * Updates the specified Issuing Authorization object by setting the values of the - * parameters passed. Any parameters not provided will be left unchanged. - */ - @Override - public Authorization update(Map params) throws StripeException { - return update(params, (RequestOptions) null); - } - - /** - * Updates the specified Issuing Authorization object by setting the values of the - * parameters passed. Any parameters not provided will be left unchanged. - */ - @Override - public Authorization update(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/issuing/authorizations/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, Authorization.class, options); - } - - /** - * Updates the specified Issuing Authorization object by setting the values of the - * parameters passed. Any parameters not provided will be left unchanged. - */ - public Authorization update(AuthorizationUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); - } - - /** - * Updates the specified Issuing Authorization object by setting the values of the - * parameters passed. Any parameters not provided will be left unchanged. - */ - public Authorization update(AuthorizationUpdateParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/issuing/authorizations/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, Authorization.class, options); - } - /** * Approves a pending Issuing Authorization object. This request should be made * within the timeout window of the Authorization objects. The objects are sorted in + * descending order by creation date, with the most recently created object appearing first. + */ + public static AuthorizationCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** + * Returns a list of Issuing Authorization objects. The objects are sorted in + * descending order by creation date, with the most recently created object appearing first. + */ + public static AuthorizationCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/authorizations"); + return ApiResource.requestCollection(url, params, AuthorizationCollection.class, options); + } + + /** + * Returns a list of Issuing Authorization objects. The objects are sorted in + * descending order by creation date, with the most recently created object appearing first. + */ + public static AuthorizationCollection list(AuthorizationListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** + * Returns a list of Issuing Authorization objects. The objects are sorted in + * descending order by creation date, with the most recently created object appearing first. + */ + public static AuthorizationCollection list(AuthorizationListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/authorizations"); + return ApiResource.requestCollection(url, params, AuthorizationCollection.class, options); + } + + /** Retrieves an Issuing Authorization object. */ + public static Authorization retrieve(String authorization) throws StripeException { + return retrieve(authorization, (Map) null, (RequestOptions) null); + } + + /** Retrieves an Issuing Authorization object. */ + public static Authorization retrieve(String authorization, RequestOptions options) + throws StripeException { + return retrieve(authorization, (Map) null, options); + } + + /** Retrieves an Issuing Authorization object. */ + public static Authorization retrieve( + String authorization, Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/issuing/authorizations/%s", ApiResource.urlEncodeId(authorization))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, Authorization.class, options); + } + + /** Retrieves an Issuing Authorization object. */ + public static Authorization retrieve( + String authorization, AuthorizationRetrieveParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/issuing/authorizations/%s", ApiResource.urlEncodeId(authorization))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, Authorization.class, options); + } + + /** + * Updates the specified Issuing Authorization object by setting the values of the + * parameters passed. Any parameters not provided will be left unchanged. + */ + @Override + public Authorization update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Updates the specified Issuing Authorization object by setting the values of the + * parameters passed. Any parameters not provided will be left unchanged. + */ + @Override + public Authorization update(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/issuing/authorizations/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, Authorization.class, options); + } + + /** + * Updates the specified Issuing Authorization object by setting the values of the + * parameters passed. Any parameters not provided will be left unchanged. + */ + public Authorization update(AuthorizationUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Updates the specified Issuing Authorization object by setting the values of the + * parameters passed. Any parameters not provided will be left unchanged. + */ + public Authorization update(AuthorizationUpdateParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/issuing/authorizations/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, Authorization.class, options); + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/issuing/Card.java b/src/main/java/com/stripe/model/issuing/Card.java index c7a76185fbf..935b15f7579 100644 --- a/src/main/java/com/stripe/model/issuing/Card.java +++ b/src/main/java/com/stripe/model/issuing/Card.java @@ -25,6 +25,10 @@ import lombok.Getter; import lombok.Setter; +/** + * You can create physical or virtual cards that + * are issued to cardholders. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -213,6 +217,30 @@ public void setReplacementForObject(Card expandableObject) { this.replacementFor = new ExpandableField(expandableObject.getId(), expandableObject); } + /** Creates an Issuing Card object. */ + public static Card create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates an Issuing Card object. */ + public static Card create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/cards"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Card.class, options); + } + + /** Creates an Issuing Card object. */ + public static Card create(CardCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates an Issuing Card object. */ + public static Card create(CardCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/cards"); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Card.class, options); + } + /** * Returns a list of Issuing Card objects. The objects are sorted in descending order * by creation date, with the most recently created object appearing first. @@ -249,30 +277,6 @@ public static CardCollection list(CardListParams params, RequestOptions options) return ApiResource.requestCollection(url, params, CardCollection.class, options); } - /** Creates an Issuing Card object. */ - public static Card create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates an Issuing Card object. */ - public static Card create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/cards"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Card.class, options); - } - - /** Creates an Issuing Card object. */ - public static Card create(CardCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates an Issuing Card object. */ - public static Card create(CardCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/cards"); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Card.class, options); - } - /** Retrieves an Issuing Card object. */ public static Card retrieve(String card) throws StripeException { return retrieve(card, (Map) null, (RequestOptions) null); diff --git a/src/main/java/com/stripe/model/issuing/Cardholder.java b/src/main/java/com/stripe/model/issuing/Cardholder.java index e85eec9163b..2cab791bbc1 100644 --- a/src/main/java/com/stripe/model/issuing/Cardholder.java +++ b/src/main/java/com/stripe/model/issuing/Cardholder.java @@ -22,6 +22,13 @@ import lombok.Getter; import lombok.Setter; +/** + * An Issuing {@code Cardholder} object represents an individual or business entity who is issued cards. + * + *

Related guide: How to create + * a Cardholder + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -109,6 +116,32 @@ public class Cardholder extends ApiResource implements HasId, MetadataStoreCardholder object that can be issued cards. */ + public static Cardholder create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new Issuing Cardholder object that can be issued cards. */ + public static Cardholder create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/cardholders"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, Cardholder.class, options); + } + + /** Creates a new Issuing Cardholder object that can be issued cards. */ + public static Cardholder create(CardholderCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new Issuing Cardholder object that can be issued cards. */ + public static Cardholder create(CardholderCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/cardholders"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, Cardholder.class, options); + } + /** * Returns a list of Issuing Cardholder objects. The objects are sorted in descending * order by creation date, with the most recently created object appearing first. @@ -145,32 +178,6 @@ public static CardholderCollection list(CardholderListParams params, RequestOpti return ApiResource.requestCollection(url, params, CardholderCollection.class, options); } - /** Creates a new Issuing Cardholder object that can be issued cards. */ - public static Cardholder create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new Issuing Cardholder object that can be issued cards. */ - public static Cardholder create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/cardholders"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, Cardholder.class, options); - } - - /** Creates a new Issuing Cardholder object that can be issued cards. */ - public static Cardholder create(CardholderCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new Issuing Cardholder object that can be issued cards. */ - public static Cardholder create(CardholderCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/cardholders"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, Cardholder.class, options); - } - /** Retrieves an Issuing Cardholder object. */ public static Cardholder retrieve(String cardholder) throws StripeException { return retrieve(cardholder, (Map) null, (RequestOptions) null); diff --git a/src/main/java/com/stripe/model/issuing/Dispute.java b/src/main/java/com/stripe/model/issuing/Dispute.java index c71716bb0bb..a019b3e01b9 100644 --- a/src/main/java/com/stripe/model/issuing/Dispute.java +++ b/src/main/java/com/stripe/model/issuing/Dispute.java @@ -23,6 +23,13 @@ import lombok.Getter; import lombok.Setter; +/** + * As a card issuer, you can dispute transactions that + * the cardholder does not recognize, suspects to be fraudulent, or has other issues with. + * + *

Related guide: Disputing + * Transactions + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -120,42 +127,6 @@ public void setTransactionObject(Transaction expandableObject) { this.transaction = new ExpandableField(expandableObject.getId(), expandableObject); } - /** - * Returns a list of Issuing Dispute objects. The objects are sorted in descending - * order by creation date, with the most recently created object appearing first. - */ - public static DisputeCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** - * Returns a list of Issuing Dispute objects. The objects are sorted in descending - * order by creation date, with the most recently created object appearing first. - */ - public static DisputeCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/disputes"); - return ApiResource.requestCollection(url, params, DisputeCollection.class, options); - } - - /** - * Returns a list of Issuing Dispute objects. The objects are sorted in descending - * order by creation date, with the most recently created object appearing first. - */ - public static DisputeCollection list(DisputeListParams params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** - * Returns a list of Issuing Dispute objects. The objects are sorted in descending - * order by creation date, with the most recently created object appearing first. - */ - public static DisputeCollection list(DisputeListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/disputes"); - return ApiResource.requestCollection(url, params, DisputeCollection.class, options); - } - /** * Creates an Issuing Dispute object. Individual pieces of evidence within the * evidence object are optional at this point. Stripe only validates that required evidence @@ -205,51 +176,39 @@ public static Dispute create(DisputeCreateParams params, RequestOptions options) } /** - * Updates the specified Issuing Dispute object by setting the values of the - * parameters passed. Any parameters not provided will be left unchanged. Properties on the - * evidence object can be unset by passing in an empty string. + * Returns a list of Issuing Dispute objects. The objects are sorted in descending + * order by creation date, with the most recently created object appearing first. */ - @Override - public Dispute update(Map params) throws StripeException { - return update(params, (RequestOptions) null); + public static DisputeCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); } /** - * Updates the specified Issuing Dispute object by setting the values of the - * parameters passed. Any parameters not provided will be left unchanged. Properties on the - * evidence object can be unset by passing in an empty string. + * Returns a list of Issuing Dispute objects. The objects are sorted in descending + * order by creation date, with the most recently created object appearing first. */ - @Override - public Dispute update(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/issuing/disputes/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Dispute.class, options); + public static DisputeCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/disputes"); + return ApiResource.requestCollection(url, params, DisputeCollection.class, options); } /** - * Updates the specified Issuing Dispute object by setting the values of the - * parameters passed. Any parameters not provided will be left unchanged. Properties on the - * evidence object can be unset by passing in an empty string. + * Returns a list of Issuing Dispute objects. The objects are sorted in descending + * order by creation date, with the most recently created object appearing first. */ - public Dispute update(DisputeUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + public static DisputeCollection list(DisputeListParams params) throws StripeException { + return list(params, (RequestOptions) null); } /** - * Updates the specified Issuing Dispute object by setting the values of the - * parameters passed. Any parameters not provided will be left unchanged. Properties on the - * evidence object can be unset by passing in an empty string. + * Returns a list of Issuing Dispute objects. The objects are sorted in descending + * order by creation date, with the most recently created object appearing first. */ - public Dispute update(DisputeUpdateParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/issuing/disputes/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Dispute.class, options); + public static DisputeCollection list(DisputeListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/issuing/disputes"); + return ApiResource.requestCollection(url, params, DisputeCollection.class, options); } /** Retrieves an Issuing Dispute object. */ @@ -354,6 +313,54 @@ public Dispute submit(DisputeSubmitParams params, RequestOptions options) throws return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Dispute.class, options); } + /** + * Updates the specified Issuing Dispute object by setting the values of the + * parameters passed. Any parameters not provided will be left unchanged. Properties on the + * evidence object can be unset by passing in an empty string. + */ + @Override + public Dispute update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Updates the specified Issuing Dispute object by setting the values of the + * parameters passed. Any parameters not provided will be left unchanged. Properties on the + * evidence object can be unset by passing in an empty string. + */ + @Override + public Dispute update(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/issuing/disputes/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Dispute.class, options); + } + + /** + * Updates the specified Issuing Dispute object by setting the values of the + * parameters passed. Any parameters not provided will be left unchanged. Properties on the + * evidence object can be unset by passing in an empty string. + */ + public Dispute update(DisputeUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Updates the specified Issuing Dispute object by setting the values of the + * parameters passed. Any parameters not provided will be left unchanged. Properties on the + * evidence object can be unset by passing in an empty string. + */ + public Dispute update(DisputeUpdateParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/issuing/disputes/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Dispute.class, options); + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -434,10 +441,6 @@ public static class Canceled extends StripeObject { @SerializedName("product_type") String productType; - /** Date when the product was returned or attempted to be returned. */ - @SerializedName("returned_at") - Long returnedAt; - /** * Result of cardholder's attempt to return the product. * @@ -446,6 +449,10 @@ public static class Canceled extends StripeObject { @SerializedName("return_status") String returnStatus; + /** Date when the product was returned or attempted to be returned. */ + @SerializedName("returned_at") + Long returnedAt; + /** Get ID of expandable {@code additionalDocumentation} object. */ public String getAdditionalDocumentation() { return (this.additionalDocumentation != null) ? this.additionalDocumentation.getId() : null; @@ -662,10 +669,6 @@ public static class MerchandiseNotAsDescribed extends StripeObject { @SerializedName("return_description") String returnDescription; - /** Date when the product was returned or attempted to be returned. */ - @SerializedName("returned_at") - Long returnedAt; - /** * Result of cardholder's attempt to return the product. * @@ -674,6 +677,10 @@ public static class MerchandiseNotAsDescribed extends StripeObject { @SerializedName("return_status") String returnStatus; + /** Date when the product was returned or attempted to be returned. */ + @SerializedName("returned_at") + Long returnedAt; + /** Get ID of expandable {@code additionalDocumentation} object. */ public String getAdditionalDocumentation() { return (this.additionalDocumentation != null) ? this.additionalDocumentation.getId() : null; diff --git a/src/main/java/com/stripe/model/issuing/Transaction.java b/src/main/java/com/stripe/model/issuing/Transaction.java index 52c093dd61e..dc01c80b366 100644 --- a/src/main/java/com/stripe/model/issuing/Transaction.java +++ b/src/main/java/com/stripe/model/issuing/Transaction.java @@ -21,6 +21,14 @@ import lombok.Getter; import lombok.Setter; +/** + * Any use of an issued card that results in funds + * entering or leaving your Stripe account, such as a completed purchase or refund, is represented + * by an Issuing {@code Transaction} object. + * + *

Related guide: Issued Card + * Transactions. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/radar/EarlyFraudWarning.java b/src/main/java/com/stripe/model/radar/EarlyFraudWarning.java index 25b065670d6..5eefbfffcbe 100644 --- a/src/main/java/com/stripe/model/radar/EarlyFraudWarning.java +++ b/src/main/java/com/stripe/model/radar/EarlyFraudWarning.java @@ -17,6 +17,13 @@ import lombok.Getter; import lombok.Setter; +/** + * An early fraud warning indicates that the card issuer has notified us that a charge may be + * fraudulent. + * + *

Related guide: Early + * Fraud Warnings. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/radar/ValueList.java b/src/main/java/com/stripe/model/radar/ValueList.java index 00201efb761..8d76426d4d3 100644 --- a/src/main/java/com/stripe/model/radar/ValueList.java +++ b/src/main/java/com/stripe/model/radar/ValueList.java @@ -17,6 +17,12 @@ import lombok.Getter; import lombok.Setter; +/** + * Value lists allow you to group values together which can then be referenced in rules. + * + *

Related guide: Default + * Stripe Lists. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -82,6 +88,71 @@ public class ValueList extends ApiResource implements HasId, MetadataStoreValueList object, which can then be referenced in rules. */ + public static ValueList create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new ValueList object, which can then be referenced in rules. */ + public static ValueList create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/radar/value_lists"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, ValueList.class, options); + } + + /** Creates a new ValueList object, which can then be referenced in rules. */ + public static ValueList create(ValueListCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a new ValueList object, which can then be referenced in rules. */ + public static ValueList create(ValueListCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/radar/value_lists"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, ValueList.class, options); + } + + /** + * Deletes a ValueList object, also deleting any items contained within the value + * list. To be deleted, a value list must not be referenced in any rules. + */ + public ValueList delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); + } + + /** + * Deletes a ValueList object, also deleting any items contained within the value + * list. To be deleted, a value list must not be referenced in any rules. + */ + public ValueList delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); + } + + /** + * Deletes a ValueList object, also deleting any items contained within the value + * list. To be deleted, a value list must not be referenced in any rules. + */ + public ValueList delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); + } + + /** + * Deletes a ValueList object, also deleting any items contained within the value + * list. To be deleted, a value list must not be referenced in any rules. + */ + public ValueList delete(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/radar/value_lists/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, ValueList.class, options); + } + /** * Returns a list of ValueList objects. The objects are sorted in descending order by * creation date, with the most recently created object appearing first. @@ -154,32 +225,6 @@ public static ValueList retrieve( ApiResource.RequestMethod.GET, url, params, ValueList.class, options); } - /** Creates a new ValueList object, which can then be referenced in rules. */ - public static ValueList create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new ValueList object, which can then be referenced in rules. */ - public static ValueList create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/radar/value_lists"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, ValueList.class, options); - } - - /** Creates a new ValueList object, which can then be referenced in rules. */ - public static ValueList create(ValueListCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Creates a new ValueList object, which can then be referenced in rules. */ - public static ValueList create(ValueListCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/radar/value_lists"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, ValueList.class, options); - } - /** * Updates a ValueList object by setting the values of the parameters passed. Any * parameters not provided will be left unchanged. Note that item_type is immutable. @@ -227,43 +272,4 @@ public ValueList update(ValueListUpdateParams params, RequestOptions options) return ApiResource.request( ApiResource.RequestMethod.POST, url, params, ValueList.class, options); } - - /** - * Deletes a ValueList object, also deleting any items contained within the value - * list. To be deleted, a value list must not be referenced in any rules. - */ - public ValueList delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); - } - - /** - * Deletes a ValueList object, also deleting any items contained within the value - * list. To be deleted, a value list must not be referenced in any rules. - */ - public ValueList delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); - } - - /** - * Deletes a ValueList object, also deleting any items contained within the value - * list. To be deleted, a value list must not be referenced in any rules. - */ - public ValueList delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** - * Deletes a ValueList object, also deleting any items contained within the value - * list. To be deleted, a value list must not be referenced in any rules. - */ - public ValueList delete(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/radar/value_lists/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, ValueList.class, options); - } } diff --git a/src/main/java/com/stripe/model/radar/ValueListItem.java b/src/main/java/com/stripe/model/radar/ValueListItem.java index 63b553f1801..c963abb40a4 100644 --- a/src/main/java/com/stripe/model/radar/ValueListItem.java +++ b/src/main/java/com/stripe/model/radar/ValueListItem.java @@ -15,6 +15,13 @@ import lombok.Getter; import lombok.Setter; +/** + * Value list items allow you to add specific values to a given Radar value list, which can then be + * used in rules. + * + *

Related guide: Managing List + * Items. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -59,6 +66,71 @@ public class ValueListItem extends ApiResource implements HasId { @SerializedName("value_list") String valueList; + /** + * Creates a new ValueListItem object, which is added to the specified parent value + * list. + */ + public static ValueListItem create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * Creates a new ValueListItem object, which is added to the specified parent value + * list. + */ + public static ValueListItem create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/radar/value_list_items"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, ValueListItem.class, options); + } + + /** + * Creates a new ValueListItem object, which is added to the specified parent value + * list. + */ + public static ValueListItem create(ValueListItemCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * Creates a new ValueListItem object, which is added to the specified parent value + * list. + */ + public static ValueListItem create(ValueListItemCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/radar/value_list_items"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, ValueListItem.class, options); + } + + /** Deletes a ValueListItem object, removing it from its parent value list. */ + public ValueListItem delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); + } + + /** Deletes a ValueListItem object, removing it from its parent value list. */ + public ValueListItem delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); + } + + /** Deletes a ValueListItem object, removing it from its parent value list. */ + public ValueListItem delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); + } + + /** Deletes a ValueListItem object, removing it from its parent value list. */ + public ValueListItem delete(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/radar/value_list_items/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, ValueListItem.class, options); + } + /** * Returns a list of ValueListItem objects. The objects are sorted in descending * order by creation date, with the most recently created object appearing first. @@ -130,69 +202,4 @@ public static ValueListItem retrieve( return ApiResource.request( ApiResource.RequestMethod.GET, url, params, ValueListItem.class, options); } - - /** - * Creates a new ValueListItem object, which is added to the specified parent value - * list. - */ - public static ValueListItem create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * Creates a new ValueListItem object, which is added to the specified parent value - * list. - */ - public static ValueListItem create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/radar/value_list_items"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, ValueListItem.class, options); - } - - /** - * Creates a new ValueListItem object, which is added to the specified parent value - * list. - */ - public static ValueListItem create(ValueListItemCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** - * Creates a new ValueListItem object, which is added to the specified parent value - * list. - */ - public static ValueListItem create(ValueListItemCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/radar/value_list_items"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, ValueListItem.class, options); - } - - /** Deletes a ValueListItem object, removing it from its parent value list. */ - public ValueListItem delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); - } - - /** Deletes a ValueListItem object, removing it from its parent value list. */ - public ValueListItem delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); - } - - /** Deletes a ValueListItem object, removing it from its parent value list. */ - public ValueListItem delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** Deletes a ValueListItem object, removing it from its parent value list. */ - public ValueListItem delete(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/radar/value_list_items/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, ValueListItem.class, options); - } } diff --git a/src/main/java/com/stripe/model/reporting/ReportRun.java b/src/main/java/com/stripe/model/reporting/ReportRun.java index f6235a838f9..d66c9cacc7d 100644 --- a/src/main/java/com/stripe/model/reporting/ReportRun.java +++ b/src/main/java/com/stripe/model/reporting/ReportRun.java @@ -18,6 +18,17 @@ import lombok.Getter; import lombok.Setter; +/** + * The Report Run object represents an instance of a report type generated with specific run + * parameters. Once the object is created, Stripe begins processing the report. When the report has + * finished running, it will give you a reference to a file where you can retrieve your results. For + * an overview, see API Access to + * Reports. + * + *

Note that certain report types can only be run based on your live-mode data (not test-mode + * data), and will error when queried without a live-mode API key. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -86,42 +97,6 @@ public class ReportRun extends ApiResource implements HasId { @SerializedName("succeeded_at") Long succeededAt; - /** Retrieves the details of an existing Report Run. */ - public static ReportRun retrieve(String reportRun) throws StripeException { - return retrieve(reportRun, (Map) null, (RequestOptions) null); - } - - /** Retrieves the details of an existing Report Run. */ - public static ReportRun retrieve(String reportRun, RequestOptions options) - throws StripeException { - return retrieve(reportRun, (Map) null, options); - } - - /** Retrieves the details of an existing Report Run. */ - public static ReportRun retrieve( - String reportRun, Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/reporting/report_runs/%s", ApiResource.urlEncodeId(reportRun))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, ReportRun.class, options); - } - - /** Retrieves the details of an existing Report Run. */ - public static ReportRun retrieve( - String reportRun, ReportRunRetrieveParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/reporting/report_runs/%s", ApiResource.urlEncodeId(reportRun))); - return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, ReportRun.class, options); - } - /** * Creates a new object and begin running the report. (Certain report types require a live-mode API key.) @@ -184,6 +159,42 @@ public static ReportRunCollection list(ReportRunListParams params, RequestOption return ApiResource.requestCollection(url, params, ReportRunCollection.class, options); } + /** Retrieves the details of an existing Report Run. */ + public static ReportRun retrieve(String reportRun) throws StripeException { + return retrieve(reportRun, (Map) null, (RequestOptions) null); + } + + /** Retrieves the details of an existing Report Run. */ + public static ReportRun retrieve(String reportRun, RequestOptions options) + throws StripeException { + return retrieve(reportRun, (Map) null, options); + } + + /** Retrieves the details of an existing Report Run. */ + public static ReportRun retrieve( + String reportRun, Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/reporting/report_runs/%s", ApiResource.urlEncodeId(reportRun))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, ReportRun.class, options); + } + + /** Retrieves the details of an existing Report Run. */ + public static ReportRun retrieve( + String reportRun, ReportRunRetrieveParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/reporting/report_runs/%s", ApiResource.urlEncodeId(reportRun))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, ReportRun.class, options); + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/reporting/ReportType.java b/src/main/java/com/stripe/model/reporting/ReportType.java index 93a52351032..b2fd1e69486 100644 --- a/src/main/java/com/stripe/model/reporting/ReportType.java +++ b/src/main/java/com/stripe/model/reporting/ReportType.java @@ -15,6 +15,17 @@ import lombok.Getter; import lombok.Setter; +/** + * The Report Type resource corresponds to a particular type of report, such as the "Activity + * summary" or "Itemized payouts" reports. These objects are identified by an ID + * belonging to a set of enumerated values. See API Access to Reports documentation + * for those Report Type IDs, along with required and optional parameters. + * + *

Note that certain report types can only be run based on your live-mode data (not test-mode + * data), and will error when queried without a live-mode API key. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -78,6 +89,30 @@ public class ReportType extends ApiResource implements HasId { @SerializedName("version") Long version; + /** Returns a full list of Report Types. */ + public static ReportTypeCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a full list of Report Types. */ + public static ReportTypeCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/reporting/report_types"); + return ApiResource.requestCollection(url, params, ReportTypeCollection.class, options); + } + + /** Returns a full list of Report Types. */ + public static ReportTypeCollection list(ReportTypeListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a full list of Report Types. */ + public static ReportTypeCollection list(ReportTypeListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/reporting/report_types"); + return ApiResource.requestCollection(url, params, ReportTypeCollection.class, options); + } + /** * Retrieves the details of a Report Type. (Certain report types require a live-mode API key.) @@ -126,28 +161,4 @@ public static ReportType retrieve( return ApiResource.request( ApiResource.RequestMethod.GET, url, params, ReportType.class, options); } - - /** Returns a full list of Report Types. */ - public static ReportTypeCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a full list of Report Types. */ - public static ReportTypeCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/reporting/report_types"); - return ApiResource.requestCollection(url, params, ReportTypeCollection.class, options); - } - - /** Returns a full list of Report Types. */ - public static ReportTypeCollection list(ReportTypeListParams params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a full list of Report Types. */ - public static ReportTypeCollection list(ReportTypeListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/reporting/report_types"); - return ApiResource.requestCollection(url, params, ReportTypeCollection.class, options); - } } diff --git a/src/main/java/com/stripe/model/sigma/ScheduledQueryRun.java b/src/main/java/com/stripe/model/sigma/ScheduledQueryRun.java index b1913a573a9..394bc8c5769 100644 --- a/src/main/java/com/stripe/model/sigma/ScheduledQueryRun.java +++ b/src/main/java/com/stripe/model/sigma/ScheduledQueryRun.java @@ -16,6 +16,12 @@ import lombok.Getter; import lombok.Setter; +/** + * If you have scheduled a Sigma + * query, you'll receive a {@code sigma.scheduled_query_run.created} webhook each time the query + * runs. The webhook contains a {@code ScheduledQueryRun} object, which you can use to retrieve the + * query results. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/terminal/Configuration.java b/src/main/java/com/stripe/model/terminal/Configuration.java index 4946adc7a23..3b77805622e 100644 --- a/src/main/java/com/stripe/model/terminal/Configuration.java +++ b/src/main/java/com/stripe/model/terminal/Configuration.java @@ -20,6 +20,7 @@ import lombok.Getter; import lombok.Setter; +/** A Configurations object represents how features should be configured for terminal readers. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -87,6 +88,33 @@ public static Configuration create(ConfigurationCreateParams params, RequestOpti ApiResource.RequestMethod.POST, url, params, Configuration.class, options); } + /** Deletes a Configuration object. */ + public Configuration delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); + } + + /** Deletes a Configuration object. */ + public Configuration delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); + } + + /** Deletes a Configuration object. */ + public Configuration delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); + } + + /** Deletes a Configuration object. */ + public Configuration delete(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/terminal/configurations/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.DELETE, url, params, Configuration.class, options); + } + /** Returns a list of Configuration objects. */ public static ConfigurationCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); @@ -185,33 +213,6 @@ public Configuration update(ConfigurationUpdateParams params, RequestOptions opt ApiResource.RequestMethod.POST, url, params, Configuration.class, options); } - /** Deletes a Configuration object. */ - public Configuration delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); - } - - /** Deletes a Configuration object. */ - public Configuration delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); - } - - /** Deletes a Configuration object. */ - public Configuration delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); - } - - /** Deletes a Configuration object. */ - public Configuration delete(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/terminal/configurations/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, Configuration.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/terminal/ConnectionToken.java b/src/main/java/com/stripe/model/terminal/ConnectionToken.java index 6e7c165d7c9..c9079dae37e 100644 --- a/src/main/java/com/stripe/model/terminal/ConnectionToken.java +++ b/src/main/java/com/stripe/model/terminal/ConnectionToken.java @@ -12,6 +12,12 @@ import lombok.Getter; import lombok.Setter; +/** + * A Connection Token is used by the Stripe Terminal SDK to connect to a reader. + * + *

Related guide: Fleet + * Management. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/terminal/Location.java b/src/main/java/com/stripe/model/terminal/Location.java index 04b37342dec..a1a362d96b2 100644 --- a/src/main/java/com/stripe/model/terminal/Location.java +++ b/src/main/java/com/stripe/model/terminal/Location.java @@ -18,6 +18,12 @@ import lombok.Getter; import lombok.Setter; +/** + * A Location represents a grouping of readers. + * + *

Related guide: Fleet + * Management. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -66,39 +72,6 @@ public class Location extends ApiResource implements HasId, MetadataStoreLocation object. */ - public static Location retrieve(String location) throws StripeException { - return retrieve(location, (Map) null, (RequestOptions) null); - } - - /** Retrieves a Location object. */ - public static Location retrieve(String location, RequestOptions options) throws StripeException { - return retrieve(location, (Map) null, options); - } - - /** Retrieves a Location object. */ - public static Location retrieve( - String location, Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/terminal/locations/%s", ApiResource.urlEncodeId(location))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Location.class, options); - } - - /** Retrieves a Location object. */ - public static Location retrieve( - String location, LocationRetrieveParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/terminal/locations/%s", ApiResource.urlEncodeId(location))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Location.class, options); - } - /** * Creates a new Location object. For further details, including which address fields * are required in each country, see the Location object by setting the values of the parameters passed. Any - * parameters not provided will be left unchanged. - */ - @Override - public Location update(Map params) throws StripeException { - return update(params, (RequestOptions) null); + /** Deletes a Location object. */ + public Location delete() throws StripeException { + return delete((Map) null, (RequestOptions) null); } - /** - * Updates a Location object by setting the values of the parameters passed. Any - * parameters not provided will be left unchanged. - */ - @Override - public Location update(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/terminal/locations/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, Location.class, options); + /** Deletes a Location object. */ + public Location delete(RequestOptions options) throws StripeException { + return delete((Map) null, options); } - /** - * Updates a Location object by setting the values of the parameters passed. Any - * parameters not provided will be left unchanged. - */ - public Location update(LocationUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + /** Deletes a Location object. */ + public Location delete(Map params) throws StripeException { + return delete(params, (RequestOptions) null); } - /** - * Updates a Location object by setting the values of the parameters passed. Any - * parameters not provided will be left unchanged. - */ - public Location update(LocationUpdateParams params, RequestOptions options) + /** Deletes a Location object. */ + public Location delete(Map params, RequestOptions options) throws StripeException { String url = String.format( @@ -186,7 +138,7 @@ public Location update(LocationUpdateParams params, RequestOptions options) Stripe.getApiBase(), String.format("/v1/terminal/locations/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, Location.class, options); + ApiResource.RequestMethod.DELETE, url, params, Location.class, options); } /** Returns a list of Location objects. */ @@ -213,23 +165,54 @@ public static LocationCollection list(LocationListParams params, RequestOptions return ApiResource.requestCollection(url, params, LocationCollection.class, options); } - /** Deletes a Location object. */ - public Location delete() throws StripeException { - return delete((Map) null, (RequestOptions) null); + /** Retrieves a Location object. */ + public static Location retrieve(String location) throws StripeException { + return retrieve(location, (Map) null, (RequestOptions) null); } - /** Deletes a Location object. */ - public Location delete(RequestOptions options) throws StripeException { - return delete((Map) null, options); + /** Retrieves a Location object. */ + public static Location retrieve(String location, RequestOptions options) throws StripeException { + return retrieve(location, (Map) null, options); } - /** Deletes a Location object. */ - public Location delete(Map params) throws StripeException { - return delete(params, (RequestOptions) null); + /** Retrieves a Location object. */ + public static Location retrieve( + String location, Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/terminal/locations/%s", ApiResource.urlEncodeId(location))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Location.class, options); } - /** Deletes a Location object. */ - public Location delete(Map params, RequestOptions options) + /** Retrieves a Location object. */ + public static Location retrieve( + String location, LocationRetrieveParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/terminal/locations/%s", ApiResource.urlEncodeId(location))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Location.class, options); + } + + /** + * Updates a Location object by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + */ + @Override + public Location update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Updates a Location object by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + */ + @Override + public Location update(Map params, RequestOptions options) throws StripeException { String url = String.format( @@ -237,6 +220,29 @@ public Location delete(Map params, RequestOptions options) Stripe.getApiBase(), String.format("/v1/terminal/locations/%s", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.DELETE, url, params, Location.class, options); + ApiResource.RequestMethod.POST, url, params, Location.class, options); + } + + /** + * Updates a Location object by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + */ + public Location update(LocationUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Updates a Location object by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + */ + public Location update(LocationUpdateParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/terminal/locations/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, Location.class, options); } } diff --git a/src/main/java/com/stripe/model/terminal/Reader.java b/src/main/java/com/stripe/model/terminal/Reader.java index d7cd325fcd1..8965cac551b 100644 --- a/src/main/java/com/stripe/model/terminal/Reader.java +++ b/src/main/java/com/stripe/model/terminal/Reader.java @@ -27,6 +27,12 @@ import lombok.Getter; import lombok.Setter; +/** + * A Reader represents a physical device for accepting payment details. + * + *

Related guide: Connecting + * to a Reader. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -119,80 +125,48 @@ public void setLocationObject(Location expandableObject) { this.location = new ExpandableField(expandableObject.getId(), expandableObject); } - /** - * Updates a Reader object by setting the values of the parameters passed. Any - * parameters not provided will be left unchanged. - */ - @Override - public Reader update(Map params) throws StripeException { - return update(params, (RequestOptions) null); + /** Cancels the current reader action. */ + public Reader cancelAction() throws StripeException { + return cancelAction((Map) null, (RequestOptions) null); } - /** - * Updates a Reader object by setting the values of the parameters passed. Any - * parameters not provided will be left unchanged. - */ - @Override - public Reader update(Map params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/terminal/readers/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Reader.class, options); + /** Cancels the current reader action. */ + public Reader cancelAction(RequestOptions options) throws StripeException { + return cancelAction((Map) null, options); } - /** - * Updates a Reader object by setting the values of the parameters passed. Any - * parameters not provided will be left unchanged. - */ - public Reader update(ReaderUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); + /** Cancels the current reader action. */ + public Reader cancelAction(Map params) throws StripeException { + return cancelAction(params, (RequestOptions) null); } - /** - * Updates a Reader object by setting the values of the parameters passed. Any - * parameters not provided will be left unchanged. - */ - public Reader update(ReaderUpdateParams params, RequestOptions options) throws StripeException { + /** Cancels the current reader action. */ + public Reader cancelAction(Map params, RequestOptions options) + throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/terminal/readers/%s", ApiResource.urlEncodeId(this.getId()))); + String.format( + "/v1/terminal/readers/%s/cancel_action", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Reader.class, options); } - /** Retrieves a Reader object. */ - public static Reader retrieve(String reader) throws StripeException { - return retrieve(reader, (Map) null, (RequestOptions) null); - } - - /** Retrieves a Reader object. */ - public static Reader retrieve(String reader, RequestOptions options) throws StripeException { - return retrieve(reader, (Map) null, options); - } - - /** Retrieves a Reader object. */ - public static Reader retrieve(String reader, Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format("/v1/terminal/readers/%s", ApiResource.urlEncodeId(reader))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Reader.class, options); + /** Cancels the current reader action. */ + public Reader cancelAction(ReaderCancelActionParams params) throws StripeException { + return cancelAction(params, (RequestOptions) null); } - /** Retrieves a Reader object. */ - public static Reader retrieve(String reader, ReaderRetrieveParams params, RequestOptions options) + /** Cancels the current reader action. */ + public Reader cancelAction(ReaderCancelActionParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/terminal/readers/%s", ApiResource.urlEncodeId(reader))); - return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Reader.class, options); + String.format( + "/v1/terminal/readers/%s/cancel_action", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Reader.class, options); } /** Creates a new Reader object. */ @@ -219,30 +193,6 @@ public static Reader create(ReaderCreateParams params, RequestOptions options) return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Reader.class, options); } - /** Returns a list of Reader objects. */ - public static ReaderCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of Reader objects. */ - public static ReaderCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/terminal/readers"); - return ApiResource.requestCollection(url, params, ReaderCollection.class, options); - } - - /** Returns a list of Reader objects. */ - public static ReaderCollection list(ReaderListParams params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of Reader objects. */ - public static ReaderCollection list(ReaderListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/terminal/readers"); - return ApiResource.requestCollection(url, params, ReaderCollection.class, options); - } - /** Deletes a Reader object. */ public Reader delete() throws StripeException { return delete((Map) null, (RequestOptions) null); @@ -269,6 +219,30 @@ public Reader delete(Map params, RequestOptions options) throws ApiResource.RequestMethod.DELETE, url, params, Reader.class, options); } + /** Returns a list of Reader objects. */ + public static ReaderCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of Reader objects. */ + public static ReaderCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/terminal/readers"); + return ApiResource.requestCollection(url, params, ReaderCollection.class, options); + } + + /** Returns a list of Reader objects. */ + public static ReaderCollection list(ReaderListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of Reader objects. */ + public static ReaderCollection list(ReaderListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/terminal/readers"); + return ApiResource.requestCollection(url, params, ReaderCollection.class, options); + } + /** Initiates a payment flow on a Reader. */ public Reader processPaymentIntent(Map params) throws StripeException { return processPaymentIntent(params, (RequestOptions) null); @@ -342,48 +316,36 @@ public Reader processSetupIntent(ReaderProcessSetupIntentParams params, RequestO return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Reader.class, options); } - /** Cancels the current reader action. */ - public Reader cancelAction() throws StripeException { - return cancelAction((Map) null, (RequestOptions) null); - } - - /** Cancels the current reader action. */ - public Reader cancelAction(RequestOptions options) throws StripeException { - return cancelAction((Map) null, options); + /** Retrieves a Reader object. */ + public static Reader retrieve(String reader) throws StripeException { + return retrieve(reader, (Map) null, (RequestOptions) null); } - /** Cancels the current reader action. */ - public Reader cancelAction(Map params) throws StripeException { - return cancelAction(params, (RequestOptions) null); + /** Retrieves a Reader object. */ + public static Reader retrieve(String reader, RequestOptions options) throws StripeException { + return retrieve(reader, (Map) null, options); } - /** Cancels the current reader action. */ - public Reader cancelAction(Map params, RequestOptions options) + /** Retrieves a Reader object. */ + public static Reader retrieve(String reader, Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format( - "/v1/terminal/readers/%s/cancel_action", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Reader.class, options); - } - - /** Cancels the current reader action. */ - public Reader cancelAction(ReaderCancelActionParams params) throws StripeException { - return cancelAction(params, (RequestOptions) null); + String.format("/v1/terminal/readers/%s", ApiResource.urlEncodeId(reader))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Reader.class, options); } - /** Cancels the current reader action. */ - public Reader cancelAction(ReaderCancelActionParams params, RequestOptions options) + /** Retrieves a Reader object. */ + public static Reader retrieve(String reader, ReaderRetrieveParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format( - "/v1/terminal/readers/%s/cancel_action", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Reader.class, options); + String.format("/v1/terminal/readers/%s", ApiResource.urlEncodeId(reader))); + return ApiResource.request(ApiResource.RequestMethod.GET, url, params, Reader.class, options); } /** Sets reader display to show cart details. */ @@ -422,6 +384,51 @@ public Reader setReaderDisplay(ReaderSetReaderDisplayParams params, RequestOptio return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Reader.class, options); } + /** + * Updates a Reader object by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + */ + @Override + public Reader update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Updates a Reader object by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + */ + @Override + public Reader update(Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/terminal/readers/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Reader.class, options); + } + + /** + * Updates a Reader object by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + */ + public Reader update(ReaderUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** + * Updates a Reader object by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + */ + public Reader update(ReaderUpdateParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/terminal/readers/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Reader.class, options); + } + + /** Represents an action performed by the reader. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -463,6 +470,7 @@ public static class ReaderAction extends StripeObject { @SerializedName("type") String type; + /** Represents a reader action to process a payment intent. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -496,6 +504,7 @@ public void setPaymentIntentObject(PaymentIntent expandableObject) { new ExpandableField(expandableObject.getId(), expandableObject); } + /** Represents a per-transaction override of a reader configuration. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -506,6 +515,7 @@ public static class ProcessConfig extends StripeObject { } } + /** Represents a reader action to process a setup intent. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -539,6 +549,7 @@ public void setSetupIntentObject(SetupIntent expandableObject) { } } + /** Represents a reader action to set the reader display. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -555,6 +566,7 @@ public static class SetReaderDisplayAction extends StripeObject { @SerializedName("type") String type; + /** Represents a cart to be displayed on the reader. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -585,6 +597,7 @@ public static class Cart extends StripeObject { @SerializedName("total") Long total; + /** Represents a line item to be displayed on the reader. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/testhelpers/TestClock.java b/src/main/java/com/stripe/model/testhelpers/TestClock.java index e7cbbb3e2db..29ce66fd9db 100644 --- a/src/main/java/com/stripe/model/testhelpers/TestClock.java +++ b/src/main/java/com/stripe/model/testhelpers/TestClock.java @@ -16,6 +16,13 @@ import lombok.Getter; import lombok.Setter; +/** + * A test clock enables deterministic control over objects in testmode. With a test clock, you can + * create objects at a frozen time in the past or future, and advance to a specific future time to + * observe webhooks and state changes. After the clock advances, you can either validate the current + * state of your scenario (and test your assumptions), change the current state of your scenario + * (and test more complex scenarios), or keep advancing forward in time. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -68,40 +75,52 @@ public class TestClock extends ApiResource implements HasId { @SerializedName("status") String status; - /** Retrieves a test clock. */ - public static TestClock retrieve(String testClock) throws StripeException { - return retrieve(testClock, (Map) null, (RequestOptions) null); + /** + * Starts advancing a test clock to a specified time in the future. Advancement is done when + * status changes to Ready. + */ + public TestClock advance(Map params) throws StripeException { + return advance(params, (RequestOptions) null); } - /** Retrieves a test clock. */ - public static TestClock retrieve(String testClock, RequestOptions options) + /** + * Starts advancing a test clock to a specified time in the future. Advancement is done when + * status changes to Ready. + */ + public TestClock advance(Map params, RequestOptions options) throws StripeException { - return retrieve(testClock, (Map) null, options); - } - - /** Retrieves a test clock. */ - public static TestClock retrieve( - String testClock, Map params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/test_helpers/test_clocks/%s", ApiResource.urlEncodeId(testClock))); + String.format( + "/v1/test_helpers/test_clocks/%s/advance", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, TestClock.class, options); + ApiResource.RequestMethod.POST, url, params, TestClock.class, options); } - /** Retrieves a test clock. */ - public static TestClock retrieve( - String testClock, TestClockRetrieveParams params, RequestOptions options) + /** + * Starts advancing a test clock to a specified time in the future. Advancement is done when + * status changes to Ready. + */ + public TestClock advance(TestClockAdvanceParams params) throws StripeException { + return advance(params, (RequestOptions) null); + } + + /** + * Starts advancing a test clock to a specified time in the future. Advancement is done when + * status changes to Ready. + */ + public TestClock advance(TestClockAdvanceParams params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), - String.format("/v1/test_helpers/test_clocks/%s", ApiResource.urlEncodeId(testClock))); + String.format( + "/v1/test_helpers/test_clocks/%s/advance", ApiResource.urlEncodeId(this.getId()))); return ApiResource.request( - ApiResource.RequestMethod.GET, url, params, TestClock.class, options); + ApiResource.RequestMethod.POST, url, params, TestClock.class, options); } /** Creates a new test clock that can be attached to new customers and quotes. */ @@ -158,54 +177,6 @@ public TestClock delete(Map params, RequestOptions options) ApiResource.RequestMethod.DELETE, url, params, TestClock.class, options); } - /** - * Starts advancing a test clock to a specified time in the future. Advancement is done when - * status changes to Ready. - */ - public TestClock advance(Map params) throws StripeException { - return advance(params, (RequestOptions) null); - } - - /** - * Starts advancing a test clock to a specified time in the future. Advancement is done when - * status changes to Ready. - */ - public TestClock advance(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/test_helpers/test_clocks/%s/advance", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, TestClock.class, options); - } - - /** - * Starts advancing a test clock to a specified time in the future. Advancement is done when - * status changes to Ready. - */ - public TestClock advance(TestClockAdvanceParams params) throws StripeException { - return advance(params, (RequestOptions) null); - } - - /** - * Starts advancing a test clock to a specified time in the future. Advancement is done when - * status changes to Ready. - */ - public TestClock advance(TestClockAdvanceParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/test_helpers/test_clocks/%s/advance", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, TestClock.class, options); - } - /** Returns a list of your test clocks. */ public static TestClockCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); @@ -229,4 +200,40 @@ public static TestClockCollection list(TestClockListParams params, RequestOption String url = String.format("%s%s", Stripe.getApiBase(), "/v1/test_helpers/test_clocks"); return ApiResource.requestCollection(url, params, TestClockCollection.class, options); } + + /** Retrieves a test clock. */ + public static TestClock retrieve(String testClock) throws StripeException { + return retrieve(testClock, (Map) null, (RequestOptions) null); + } + + /** Retrieves a test clock. */ + public static TestClock retrieve(String testClock, RequestOptions options) + throws StripeException { + return retrieve(testClock, (Map) null, options); + } + + /** Retrieves a test clock. */ + public static TestClock retrieve( + String testClock, Map params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/test_helpers/test_clocks/%s", ApiResource.urlEncodeId(testClock))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, TestClock.class, options); + } + + /** Retrieves a test clock. */ + public static TestClock retrieve( + String testClock, TestClockRetrieveParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format("/v1/test_helpers/test_clocks/%s", ApiResource.urlEncodeId(testClock))); + return ApiResource.request( + ApiResource.RequestMethod.GET, url, params, TestClock.class, options); + } } diff --git a/src/main/java/com/stripe/model/treasury/CreditReversal.java b/src/main/java/com/stripe/model/treasury/CreditReversal.java index 1715d41aa79..c690e942cab 100644 --- a/src/main/java/com/stripe/model/treasury/CreditReversal.java +++ b/src/main/java/com/stripe/model/treasury/CreditReversal.java @@ -17,6 +17,11 @@ import lombok.Getter; import lombok.Setter; +/** + * You can reverse some ReceivedCredits + * depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a + * new object known as a CreditReversal. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -119,6 +124,32 @@ public void setTransactionObject(Transaction expandableObject) { this.transaction = new ExpandableField(expandableObject.getId(), expandableObject); } + /** Reverses a ReceivedCredit and creates a CreditReversal object. */ + public static CreditReversal create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Reverses a ReceivedCredit and creates a CreditReversal object. */ + public static CreditReversal create(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/credit_reversals"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, CreditReversal.class, options); + } + + /** Reverses a ReceivedCredit and creates a CreditReversal object. */ + public static CreditReversal create(CreditReversalCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Reverses a ReceivedCredit and creates a CreditReversal object. */ + public static CreditReversal create(CreditReversalCreateParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/credit_reversals"); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, CreditReversal.class, options); + } + /** Returns a list of CreditReversals. */ public static CreditReversalCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); @@ -195,32 +226,6 @@ public static CreditReversal retrieve( ApiResource.RequestMethod.GET, url, params, CreditReversal.class, options); } - /** Reverses a ReceivedCredit and creates a CreditReversal object. */ - public static CreditReversal create(Map params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Reverses a ReceivedCredit and creates a CreditReversal object. */ - public static CreditReversal create(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/credit_reversals"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, CreditReversal.class, options); - } - - /** Reverses a ReceivedCredit and creates a CreditReversal object. */ - public static CreditReversal create(CreditReversalCreateParams params) throws StripeException { - return create(params, (RequestOptions) null); - } - - /** Reverses a ReceivedCredit and creates a CreditReversal object. */ - public static CreditReversal create(CreditReversalCreateParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/credit_reversals"); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, CreditReversal.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/treasury/DebitReversal.java b/src/main/java/com/stripe/model/treasury/DebitReversal.java index 275fefeaeb5..7e586a93efa 100644 --- a/src/main/java/com/stripe/model/treasury/DebitReversal.java +++ b/src/main/java/com/stripe/model/treasury/DebitReversal.java @@ -17,6 +17,11 @@ import lombok.Getter; import lombok.Setter; +/** + * You can reverse some ReceivedDebits + * depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a + * new object known as a DebitReversal. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -149,6 +154,31 @@ public static DebitReversal create(DebitReversalCreateParams params, RequestOpti ApiResource.RequestMethod.POST, url, params, DebitReversal.class, options); } + /** Returns a list of DebitReversals. */ + public static DebitReversalCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of DebitReversals. */ + public static DebitReversalCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/debit_reversals"); + return ApiResource.requestCollection(url, params, DebitReversalCollection.class, options); + } + + /** Returns a list of DebitReversals. */ + public static DebitReversalCollection list(DebitReversalListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of DebitReversals. */ + public static DebitReversalCollection list(DebitReversalListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/debit_reversals"); + return ApiResource.requestCollection(url, params, DebitReversalCollection.class, options); + } + /** Retrieves a DebitReversal object. */ public static DebitReversal retrieve(String debitReversal) throws StripeException { return retrieve(debitReversal, (Map) null, (RequestOptions) null); @@ -188,31 +218,6 @@ public static DebitReversal retrieve( ApiResource.RequestMethod.GET, url, params, DebitReversal.class, options); } - /** Returns a list of DebitReversals. */ - public static DebitReversalCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of DebitReversals. */ - public static DebitReversalCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/debit_reversals"); - return ApiResource.requestCollection(url, params, DebitReversalCollection.class, options); - } - - /** Returns a list of DebitReversals. */ - public static DebitReversalCollection list(DebitReversalListParams params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of DebitReversals. */ - public static DebitReversalCollection list(DebitReversalListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/debit_reversals"); - return ApiResource.requestCollection(url, params, DebitReversalCollection.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/treasury/FinancialAccount.java b/src/main/java/com/stripe/model/treasury/FinancialAccount.java index 35e4df68473..12366e818fc 100644 --- a/src/main/java/com/stripe/model/treasury/FinancialAccount.java +++ b/src/main/java/com/stripe/model/treasury/FinancialAccount.java @@ -21,6 +21,11 @@ import lombok.Getter; import lombok.Setter; +/** + * Stripe Treasury provides users with a container for money called a FinancialAccount that is + * separate from their Payments balance. FinancialAccounts serve as the source and destination of + * Treasury’s money movement APIs. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -155,94 +160,6 @@ public static FinancialAccount create(FinancialAccountCreateParams params, Reque ApiResource.RequestMethod.POST, url, params, FinancialAccount.class, options); } - /** Updates the details of a FinancialAccount. */ - @Override - public FinancialAccount update(Map params) throws StripeException { - return update(params, (RequestOptions) null); - } - - /** Updates the details of a FinancialAccount. */ - @Override - public FinancialAccount update(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/treasury/financial_accounts/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, FinancialAccount.class, options); - } - - /** Updates the details of a FinancialAccount. */ - public FinancialAccount update(FinancialAccountUpdateParams params) throws StripeException { - return update(params, (RequestOptions) null); - } - - /** Updates the details of a FinancialAccount. */ - public FinancialAccount update(FinancialAccountUpdateParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/treasury/financial_accounts/%s", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, FinancialAccount.class, options); - } - - /** Updates the Features associated with a FinancialAccount. */ - public FinancialAccountFeatures updateFeatures() throws StripeException { - return updateFeatures((Map) null, (RequestOptions) null); - } - - /** Updates the Features associated with a FinancialAccount. */ - public FinancialAccountFeatures updateFeatures(RequestOptions options) throws StripeException { - return updateFeatures((Map) null, options); - } - - /** Updates the Features associated with a FinancialAccount. */ - public FinancialAccountFeatures updateFeatures(Map params) - throws StripeException { - return updateFeatures(params, (RequestOptions) null); - } - - /** Updates the Features associated with a FinancialAccount. */ - public FinancialAccountFeatures updateFeatures(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/treasury/financial_accounts/%s/features", - ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, FinancialAccountFeatures.class, options); - } - - /** Updates the Features associated with a FinancialAccount. */ - public FinancialAccountFeatures updateFeatures(FinancialAccountUpdateFeaturesParams params) - throws StripeException { - return updateFeatures(params, (RequestOptions) null); - } - - /** Updates the Features associated with a FinancialAccount. */ - public FinancialAccountFeatures updateFeatures( - FinancialAccountUpdateFeaturesParams params, RequestOptions options) throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/treasury/financial_accounts/%s/features", - ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, FinancialAccountFeatures.class, options); - } - /** Returns a list of FinancialAccounts. */ public static FinancialAccountCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); @@ -353,6 +270,95 @@ public FinancialAccountFeatures retrieveFeatures( ApiResource.RequestMethod.GET, url, params, FinancialAccountFeatures.class, options); } + /** Updates the details of a FinancialAccount. */ + @Override + public FinancialAccount update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates the details of a FinancialAccount. */ + @Override + public FinancialAccount update(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/treasury/financial_accounts/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, FinancialAccount.class, options); + } + + /** Updates the details of a FinancialAccount. */ + public FinancialAccount update(FinancialAccountUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates the details of a FinancialAccount. */ + public FinancialAccount update(FinancialAccountUpdateParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/treasury/financial_accounts/%s", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, FinancialAccount.class, options); + } + + /** Updates the Features associated with a FinancialAccount. */ + public FinancialAccountFeatures updateFeatures() throws StripeException { + return updateFeatures((Map) null, (RequestOptions) null); + } + + /** Updates the Features associated with a FinancialAccount. */ + public FinancialAccountFeatures updateFeatures(RequestOptions options) throws StripeException { + return updateFeatures((Map) null, options); + } + + /** Updates the Features associated with a FinancialAccount. */ + public FinancialAccountFeatures updateFeatures(Map params) + throws StripeException { + return updateFeatures(params, (RequestOptions) null); + } + + /** Updates the Features associated with a FinancialAccount. */ + public FinancialAccountFeatures updateFeatures(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/treasury/financial_accounts/%s/features", + ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, FinancialAccountFeatures.class, options); + } + + /** Updates the Features associated with a FinancialAccount. */ + public FinancialAccountFeatures updateFeatures(FinancialAccountUpdateFeaturesParams params) + throws StripeException { + return updateFeatures(params, (RequestOptions) null); + } + + /** Updates the Features associated with a FinancialAccount. */ + public FinancialAccountFeatures updateFeatures( + FinancialAccountUpdateFeaturesParams params, RequestOptions options) throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/treasury/financial_accounts/%s/features", + ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, FinancialAccountFeatures.class, options); + } + + /** Balance information for the FinancialAccount. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -373,6 +379,7 @@ public static class Balance extends StripeObject { Map outboundPending; } + /** FinancialAddresses contain identifying information that resolves to a FinancialAccount. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -393,6 +400,7 @@ public static class FinancialAddress extends StripeObject { @SerializedName("type") String type; + /** ABA Records contain U.S. bank account details per the ABA format. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -419,6 +427,7 @@ public static class Aba extends StripeObject { } } + /** Restrictions that a Connect Platform has placed on this FinancialAccount. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -458,6 +467,7 @@ public static class Closed extends StripeObject { } } + /** Toggle settings for enabling/disabling a feature. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -478,6 +488,7 @@ public static class ToggleSettings extends StripeObject { @SerializedName("status_details") List statusDetails; + /** Additional details on the FinancialAccount Features information. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/treasury/FinancialAccountFeatures.java b/src/main/java/com/stripe/model/treasury/FinancialAccountFeatures.java index f3312834622..c2f030759a8 100644 --- a/src/main/java/com/stripe/model/treasury/FinancialAccountFeatures.java +++ b/src/main/java/com/stripe/model/treasury/FinancialAccountFeatures.java @@ -8,6 +8,11 @@ import lombok.Getter; import lombok.Setter; +/** + * Encodes whether a FinancialAccount has access to a particular Feature, with a {@code status} enum + * and associated {@code status_details}. Stripe or the platform can control Features via the + * requested field. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -48,6 +53,7 @@ public class FinancialAccountFeatures extends StripeObject { @SerializedName("outbound_transfers") OutboundTransfers outboundTransfers; + /** Toggle settings for enabling/disabling a feature. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -68,6 +74,7 @@ public static class CardIssuing extends StripeObject { @SerializedName("status_details") List statusDetails; + /** Additional details on the FinancialAccount Features information. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -102,6 +109,7 @@ public static class StatusDetails extends StripeObject { } } + /** Toggle settings for enabling/disabling a feature. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -122,6 +130,7 @@ public static class DepositInsurance extends StripeObject { @SerializedName("status_details") List statusDetails; + /** Additional details on the FinancialAccount Features information. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -156,6 +165,7 @@ public static class StatusDetails extends StripeObject { } } + /** Settings related to Financial Addresses features on a Financial Account. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -164,6 +174,7 @@ public static class FinancialAddresses extends StripeObject { @SerializedName("aba") Aba aba; + /** Toggle settings for enabling/disabling a feature. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -184,6 +195,7 @@ public static class Aba extends StripeObject { @SerializedName("status_details") List statusDetails; + /** Additional details on the FinancialAccount Features information. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -219,6 +231,7 @@ public static class StatusDetails extends StripeObject { } } + /** InboundTransfers contains inbound transfers features for a FinancialAccount. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -227,6 +240,7 @@ public static class InboundTransfers extends StripeObject { @SerializedName("ach") Ach ach; + /** Toggle settings for enabling/disabling a feature. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -247,6 +261,7 @@ public static class Ach extends StripeObject { @SerializedName("status_details") List statusDetails; + /** Additional details on the FinancialAccount Features information. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -282,6 +297,7 @@ public static class StatusDetails extends StripeObject { } } + /** Toggle settings for enabling/disabling a feature. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -302,6 +318,7 @@ public static class IntraStripeFlows extends StripeObject { @SerializedName("status_details") List statusDetails; + /** Additional details on the FinancialAccount Features information. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -336,6 +353,7 @@ public static class StatusDetails extends StripeObject { } } + /** Settings related to Outbound Payments features on a Financial Account. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -348,6 +366,7 @@ public static class OutboundPayments extends StripeObject { @SerializedName("us_domestic_wire") UsDomesticWire usDomesticWire; + /** Toggle settings for enabling/disabling a feature. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -368,6 +387,7 @@ public static class Ach extends StripeObject { @SerializedName("status_details") List statusDetails; + /** Additional details on the FinancialAccount Features information. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -402,6 +422,7 @@ public static class StatusDetails extends StripeObject { } } + /** Toggle settings for enabling/disabling a feature. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -422,6 +443,7 @@ public static class UsDomesticWire extends StripeObject { @SerializedName("status_details") List statusDetails; + /** Additional details on the FinancialAccount Features information. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -457,6 +479,7 @@ public static class StatusDetails extends StripeObject { } } + /** OutboundTransfers contains outbound transfers features for a FinancialAccount. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -469,6 +492,7 @@ public static class OutboundTransfers extends StripeObject { @SerializedName("us_domestic_wire") UsDomesticWire usDomesticWire; + /** Toggle settings for enabling/disabling a feature. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -489,6 +513,7 @@ public static class Ach extends StripeObject { @SerializedName("status_details") List statusDetails; + /** Additional details on the FinancialAccount Features information. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -523,6 +548,7 @@ public static class StatusDetails extends StripeObject { } } + /** Toggle settings for enabling/disabling a feature. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -543,6 +569,7 @@ public static class UsDomesticWire extends StripeObject { @SerializedName("status_details") List statusDetails; + /** Additional details on the FinancialAccount Features information. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -578,6 +605,7 @@ public static class StatusDetails extends StripeObject { } } + /** Restrictions that a Connect Platform has placed on this FinancialAccount. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/treasury/InboundTransfer.java b/src/main/java/com/stripe/model/treasury/InboundTransfer.java index 2674a2cdb47..8bc51e33024 100644 --- a/src/main/java/com/stripe/model/treasury/InboundTransfer.java +++ b/src/main/java/com/stripe/model/treasury/InboundTransfer.java @@ -22,6 +22,13 @@ import lombok.Getter; import lombok.Setter; +/** + * Use InboundTransfers + * to add funds to your FinancialAccount via a PaymentMethod + * that is owned by you. The funds will be transferred via an ACH debit. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -228,6 +235,31 @@ public static InboundTransfer create(InboundTransferCreateParams params, Request ApiResource.RequestMethod.POST, url, params, InboundTransfer.class, options); } + /** Returns a list of InboundTransfers sent from the specified FinancialAccount. */ + public static InboundTransferCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of InboundTransfers sent from the specified FinancialAccount. */ + public static InboundTransferCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/inbound_transfers"); + return ApiResource.requestCollection(url, params, InboundTransferCollection.class, options); + } + + /** Returns a list of InboundTransfers sent from the specified FinancialAccount. */ + public static InboundTransferCollection list(InboundTransferListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of InboundTransfers sent from the specified FinancialAccount. */ + public static InboundTransferCollection list( + InboundTransferListParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/inbound_transfers"); + return ApiResource.requestCollection(url, params, InboundTransferCollection.class, options); + } + /** Retrieves the details of an existing InboundTransfer. */ public static InboundTransfer retrieve(String id) throws StripeException { return retrieve(id, (Map) null, (RequestOptions) null); @@ -263,31 +295,6 @@ public static InboundTransfer retrieve( ApiResource.RequestMethod.GET, url, params, InboundTransfer.class, options); } - /** Returns a list of InboundTransfers sent from the specified FinancialAccount. */ - public static InboundTransferCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of InboundTransfers sent from the specified FinancialAccount. */ - public static InboundTransferCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/inbound_transfers"); - return ApiResource.requestCollection(url, params, InboundTransferCollection.class, options); - } - - /** Returns a list of InboundTransfers sent from the specified FinancialAccount. */ - public static InboundTransferCollection list(InboundTransferListParams params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of InboundTransfers sent from the specified FinancialAccount. */ - public static InboundTransferCollection list( - InboundTransferListParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/inbound_transfers"); - return ApiResource.requestCollection(url, params, InboundTransferCollection.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/treasury/OutboundPayment.java b/src/main/java/com/stripe/model/treasury/OutboundPayment.java index aff11ba4443..424bbaa9638 100644 --- a/src/main/java/com/stripe/model/treasury/OutboundPayment.java +++ b/src/main/java/com/stripe/model/treasury/OutboundPayment.java @@ -22,6 +22,16 @@ import lombok.Getter; import lombok.Setter; +/** + * Use OutboundPayments to send funds to another party's external bank account or FinancialAccount. To send money to an + * account belonging to the same user, use an OutboundTransfer. + * + *

Simulate OutboundPayment state changes with the {@code + * /v1/test_helpers/treasury/outbound_payments} endpoints. These methods can only be called on test + * mode objects. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -167,6 +177,52 @@ public void setTransactionObject(Transaction expandableObject) { this.transaction = new ExpandableField(expandableObject.getId(), expandableObject); } + /** Cancel an OutboundPayment. */ + public OutboundPayment cancel() throws StripeException { + return cancel((Map) null, (RequestOptions) null); + } + + /** Cancel an OutboundPayment. */ + public OutboundPayment cancel(RequestOptions options) throws StripeException { + return cancel((Map) null, options); + } + + /** Cancel an OutboundPayment. */ + public OutboundPayment cancel(Map params) throws StripeException { + return cancel(params, (RequestOptions) null); + } + + /** Cancel an OutboundPayment. */ + public OutboundPayment cancel(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/treasury/outbound_payments/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, OutboundPayment.class, options); + } + + /** Cancel an OutboundPayment. */ + public OutboundPayment cancel(OutboundPaymentCancelParams params) throws StripeException { + return cancel(params, (RequestOptions) null); + } + + /** Cancel an OutboundPayment. */ + public OutboundPayment cancel(OutboundPaymentCancelParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/treasury/outbound_payments/%s/cancel", ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, OutboundPayment.class, options); + } + /** Creates an OutboundPayment. */ public static OutboundPayment create(Map params) throws StripeException { return create(params, (RequestOptions) null); @@ -193,6 +249,31 @@ public static OutboundPayment create(OutboundPaymentCreateParams params, Request ApiResource.RequestMethod.POST, url, params, OutboundPayment.class, options); } + /** Returns a list of OutboundPayments sent from the specified FinancialAccount. */ + public static OutboundPaymentCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of OutboundPayments sent from the specified FinancialAccount. */ + public static OutboundPaymentCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/outbound_payments"); + return ApiResource.requestCollection(url, params, OutboundPaymentCollection.class, options); + } + + /** Returns a list of OutboundPayments sent from the specified FinancialAccount. */ + public static OutboundPaymentCollection list(OutboundPaymentListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of OutboundPayments sent from the specified FinancialAccount. */ + public static OutboundPaymentCollection list( + OutboundPaymentListParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/outbound_payments"); + return ApiResource.requestCollection(url, params, OutboundPaymentCollection.class, options); + } + /** * Retrieves the details of an existing OutboundPayment by passing the unique OutboundPayment ID * from either the OutboundPayment creation request or OutboundPayment list. @@ -240,77 +321,6 @@ public static OutboundPayment retrieve( ApiResource.RequestMethod.GET, url, params, OutboundPayment.class, options); } - /** Returns a list of OutboundPayments sent from the specified FinancialAccount. */ - public static OutboundPaymentCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of OutboundPayments sent from the specified FinancialAccount. */ - public static OutboundPaymentCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/outbound_payments"); - return ApiResource.requestCollection(url, params, OutboundPaymentCollection.class, options); - } - - /** Returns a list of OutboundPayments sent from the specified FinancialAccount. */ - public static OutboundPaymentCollection list(OutboundPaymentListParams params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of OutboundPayments sent from the specified FinancialAccount. */ - public static OutboundPaymentCollection list( - OutboundPaymentListParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/outbound_payments"); - return ApiResource.requestCollection(url, params, OutboundPaymentCollection.class, options); - } - - /** Cancel an OutboundPayment. */ - public OutboundPayment cancel() throws StripeException { - return cancel((Map) null, (RequestOptions) null); - } - - /** Cancel an OutboundPayment. */ - public OutboundPayment cancel(RequestOptions options) throws StripeException { - return cancel((Map) null, options); - } - - /** Cancel an OutboundPayment. */ - public OutboundPayment cancel(Map params) throws StripeException { - return cancel(params, (RequestOptions) null); - } - - /** Cancel an OutboundPayment. */ - public OutboundPayment cancel(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/treasury/outbound_payments/%s/cancel", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, OutboundPayment.class, options); - } - - /** Cancel an OutboundPayment. */ - public OutboundPayment cancel(OutboundPaymentCancelParams params) throws StripeException { - return cancel(params, (RequestOptions) null); - } - - /** Cancel an OutboundPayment. */ - public OutboundPayment cancel(OutboundPaymentCancelParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/treasury/outbound_payments/%s/cancel", ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, OutboundPayment.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/treasury/OutboundTransfer.java b/src/main/java/com/stripe/model/treasury/OutboundTransfer.java index b5ab1e2425c..0a63532d180 100644 --- a/src/main/java/com/stripe/model/treasury/OutboundTransfer.java +++ b/src/main/java/com/stripe/model/treasury/OutboundTransfer.java @@ -22,6 +22,17 @@ import lombok.Getter; import lombok.Setter; +/** + * Use OutboundTransfers to transfer funds from a FinancialAccount to a PaymentMethod + * belonging to the same entity. To send funds to a different party, use OutboundPayments instead. You can send + * funds over ACH rails or through a domestic wire transfer to a user's own external bank account. + * + *

Simulate OutboundTransfer state changes with the {@code + * /v1/test_helpers/treasury/outbound_transfers} endpoints. These methods can only be called on test + * mode objects. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -149,6 +160,54 @@ public void setTransactionObject(Transaction expandableObject) { this.transaction = new ExpandableField(expandableObject.getId(), expandableObject); } + /** An OutboundTransfer can be canceled if the funds have not yet been paid out. */ + public OutboundTransfer cancel() throws StripeException { + return cancel((Map) null, (RequestOptions) null); + } + + /** An OutboundTransfer can be canceled if the funds have not yet been paid out. */ + public OutboundTransfer cancel(RequestOptions options) throws StripeException { + return cancel((Map) null, options); + } + + /** An OutboundTransfer can be canceled if the funds have not yet been paid out. */ + public OutboundTransfer cancel(Map params) throws StripeException { + return cancel(params, (RequestOptions) null); + } + + /** An OutboundTransfer can be canceled if the funds have not yet been paid out. */ + public OutboundTransfer cancel(Map params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/treasury/outbound_transfers/%s/cancel", + ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, OutboundTransfer.class, options); + } + + /** An OutboundTransfer can be canceled if the funds have not yet been paid out. */ + public OutboundTransfer cancel(OutboundTransferCancelParams params) throws StripeException { + return cancel(params, (RequestOptions) null); + } + + /** An OutboundTransfer can be canceled if the funds have not yet been paid out. */ + public OutboundTransfer cancel(OutboundTransferCancelParams params, RequestOptions options) + throws StripeException { + String url = + String.format( + "%s%s", + Stripe.getApiBase(), + String.format( + "/v1/treasury/outbound_transfers/%s/cancel", + ApiResource.urlEncodeId(this.getId()))); + return ApiResource.request( + ApiResource.RequestMethod.POST, url, params, OutboundTransfer.class, options); + } + /** Creates an OutboundTransfer. */ public static OutboundTransfer create(Map params) throws StripeException { return create(params, (RequestOptions) null); @@ -176,6 +235,31 @@ public static OutboundTransfer create(OutboundTransferCreateParams params, Reque ApiResource.RequestMethod.POST, url, params, OutboundTransfer.class, options); } + /** Returns a list of OutboundTransfers sent from the specified FinancialAccount. */ + public static OutboundTransferCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of OutboundTransfers sent from the specified FinancialAccount. */ + public static OutboundTransferCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/outbound_transfers"); + return ApiResource.requestCollection(url, params, OutboundTransferCollection.class, options); + } + + /** Returns a list of OutboundTransfers sent from the specified FinancialAccount. */ + public static OutboundTransferCollection list(OutboundTransferListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Returns a list of OutboundTransfers sent from the specified FinancialAccount. */ + public static OutboundTransferCollection list( + OutboundTransferListParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/outbound_transfers"); + return ApiResource.requestCollection(url, params, OutboundTransferCollection.class, options); + } + /** * Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID * from either the OutboundTransfer creation request or OutboundTransfer list. @@ -227,79 +311,6 @@ public static OutboundTransfer retrieve( ApiResource.RequestMethod.GET, url, params, OutboundTransfer.class, options); } - /** Returns a list of OutboundTransfers sent from the specified FinancialAccount. */ - public static OutboundTransferCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of OutboundTransfers sent from the specified FinancialAccount. */ - public static OutboundTransferCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/outbound_transfers"); - return ApiResource.requestCollection(url, params, OutboundTransferCollection.class, options); - } - - /** Returns a list of OutboundTransfers sent from the specified FinancialAccount. */ - public static OutboundTransferCollection list(OutboundTransferListParams params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Returns a list of OutboundTransfers sent from the specified FinancialAccount. */ - public static OutboundTransferCollection list( - OutboundTransferListParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/outbound_transfers"); - return ApiResource.requestCollection(url, params, OutboundTransferCollection.class, options); - } - - /** An OutboundTransfer can be canceled if the funds have not yet been paid out. */ - public OutboundTransfer cancel() throws StripeException { - return cancel((Map) null, (RequestOptions) null); - } - - /** An OutboundTransfer can be canceled if the funds have not yet been paid out. */ - public OutboundTransfer cancel(RequestOptions options) throws StripeException { - return cancel((Map) null, options); - } - - /** An OutboundTransfer can be canceled if the funds have not yet been paid out. */ - public OutboundTransfer cancel(Map params) throws StripeException { - return cancel(params, (RequestOptions) null); - } - - /** An OutboundTransfer can be canceled if the funds have not yet been paid out. */ - public OutboundTransfer cancel(Map params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/treasury/outbound_transfers/%s/cancel", - ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, OutboundTransfer.class, options); - } - - /** An OutboundTransfer can be canceled if the funds have not yet been paid out. */ - public OutboundTransfer cancel(OutboundTransferCancelParams params) throws StripeException { - return cancel(params, (RequestOptions) null); - } - - /** An OutboundTransfer can be canceled if the funds have not yet been paid out. */ - public OutboundTransfer cancel(OutboundTransferCancelParams params, RequestOptions options) - throws StripeException { - String url = - String.format( - "%s%s", - Stripe.getApiBase(), - String.format( - "/v1/treasury/outbound_transfers/%s/cancel", - ApiResource.urlEncodeId(this.getId()))); - return ApiResource.request( - ApiResource.RequestMethod.POST, url, params, OutboundTransfer.class, options); - } - @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/treasury/ReceivedCredit.java b/src/main/java/com/stripe/model/treasury/ReceivedCredit.java index 7929c5f8a6d..c2f3b0bab4f 100644 --- a/src/main/java/com/stripe/model/treasury/ReceivedCredit.java +++ b/src/main/java/com/stripe/model/treasury/ReceivedCredit.java @@ -19,6 +19,11 @@ import lombok.Getter; import lombok.Setter; +/** + * ReceivedCredits represent funds sent to a FinancialAccount (for example, via ACH + * or wire). These money movements are not initiated from the FinancialAccount. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/treasury/ReceivedDebit.java b/src/main/java/com/stripe/model/treasury/ReceivedDebit.java index af0a9f49baf..ace13b07c21 100644 --- a/src/main/java/com/stripe/model/treasury/ReceivedDebit.java +++ b/src/main/java/com/stripe/model/treasury/ReceivedDebit.java @@ -18,6 +18,11 @@ import lombok.Getter; import lombok.Setter; +/** + * ReceivedDebits represent funds pulled from a FinancialAccount. These are not + * initiated from the FinancialAccount. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/treasury/Transaction.java b/src/main/java/com/stripe/model/treasury/Transaction.java index e7875887b51..b314108f7ed 100644 --- a/src/main/java/com/stripe/model/treasury/Transaction.java +++ b/src/main/java/com/stripe/model/treasury/Transaction.java @@ -15,6 +15,10 @@ import lombok.Getter; import lombok.Setter; +/** + * Transactions represent changes to a FinancialAccount's balance. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -102,6 +106,30 @@ public class Transaction extends ApiResource implements HasId { @SerializedName("status_transitions") StatusTransitions statusTransitions; + /** Retrieves a list of Transaction objects. */ + public static TransactionCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Retrieves a list of Transaction objects. */ + public static TransactionCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/transactions"); + return ApiResource.requestCollection(url, params, TransactionCollection.class, options); + } + + /** Retrieves a list of Transaction objects. */ + public static TransactionCollection list(TransactionListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Retrieves a list of Transaction objects. */ + public static TransactionCollection list(TransactionListParams params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/transactions"); + return ApiResource.requestCollection(url, params, TransactionCollection.class, options); + } + /** Retrieves the details of an existing Transaction. */ public static Transaction retrieve(String id) throws StripeException { return retrieve(id, (Map) null, (RequestOptions) null); @@ -136,30 +164,7 @@ public static Transaction retrieve( ApiResource.RequestMethod.GET, url, params, Transaction.class, options); } - /** Retrieves a list of Transaction objects. */ - public static TransactionCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Retrieves a list of Transaction objects. */ - public static TransactionCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/transactions"); - return ApiResource.requestCollection(url, params, TransactionCollection.class, options); - } - - /** Retrieves a list of Transaction objects. */ - public static TransactionCollection list(TransactionListParams params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Retrieves a list of Transaction objects. */ - public static TransactionCollection list(TransactionListParams params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/transactions"); - return ApiResource.requestCollection(url, params, TransactionCollection.class, options); - } - + /** Change to a FinancialAccount's balance. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/model/treasury/TransactionEntry.java b/src/main/java/com/stripe/model/treasury/TransactionEntry.java index 972aea792af..ccb320515dd 100644 --- a/src/main/java/com/stripe/model/treasury/TransactionEntry.java +++ b/src/main/java/com/stripe/model/treasury/TransactionEntry.java @@ -16,6 +16,10 @@ import lombok.Getter; import lombok.Setter; +/** + * TransactionEntries represent individual units of money movements within a single Transaction. + */ @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -120,6 +124,31 @@ public void setTransactionObject(Transaction expandableObject) { this.transaction = new ExpandableField(expandableObject.getId(), expandableObject); } + /** Retrieves a list of TransactionEntry objects. */ + public static TransactionEntryCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Retrieves a list of TransactionEntry objects. */ + public static TransactionEntryCollection list(Map params, RequestOptions options) + throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/transaction_entries"); + return ApiResource.requestCollection(url, params, TransactionEntryCollection.class, options); + } + + /** Retrieves a list of TransactionEntry objects. */ + public static TransactionEntryCollection list(TransactionEntryListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Retrieves a list of TransactionEntry objects. */ + public static TransactionEntryCollection list( + TransactionEntryListParams params, RequestOptions options) throws StripeException { + String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/transaction_entries"); + return ApiResource.requestCollection(url, params, TransactionEntryCollection.class, options); + } + /** Retrieves a TransactionEntry object. */ public static TransactionEntry retrieve(String id) throws StripeException { return retrieve(id, (Map) null, (RequestOptions) null); @@ -156,31 +185,7 @@ public static TransactionEntry retrieve( ApiResource.RequestMethod.GET, url, params, TransactionEntry.class, options); } - /** Retrieves a list of TransactionEntry objects. */ - public static TransactionEntryCollection list(Map params) throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Retrieves a list of TransactionEntry objects. */ - public static TransactionEntryCollection list(Map params, RequestOptions options) - throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/transaction_entries"); - return ApiResource.requestCollection(url, params, TransactionEntryCollection.class, options); - } - - /** Retrieves a list of TransactionEntry objects. */ - public static TransactionEntryCollection list(TransactionEntryListParams params) - throws StripeException { - return list(params, (RequestOptions) null); - } - - /** Retrieves a list of TransactionEntry objects. */ - public static TransactionEntryCollection list( - TransactionEntryListParams params, RequestOptions options) throws StripeException { - String url = String.format("%s%s", Stripe.getApiBase(), "/v1/treasury/transaction_entries"); - return ApiResource.requestCollection(url, params, TransactionEntryCollection.class, options); - } - + /** Change to a FinancialAccount's balance. */ @Getter @Setter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/stripe/param/AccountCreateParams.java b/src/main/java/com/stripe/param/AccountCreateParams.java index 73374ef0960..40914e9584e 100644 --- a/src/main/java/com/stripe/param/AccountCreateParams.java +++ b/src/main/java/com/stripe/param/AccountCreateParams.java @@ -88,8 +88,9 @@ public class AccountCreateParams extends ApiRequestParams { * href="https://stripe.com/docs/api#account_create_bank_account">bank account creation. * <br><br>By default, providing an external account sets it as the new default * external account for its currency, and deletes the old default if one exists. To add additional - * external accounts without replacing the existing default for the currency, use the bank account - * or card creation API. + * external accounts without replacing the existing default for the currency, use the bank account or card creation APIs. */ @SerializedName("external_account") String externalAccount; @@ -353,7 +354,8 @@ public Builder addAllExpand(List elements) { * <br><br>By default, providing an external account sets it as the new default * external account for its currency, and deletes the old default if one exists. To add * additional external accounts without replacing the existing default for the currency, use the - * bank account or card creation API. + * bank account or card creation APIs. */ public Builder setExternalAccount(String externalAccount) { this.externalAccount = externalAccount; diff --git a/src/main/java/com/stripe/param/AccountUpdateParams.java b/src/main/java/com/stripe/param/AccountUpdateParams.java index ab85dd68f0f..69c811333af 100644 --- a/src/main/java/com/stripe/param/AccountUpdateParams.java +++ b/src/main/java/com/stripe/param/AccountUpdateParams.java @@ -76,8 +76,9 @@ public class AccountUpdateParams extends ApiRequestParams { * href="https://stripe.com/docs/api#account_create_bank_account">bank account creation. * <br><br>By default, providing an external account sets it as the new default * external account for its currency, and deletes the old default if one exists. To add additional - * external accounts without replacing the existing default for the currency, use the bank account - * or card creation API. + * external accounts without replacing the existing default for the currency, use the bank account or card creation APIs. */ @SerializedName("external_account") Object externalAccount; @@ -337,7 +338,8 @@ public Builder addAllExpand(List elements) { * <br><br>By default, providing an external account sets it as the new default * external account for its currency, and deletes the old default if one exists. To add * additional external accounts without replacing the existing default for the currency, use the - * bank account or card creation API. + * bank account or card creation APIs. */ public Builder setExternalAccount(String externalAccount) { this.externalAccount = externalAccount; @@ -354,7 +356,8 @@ public Builder setExternalAccount(String externalAccount) { * <br><br>By default, providing an external account sets it as the new default * external account for its currency, and deletes the old default if one exists. To add * additional external accounts without replacing the existing default for the currency, use the - * bank account or card creation API. + * bank account or card creation APIs. */ public Builder setExternalAccount(EmptyParam externalAccount) { this.externalAccount = externalAccount; diff --git a/src/main/java/com/stripe/param/CustomerCashBalanceTransactionCollectionListParams.java b/src/main/java/com/stripe/param/CustomerCashBalanceTransactionCollectionListParams.java new file mode 100644 index 00000000000..fa998092639 --- /dev/null +++ b/src/main/java/com/stripe/param/CustomerCashBalanceTransactionCollectionListParams.java @@ -0,0 +1,170 @@ +// File generated from our OpenAPI spec +package com.stripe.param; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class CustomerCashBalanceTransactionCollectionListParams extends ApiRequestParams { + /** + * A cursor for use in pagination. {@code ending_before} is an object ID that defines your place + * in the list. For instance, if you make a list request and receive 100 objects, starting with + * {@code obj_bar}, your subsequent call can include {@code ending_before=obj_bar} in order to + * fetch the previous page of the list. + */ + @SerializedName("ending_before") + String endingBefore; + + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * A limit on the number of objects to be returned. Limit can range between 1 and 100, and the + * default is 10. + */ + @SerializedName("limit") + Long limit; + + /** + * A cursor for use in pagination. {@code starting_after} is an object ID that defines your place + * in the list. For instance, if you make a list request and receive 100 objects, ending with + * {@code obj_foo}, your subsequent call can include {@code starting_after=obj_foo} in order to + * fetch the next page of the list. + */ + @SerializedName("starting_after") + String startingAfter; + + private CustomerCashBalanceTransactionCollectionListParams( + String endingBefore, + List expand, + Map extraParams, + Long limit, + String startingAfter) { + this.endingBefore = endingBefore; + this.expand = expand; + this.extraParams = extraParams; + this.limit = limit; + this.startingAfter = startingAfter; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String endingBefore; + + private List expand; + + private Map extraParams; + + private Long limit; + + private String startingAfter; + + /** Finalize and obtain parameter instance from this builder. */ + public CustomerCashBalanceTransactionCollectionListParams build() { + return new CustomerCashBalanceTransactionCollectionListParams( + this.endingBefore, this.expand, this.extraParams, this.limit, this.startingAfter); + } + + /** + * A cursor for use in pagination. {@code ending_before} is an object ID that defines your place + * in the list. For instance, if you make a list request and receive 100 objects, starting with + * {@code obj_bar}, your subsequent call can include {@code ending_before=obj_bar} in order to + * fetch the previous page of the list. + */ + public Builder setEndingBefore(String endingBefore) { + this.endingBefore = endingBefore; + return this; + } + + /** + * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * CustomerCashBalanceTransactionCollectionListParams#expand} for the field documentation. + */ + public Builder addExpand(String element) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.add(element); + return this; + } + + /** + * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * CustomerCashBalanceTransactionCollectionListParams#expand} for the field documentation. + */ + public Builder addAllExpand(List elements) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.addAll(elements); + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * CustomerCashBalanceTransactionCollectionListParams#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 CustomerCashBalanceTransactionCollectionListParams#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * A limit on the number of objects to be returned. Limit can range between 1 and 100, and the + * default is 10. + */ + public Builder setLimit(Long limit) { + this.limit = limit; + return this; + } + + /** + * A cursor for use in pagination. {@code starting_after} is an object ID that defines your + * place in the list. For instance, if you make a list request and receive 100 objects, ending + * with {@code obj_foo}, your subsequent call can include {@code starting_after=obj_foo} in + * order to fetch the next page of the list. + */ + public Builder setStartingAfter(String startingAfter) { + this.startingAfter = startingAfter; + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/CustomerCashBalanceTransactionCollectionRetrieveParams.java b/src/main/java/com/stripe/param/CustomerCashBalanceTransactionCollectionRetrieveParams.java new file mode 100644 index 00000000000..1a6ec9a2868 --- /dev/null +++ b/src/main/java/com/stripe/param/CustomerCashBalanceTransactionCollectionRetrieveParams.java @@ -0,0 +1,102 @@ +// File generated from our OpenAPI spec +package com.stripe.param; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.Getter; + +@Getter +public class CustomerCashBalanceTransactionCollectionRetrieveParams extends ApiRequestParams { + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private CustomerCashBalanceTransactionCollectionRetrieveParams( + List expand, Map extraParams) { + this.expand = expand; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List expand; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public CustomerCashBalanceTransactionCollectionRetrieveParams build() { + return new CustomerCashBalanceTransactionCollectionRetrieveParams( + this.expand, this.extraParams); + } + + /** + * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * CustomerCashBalanceTransactionCollectionRetrieveParams#expand} for the field documentation. + */ + public Builder addExpand(String element) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.add(element); + return this; + } + + /** + * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * CustomerCashBalanceTransactionCollectionRetrieveParams#expand} for the field documentation. + */ + public Builder addAllExpand(List elements) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.addAll(elements); + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * CustomerCashBalanceTransactionCollectionRetrieveParams#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 CustomerCashBalanceTransactionCollectionRetrieveParams#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/PaymentMethodCreateParams.java b/src/main/java/com/stripe/param/PaymentMethodCreateParams.java index e83ef8dd67b..d0142bd6677 100644 --- a/src/main/java/com/stripe/param/PaymentMethodCreateParams.java +++ b/src/main/java/com/stripe/param/PaymentMethodCreateParams.java @@ -1839,72 +1839,6 @@ public Builder setNumber(String number) { } } - @Getter - public static class Token { - /** - * 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; - - @SerializedName("token") - String token; - - private Token(Map extraParams, String token) { - this.extraParams = extraParams; - this.token = token; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Map extraParams; - - private String token; - - /** Finalize and obtain parameter instance from this builder. */ - public Token build() { - return new Token(this.extraParams, this.token); - } - - /** - * 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 - * PaymentMethodCreateParams.Token#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 PaymentMethodCreateParams.Token#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 Builder setToken(String token) { - this.token = token; - return this; - } - } - } - @Getter public static class CustomerBalance { /** @@ -3399,6 +3333,72 @@ public enum Country implements ApiRequestParams.EnumParam { } } + @Getter + public static class Token { + /** + * 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; + + @SerializedName("token") + String token; + + private Token(Map extraParams, String token) { + this.extraParams = extraParams; + this.token = token; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String token; + + /** Finalize and obtain parameter instance from this builder. */ + public Token build() { + return new Token(this.extraParams, this.token); + } + + /** + * 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 + * PaymentMethodCreateParams.Token#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 PaymentMethodCreateParams.Token#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 Builder setToken(String token) { + this.token = token; + return this; + } + } + } + @Getter public static class UsBankAccount { /** Account holder type: individual or company. */ diff --git a/src/main/java/com/stripe/param/SetupIntentConfirmParams.java b/src/main/java/com/stripe/param/SetupIntentConfirmParams.java index 03703ab0817..f40e868275e 100644 --- a/src/main/java/com/stripe/param/SetupIntentConfirmParams.java +++ b/src/main/java/com/stripe/param/SetupIntentConfirmParams.java @@ -4692,6 +4692,13 @@ public static class Card { @SerializedName("moto") Boolean moto; + /** + * Selected network to process this SetupIntent on. Depends on the available networks of the + * card attached to the SetupIntent. Can be only set confirm-time. + */ + @SerializedName("network") + Network network; + /** * We strongly recommend that you rely on our SCA Engine to automatically prompt your * customers for authentication based on risk level and extraParams, MandateOptions mandateOptions, Boolean moto, + Network network, RequestThreeDSecure requestThreeDSecure) { this.extraParams = extraParams; this.mandateOptions = mandateOptions; this.moto = moto; + this.network = network; this.requestThreeDSecure = requestThreeDSecure; } @@ -4728,12 +4737,18 @@ public static class Builder { private Boolean moto; + private Network network; + private RequestThreeDSecure requestThreeDSecure; /** Finalize and obtain parameter instance from this builder. */ public Card build() { return new Card( - this.extraParams, this.mandateOptions, this.moto, this.requestThreeDSecure); + this.extraParams, + this.mandateOptions, + this.moto, + this.network, + this.requestThreeDSecure); } /** @@ -4780,6 +4795,15 @@ public Builder setMoto(Boolean moto) { return this; } + /** + * Selected network to process this SetupIntent on. Depends on the available networks of the + * card attached to the SetupIntent. Can be only set confirm-time. + */ + public Builder setNetwork(Network network) { + this.network = network; + return this; + } + /** * We strongly recommend that you rely on our SCA Engine to automatically prompt your * customers for authentication based on risk level and extraParams, MandateOptions mandateOptions, Boolean moto, + Network network, RequestThreeDSecure requestThreeDSecure) { this.extraParams = extraParams; this.mandateOptions = mandateOptions; this.moto = moto; + this.network = network; this.requestThreeDSecure = requestThreeDSecure; } @@ -5003,12 +5012,18 @@ public static class Builder { private Boolean moto; + private Network network; + private RequestThreeDSecure requestThreeDSecure; /** Finalize and obtain parameter instance from this builder. */ public Card build() { return new Card( - this.extraParams, this.mandateOptions, this.moto, this.requestThreeDSecure); + this.extraParams, + this.mandateOptions, + this.moto, + this.network, + this.requestThreeDSecure); } /** @@ -5055,6 +5070,15 @@ public Builder setMoto(Boolean moto) { return this; } + /** + * Selected network to process this SetupIntent on. Depends on the available networks of the + * card attached to the SetupIntent. Can be only set confirm-time. + */ + public Builder setNetwork(Network network) { + this.network = network; + return this; + } + /** * We strongly recommend that you rely on our SCA Engine to automatically prompt your * customers for authentication based on risk level and extraParams, MandateOptions mandateOptions, Boolean moto, + Network network, RequestThreeDSecure requestThreeDSecure) { this.extraParams = extraParams; this.mandateOptions = mandateOptions; this.moto = moto; + this.network = network; this.requestThreeDSecure = requestThreeDSecure; } @@ -4720,12 +4729,18 @@ public static class Builder { private Boolean moto; + private Network network; + private RequestThreeDSecure requestThreeDSecure; /** Finalize and obtain parameter instance from this builder. */ public Card build() { return new Card( - this.extraParams, this.mandateOptions, this.moto, this.requestThreeDSecure); + this.extraParams, + this.mandateOptions, + this.moto, + this.network, + this.requestThreeDSecure); } /** @@ -4772,6 +4787,15 @@ public Builder setMoto(Boolean moto) { return this; } + /** + * Selected network to process this SetupIntent on. Depends on the available networks of the + * card attached to the SetupIntent. Can be only set confirm-time. + */ + public Builder setNetwork(Network network) { + this.network = network; + return this; + } + /** * We strongly recommend that you rely on our SCA Engine to automatically prompt your * customers for authentication based on risk level and extraParams, MandateOptions mandateOptions, + Network network, RequestThreeDSecure requestThreeDSecure) { this.extraParams = extraParams; this.mandateOptions = mandateOptions; + this.network = network; this.requestThreeDSecure = requestThreeDSecure; } @@ -2869,11 +2878,14 @@ public static class Builder { private MandateOptions mandateOptions; + private Network network; + private RequestThreeDSecure requestThreeDSecure; /** Finalize and obtain parameter instance from this builder. */ public Card build() { - return new Card(this.extraParams, this.mandateOptions, this.requestThreeDSecure); + return new Card( + this.extraParams, this.mandateOptions, this.network, this.requestThreeDSecure); } /** @@ -2912,6 +2924,15 @@ public Builder setMandateOptions(MandateOptions mandateOptions) { return this; } + /** + * Selected network to process this Subscription on. Depends on the available networks of + * the card attached to the Subscription. Can be only set confirm-time. + */ + public Builder setNetwork(Network network) { + this.network = network; + return this; + } + /** * We strongly recommend that you rely on our SCA Engine to automatically prompt your * customers for authentication based on risk level and extraParams, MandateOptions mandateOptions, + Network network, RequestThreeDSecure requestThreeDSecure) { this.extraParams = extraParams; this.mandateOptions = mandateOptions; + this.network = network; this.requestThreeDSecure = requestThreeDSecure; } @@ -3168,11 +3177,14 @@ public static class Builder { private MandateOptions mandateOptions; + private Network network; + private RequestThreeDSecure requestThreeDSecure; /** Finalize and obtain parameter instance from this builder. */ public Card build() { - return new Card(this.extraParams, this.mandateOptions, this.requestThreeDSecure); + return new Card( + this.extraParams, this.mandateOptions, this.network, this.requestThreeDSecure); } /** @@ -3211,6 +3223,15 @@ public Builder setMandateOptions(MandateOptions mandateOptions) { return this; } + /** + * Selected network to process this Subscription on. Depends on the available networks of + * the card attached to the Subscription. Can be only set confirm-time. + */ + public Builder setNetwork(Network network) { + this.network = network; + return this; + } + /** * We strongly recommend that you rely on our SCA Engine to automatically prompt your * customers for authentication based on risk level and