diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 8110841c8f5..604997fea3a 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2202 \ No newline at end of file +v2203 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/PaymentIntent.java b/src/main/java/com/stripe/model/PaymentIntent.java index 0aaada7a907..6d26907bbe9 100644 --- a/src/main/java/com/stripe/model/PaymentIntent.java +++ b/src/main/java/com/stripe/model/PaymentIntent.java @@ -20,6 +20,7 @@ import com.stripe.param.PaymentIntentReauthorizeParams; import com.stripe.param.PaymentIntentRetrieveParams; import com.stripe.param.PaymentIntentSearchParams; +import com.stripe.param.PaymentIntentSimulateCryptoDepositParams; import com.stripe.param.PaymentIntentTriggerActionParams; import com.stripe.param.PaymentIntentUpdateParams; import com.stripe.param.PaymentIntentVerifyMicrodepositsParams; @@ -2113,6 +2114,9 @@ public static class NextAction extends StripeObject { @SerializedName("cashapp_handle_redirect_or_display_qr_code") CashappHandleRedirectOrDisplayQrCode cashappHandleRedirectOrDisplayQrCode; + @SerializedName("crypto_display_details") + CryptoDisplayDetails cryptoDisplayDetails; + @SerializedName("display_bank_transfer_instructions") DisplayBankTransferInstructions displayBankTransferInstructions; @@ -2298,6 +2302,162 @@ public static class QrCode extends StripeObject { } } + /** + * For more details about CryptoDisplayDetails, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class CryptoDisplayDetails extends StripeObject { + @SerializedName("deposit_addresses") + DepositAddresses depositAddresses; + + /** + * For more details about DepositAddresses, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class DepositAddresses extends StripeObject { + @SerializedName("base") + Base base; + + @SerializedName("solana") + Solana solana; + + @SerializedName("tempo") + Tempo tempo; + + /** + * For more details about Base, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Base extends StripeObject { + /** Address of the deposit address. */ + @SerializedName("address") + String address; + + /** The token currencies supported on this network. */ + @SerializedName("supported_tokens") + List + supportedTokens; + + /** + * For more details about SupportedToken, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class SupportedToken extends StripeObject { + /** + * The on-chain contract address for the supported token currency on this specific + * network. + */ + @SerializedName("token_contract_address") + String tokenContractAddress; + + /** + * The supported token currency. Supported token currencies include: {@code usdc}. + * + *

Equal to {@code usdc}. + */ + @SerializedName("token_currency") + String tokenCurrency; + } + } + + /** + * For more details about Solana, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Solana extends StripeObject { + /** Address of the deposit address. */ + @SerializedName("address") + String address; + + /** The token currencies supported on this network. */ + @SerializedName("supported_tokens") + List + supportedTokens; + + /** + * For more details about SupportedToken, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class SupportedToken extends StripeObject { + /** + * The on-chain contract address for the supported token currency on this specific + * network. + */ + @SerializedName("token_contract_address") + String tokenContractAddress; + + /** + * The supported token currency. Supported token currencies include: {@code usdc}. + * + *

Equal to {@code usdc}. + */ + @SerializedName("token_currency") + String tokenCurrency; + } + } + + /** + * For more details about Tempo, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Tempo extends StripeObject { + /** Address of the deposit address. */ + @SerializedName("address") + String address; + + /** The token currencies supported on this network. */ + @SerializedName("supported_tokens") + List + supportedTokens; + + /** + * For more details about SupportedToken, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class SupportedToken extends StripeObject { + /** + * The on-chain contract address for the supported token currency on this specific + * network. + */ + @SerializedName("token_contract_address") + String tokenContractAddress; + + /** + * The supported token currency. Supported token currencies include: {@code usdc}. + * + *

Equal to {@code usdc}. + */ + @SerializedName("token_currency") + String tokenCurrency; + } + } + } + } + /** * For more details about DisplayBankTransferInstructions, please refer to the API Reference. @@ -5718,6 +5878,17 @@ public static class Cashapp extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Crypto extends StripeObject { + @SerializedName("deposit_options") + DepositOptions depositOptions; + + /** + * The mode of the crypto payment. + * + *

One of {@code default}, or {@code deposit}. + */ + @SerializedName("mode") + String mode; + /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. * @@ -5741,6 +5912,23 @@ public static class Crypto extends StripeObject { */ @SerializedName("setup_future_usage") String setupFutureUsage; + + /** + * For more details about DepositOptions, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class DepositOptions extends StripeObject { + /** + * The blockchain networks to support for deposits. Learn more about supported + * networks and tokens. + */ + @SerializedName("networks") + List networks; + } } /** @@ -7771,6 +7959,84 @@ public void setDestinationObject(Account expandableObject) { } } + public TestHelpers getTestHelpers() { + return new TestHelpers(this); + } + + public static class TestHelpers { + private final PaymentIntent resource; + + private TestHelpers(PaymentIntent resource) { + this.resource = resource; + } + + /** + * Simulate an incoming crypto deposit for a testmode PaymentIntent with {@code + * payment_method_options[crypto][mode]=deposit}. The {@code transaction_hash} parameter + * determines whether the simulated deposit succeeds or fails. Learn more about testing + * your integration. + */ + public PaymentIntent simulateCryptoDeposit(Map params) throws StripeException { + return simulateCryptoDeposit(params, (RequestOptions) null); + } + + /** + * Simulate an incoming crypto deposit for a testmode PaymentIntent with {@code + * payment_method_options[crypto][mode]=deposit}. The {@code transaction_hash} parameter + * determines whether the simulated deposit succeeds or fails. Learn more about testing + * your integration. + */ + public PaymentIntent simulateCryptoDeposit(Map params, RequestOptions options) + throws StripeException { + String path = + String.format( + "/v1/test_helpers/payment_intents/%s/simulate_crypto_deposit", + ApiResource.urlEncodeId(this.resource.getId())); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); + return resource.getResponseGetter().request(request, PaymentIntent.class); + } + + /** + * Simulate an incoming crypto deposit for a testmode PaymentIntent with {@code + * payment_method_options[crypto][mode]=deposit}. The {@code transaction_hash} parameter + * determines whether the simulated deposit succeeds or fails. Learn more about testing + * your integration. + */ + public PaymentIntent simulateCryptoDeposit(PaymentIntentSimulateCryptoDepositParams params) + throws StripeException { + return simulateCryptoDeposit(params, (RequestOptions) null); + } + + /** + * Simulate an incoming crypto deposit for a testmode PaymentIntent with {@code + * payment_method_options[crypto][mode]=deposit}. The {@code transaction_hash} parameter + * determines whether the simulated deposit succeeds or fails. Learn more about testing + * your integration. + */ + public PaymentIntent simulateCryptoDeposit( + PaymentIntentSimulateCryptoDepositParams params, RequestOptions options) + throws StripeException { + String path = + String.format( + "/v1/test_helpers/payment_intents/%s/simulate_crypto_deposit", + ApiResource.urlEncodeId(this.resource.getId())); + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return resource.getResponseGetter().request(request, PaymentIntent.class); + } + } + @Override public void setResponseGetter(StripeResponseGetter responseGetter) { super.setResponseGetter(responseGetter); diff --git a/src/main/java/com/stripe/param/PaymentIntentConfirmParams.java b/src/main/java/com/stripe/param/PaymentIntentConfirmParams.java index c2ff41d2a75..e665e74e32d 100644 --- a/src/main/java/com/stripe/param/PaymentIntentConfirmParams.java +++ b/src/main/java/com/stripe/param/PaymentIntentConfirmParams.java @@ -27304,6 +27304,10 @@ public enum SetupFutureUsage implements ApiRequestParams.EnumParam { @Getter @EqualsAndHashCode(callSuper = false) public static class Crypto { + /** Specific configuration for this PaymentIntent when the mode is {@code deposit}. */ + @SerializedName("deposit_options") + DepositOptions depositOptions; + /** * 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. @@ -27313,6 +27317,10 @@ public static class Crypto { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; + /** The mode of the crypto payment. */ + @SerializedName("mode") + Mode mode; + /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. * @@ -27339,8 +27347,14 @@ public static class Crypto { @SerializedName("setup_future_usage") SetupFutureUsage setupFutureUsage; - private Crypto(Map extraParams, SetupFutureUsage setupFutureUsage) { + private Crypto( + DepositOptions depositOptions, + Map extraParams, + Mode mode, + SetupFutureUsage setupFutureUsage) { + this.depositOptions = depositOptions; this.extraParams = extraParams; + this.mode = mode; this.setupFutureUsage = setupFutureUsage; } @@ -27349,14 +27363,25 @@ public static Builder builder() { } public static class Builder { + private DepositOptions depositOptions; + private Map extraParams; + private Mode mode; + private SetupFutureUsage setupFutureUsage; /** Finalize and obtain parameter instance from this builder. */ public PaymentIntentConfirmParams.PaymentMethodOptions.Crypto build() { return new PaymentIntentConfirmParams.PaymentMethodOptions.Crypto( - this.extraParams, this.setupFutureUsage); + this.depositOptions, this.extraParams, this.mode, this.setupFutureUsage); + } + + /** Specific configuration for this PaymentIntent when the mode is {@code deposit}. */ + public Builder setDepositOptions( + PaymentIntentConfirmParams.PaymentMethodOptions.Crypto.DepositOptions depositOptions) { + this.depositOptions = depositOptions; + return this; } /** @@ -27387,6 +27412,12 @@ public Builder putAllExtraParam(Map map) { return this; } + /** The mode of the crypto payment. */ + public Builder setMode(PaymentIntentConfirmParams.PaymentMethodOptions.Crypto.Mode mode) { + this.mode = mode; + return this; + } + /** * Indicates that you intend to make future payments with this PaymentIntent's payment * method. @@ -27419,6 +27450,151 @@ public Builder setSetupFutureUsage( } } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class DepositOptions { + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field + * (serialized) name in this param object. Effectively, this map is flattened to its parent + * instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. The blockchain networks to support for deposits. Learn more + * about supported + * networks and tokens. + */ + @SerializedName("networks") + List + networks; + + private DepositOptions( + Map extraParams, + List + networks) { + this.extraParams = extraParams; + this.networks = networks; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private List< + PaymentIntentConfirmParams.PaymentMethodOptions.Crypto.DepositOptions.Network> + networks; + + /** Finalize and obtain parameter instance from this builder. */ + public PaymentIntentConfirmParams.PaymentMethodOptions.Crypto.DepositOptions build() { + return new PaymentIntentConfirmParams.PaymentMethodOptions.Crypto.DepositOptions( + this.extraParams, this.networks); + } + + /** + * 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 + * PaymentIntentConfirmParams.PaymentMethodOptions.Crypto.DepositOptions#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 + * PaymentIntentConfirmParams.PaymentMethodOptions.Crypto.DepositOptions#extraParams} for + * the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Add an element to `networks` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * PaymentIntentConfirmParams.PaymentMethodOptions.Crypto.DepositOptions#networks} for the + * field documentation. + */ + public Builder addNetwork( + PaymentIntentConfirmParams.PaymentMethodOptions.Crypto.DepositOptions.Network + element) { + if (this.networks == null) { + this.networks = new ArrayList<>(); + } + this.networks.add(element); + return this; + } + + /** + * Add all elements to `networks` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * PaymentIntentConfirmParams.PaymentMethodOptions.Crypto.DepositOptions#networks} for the + * field documentation. + */ + public Builder addAllNetwork( + List + elements) { + if (this.networks == null) { + this.networks = new ArrayList<>(); + } + this.networks.addAll(elements); + return this; + } + } + + public enum Network implements ApiRequestParams.EnumParam { + @SerializedName("base") + BASE("base"), + + @SerializedName("solana") + SOLANA("solana"), + + @SerializedName("tempo") + TEMPO("tempo"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Network(String value) { + this.value = value; + } + } + } + + public enum Mode implements ApiRequestParams.EnumParam { + @SerializedName("default") + DEFAULT("default"), + + @SerializedName("deposit") + DEPOSIT("deposit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Mode(String value) { + this.value = value; + } + } + public enum SetupFutureUsage implements ApiRequestParams.EnumParam { @SerializedName("none") NONE("none"); diff --git a/src/main/java/com/stripe/param/PaymentIntentCreateParams.java b/src/main/java/com/stripe/param/PaymentIntentCreateParams.java index ed68eaf15ad..97820a0f76a 100644 --- a/src/main/java/com/stripe/param/PaymentIntentCreateParams.java +++ b/src/main/java/com/stripe/param/PaymentIntentCreateParams.java @@ -27800,6 +27800,10 @@ public enum SetupFutureUsage implements ApiRequestParams.EnumParam { @Getter @EqualsAndHashCode(callSuper = false) public static class Crypto { + /** Specific configuration for this PaymentIntent when the mode is {@code deposit}. */ + @SerializedName("deposit_options") + DepositOptions depositOptions; + /** * 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. @@ -27809,6 +27813,10 @@ public static class Crypto { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; + /** The mode of the crypto payment. */ + @SerializedName("mode") + Mode mode; + /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. * @@ -27835,8 +27843,14 @@ public static class Crypto { @SerializedName("setup_future_usage") SetupFutureUsage setupFutureUsage; - private Crypto(Map extraParams, SetupFutureUsage setupFutureUsage) { + private Crypto( + DepositOptions depositOptions, + Map extraParams, + Mode mode, + SetupFutureUsage setupFutureUsage) { + this.depositOptions = depositOptions; this.extraParams = extraParams; + this.mode = mode; this.setupFutureUsage = setupFutureUsage; } @@ -27845,14 +27859,25 @@ public static Builder builder() { } public static class Builder { + private DepositOptions depositOptions; + private Map extraParams; + private Mode mode; + private SetupFutureUsage setupFutureUsage; /** Finalize and obtain parameter instance from this builder. */ public PaymentIntentCreateParams.PaymentMethodOptions.Crypto build() { return new PaymentIntentCreateParams.PaymentMethodOptions.Crypto( - this.extraParams, this.setupFutureUsage); + this.depositOptions, this.extraParams, this.mode, this.setupFutureUsage); + } + + /** Specific configuration for this PaymentIntent when the mode is {@code deposit}. */ + public Builder setDepositOptions( + PaymentIntentCreateParams.PaymentMethodOptions.Crypto.DepositOptions depositOptions) { + this.depositOptions = depositOptions; + return this; } /** @@ -27883,6 +27908,12 @@ public Builder putAllExtraParam(Map map) { return this; } + /** The mode of the crypto payment. */ + public Builder setMode(PaymentIntentCreateParams.PaymentMethodOptions.Crypto.Mode mode) { + this.mode = mode; + return this; + } + /** * Indicates that you intend to make future payments with this PaymentIntent's payment * method. @@ -27915,6 +27946,149 @@ public Builder setSetupFutureUsage( } } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class DepositOptions { + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field + * (serialized) name in this param object. Effectively, this map is flattened to its parent + * instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. The blockchain networks to support for deposits. Learn more + * about supported + * networks and tokens. + */ + @SerializedName("networks") + List networks; + + private DepositOptions( + Map extraParams, + List + networks) { + this.extraParams = extraParams; + this.networks = networks; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private List + networks; + + /** Finalize and obtain parameter instance from this builder. */ + public PaymentIntentCreateParams.PaymentMethodOptions.Crypto.DepositOptions build() { + return new PaymentIntentCreateParams.PaymentMethodOptions.Crypto.DepositOptions( + this.extraParams, this.networks); + } + + /** + * 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 + * PaymentIntentCreateParams.PaymentMethodOptions.Crypto.DepositOptions#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 + * PaymentIntentCreateParams.PaymentMethodOptions.Crypto.DepositOptions#extraParams} for + * the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Add an element to `networks` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * PaymentIntentCreateParams.PaymentMethodOptions.Crypto.DepositOptions#networks} for the + * field documentation. + */ + public Builder addNetwork( + PaymentIntentCreateParams.PaymentMethodOptions.Crypto.DepositOptions.Network + element) { + if (this.networks == null) { + this.networks = new ArrayList<>(); + } + this.networks.add(element); + return this; + } + + /** + * Add all elements to `networks` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * PaymentIntentCreateParams.PaymentMethodOptions.Crypto.DepositOptions#networks} for the + * field documentation. + */ + public Builder addAllNetwork( + List + elements) { + if (this.networks == null) { + this.networks = new ArrayList<>(); + } + this.networks.addAll(elements); + return this; + } + } + + public enum Network implements ApiRequestParams.EnumParam { + @SerializedName("base") + BASE("base"), + + @SerializedName("solana") + SOLANA("solana"), + + @SerializedName("tempo") + TEMPO("tempo"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Network(String value) { + this.value = value; + } + } + } + + public enum Mode implements ApiRequestParams.EnumParam { + @SerializedName("default") + DEFAULT("default"), + + @SerializedName("deposit") + DEPOSIT("deposit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Mode(String value) { + this.value = value; + } + } + public enum SetupFutureUsage implements ApiRequestParams.EnumParam { @SerializedName("none") NONE("none"); diff --git a/src/main/java/com/stripe/param/PaymentIntentSimulateCryptoDepositParams.java b/src/main/java/com/stripe/param/PaymentIntentSimulateCryptoDepositParams.java new file mode 100644 index 00000000000..3b044e82613 --- /dev/null +++ b/src/main/java/com/stripe/param/PaymentIntentSimulateCryptoDepositParams.java @@ -0,0 +1,207 @@ +// 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.EqualsAndHashCode; +import lombok.Getter; + +@Getter +@EqualsAndHashCode(callSuper = false) +public class PaymentIntentSimulateCryptoDepositParams extends ApiRequestParams { + /** + * Required. The buyer's wallet address from which the crypto deposit is + * originating. + */ + @SerializedName("buyer_wallet") + String buyerWallet; + + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** Required. The blockchain network of the simulated crypto deposit. */ + @SerializedName("network") + Network network; + + /** Required. The token currency of the simulated crypto deposit. */ + @SerializedName("token_currency") + TokenCurrency tokenCurrency; + + /** + * Required. A testmode transaction hash that determines the outcome of the + * simulated deposit. + */ + @SerializedName("transaction_hash") + String transactionHash; + + private PaymentIntentSimulateCryptoDepositParams( + String buyerWallet, + List expand, + Map extraParams, + Network network, + TokenCurrency tokenCurrency, + String transactionHash) { + this.buyerWallet = buyerWallet; + this.expand = expand; + this.extraParams = extraParams; + this.network = network; + this.tokenCurrency = tokenCurrency; + this.transactionHash = transactionHash; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String buyerWallet; + + private List expand; + + private Map extraParams; + + private Network network; + + private TokenCurrency tokenCurrency; + + private String transactionHash; + + /** Finalize and obtain parameter instance from this builder. */ + public PaymentIntentSimulateCryptoDepositParams build() { + return new PaymentIntentSimulateCryptoDepositParams( + this.buyerWallet, + this.expand, + this.extraParams, + this.network, + this.tokenCurrency, + this.transactionHash); + } + + /** + * Required. The buyer's wallet address from which the crypto deposit is + * originating. + */ + public Builder setBuyerWallet(String buyerWallet) { + this.buyerWallet = buyerWallet; + 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 + * PaymentIntentSimulateCryptoDepositParams#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 + * PaymentIntentSimulateCryptoDepositParams#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 + * PaymentIntentSimulateCryptoDepositParams#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 PaymentIntentSimulateCryptoDepositParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Required. The blockchain network of the simulated crypto deposit. */ + public Builder setNetwork(PaymentIntentSimulateCryptoDepositParams.Network network) { + this.network = network; + return this; + } + + /** Required. The token currency of the simulated crypto deposit. */ + public Builder setTokenCurrency( + PaymentIntentSimulateCryptoDepositParams.TokenCurrency tokenCurrency) { + this.tokenCurrency = tokenCurrency; + return this; + } + + /** + * Required. A testmode transaction hash that determines the outcome of the + * simulated deposit. + */ + public Builder setTransactionHash(String transactionHash) { + this.transactionHash = transactionHash; + return this; + } + } + + public enum Network implements ApiRequestParams.EnumParam { + @SerializedName("base") + BASE("base"), + + @SerializedName("solana") + SOLANA("solana"), + + @SerializedName("tempo") + TEMPO("tempo"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Network(String value) { + this.value = value; + } + } + + public enum TokenCurrency implements ApiRequestParams.EnumParam { + @SerializedName("usdc") + USDC("usdc"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + TokenCurrency(String value) { + this.value = value; + } + } +} diff --git a/src/main/java/com/stripe/param/PaymentIntentUpdateParams.java b/src/main/java/com/stripe/param/PaymentIntentUpdateParams.java index 8e43294ba2f..478aae19285 100644 --- a/src/main/java/com/stripe/param/PaymentIntentUpdateParams.java +++ b/src/main/java/com/stripe/param/PaymentIntentUpdateParams.java @@ -28898,6 +28898,10 @@ public enum SetupFutureUsage implements ApiRequestParams.EnumParam { @Getter @EqualsAndHashCode(callSuper = false) public static class Crypto { + /** Specific configuration for this PaymentIntent when the mode is {@code deposit}. */ + @SerializedName("deposit_options") + DepositOptions depositOptions; + /** * 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. @@ -28907,6 +28911,10 @@ public static class Crypto { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; + /** The mode of the crypto payment. */ + @SerializedName("mode") + Mode mode; + /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. * @@ -28933,8 +28941,14 @@ public static class Crypto { @SerializedName("setup_future_usage") SetupFutureUsage setupFutureUsage; - private Crypto(Map extraParams, SetupFutureUsage setupFutureUsage) { + private Crypto( + DepositOptions depositOptions, + Map extraParams, + Mode mode, + SetupFutureUsage setupFutureUsage) { + this.depositOptions = depositOptions; this.extraParams = extraParams; + this.mode = mode; this.setupFutureUsage = setupFutureUsage; } @@ -28943,14 +28957,25 @@ public static Builder builder() { } public static class Builder { + private DepositOptions depositOptions; + private Map extraParams; + private Mode mode; + private SetupFutureUsage setupFutureUsage; /** Finalize and obtain parameter instance from this builder. */ public PaymentIntentUpdateParams.PaymentMethodOptions.Crypto build() { return new PaymentIntentUpdateParams.PaymentMethodOptions.Crypto( - this.extraParams, this.setupFutureUsage); + this.depositOptions, this.extraParams, this.mode, this.setupFutureUsage); + } + + /** Specific configuration for this PaymentIntent when the mode is {@code deposit}. */ + public Builder setDepositOptions( + PaymentIntentUpdateParams.PaymentMethodOptions.Crypto.DepositOptions depositOptions) { + this.depositOptions = depositOptions; + return this; } /** @@ -28981,6 +29006,12 @@ public Builder putAllExtraParam(Map map) { return this; } + /** The mode of the crypto payment. */ + public Builder setMode(PaymentIntentUpdateParams.PaymentMethodOptions.Crypto.Mode mode) { + this.mode = mode; + return this; + } + /** * Indicates that you intend to make future payments with this PaymentIntent's payment * method. @@ -29013,6 +29044,149 @@ public Builder setSetupFutureUsage( } } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class DepositOptions { + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field + * (serialized) name in this param object. Effectively, this map is flattened to its parent + * instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. The blockchain networks to support for deposits. Learn more + * about supported + * networks and tokens. + */ + @SerializedName("networks") + List networks; + + private DepositOptions( + Map extraParams, + List + networks) { + this.extraParams = extraParams; + this.networks = networks; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private List + networks; + + /** Finalize and obtain parameter instance from this builder. */ + public PaymentIntentUpdateParams.PaymentMethodOptions.Crypto.DepositOptions build() { + return new PaymentIntentUpdateParams.PaymentMethodOptions.Crypto.DepositOptions( + this.extraParams, this.networks); + } + + /** + * 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 + * PaymentIntentUpdateParams.PaymentMethodOptions.Crypto.DepositOptions#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 + * PaymentIntentUpdateParams.PaymentMethodOptions.Crypto.DepositOptions#extraParams} for + * the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Add an element to `networks` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * PaymentIntentUpdateParams.PaymentMethodOptions.Crypto.DepositOptions#networks} for the + * field documentation. + */ + public Builder addNetwork( + PaymentIntentUpdateParams.PaymentMethodOptions.Crypto.DepositOptions.Network + element) { + if (this.networks == null) { + this.networks = new ArrayList<>(); + } + this.networks.add(element); + return this; + } + + /** + * Add all elements to `networks` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * PaymentIntentUpdateParams.PaymentMethodOptions.Crypto.DepositOptions#networks} for the + * field documentation. + */ + public Builder addAllNetwork( + List + elements) { + if (this.networks == null) { + this.networks = new ArrayList<>(); + } + this.networks.addAll(elements); + return this; + } + } + + public enum Network implements ApiRequestParams.EnumParam { + @SerializedName("base") + BASE("base"), + + @SerializedName("solana") + SOLANA("solana"), + + @SerializedName("tempo") + TEMPO("tempo"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Network(String value) { + this.value = value; + } + } + } + + public enum Mode implements ApiRequestParams.EnumParam { + @SerializedName("default") + DEFAULT("default"), + + @SerializedName("deposit") + DEPOSIT("deposit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Mode(String value) { + this.value = value; + } + } + public enum SetupFutureUsage implements ApiRequestParams.EnumParam { @SerializedName("none") NONE("none"); diff --git a/src/main/java/com/stripe/service/TestHelpersService.java b/src/main/java/com/stripe/service/TestHelpersService.java index 3d5347f3f08..8d770b77c45 100644 --- a/src/main/java/com/stripe/service/TestHelpersService.java +++ b/src/main/java/com/stripe/service/TestHelpersService.java @@ -25,6 +25,10 @@ public com.stripe.service.testhelpers.IssuingService issuing() { return new com.stripe.service.testhelpers.IssuingService(this.getResponseGetter()); } + public com.stripe.service.testhelpers.PaymentIntentService paymentIntents() { + return new com.stripe.service.testhelpers.PaymentIntentService(this.getResponseGetter()); + } + public com.stripe.service.testhelpers.RefundService refunds() { return new com.stripe.service.testhelpers.RefundService(this.getResponseGetter()); } diff --git a/src/main/java/com/stripe/service/testhelpers/PaymentIntentService.java b/src/main/java/com/stripe/service/testhelpers/PaymentIntentService.java new file mode 100644 index 00000000000..ff0558ad05a --- /dev/null +++ b/src/main/java/com/stripe/service/testhelpers/PaymentIntentService.java @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec +package com.stripe.service.testhelpers; + +import com.stripe.exception.StripeException; +import com.stripe.model.PaymentIntent; +import com.stripe.net.ApiRequest; +import com.stripe.net.ApiRequestParams; +import com.stripe.net.ApiResource; +import com.stripe.net.ApiService; +import com.stripe.net.BaseAddress; +import com.stripe.net.RequestOptions; +import com.stripe.net.StripeResponseGetter; +import com.stripe.param.PaymentIntentSimulateCryptoDepositParams; + +public final class PaymentIntentService extends ApiService { + public PaymentIntentService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + /** + * Simulate an incoming crypto deposit for a testmode PaymentIntent with {@code + * payment_method_options[crypto][mode]=deposit}. The {@code transaction_hash} parameter + * determines whether the simulated deposit succeeds or fails. Learn more about testing + * your integration. + */ + public PaymentIntent simulateCryptoDeposit( + String intent, PaymentIntentSimulateCryptoDepositParams params) throws StripeException { + return simulateCryptoDeposit(intent, params, (RequestOptions) null); + } + /** + * Simulate an incoming crypto deposit for a testmode PaymentIntent with {@code + * payment_method_options[crypto][mode]=deposit}. The {@code transaction_hash} parameter + * determines whether the simulated deposit succeeds or fails. Learn more about testing + * your integration. + */ + public PaymentIntent simulateCryptoDeposit( + String intent, PaymentIntentSimulateCryptoDepositParams params, RequestOptions options) + throws StripeException { + String path = + String.format( + "/v1/test_helpers/payment_intents/%s/simulate_crypto_deposit", + ApiResource.urlEncodeId(intent)); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, PaymentIntent.class); + } +}