From d69c3c085fdcf3d1fee3dd3c90931c7aaa474679 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Sat, 22 Nov 2025 02:22:54 +0000 Subject: [PATCH] Update generated code for v2129 and --- API_VERSION | 2 +- OPENAPI_VERSION | 2 +- src/main/java/com/stripe/StripeClient.java | 12 + .../stripe/model/EventDataClassLookup.java | 3 + .../java/com/stripe/model/PaymentIntent.java | 21 + .../delegatedcheckout/RequestedSession.java | 34 +- .../model/productcatalog/TrialOffer.java | 187 +++++++ .../param/PaymentIntentCreateParams.java | 92 ++++ .../TrialOfferCreateParams.java | 477 ++++++++++++++++++ .../stripe/service/ProductCatalogService.java | 15 + .../java/com/stripe/service/V1Services.java | 4 + .../productcatalog/TrialOfferService.java | 37 ++ 12 files changed, 862 insertions(+), 24 deletions(-) create mode 100644 src/main/java/com/stripe/model/productcatalog/TrialOffer.java create mode 100644 src/main/java/com/stripe/param/productcatalog/TrialOfferCreateParams.java create mode 100644 src/main/java/com/stripe/service/ProductCatalogService.java create mode 100644 src/main/java/com/stripe/service/productcatalog/TrialOfferService.java diff --git a/API_VERSION b/API_VERSION index e2854d25681..dc9d80dc3e3 100644 --- a/API_VERSION +++ b/API_VERSION @@ -1 +1 @@ -7f436e73385732b1c5502f408a6fe37f7b6b0612 \ No newline at end of file +368be7755d15d02a1038325c7d159703b01662b0 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 1d5ad796c42..3809bd6156a 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2128 \ No newline at end of file +v2129 \ No newline at end of file diff --git a/src/main/java/com/stripe/StripeClient.java b/src/main/java/com/stripe/StripeClient.java index e8b3e86193f..e63f9192dc8 100644 --- a/src/main/java/com/stripe/StripeClient.java +++ b/src/main/java/com/stripe/StripeClient.java @@ -761,6 +761,18 @@ public com.stripe.service.PrivacyService privacy() { return new com.stripe.service.PrivacyService(this.getResponseGetter()); } + /** + * @deprecated StripeClient.productCatalog() is deprecated, use StripeClient.v1().productCatalog() + * instead. All functionality under it has been copied over to + * StripeClient.v1().productCatalog(). See migration + * guide for more on this and tips on migrating to the new v1 namespace. + */ + @Deprecated + public com.stripe.service.ProductCatalogService productCatalog() { + return new com.stripe.service.ProductCatalogService(this.getResponseGetter()); + } + /** * @deprecated StripeClient.products() is deprecated, use StripeClient.v1().products() instead. * All functionality under it has been copied over to StripeClient.v1().products(). See paymentMethodTypes; + /** + * When you enable this parameter, this PaymentIntent will route your payment to processors that + * you configure in the dashboard. + */ + @SerializedName("payments_orchestration") + PaymentsOrchestration paymentsOrchestration; + @SerializedName("presentment_details") PresentmentDetails presentmentDetails; @@ -6342,6 +6349,19 @@ public static class Zip extends StripeObject { } } + /** + * For more details about PaymentsOrchestration, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class PaymentsOrchestration extends StripeObject { + /** Whether this feature is enabled. */ + @SerializedName("enabled") + Boolean enabled; + } + /** * For more details about PresentmentDetails, please refer to the API Reference. @@ -6477,6 +6497,7 @@ public void setResponseGetter(StripeResponseGetter responseGetter) { trySetResponseGetter(paymentMethod, responseGetter); trySetResponseGetter(paymentMethodConfigurationDetails, responseGetter); trySetResponseGetter(paymentMethodOptions, responseGetter); + trySetResponseGetter(paymentsOrchestration, responseGetter); trySetResponseGetter(presentmentDetails, responseGetter); trySetResponseGetter(processing, responseGetter); trySetResponseGetter(review, responseGetter); diff --git a/src/main/java/com/stripe/model/delegatedcheckout/RequestedSession.java b/src/main/java/com/stripe/model/delegatedcheckout/RequestedSession.java index 4372976121f..bc2d50a00d8 100644 --- a/src/main/java/com/stripe/model/delegatedcheckout/RequestedSession.java +++ b/src/main/java/com/stripe/model/delegatedcheckout/RequestedSession.java @@ -536,14 +536,6 @@ public static class LineItemDetail extends StripeObject { @SerializedName("amount_subtotal") Long amountSubtotal; - /** The total after discounts but before taxes are applied. */ - @SerializedName("amount_subtotal_after_discount") - Long amountSubtotalAfterDiscount; - - /** The total after discounts and taxes. */ - @SerializedName("amount_total") - Long amountTotal; - /** The description of the line item. */ @SerializedName("description") String description; @@ -571,14 +563,6 @@ public static class LineItemDetail extends StripeObject { /** The per-unit amount of the item before any discounts or taxes are applied. */ @SerializedName("unit_amount") Long unitAmount; - - /** The per-unit amount of the item after discounts but before taxes are applied. */ - @SerializedName("unit_amount_after_discount") - Long unitAmountAfterDiscount; - - /** The per-unit discount amount. If no discount were applied, defaults to 0. */ - @SerializedName("unit_discount") - Long unitDiscount; } /** @@ -718,17 +702,23 @@ public static class SellerDetails extends StripeObject {} @Setter @EqualsAndHashCode(callSuper = false) public static class TotalDetails extends StripeObject { - /** The amount discount of the total details. */ - @SerializedName("amount_discount") - Long amountDiscount; + /** + * The amount of order-level discounts applied to the cart. The total discount amount for this + * session can be computed by summing the cart discount and the item discounts. + */ + @SerializedName("amount_cart_discount") + Long amountCartDiscount; /** The amount fulfillment of the total details. */ @SerializedName("amount_fulfillment") Long amountFulfillment; - /** Total of all items after discounts but before taxes are applied. */ - @SerializedName("amount_subtotal_after_discount") - Long amountSubtotalAfterDiscount; + /** + * The amount of item-level discounts applied to the cart. The total discount amount for this + * session can be computed by summing the cart discount and the item discounts. + */ + @SerializedName("amount_items_discount") + Long amountItemsDiscount; /** The amount tax of the total details. */ @SerializedName("amount_tax") diff --git a/src/main/java/com/stripe/model/productcatalog/TrialOffer.java b/src/main/java/com/stripe/model/productcatalog/TrialOffer.java new file mode 100644 index 00000000000..dbae9312a30 --- /dev/null +++ b/src/main/java/com/stripe/model/productcatalog/TrialOffer.java @@ -0,0 +1,187 @@ +// File generated from our OpenAPI spec +package com.stripe.model.productcatalog; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.ExpandableField; +import com.stripe.model.HasId; +import com.stripe.model.Price; +import com.stripe.model.StripeObject; +import com.stripe.net.ApiRequest; +import com.stripe.net.ApiRequestParams; +import com.stripe.net.ApiResource; +import com.stripe.net.BaseAddress; +import com.stripe.net.RequestOptions; +import com.stripe.net.StripeResponseGetter; +import com.stripe.param.productcatalog.TrialOfferCreateParams; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + * Resource for the TrialOffer API, used to describe a subscription item's trial period settings. + * Renders a TrialOffer object that describes the price, duration, end_behavior of a trial offer. + */ +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class TrialOffer extends ApiResource implements HasId { + @SerializedName("duration") + Duration duration; + + @SerializedName("end_behavior") + EndBehavior endBehavior; + + /** 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; + + /** + * String representing the object's type. Objects of the same type share the same value. + * + *

