From 3d1a3b5cf55292de1aa57fe0bbb63fa1897cb32e Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 26 Apr 2024 10:43:11 +0000 Subject: [PATCH] Update generated code for v994 --- OPENAPI_VERSION | 2 +- .../java/com/stripe/model/StripeError.java | 18 +- .../com/stripe/model/tax/Calculation.java | 48 +++ .../com/stripe/model/tax/Transaction.java | 48 +++ .../param/tax/CalculationCreateParams.java | 278 ++++++++++++++++++ 5 files changed, 384 insertions(+), 10 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 6eb80deb21c..02bc66ab1f5 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v992 \ No newline at end of file +v994 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/StripeError.java b/src/main/java/com/stripe/model/StripeError.java index 1777e91a739..2705d318e20 100644 --- a/src/main/java/com/stripe/model/StripeError.java +++ b/src/main/java/com/stripe/model/StripeError.java @@ -86,15 +86,15 @@ public class StripeError extends StripeObject { * {@code secret_key_required}, {@code sepa_unsupported_account}, {@code setup_attempt_failed}, * {@code setup_intent_authentication_failure}, {@code setup_intent_invalid_parameter}, {@code * setup_intent_mandate_invalid}, {@code setup_intent_setup_attempt_expired}, {@code - * setup_intent_unexpected_state}, {@code shipping_calculation_failed}, {@code sku_inactive}, - * {@code state_unsupported}, {@code status_transition_invalid}, {@code stripe_tax_inactive}, - * {@code tax_id_invalid}, {@code taxes_calculation_failed}, {@code - * terminal_location_country_unsupported}, {@code terminal_reader_busy}, {@code - * terminal_reader_hardware_fault}, {@code terminal_reader_offline}, {@code - * terminal_reader_timeout}, {@code testmode_charges_only}, {@code tls_version_unsupported}, - * {@code token_already_used}, {@code token_card_network_invalid}, {@code token_in_use}, {@code - * transfer_source_balance_parameters_mismatch}, {@code transfers_not_allowed}, or {@code - * url_invalid}. + * setup_intent_unexpected_state}, {@code shipping_address_invalid}, {@code + * shipping_calculation_failed}, {@code sku_inactive}, {@code state_unsupported}, {@code + * status_transition_invalid}, {@code stripe_tax_inactive}, {@code tax_id_invalid}, {@code + * taxes_calculation_failed}, {@code terminal_location_country_unsupported}, {@code + * terminal_reader_busy}, {@code terminal_reader_hardware_fault}, {@code terminal_reader_offline}, + * {@code terminal_reader_timeout}, {@code testmode_charges_only}, {@code + * tls_version_unsupported}, {@code token_already_used}, {@code token_card_network_invalid}, + * {@code token_in_use}, {@code transfer_source_balance_parameters_mismatch}, {@code + * transfers_not_allowed}, or {@code url_invalid}. */ @SerializedName("code") String code; diff --git a/src/main/java/com/stripe/model/tax/Calculation.java b/src/main/java/com/stripe/model/tax/Calculation.java index d7c5564208e..cedafa9df63 100644 --- a/src/main/java/com/stripe/model/tax/Calculation.java +++ b/src/main/java/com/stripe/model/tax/Calculation.java @@ -79,6 +79,10 @@ public class Calculation extends ApiResource implements HasId { @SerializedName("object") String object; + /** The details of the ship from location, such as the address. */ + @SerializedName("ship_from_details") + ShipFromDetails shipFromDetails; + /** The shipping cost details for the calculation. */ @SerializedName("shipping_cost") ShippingCost shippingCost; @@ -276,6 +280,49 @@ public static class TaxId extends StripeObject { } } + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ShipFromDetails extends StripeObject { + @SerializedName("address") + Address address; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Address extends StripeObject { + /** City, district, suburb, town, or village. */ + @SerializedName("city") + String city; + + /** + * Two-letter country code (ISO + * 3166-1 alpha-2). + */ + @SerializedName("country") + String country; + + /** Address line 1 (e.g., street, PO Box, or company name). */ + @SerializedName("line1") + String line1; + + /** Address line 2 (e.g., apartment, suite, unit, or building). */ + @SerializedName("line2") + String line2; + + /** ZIP or postal code. */ + @SerializedName("postal_code") + String postalCode; + + /** + * State/province as an ISO 3166-2 + * subdivision code, without country prefix. Example: "NY" or "TX". + */ + @SerializedName("state") + String state; + } + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -508,6 +555,7 @@ public void setResponseGetter(StripeResponseGetter responseGetter) { super.setResponseGetter(responseGetter); trySetResponseGetter(customerDetails, responseGetter); trySetResponseGetter(lineItems, responseGetter); + trySetResponseGetter(shipFromDetails, responseGetter); trySetResponseGetter(shippingCost, responseGetter); } } diff --git a/src/main/java/com/stripe/model/tax/Transaction.java b/src/main/java/com/stripe/model/tax/Transaction.java index 9c7eac7eb48..0676f03b719 100644 --- a/src/main/java/com/stripe/model/tax/Transaction.java +++ b/src/main/java/com/stripe/model/tax/Transaction.java @@ -93,6 +93,10 @@ public class Transaction extends ApiResource implements HasId { @SerializedName("reversal") Reversal reversal; + /** The details of the ship from location, such as the address. */ + @SerializedName("ship_from_details") + ShipFromDetails shipFromDetails; + /** The shipping cost details for the transaction. */ @SerializedName("shipping_cost") ShippingCost shippingCost; @@ -374,6 +378,49 @@ public static class Reversal extends StripeObject { String originalTransaction; } + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ShipFromDetails extends StripeObject { + @SerializedName("address") + Address address; + + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Address extends StripeObject { + /** City, district, suburb, town, or village. */ + @SerializedName("city") + String city; + + /** + * Two-letter country code (ISO + * 3166-1 alpha-2). + */ + @SerializedName("country") + String country; + + /** Address line 1 (e.g., street, PO Box, or company name). */ + @SerializedName("line1") + String line1; + + /** Address line 2 (e.g., apartment, suite, unit, or building). */ + @SerializedName("line2") + String line2; + + /** ZIP or postal code. */ + @SerializedName("postal_code") + String postalCode; + + /** + * State/province as an ISO 3166-2 + * subdivision code, without country prefix. Example: "NY" or "TX". + */ + @SerializedName("state") + String state; + } + } + @Getter @Setter @EqualsAndHashCode(callSuper = false) @@ -541,6 +588,7 @@ public void setResponseGetter(StripeResponseGetter responseGetter) { trySetResponseGetter(customerDetails, responseGetter); trySetResponseGetter(lineItems, responseGetter); trySetResponseGetter(reversal, responseGetter); + trySetResponseGetter(shipFromDetails, responseGetter); trySetResponseGetter(shippingCost, responseGetter); } } diff --git a/src/main/java/com/stripe/param/tax/CalculationCreateParams.java b/src/main/java/com/stripe/param/tax/CalculationCreateParams.java index 945e2668609..28af4eb1e7d 100644 --- a/src/main/java/com/stripe/param/tax/CalculationCreateParams.java +++ b/src/main/java/com/stripe/param/tax/CalculationCreateParams.java @@ -48,6 +48,10 @@ public class CalculationCreateParams extends ApiRequestParams { @SerializedName("line_items") List lineItems; + /** Details about the address from which the goods are being shipped. */ + @SerializedName("ship_from_details") + ShipFromDetails shipFromDetails; + /** Shipping cost details to be used for the calculation. */ @SerializedName("shipping_cost") ShippingCost shippingCost; @@ -67,6 +71,7 @@ private CalculationCreateParams( List expand, Map extraParams, List lineItems, + ShipFromDetails shipFromDetails, ShippingCost shippingCost, Long taxDate) { this.currency = currency; @@ -75,6 +80,7 @@ private CalculationCreateParams( this.expand = expand; this.extraParams = extraParams; this.lineItems = lineItems; + this.shipFromDetails = shipFromDetails; this.shippingCost = shippingCost; this.taxDate = taxDate; } @@ -96,6 +102,8 @@ public static class Builder { private List lineItems; + private ShipFromDetails shipFromDetails; + private ShippingCost shippingCost; private Long taxDate; @@ -109,6 +117,7 @@ public CalculationCreateParams build() { this.expand, this.extraParams, this.lineItems, + this.shipFromDetails, this.shippingCost, this.taxDate); } @@ -216,6 +225,12 @@ public Builder addAllLineItem(List elements) { return this; } + /** Details about the address from which the goods are being shipped. */ + public Builder setShipFromDetails(CalculationCreateParams.ShipFromDetails shipFromDetails) { + this.shipFromDetails = shipFromDetails; + return this; + } + /** Shipping cost details to be used for the calculation. */ public Builder setShippingCost(CalculationCreateParams.ShippingCost shippingCost) { this.shippingCost = shippingCost; @@ -1179,6 +1194,269 @@ public enum TaxBehavior implements ApiRequestParams.EnumParam { } } + @Getter + public static class ShipFromDetails { + /** Required. The address from which the goods are being shipped from. */ + @SerializedName("address") + Address address; + + /** + * 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 ShipFromDetails(Address address, Map extraParams) { + this.address = address; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Address address; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public CalculationCreateParams.ShipFromDetails build() { + return new CalculationCreateParams.ShipFromDetails(this.address, this.extraParams); + } + + /** Required. The address from which the goods are being shipped from. */ + public Builder setAddress(CalculationCreateParams.ShipFromDetails.Address address) { + this.address = address; + 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 + * CalculationCreateParams.ShipFromDetails#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 CalculationCreateParams.ShipFromDetails#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + + @Getter + public static class Address { + /** City, district, suburb, town, or village. */ + @SerializedName("city") + Object city; + + /** + * Required. Two-letter country code (ISO 3166-1 alpha-2). + */ + @SerializedName("country") + String country; + + /** + * 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; + + /** Address line 1 (e.g., street, PO Box, or company name). */ + @SerializedName("line1") + Object line1; + + /** Address line 2 (e.g., apartment, suite, unit, or building). */ + @SerializedName("line2") + Object line2; + + /** ZIP or postal code. */ + @SerializedName("postal_code") + Object postalCode; + + /** + * State/province as an ISO 3166-2 + * subdivision code, without country prefix. Example: "NY" or "TX". + */ + @SerializedName("state") + Object state; + + private Address( + Object city, + String country, + Map extraParams, + Object line1, + Object line2, + Object postalCode, + Object state) { + this.city = city; + this.country = country; + this.extraParams = extraParams; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object city; + + private String country; + + private Map extraParams; + + private Object line1; + + private Object line2; + + private Object postalCode; + + private Object state; + + /** Finalize and obtain parameter instance from this builder. */ + public CalculationCreateParams.ShipFromDetails.Address build() { + return new CalculationCreateParams.ShipFromDetails.Address( + this.city, + this.country, + this.extraParams, + this.line1, + this.line2, + this.postalCode, + this.state); + } + + /** City, district, suburb, town, or village. */ + public Builder setCity(String city) { + this.city = city; + return this; + } + + /** City, district, suburb, town, or village. */ + public Builder setCity(EmptyParam city) { + this.city = city; + return this; + } + + /** + * Required. Two-letter country code (ISO 3166-1 alpha-2). + */ + public Builder setCountry(String country) { + this.country = country; + 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 CalculationCreateParams.ShipFromDetails.Address#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 CalculationCreateParams.ShipFromDetails.Address#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Address line 1 (e.g., street, PO Box, or company name). */ + public Builder setLine1(String line1) { + this.line1 = line1; + return this; + } + + /** Address line 1 (e.g., street, PO Box, or company name). */ + public Builder setLine1(EmptyParam line1) { + this.line1 = line1; + return this; + } + + /** Address line 2 (e.g., apartment, suite, unit, or building). */ + public Builder setLine2(String line2) { + this.line2 = line2; + return this; + } + + /** Address line 2 (e.g., apartment, suite, unit, or building). */ + public Builder setLine2(EmptyParam line2) { + this.line2 = line2; + return this; + } + + /** ZIP or postal code. */ + public Builder setPostalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** ZIP or postal code. */ + public Builder setPostalCode(EmptyParam postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * State/province as an ISO 3166-2 + * subdivision code, without country prefix. Example: "NY" or "TX". + */ + public Builder setState(String state) { + this.state = state; + return this; + } + + /** + * State/province as an ISO 3166-2 + * subdivision code, without country prefix. Example: "NY" or "TX". + */ + public Builder setState(EmptyParam state) { + this.state = state; + return this; + } + } + } + } + @Getter public static class ShippingCost { /**