Equal to {@code product_catalog.trial_offer}. + */ + @SerializedName("object") + String object; + + /** The price during the trial offer. */ + @SerializedName("price") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField price; + + /** Get ID of expandable {@code price} object. */ + public String getPrice() { + return (this.price != null) ? this.price.getId() : null; + } + + public void setPrice(String id) { + this.price = ApiResource.setExpandableFieldId(id, this.price); + } + + /** Get expanded {@code price}. */ + public Price getPriceObject() { + return (this.price != null) ? this.price.getExpanded() : null; + } + + public void setPriceObject(Price expandableObject) { + this.price = new ExpandableField(expandableObject.getId(), expandableObject); + } + + /** Creates a trial offer. */ + public static TrialOffer create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a trial offer. */ + public static TrialOffer create(Map params, RequestOptions options) + throws StripeException { + String path = "/v1/product_catalog/trial_offers"; + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); + return getGlobalResponseGetter().request(request, TrialOffer.class); + } + + /** Creates a trial offer. */ + public static TrialOffer create(TrialOfferCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Creates a trial offer. */ + public static TrialOffer create(TrialOfferCreateParams params, RequestOptions options) + throws StripeException { + String path = "/v1/product_catalog/trial_offers"; + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, TrialOffer.class); + } + + /** + * For more details about Duration, please refer to the API + * Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Duration extends StripeObject { + @SerializedName("relative") + Relative relative; + + /** + * The type of trial offer duration. + * + *

One of {@code relative}, or {@code timestamp}. + */ + @SerializedName("type") + String type; + + /** + * For more details about Relative, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Relative extends StripeObject { + /** The number of iterations of the price's interval for this trial offer. */ + @SerializedName("iterations") + Long iterations; + } + } + + /** + * For more details about EndBehavior, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class EndBehavior extends StripeObject { + @SerializedName("transition") + Transition transition; + + /** + * The type of behavior when the trial offer ends. + * + *

Equal to {@code transition}. + */ + @SerializedName("type") + String type; + + /** + * For more details about Transition, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Transition extends StripeObject { + /** The new price to use at the end of the trial offer period. */ + @SerializedName("price") + String price; + } + } + + @Override + public void setResponseGetter(StripeResponseGetter responseGetter) { + super.setResponseGetter(responseGetter); + trySetResponseGetter(duration, responseGetter); + trySetResponseGetter(endBehavior, responseGetter); + trySetResponseGetter(price, responseGetter); + } +} diff --git a/src/main/java/com/stripe/param/PaymentIntentCreateParams.java b/src/main/java/com/stripe/param/PaymentIntentCreateParams.java index 3c2fd9b4f43..3c04d0ef5f0 100644 --- a/src/main/java/com/stripe/param/PaymentIntentCreateParams.java +++ b/src/main/java/com/stripe/param/PaymentIntentCreateParams.java @@ -261,6 +261,13 @@ public class PaymentIntentCreateParams extends ApiRequestParams { @SerializedName("payment_method_types") List paymentMethodTypes; + /** + * When you enable this parameter, this PaymentIntent will route your payment to processors that + * you configure in the dashboard. + */ + @SerializedName("payments_orchestration") + PaymentsOrchestration paymentsOrchestration; + /** * Options to configure Radar. Learn more about Radar Sessions. @@ -395,6 +402,7 @@ private PaymentIntentCreateParams( PaymentMethodData paymentMethodData, PaymentMethodOptions paymentMethodOptions, List paymentMethodTypes, + PaymentsOrchestration paymentsOrchestration, RadarOptions radarOptions, String receiptEmail, String returnUrl, @@ -436,6 +444,7 @@ private PaymentIntentCreateParams( this.paymentMethodData = paymentMethodData; this.paymentMethodOptions = paymentMethodOptions; this.paymentMethodTypes = paymentMethodTypes; + this.paymentsOrchestration = paymentsOrchestration; this.radarOptions = radarOptions; this.receiptEmail = receiptEmail; this.returnUrl = returnUrl; @@ -514,6 +523,8 @@ public static class Builder { private List paymentMethodTypes; + private PaymentsOrchestration paymentsOrchestration; + private RadarOptions radarOptions; private String receiptEmail; @@ -569,6 +580,7 @@ public PaymentIntentCreateParams build() { this.paymentMethodData, this.paymentMethodOptions, this.paymentMethodTypes, + this.paymentsOrchestration, this.radarOptions, this.receiptEmail, this.returnUrl, @@ -1006,6 +1018,16 @@ public Builder addAllPaymentMethodType(List elements) { return this; } + /** + * When you enable this parameter, this PaymentIntent will route your payment to processors that + * you configure in the dashboard. + */ + public Builder setPaymentsOrchestration( + PaymentIntentCreateParams.PaymentsOrchestration paymentsOrchestration) { + this.paymentsOrchestration = paymentsOrchestration; + return this; + } + /** * Options to configure Radar. Learn more about Radar Sessions. @@ -44179,6 +44201,76 @@ public enum SetupFutureUsage implements ApiRequestParams.EnumParam { } } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class PaymentsOrchestration { + /** Required. Whether this feature is enabled. */ + @SerializedName("enabled") + Boolean enabled; + + /** + * 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 PaymentsOrchestration(Boolean enabled, Map extraParams) { + this.enabled = enabled; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Boolean enabled; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public PaymentIntentCreateParams.PaymentsOrchestration build() { + return new PaymentIntentCreateParams.PaymentsOrchestration(this.enabled, this.extraParams); + } + + /** Required. Whether this feature is enabled. */ + public Builder setEnabled(Boolean enabled) { + this.enabled = enabled; + 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 + * PaymentIntentCreateParams.PaymentsOrchestration#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.PaymentsOrchestration#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 @EqualsAndHashCode(callSuper = false) public static class RadarOptions { diff --git a/src/main/java/com/stripe/param/productcatalog/TrialOfferCreateParams.java b/src/main/java/com/stripe/param/productcatalog/TrialOfferCreateParams.java new file mode 100644 index 00000000000..224b3159ce8 --- /dev/null +++ b/src/main/java/com/stripe/param/productcatalog/TrialOfferCreateParams.java @@ -0,0 +1,477 @@ +// File generated from our OpenAPI spec +package com.stripe.param.productcatalog; + +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 TrialOfferCreateParams extends ApiRequestParams { + /** Required. Duration of one service period of the trial. */ + @SerializedName("duration") + Duration duration; + + /** Required. Define behavior that occurs at the end of the trial. */ + @SerializedName("end_behavior") + EndBehavior endBehavior; + + /** 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. Price configuration during the trial period (amount, billing scheme, + * etc). + */ + @SerializedName("price") + String price; + + private TrialOfferCreateParams( + Duration duration, + EndBehavior endBehavior, + List expand, + Map extraParams, + String price) { + this.duration = duration; + this.endBehavior = endBehavior; + this.expand = expand; + this.extraParams = extraParams; + this.price = price; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Duration duration; + + private EndBehavior endBehavior; + + private List expand; + + private Map extraParams; + + private String price; + + /** Finalize and obtain parameter instance from this builder. */ + public TrialOfferCreateParams build() { + return new TrialOfferCreateParams( + this.duration, this.endBehavior, this.expand, this.extraParams, this.price); + } + + /** Required. Duration of one service period of the trial. */ + public Builder setDuration(TrialOfferCreateParams.Duration duration) { + this.duration = duration; + return this; + } + + /** Required. Define behavior that occurs at the end of the trial. */ + public Builder setEndBehavior(TrialOfferCreateParams.EndBehavior endBehavior) { + this.endBehavior = endBehavior; + 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 + * TrialOfferCreateParams#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 + * TrialOfferCreateParams#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 + * TrialOfferCreateParams#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 TrialOfferCreateParams#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. Price configuration during the trial period (amount, billing + * scheme, etc). + */ + public Builder setPrice(String price) { + this.price = price; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Duration { + /** + * 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; + + /** + * The relative duration of the trial period computed as the number of recurring price + * intervals. + */ + @SerializedName("relative") + Relative relative; + + /** Required. Specifies how the trial offer duration is determined. */ + @SerializedName("type") + Type type; + + private Duration(Map extraParams, Relative relative, Type type) { + this.extraParams = extraParams; + this.relative = relative; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Relative relative; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public TrialOfferCreateParams.Duration build() { + return new TrialOfferCreateParams.Duration(this.extraParams, this.relative, this.type); + } + + /** + * 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 + * TrialOfferCreateParams.Duration#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 TrialOfferCreateParams.Duration#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * The relative duration of the trial period computed as the number of recurring price + * intervals. + */ + public Builder setRelative(TrialOfferCreateParams.Duration.Relative relative) { + this.relative = relative; + return this; + } + + /** Required. Specifies how the trial offer duration is determined. */ + public Builder setType(TrialOfferCreateParams.Duration.Type type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Relative { + /** + * 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 number of recurring price's interval to apply for the trial + * period. + */ + @SerializedName("iterations") + Long iterations; + + private Relative(Map extraParams, Long iterations) { + this.extraParams = extraParams; + this.iterations = iterations; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Long iterations; + + /** Finalize and obtain parameter instance from this builder. */ + public TrialOfferCreateParams.Duration.Relative build() { + return new TrialOfferCreateParams.Duration.Relative(this.extraParams, this.iterations); + } + + /** + * 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 TrialOfferCreateParams.Duration.Relative#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 TrialOfferCreateParams.Duration.Relative#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 number of recurring price's interval to apply for the + * trial period. + */ + public Builder setIterations(Long iterations) { + this.iterations = iterations; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("relative") + RELATIVE("relative"), + + @SerializedName("timestamp") + TIMESTAMP("timestamp"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class EndBehavior { + /** + * 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 transition to apply when the trial offer ends. */ + @SerializedName("transition") + Transition transition; + + private EndBehavior(Map extraParams, Transition transition) { + this.extraParams = extraParams; + this.transition = transition; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Transition transition; + + /** Finalize and obtain parameter instance from this builder. */ + public TrialOfferCreateParams.EndBehavior build() { + return new TrialOfferCreateParams.EndBehavior(this.extraParams, this.transition); + } + + /** + * 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 + * TrialOfferCreateParams.EndBehavior#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 TrialOfferCreateParams.EndBehavior#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 transition to apply when the trial offer ends. */ + public Builder setTransition(TrialOfferCreateParams.EndBehavior.Transition transition) { + this.transition = transition; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Transition { + /** + * 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 price to transition the recurring item to when the trial + * offer ends. + */ + @SerializedName("price") + String price; + + private Transition(Map extraParams, String price) { + this.extraParams = extraParams; + this.price = price; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String price; + + /** Finalize and obtain parameter instance from this builder. */ + public TrialOfferCreateParams.EndBehavior.Transition build() { + return new TrialOfferCreateParams.EndBehavior.Transition(this.extraParams, this.price); + } + + /** + * 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 TrialOfferCreateParams.EndBehavior.Transition#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 TrialOfferCreateParams.EndBehavior.Transition#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 price to transition the recurring item to when the trial + * offer ends. + */ + public Builder setPrice(String price) { + this.price = price; + return this; + } + } + } + } +} diff --git a/src/main/java/com/stripe/service/ProductCatalogService.java b/src/main/java/com/stripe/service/ProductCatalogService.java new file mode 100644 index 00000000000..abfa4ccfa2c --- /dev/null +++ b/src/main/java/com/stripe/service/ProductCatalogService.java @@ -0,0 +1,15 @@ +// File generated from our OpenAPI spec +package com.stripe.service; + +import com.stripe.net.ApiService; +import com.stripe.net.StripeResponseGetter; + +public final class ProductCatalogService extends ApiService { + public ProductCatalogService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + public com.stripe.service.productcatalog.TrialOfferService trialOffers() { + return new com.stripe.service.productcatalog.TrialOfferService(this.getResponseGetter()); + } +} diff --git a/src/main/java/com/stripe/service/V1Services.java b/src/main/java/com/stripe/service/V1Services.java index 10d8328703b..f89c0768fae 100644 --- a/src/main/java/com/stripe/service/V1Services.java +++ b/src/main/java/com/stripe/service/V1Services.java @@ -229,6 +229,10 @@ public com.stripe.service.PrivacyService privacy() { return new com.stripe.service.PrivacyService(this.getResponseGetter()); } + public com.stripe.service.ProductCatalogService productCatalog() { + return new com.stripe.service.ProductCatalogService(this.getResponseGetter()); + } + public com.stripe.service.ProductService products() { return new com.stripe.service.ProductService(this.getResponseGetter()); } diff --git a/src/main/java/com/stripe/service/productcatalog/TrialOfferService.java b/src/main/java/com/stripe/service/productcatalog/TrialOfferService.java new file mode 100644 index 00000000000..70ff2641bcf --- /dev/null +++ b/src/main/java/com/stripe/service/productcatalog/TrialOfferService.java @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec +package com.stripe.service.productcatalog; + +import com.stripe.exception.StripeException; +import com.stripe.model.productcatalog.TrialOffer; +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.productcatalog.TrialOfferCreateParams; + +public final class TrialOfferService extends ApiService { + public TrialOfferService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + /** Creates a trial offer. */ + public TrialOffer create(TrialOfferCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + /** Creates a trial offer. */ + public TrialOffer create(TrialOfferCreateParams params, RequestOptions options) + throws StripeException { + String path = "/v1/product_catalog/trial_offers"; + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, TrialOffer.class); + } +}