From 12069194c93cc8cc781f0977645a261274367b1e Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 22 Jan 2026 17:22:57 +0000 Subject: [PATCH 1/2] Update generated code for v2155 and --- CODEGEN_VERSION | 2 +- OPENAPI_VERSION | 2 +- src/main/java/com/stripe/StripeClient.java | 12 + src/main/java/com/stripe/model/Coupon.java | 19 + src/main/java/com/stripe/model/Discount.java | 20 + .../stripe/model/EventDataClassLookup.java | 1 + .../model/FrMealVouchersOnboarding.java | 337 ++ .../FrMealVouchersOnboardingCollection.java | 5 + .../com/stripe/param/CouponCreateParams.java | 136 +- .../FrMealVouchersOnboardingCreateParams.java | 197 + .../FrMealVouchersOnboardingListParams.java | 171 + ...rMealVouchersOnboardingRetrieveParams.java | 101 + .../FrMealVouchersOnboardingUpdateParams.java | 122 + .../param/InvoiceCreatePreviewParams.java | 4813 ++++++++++++++--- .../com/stripe/param/QuoteCreateParams.java | 1678 +++++- .../com/stripe/param/QuoteUpdateParams.java | 1700 +++++- .../param/SubscriptionCreateParams.java | 1221 ++++- .../param/SubscriptionItemCreateParams.java | 397 +- .../param/SubscriptionItemUpdateParams.java | 397 +- .../SubscriptionScheduleAmendParams.java | 1754 +++++- .../SubscriptionScheduleCreateParams.java | 809 ++- .../SubscriptionScheduleUpdateParams.java | 809 ++- .../param/SubscriptionUpdateParams.java | 1225 ++++- .../param/checkout/SessionCreateParams.java | 5 +- .../param/checkout/SessionUpdateParams.java | 5 +- .../FrMealVouchersOnboardingService.java | 124 + .../java/com/stripe/service/V1Services.java | 4 + 27 files changed, 14680 insertions(+), 1386 deletions(-) create mode 100644 src/main/java/com/stripe/model/FrMealVouchersOnboarding.java create mode 100644 src/main/java/com/stripe/model/FrMealVouchersOnboardingCollection.java create mode 100644 src/main/java/com/stripe/param/FrMealVouchersOnboardingCreateParams.java create mode 100644 src/main/java/com/stripe/param/FrMealVouchersOnboardingListParams.java create mode 100644 src/main/java/com/stripe/param/FrMealVouchersOnboardingRetrieveParams.java create mode 100644 src/main/java/com/stripe/param/FrMealVouchersOnboardingUpdateParams.java create mode 100644 src/main/java/com/stripe/service/FrMealVouchersOnboardingService.java diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index 81e38dd3bef..f0d8c5cf5ee 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -c250368ba89214c80bc8de3e4fc5d2094c5502cc \ No newline at end of file +8989becedb2153519066ec2233cbf5880b938188 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 4c7a9ad2bfe..8d0138b868d 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2153 \ No newline at end of file +v2155 \ 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 db693313ca1..c4d64a10786 100644 --- a/src/main/java/com/stripe/StripeClient.java +++ b/src/main/java/com/stripe/StripeClient.java @@ -520,6 +520,18 @@ public com.stripe.service.ForwardingService forwarding() { return new com.stripe.service.ForwardingService(this.getResponseGetter()); } + /** + * @deprecated StripeClient.frMealVouchersOnboardings() is deprecated, use + * StripeClient.v1().frMealVouchersOnboardings() instead. All functionality under it has been + * copied over to StripeClient.v1().frMealVouchersOnboardings(). See migration + * guide for more on this and tips on migrating to the new v1 namespace. + */ + @Deprecated + public com.stripe.service.FrMealVouchersOnboardingService frMealVouchersOnboardings() { + return new com.stripe.service.FrMealVouchersOnboardingService(this.getResponseGetter()); + } + /** * @deprecated StripeClient.fxQuotes() is deprecated, use StripeClient.v1().fxQuotes() instead. * All functionality under it has been copied over to StripeClient.v1().fxQuotes(). See @SerializedName("script") Script script; + @SerializedName("service_period") + ServicePeriod servicePeriod; + /** Number of times this coupon has been applied to a customer. */ @SerializedName("times_redeemed") Long timesRedeemed; @@ -444,10 +447,26 @@ public static class Script extends StripeObject implements HasId { String id; } + /** + * For more details about ServicePeriod, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriod extends StripeObject { + @SerializedName("interval") + String interval; + + @SerializedName("interval_count") + Long intervalCount; + } + @Override public void setResponseGetter(StripeResponseGetter responseGetter) { super.setResponseGetter(responseGetter); trySetResponseGetter(appliesTo, responseGetter); trySetResponseGetter(script, responseGetter); + trySetResponseGetter(servicePeriod, responseGetter); } } diff --git a/src/main/java/com/stripe/model/Discount.java b/src/main/java/com/stripe/model/Discount.java index 6b71a8bdab2..b1b4069da7a 100644 --- a/src/main/java/com/stripe/model/Discount.java +++ b/src/main/java/com/stripe/model/Discount.java @@ -92,6 +92,9 @@ public class Discount extends StripeObject implements HasId { @SerializedName("schedule") String schedule; + @SerializedName("service_period_details") + ServicePeriodDetails servicePeriodDetails; + @SerializedName("source") Source source; @@ -149,6 +152,23 @@ public void setPromotionCodeObject(PromotionCode expandableObject) { new ExpandableField(expandableObject.getId(), expandableObject); } + /** + * For more details about ServicePeriodDetails, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodDetails extends StripeObject { + /** The date that the service period was anchored to. */ + @SerializedName("service_period_anchored_at") + Long servicePeriodAnchoredAt; + + /** The date that the service period started. */ + @SerializedName("start_date") + Long startDate; + } + /** * For more details about Source, please refer to the API * Reference. diff --git a/src/main/java/com/stripe/model/EventDataClassLookup.java b/src/main/java/com/stripe/model/EventDataClassLookup.java index 28c12348ab1..d664409e727 100644 --- a/src/main/java/com/stripe/model/EventDataClassLookup.java +++ b/src/main/java/com/stripe/model/EventDataClassLookup.java @@ -51,6 +51,7 @@ public final class EventDataClassLookup { classLookup.put("fee_refund", com.stripe.model.FeeRefund.class); classLookup.put("file", com.stripe.model.File.class); classLookup.put("file_link", com.stripe.model.FileLink.class); + classLookup.put("fr_meal_vouchers_onboarding", com.stripe.model.FrMealVouchersOnboarding.class); classLookup.put("funding_instructions", com.stripe.model.FundingInstructions.class); classLookup.put("fx_quote", com.stripe.model.FxQuote.class); classLookup.put("invoice", com.stripe.model.Invoice.class); diff --git a/src/main/java/com/stripe/model/FrMealVouchersOnboarding.java b/src/main/java/com/stripe/model/FrMealVouchersOnboarding.java new file mode 100644 index 00000000000..98458534aee --- /dev/null +++ b/src/main/java/com/stripe/model/FrMealVouchersOnboarding.java @@ -0,0 +1,337 @@ +// File generated from our OpenAPI spec +package com.stripe.model; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +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.FrMealVouchersOnboardingCreateParams; +import com.stripe.param.FrMealVouchersOnboardingListParams; +import com.stripe.param.FrMealVouchersOnboardingRetrieveParams; +import com.stripe.param.FrMealVouchersOnboardingUpdateParams; +import java.util.List; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + * The French Meal Vouchers Onboarding resource encapsulates the onboarding status and other related + * information for a single restaurant (SIRET number) in the context of the French Meal Vouchers + * program. + */ +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class FrMealVouchersOnboarding extends ApiResource + implements HasId, MetadataStore { + /** 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; + + /** + * Set of key-value pairs that you can attach + * to an object. This can be useful for storing additional information about the object in a + * structured format. + */ + @Getter(onMethod_ = {@Override}) + @SerializedName("metadata") + Map metadata; + + /** Name of the restaurant. */ + @SerializedName("name") + String name; + + /** + * String representing the object's type. Objects of the same type share the same value. + * + *

Equal to {@code fr_meal_vouchers_onboarding}. + */ + @SerializedName("object") + String object; + + /** Postal code of the restaurant. */ + @SerializedName("postal_code") + String postalCode; + + /** This represents the onboarding state of the restaurant on different providers. */ + @SerializedName("providers") + Providers providers; + + /** SIRET number associated with the restaurant. */ + @SerializedName("siret") + String siret; + + /** + * Creates a French Meal Vouchers Onboarding object that represents a restaurant’s onboarding + * status and starts the onboarding process. + */ + public static FrMealVouchersOnboarding create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * Creates a French Meal Vouchers Onboarding object that represents a restaurant’s onboarding + * status and starts the onboarding process. + */ + public static FrMealVouchersOnboarding create(Map params, RequestOptions options) + throws StripeException { + String path = "/v1/fr_meal_vouchers_onboardings"; + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); + return getGlobalResponseGetter().request(request, FrMealVouchersOnboarding.class); + } + + /** + * Creates a French Meal Vouchers Onboarding object that represents a restaurant’s onboarding + * status and starts the onboarding process. + */ + public static FrMealVouchersOnboarding create(FrMealVouchersOnboardingCreateParams params) + throws StripeException { + return create(params, (RequestOptions) null); + } + + /** + * Creates a French Meal Vouchers Onboarding object that represents a restaurant’s onboarding + * status and starts the onboarding process. + */ + public static FrMealVouchersOnboarding create( + FrMealVouchersOnboardingCreateParams params, RequestOptions options) throws StripeException { + String path = "/v1/fr_meal_vouchers_onboardings"; + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, FrMealVouchersOnboarding.class); + } + + /** Lists French Meal Vouchers Onboarding objects. */ + public static FrMealVouchersOnboardingCollection list(Map params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Lists French Meal Vouchers Onboarding objects. */ + public static FrMealVouchersOnboardingCollection list( + Map params, RequestOptions options) throws StripeException { + String path = "/v1/fr_meal_vouchers_onboardings"; + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options); + return getGlobalResponseGetter().request(request, FrMealVouchersOnboardingCollection.class); + } + + /** Lists French Meal Vouchers Onboarding objects. */ + public static FrMealVouchersOnboardingCollection list(FrMealVouchersOnboardingListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + + /** Lists French Meal Vouchers Onboarding objects. */ + public static FrMealVouchersOnboardingCollection list( + FrMealVouchersOnboardingListParams params, RequestOptions options) throws StripeException { + String path = "/v1/fr_meal_vouchers_onboardings"; + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, FrMealVouchersOnboardingCollection.class); + } + + /** Retrieves the details of a French Meal Vouchers Onboarding object. */ + public static FrMealVouchersOnboarding retrieve(String id) throws StripeException { + return retrieve(id, (Map) null, (RequestOptions) null); + } + + /** Retrieves the details of a French Meal Vouchers Onboarding object. */ + public static FrMealVouchersOnboarding retrieve(String id, RequestOptions options) + throws StripeException { + return retrieve(id, (Map) null, options); + } + + /** Retrieves the details of a French Meal Vouchers Onboarding object. */ + public static FrMealVouchersOnboarding retrieve( + String id, Map params, RequestOptions options) throws StripeException { + String path = String.format("/v1/fr_meal_vouchers_onboardings/%s", ApiResource.urlEncodeId(id)); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options); + return getGlobalResponseGetter().request(request, FrMealVouchersOnboarding.class); + } + + /** Retrieves the details of a French Meal Vouchers Onboarding object. */ + public static FrMealVouchersOnboarding retrieve( + String id, FrMealVouchersOnboardingRetrieveParams params, RequestOptions options) + throws StripeException { + String path = String.format("/v1/fr_meal_vouchers_onboardings/%s", ApiResource.urlEncodeId(id)); + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, FrMealVouchersOnboarding.class); + } + + /** Updates the details of a restaurant’s French Meal Vouchers Onboarding object. */ + @Override + public FrMealVouchersOnboarding update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates the details of a restaurant’s French Meal Vouchers Onboarding object. */ + @Override + public FrMealVouchersOnboarding update(Map params, RequestOptions options) + throws StripeException { + String path = + String.format("/v1/fr_meal_vouchers_onboardings/%s", ApiResource.urlEncodeId(this.getId())); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); + return getResponseGetter().request(request, FrMealVouchersOnboarding.class); + } + + /** Updates the details of a restaurant’s French Meal Vouchers Onboarding object. */ + public FrMealVouchersOnboarding update(FrMealVouchersOnboardingUpdateParams params) + throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates the details of a restaurant’s French Meal Vouchers Onboarding object. */ + public FrMealVouchersOnboarding update( + FrMealVouchersOnboardingUpdateParams params, RequestOptions options) throws StripeException { + String path = + String.format("/v1/fr_meal_vouchers_onboardings/%s", ApiResource.urlEncodeId(this.getId())); + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return getResponseGetter().request(request, FrMealVouchersOnboarding.class); + } + + /** This represents the onboarding state of the restaurant on different providers. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Providers extends StripeObject { + /** This represents the onboarding state of the restaurant on Conecs. */ + @SerializedName("conecs") + Conecs conecs; + + /** This represents the onboarding state of the restaurant on Conecs. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Conecs extends StripeObject { + /** This represents information which issuers are available to this restaurant via Conecs. */ + @SerializedName("issuers") + Issuers issuers; + + /** + * This represents information about outstanding requirements for this restaurant to onboard + * to Conecs. + */ + @SerializedName("requirements") + Requirements requirements; + + /** + * Status of the restaurant's onboarding to Conecs + * + *

One of {@code action_required}, {@code active}, {@code disentitled}, or {@code pending}. + */ + @SerializedName("status") + String status; + + /** This represents information which issuers are available to this restaurant via Conecs. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Issuers extends StripeObject { + /** + * Issuers are available to this restaurant via Conecs, will be blank if the onboarding to + * Conecs is not complete or unsuccessful. + */ + @SerializedName("available") + List available; + } + + /** + * This represents information about outstanding requirements for this restaurant to onboard + * to Conecs. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Requirements extends StripeObject { + /** + * Information any errors that are preventing the onboarding to Conecs from being completed. + */ + @SerializedName("errors") + List errors; + + /** Fields that need to be provided to complete the onboarding to Conecs. */ + @SerializedName("past_due") + List pastDue; + + /** + * For more details about Errors, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Errors extends StripeObject { + /** + * The code for the type of error. + * + *

One of {@code postal_code_invalid}, or {@code siret_invalid}. + */ + @SerializedName("code") + String code; + + /** An informative message that provides additional details about the error. */ + @SerializedName("message") + String message; + + /** + * The specific onboarding requirement field (in the requirements hash) that needs to be + * resolved. + * + *

One of {@code postal_code}, or {@code siret}. + */ + @SerializedName("requirement") + String requirement; + } + } + } + } + + @Override + public void setResponseGetter(StripeResponseGetter responseGetter) { + super.setResponseGetter(responseGetter); + trySetResponseGetter(providers, responseGetter); + } +} diff --git a/src/main/java/com/stripe/model/FrMealVouchersOnboardingCollection.java b/src/main/java/com/stripe/model/FrMealVouchersOnboardingCollection.java new file mode 100644 index 00000000000..6f89fc46248 --- /dev/null +++ b/src/main/java/com/stripe/model/FrMealVouchersOnboardingCollection.java @@ -0,0 +1,5 @@ +// File generated from our OpenAPI spec +package com.stripe.model; + +public class FrMealVouchersOnboardingCollection + extends StripeCollection {} diff --git a/src/main/java/com/stripe/param/CouponCreateParams.java b/src/main/java/com/stripe/param/CouponCreateParams.java index ed8abfde592..cb37db49957 100644 --- a/src/main/java/com/stripe/param/CouponCreateParams.java +++ b/src/main/java/com/stripe/param/CouponCreateParams.java @@ -123,6 +123,10 @@ public class CouponCreateParams extends ApiRequestParams { @SerializedName("script") Script script; + /** A hash specifying the service period for the coupon. */ + @SerializedName("service_period") + ServicePeriod servicePeriod; + private CouponCreateParams( Long amountOff, AppliesTo appliesTo, @@ -138,7 +142,8 @@ private CouponCreateParams( String name, BigDecimal percentOff, Long redeemBy, - Script script) { + Script script, + ServicePeriod servicePeriod) { this.amountOff = amountOff; this.appliesTo = appliesTo; this.currency = currency; @@ -154,6 +159,7 @@ private CouponCreateParams( this.percentOff = percentOff; this.redeemBy = redeemBy; this.script = script; + this.servicePeriod = servicePeriod; } public static Builder builder() { @@ -191,6 +197,8 @@ public static class Builder { private Script script; + private ServicePeriod servicePeriod; + /** Finalize and obtain parameter instance from this builder. */ public CouponCreateParams build() { return new CouponCreateParams( @@ -208,7 +216,8 @@ public CouponCreateParams build() { this.name, this.percentOff, this.redeemBy, - this.script); + this.script, + this.servicePeriod); } /** @@ -437,6 +446,12 @@ public Builder setScript(CouponCreateParams.Script script) { this.script = script; return this; } + + /** A hash specifying the service period for the coupon. */ + public Builder setServicePeriod(CouponCreateParams.ServicePeriod servicePeriod) { + this.servicePeriod = servicePeriod; + return this; + } } @Getter @@ -708,6 +723,118 @@ public Builder setId(String id) { } } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriod { + /** + * 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. Specifies coupon frequency. Either {@code day}, {@code week}, + * {@code month} or {@code year}. + */ + @SerializedName("interval") + Interval interval; + + /** Required. The number of intervals for which the coupon will be applied. */ + @SerializedName("interval_count") + Long intervalCount; + + private ServicePeriod(Map extraParams, Interval interval, Long intervalCount) { + this.extraParams = extraParams; + this.interval = interval; + this.intervalCount = intervalCount; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Interval interval; + + private Long intervalCount; + + /** Finalize and obtain parameter instance from this builder. */ + public CouponCreateParams.ServicePeriod build() { + return new CouponCreateParams.ServicePeriod( + this.extraParams, this.interval, this.intervalCount); + } + + /** + * 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 + * CouponCreateParams.ServicePeriod#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 CouponCreateParams.ServicePeriod#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. Specifies coupon frequency. Either {@code day}, {@code week}, + * {@code month} or {@code year}. + */ + public Builder setInterval(CouponCreateParams.ServicePeriod.Interval interval) { + this.interval = interval; + return this; + } + + /** + * Required. The number of intervals for which the coupon will be applied. + */ + public Builder setIntervalCount(Long intervalCount) { + this.intervalCount = intervalCount; + return this; + } + } + + public enum Interval implements ApiRequestParams.EnumParam { + @SerializedName("day") + DAY("day"), + + @SerializedName("month") + MONTH("month"), + + @SerializedName("week") + WEEK("week"), + + @SerializedName("year") + YEAR("year"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Interval(String value) { + this.value = value; + } + } + } + public enum Duration implements ApiRequestParams.EnumParam { @SerializedName("forever") FOREVER("forever"), @@ -716,7 +843,10 @@ public enum Duration implements ApiRequestParams.EnumParam { ONCE("once"), @SerializedName("repeating") - REPEATING("repeating"); + REPEATING("repeating"), + + @SerializedName("service_period") + SERVICE_PERIOD("service_period"); @Getter(onMethod_ = {@Override}) private final String value; diff --git a/src/main/java/com/stripe/param/FrMealVouchersOnboardingCreateParams.java b/src/main/java/com/stripe/param/FrMealVouchersOnboardingCreateParams.java new file mode 100644 index 00000000000..0bdcc4ca922 --- /dev/null +++ b/src/main/java/com/stripe/param/FrMealVouchersOnboardingCreateParams.java @@ -0,0 +1,197 @@ +// 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 FrMealVouchersOnboardingCreateParams 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; + + /** + * Set of key-value pairs that you can attach + * to an object. This can be useful for storing additional information about the object in a + * structured format. Individual keys can be unset by posting an empty value to them. All keys can + * be unset by posting an empty value to {@code metadata}. This cannot be changed after creation + * of this object. + */ + @SerializedName("metadata") + Map metadata; + + /** + * Required. Name of the restaurant. This cannot be changed after creation of + * this object. + */ + @SerializedName("name") + String name; + + /** Required. Postal code of the restaurant. */ + @SerializedName("postal_code") + String postalCode; + + /** + * Required. SIRET number associated with the restaurant. This cannot be changed + * after creation of this object. + */ + @SerializedName("siret") + String siret; + + private FrMealVouchersOnboardingCreateParams( + List expand, + Map extraParams, + Map metadata, + String name, + String postalCode, + String siret) { + this.expand = expand; + this.extraParams = extraParams; + this.metadata = metadata; + this.name = name; + this.postalCode = postalCode; + this.siret = siret; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List expand; + + private Map extraParams; + + private Map metadata; + + private String name; + + private String postalCode; + + private String siret; + + /** Finalize and obtain parameter instance from this builder. */ + public FrMealVouchersOnboardingCreateParams build() { + return new FrMealVouchersOnboardingCreateParams( + this.expand, this.extraParams, this.metadata, this.name, this.postalCode, this.siret); + } + + /** + * 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 + * FrMealVouchersOnboardingCreateParams#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 + * FrMealVouchersOnboardingCreateParams#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 + * FrMealVouchersOnboardingCreateParams#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 FrMealVouchersOnboardingCreateParams#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 a key/value pair to `metadata` 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 + * FrMealVouchersOnboardingCreateParams#metadata} for the field documentation. + */ + public Builder putMetadata(String key, String value) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `metadata` 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 FrMealVouchersOnboardingCreateParams#metadata} for the field documentation. + */ + public Builder putAllMetadata(Map map) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.putAll(map); + return this; + } + + /** + * Required. Name of the restaurant. This cannot be changed after creation of + * this object. + */ + public Builder setName(String name) { + this.name = name; + return this; + } + + /** Required. Postal code of the restaurant. */ + public Builder setPostalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * Required. SIRET number associated with the restaurant. This cannot be + * changed after creation of this object. + */ + public Builder setSiret(String siret) { + this.siret = siret; + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/FrMealVouchersOnboardingListParams.java b/src/main/java/com/stripe/param/FrMealVouchersOnboardingListParams.java new file mode 100644 index 00000000000..4f2b91c6975 --- /dev/null +++ b/src/main/java/com/stripe/param/FrMealVouchersOnboardingListParams.java @@ -0,0 +1,171 @@ +// 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 FrMealVouchersOnboardingListParams 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 FrMealVouchersOnboardingListParams( + 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 FrMealVouchersOnboardingListParams build() { + return new FrMealVouchersOnboardingListParams( + 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 + * FrMealVouchersOnboardingListParams#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 + * FrMealVouchersOnboardingListParams#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 + * FrMealVouchersOnboardingListParams#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 FrMealVouchersOnboardingListParams#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/FrMealVouchersOnboardingRetrieveParams.java b/src/main/java/com/stripe/param/FrMealVouchersOnboardingRetrieveParams.java new file mode 100644 index 00000000000..141cb16d6be --- /dev/null +++ b/src/main/java/com/stripe/param/FrMealVouchersOnboardingRetrieveParams.java @@ -0,0 +1,101 @@ +// 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 FrMealVouchersOnboardingRetrieveParams 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 FrMealVouchersOnboardingRetrieveParams( + 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 FrMealVouchersOnboardingRetrieveParams build() { + return new FrMealVouchersOnboardingRetrieveParams(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 + * FrMealVouchersOnboardingRetrieveParams#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 + * FrMealVouchersOnboardingRetrieveParams#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 + * FrMealVouchersOnboardingRetrieveParams#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 FrMealVouchersOnboardingRetrieveParams#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/FrMealVouchersOnboardingUpdateParams.java b/src/main/java/com/stripe/param/FrMealVouchersOnboardingUpdateParams.java new file mode 100644 index 00000000000..af349bd472a --- /dev/null +++ b/src/main/java/com/stripe/param/FrMealVouchersOnboardingUpdateParams.java @@ -0,0 +1,122 @@ +// File generated from our OpenAPI spec +package com.stripe.param; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import com.stripe.param.common.EmptyParam; +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 FrMealVouchersOnboardingUpdateParams 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; + + /** Required. Corrected Postal code of the restaurant. */ + @SerializedName("postal_code") + Object postalCode; + + private FrMealVouchersOnboardingUpdateParams( + List expand, Map extraParams, Object postalCode) { + this.expand = expand; + this.extraParams = extraParams; + this.postalCode = postalCode; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List expand; + + private Map extraParams; + + private Object postalCode; + + /** Finalize and obtain parameter instance from this builder. */ + public FrMealVouchersOnboardingUpdateParams build() { + return new FrMealVouchersOnboardingUpdateParams( + this.expand, this.extraParams, this.postalCode); + } + + /** + * 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 + * FrMealVouchersOnboardingUpdateParams#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 + * FrMealVouchersOnboardingUpdateParams#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 + * FrMealVouchersOnboardingUpdateParams#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 FrMealVouchersOnboardingUpdateParams#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. Corrected Postal code of the restaurant. */ + public Builder setPostalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** Required. Corrected Postal code of the restaurant. */ + public Builder setPostalCode(EmptyParam postalCode) { + this.postalCode = postalCode; + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/InvoiceCreatePreviewParams.java b/src/main/java/com/stripe/param/InvoiceCreatePreviewParams.java index 8b16f4d7a96..32028352253 100644 --- a/src/main/java/com/stripe/param/InvoiceCreatePreviewParams.java +++ b/src/main/java/com/stripe/param/InvoiceCreatePreviewParams.java @@ -1919,17 +1919,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -1947,10 +1953,17 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public InvoiceCreatePreviewParams.Discount build() { return new InvoiceCreatePreviewParams.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -2002,6 +2015,12 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings(InvoiceCreatePreviewParams.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -2244,361 +2263,735 @@ public enum Type implements ApiRequestParams.EnumParam { } } } - } - @Getter - @EqualsAndHashCode(callSuper = false) - public static class InvoiceItem { - /** The integer amount in cents (or local equivalent) of previewed invoice item. */ - @SerializedName("amount") - Long amount; + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; - /** - * Three-letter ISO currency - * code, in lowercase. Must be a supported - * currency. Only applicable to new invoice items. - */ - @SerializedName("currency") - String currency; + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; - /** - * An arbitrary string which you can attach to the invoice item. The description is displayed in - * the invoice for easy tracking. - */ - @SerializedName("description") - String description; + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code now} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; - /** - * Explicitly controls whether discounts apply to this invoice item. Defaults to true, except - * for negative invoice items. - */ - @SerializedName("discountable") - Boolean discountable; + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } - /** The coupons to redeem into discounts for the invoice item in the preview. */ - @SerializedName("discounts") - Object discounts; + public static Builder builder() { + return new Builder(); + } - /** - * 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; + public static class Builder { + private Map extraParams; - /** - * The ID of the invoice item to update in preview. If not specified, a new invoice item will be - * added to the preview of the upcoming invoice. - */ - @SerializedName("invoiceitem") - String invoiceitem; + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; - /** - * Set of key-value pairs that you can attach - * to an object. This can be useful for storing additional information about the object in a - * structured format. Individual keys can be unset by posting an empty value to them. All keys - * can be unset by posting an empty value to {@code metadata}. - */ - @SerializedName("metadata") - Object metadata; + private StartDate startDate; - /** - * The period associated with this invoice item. When set to different values, the period will - * be rendered on the invoice. If you have Stripe Revenue Recognition enabled, - * the period will be used to recognize and defer revenue. See the Revenue - * Recognition documentation for details. - */ - @SerializedName("period") - Period period; + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.Discount.Settings build() { + return new InvoiceCreatePreviewParams.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } - /** The ID of the price object. One of {@code price} or {@code price_data} is required. */ - @SerializedName("price") - String 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 InvoiceCreatePreviewParams.Discount.Settings#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; + } - /** - * Data used to generate a new Price object - * inline. One of {@code price} or {@code price_data} is required. - */ - @SerializedName("price_data") - PriceData priceData; + /** + * 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 InvoiceCreatePreviewParams.Discount.Settings#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } - /** Non-negative integer. The quantity of units for the invoice item. */ - @SerializedName("quantity") - Long quantity; + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + InvoiceCreatePreviewParams.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } - /** - * Only required if a default - * tax behavior was not provided in the Stripe Tax settings. Specifies whether the price is - * considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code - * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code - * exclusive}, it cannot be changed. - */ - @SerializedName("tax_behavior") - TaxBehavior taxBehavior; + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code now} if omitted. + */ + public Builder setStartDate( + InvoiceCreatePreviewParams.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } - /** A tax code ID. */ - @SerializedName("tax_code") - Object taxCode; + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + @SerializedName("custom") + Custom custom; - /** - * The tax rates that apply to the item. When set, any {@code default_tax_rates} do not apply to - * this item. - */ - @SerializedName("tax_rates") - Object taxRates; + /** + * 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 integer unit amount in cents (or local equivalent) of the charge to be applied to the - * upcoming invoice. This unit_amount will be multiplied by the quantity to get the full amount. - * If you want to apply a credit to the customer's account, pass a negative unit_amount. - */ - @SerializedName("unit_amount") - Long unitAmount; + /** + * The type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + @SerializedName("type") + Type type; - /** - * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent) with - * at most 12 decimal places. Only one of {@code unit_amount} and {@code unit_amount_decimal} - * can be set. - */ - @SerializedName("unit_amount_decimal") - BigDecimal unitAmountDecimal; + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } - private InvoiceItem( - Long amount, - String currency, - String description, - Boolean discountable, - Object discounts, - Map extraParams, - String invoiceitem, - Object metadata, - Period period, - String price, - PriceData priceData, - Long quantity, - TaxBehavior taxBehavior, - Object taxCode, - Object taxRates, - Long unitAmount, - BigDecimal unitAmountDecimal) { - this.amount = amount; - this.currency = currency; - this.description = description; - this.discountable = discountable; - this.discounts = discounts; - this.extraParams = extraParams; - this.invoiceitem = invoiceitem; - this.metadata = metadata; - this.period = period; - this.price = price; - this.priceData = priceData; - this.quantity = quantity; - this.taxBehavior = taxBehavior; - this.taxCode = taxCode; - this.taxRates = taxRates; - this.unitAmount = unitAmount; - this.unitAmountDecimal = unitAmountDecimal; - } + public static Builder builder() { + return new Builder(); + } - public static Builder builder() { - return new Builder(); - } + public static class Builder { + private Custom custom; - public static class Builder { - private Long amount; + private Map extraParams; - private String currency; + private Type type; - private String description; + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.Discount.Settings.ServicePeriodAnchorConfig build() { + return new InvoiceCreatePreviewParams.Discount.Settings.ServicePeriodAnchorConfig( + this.custom, this.extraParams, this.type); + } - private Boolean discountable; + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + public Builder setCustom( + InvoiceCreatePreviewParams.Discount.Settings.ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + return this; + } - private Object discounts; + /** + * 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 + * InvoiceCreatePreviewParams.Discount.Settings.ServicePeriodAnchorConfig#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; + } - private Map extraParams; + /** + * 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 + * InvoiceCreatePreviewParams.Discount.Settings.ServicePeriodAnchorConfig#extraParams} for + * the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } - private String invoiceitem; + /** + * The type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + public Builder setType( + InvoiceCreatePreviewParams.Discount.Settings.ServicePeriodAnchorConfig.Type type) { + this.type = type; + return this; + } + } - private Object metadata; + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 to + * 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; - private Period period; + /** + * 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 String price; + /** The hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; - private PriceData priceData; + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; - private Long quantity; + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; - private TaxBehavior taxBehavior; + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; - private Object taxCode; + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } - private Object taxRates; + public static Builder builder() { + return new Builder(); + } - private Long unitAmount; + public static class Builder { + private Long dayOfMonth; - private BigDecimal unitAmountDecimal; + private Map extraParams; - /** Finalize and obtain parameter instance from this builder. */ - public InvoiceCreatePreviewParams.InvoiceItem build() { - return new InvoiceCreatePreviewParams.InvoiceItem( - this.amount, - this.currency, - this.description, - this.discountable, - this.discounts, - this.extraParams, - this.invoiceitem, - this.metadata, - this.period, - this.price, - this.priceData, - this.quantity, - this.taxBehavior, - this.taxCode, - this.taxRates, - this.unitAmount, - this.unitAmountDecimal); - } + private Long hour; - /** The integer amount in cents (or local equivalent) of previewed invoice item. */ - public Builder setAmount(Long amount) { - this.amount = amount; - return this; - } + private Long minute; - /** - * Three-letter ISO currency - * code, in lowercase. Must be a supported - * currency. Only applicable to new invoice items. - */ - public Builder setCurrency(String currency) { - this.currency = currency; - return this; - } + private Long month; - /** - * An arbitrary string which you can attach to the invoice item. The description is displayed - * in the invoice for easy tracking. - */ - public Builder setDescription(String description) { - this.description = description; - return this; - } + private Long second; - /** - * Explicitly controls whether discounts apply to this invoice item. Defaults to true, except - * for negative invoice items. - */ - public Builder setDiscountable(Boolean discountable) { - this.discountable = discountable; - return this; - } + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.Discount.Settings.ServicePeriodAnchorConfig.Custom + build() { + return new InvoiceCreatePreviewParams.Discount.Settings.ServicePeriodAnchorConfig + .Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } - /** - * Add an element to `discounts` list. A list is initialized for the first `add/addAll` call, - * and subsequent calls adds additional elements to the original list. See {@link - * InvoiceCreatePreviewParams.InvoiceItem#discounts} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder addDiscount(InvoiceCreatePreviewParams.InvoiceItem.Discount element) { - if (this.discounts == null || this.discounts instanceof EmptyParam) { - this.discounts = new ArrayList(); - } - ((List) this.discounts).add(element); - return this; - } + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + return this; + } - /** - * Add all elements to `discounts` list. A list is initialized for the first `add/addAll` - * call, and subsequent calls adds additional elements to the original list. See {@link - * InvoiceCreatePreviewParams.InvoiceItem#discounts} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder addAllDiscount( - List elements) { - if (this.discounts == null || this.discounts instanceof EmptyParam) { - this.discounts = new ArrayList(); - } - ((List) this.discounts).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 + * InvoiceCreatePreviewParams.Discount.Settings.ServicePeriodAnchorConfig.Custom#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; + } - /** The coupons to redeem into discounts for the invoice item in the preview. */ - public Builder setDiscounts(EmptyParam discounts) { - this.discounts = discounts; - 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 + * InvoiceCreatePreviewParams.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 coupons to redeem into discounts for the invoice item in the preview. */ - public Builder setDiscounts(List discounts) { - this.discounts = discounts; - return this; - } + /** The hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + 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 - * InvoiceCreatePreviewParams.InvoiceItem#extraParams} for the field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } } - 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 InvoiceCreatePreviewParams.InvoiceItem#extraParams} for the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("subscription_service_cycle_anchor") + SUBSCRIPTION_SERVICE_CYCLE_ANCHOR("subscription_service_cycle_anchor"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } } - this.extraParams.putAll(map); - return this; } - /** - * The ID of the invoice item to update in preview. If not specified, a new invoice item will - * be added to the preview of the upcoming invoice. - */ - public Builder setInvoiceitem(String invoiceitem) { - this.invoiceitem = invoiceitem; - return this; - } + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), - /** - * Add a key/value pair to `metadata` 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 - * InvoiceCreatePreviewParams.InvoiceItem#metadata} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder putMetadata(String key, String value) { - if (this.metadata == null || this.metadata instanceof EmptyParam) { - this.metadata = new HashMap(); + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("now") + NOW("now"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; } - ((Map) this.metadata).put(key, value); - return this; } + } + } - /** - * Add all map key/value pairs to `metadata` 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 InvoiceCreatePreviewParams.InvoiceItem#metadata} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder putAllMetadata(Map map) { - if (this.metadata == null || this.metadata instanceof EmptyParam) { - this.metadata = new HashMap(); + @Getter + @EqualsAndHashCode(callSuper = false) + public static class InvoiceItem { + /** The integer amount in cents (or local equivalent) of previewed invoice item. */ + @SerializedName("amount") + Long amount; + + /** + * Three-letter ISO currency + * code, in lowercase. Must be a supported + * currency. Only applicable to new invoice items. + */ + @SerializedName("currency") + String currency; + + /** + * An arbitrary string which you can attach to the invoice item. The description is displayed in + * the invoice for easy tracking. + */ + @SerializedName("description") + String description; + + /** + * Explicitly controls whether discounts apply to this invoice item. Defaults to true, except + * for negative invoice items. + */ + @SerializedName("discountable") + Boolean discountable; + + /** The coupons to redeem into discounts for the invoice item in the preview. */ + @SerializedName("discounts") + Object discounts; + + /** + * 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 ID of the invoice item to update in preview. If not specified, a new invoice item will be + * added to the preview of the upcoming invoice. + */ + @SerializedName("invoiceitem") + String invoiceitem; + + /** + * Set of key-value pairs that you can attach + * to an object. This can be useful for storing additional information about the object in a + * structured format. Individual keys can be unset by posting an empty value to them. All keys + * can be unset by posting an empty value to {@code metadata}. + */ + @SerializedName("metadata") + Object metadata; + + /** + * The period associated with this invoice item. When set to different values, the period will + * be rendered on the invoice. If you have Stripe Revenue Recognition enabled, + * the period will be used to recognize and defer revenue. See the Revenue + * Recognition documentation for details. + */ + @SerializedName("period") + Period period; + + /** The ID of the price object. One of {@code price} or {@code price_data} is required. */ + @SerializedName("price") + String price; + + /** + * Data used to generate a new Price object + * inline. One of {@code price} or {@code price_data} is required. + */ + @SerializedName("price_data") + PriceData priceData; + + /** Non-negative integer. The quantity of units for the invoice item. */ + @SerializedName("quantity") + Long quantity; + + /** + * Only required if a default + * tax behavior was not provided in the Stripe Tax settings. Specifies whether the price is + * considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code + * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code + * exclusive}, it cannot be changed. + */ + @SerializedName("tax_behavior") + TaxBehavior taxBehavior; + + /** A tax code ID. */ + @SerializedName("tax_code") + Object taxCode; + + /** + * The tax rates that apply to the item. When set, any {@code default_tax_rates} do not apply to + * this item. + */ + @SerializedName("tax_rates") + Object taxRates; + + /** + * The integer unit amount in cents (or local equivalent) of the charge to be applied to the + * upcoming invoice. This unit_amount will be multiplied by the quantity to get the full amount. + * If you want to apply a credit to the customer's account, pass a negative unit_amount. + */ + @SerializedName("unit_amount") + Long unitAmount; + + /** + * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent) with + * at most 12 decimal places. Only one of {@code unit_amount} and {@code unit_amount_decimal} + * can be set. + */ + @SerializedName("unit_amount_decimal") + BigDecimal unitAmountDecimal; + + private InvoiceItem( + Long amount, + String currency, + String description, + Boolean discountable, + Object discounts, + Map extraParams, + String invoiceitem, + Object metadata, + Period period, + String price, + PriceData priceData, + Long quantity, + TaxBehavior taxBehavior, + Object taxCode, + Object taxRates, + Long unitAmount, + BigDecimal unitAmountDecimal) { + this.amount = amount; + this.currency = currency; + this.description = description; + this.discountable = discountable; + this.discounts = discounts; + this.extraParams = extraParams; + this.invoiceitem = invoiceitem; + this.metadata = metadata; + this.period = period; + this.price = price; + this.priceData = priceData; + this.quantity = quantity; + this.taxBehavior = taxBehavior; + this.taxCode = taxCode; + this.taxRates = taxRates; + this.unitAmount = unitAmount; + this.unitAmountDecimal = unitAmountDecimal; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long amount; + + private String currency; + + private String description; + + private Boolean discountable; + + private Object discounts; + + private Map extraParams; + + private String invoiceitem; + + private Object metadata; + + private Period period; + + private String price; + + private PriceData priceData; + + private Long quantity; + + private TaxBehavior taxBehavior; + + private Object taxCode; + + private Object taxRates; + + private Long unitAmount; + + private BigDecimal unitAmountDecimal; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.InvoiceItem build() { + return new InvoiceCreatePreviewParams.InvoiceItem( + this.amount, + this.currency, + this.description, + this.discountable, + this.discounts, + this.extraParams, + this.invoiceitem, + this.metadata, + this.period, + this.price, + this.priceData, + this.quantity, + this.taxBehavior, + this.taxCode, + this.taxRates, + this.unitAmount, + this.unitAmountDecimal); + } + + /** The integer amount in cents (or local equivalent) of previewed invoice item. */ + public Builder setAmount(Long amount) { + this.amount = amount; + return this; + } + + /** + * Three-letter ISO currency + * code, in lowercase. Must be a supported + * currency. Only applicable to new invoice items. + */ + public Builder setCurrency(String currency) { + this.currency = currency; + return this; + } + + /** + * An arbitrary string which you can attach to the invoice item. The description is displayed + * in the invoice for easy tracking. + */ + public Builder setDescription(String description) { + this.description = description; + return this; + } + + /** + * Explicitly controls whether discounts apply to this invoice item. Defaults to true, except + * for negative invoice items. + */ + public Builder setDiscountable(Boolean discountable) { + this.discountable = discountable; + return this; + } + + /** + * Add an element to `discounts` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * InvoiceCreatePreviewParams.InvoiceItem#discounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addDiscount(InvoiceCreatePreviewParams.InvoiceItem.Discount element) { + if (this.discounts == null || this.discounts instanceof EmptyParam) { + this.discounts = new ArrayList(); + } + ((List) this.discounts).add(element); + return this; + } + + /** + * Add all elements to `discounts` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * InvoiceCreatePreviewParams.InvoiceItem#discounts} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllDiscount( + List elements) { + if (this.discounts == null || this.discounts instanceof EmptyParam) { + this.discounts = new ArrayList(); + } + ((List) this.discounts).addAll(elements); + return this; + } + + /** The coupons to redeem into discounts for the invoice item in the preview. */ + public Builder setDiscounts(EmptyParam discounts) { + this.discounts = discounts; + return this; + } + + /** The coupons to redeem into discounts for the invoice item in the preview. */ + public Builder setDiscounts(List discounts) { + this.discounts = discounts; + 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 + * InvoiceCreatePreviewParams.InvoiceItem#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 InvoiceCreatePreviewParams.InvoiceItem#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 ID of the invoice item to update in preview. If not specified, a new invoice item will + * be added to the preview of the upcoming invoice. + */ + public Builder setInvoiceitem(String invoiceitem) { + this.invoiceitem = invoiceitem; + return this; + } + + /** + * Add a key/value pair to `metadata` 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 + * InvoiceCreatePreviewParams.InvoiceItem#metadata} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder putMetadata(String key, String value) { + if (this.metadata == null || this.metadata instanceof EmptyParam) { + this.metadata = new HashMap(); + } + ((Map) this.metadata).put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `metadata` 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 InvoiceCreatePreviewParams.InvoiceItem#metadata} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder putAllMetadata(Map map) { + if (this.metadata == null || this.metadata instanceof EmptyParam) { + this.metadata = new HashMap(); } ((Map) this.metadata).putAll(map); return this; @@ -5368,19 +5761,25 @@ public static class Add { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Add( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, Long index, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.index = index; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -5400,6 +5799,8 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add build() { return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add( @@ -5408,7 +5809,8 @@ public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add b this.discountEnd, this.extraParams, this.index, - this.promotionCode); + this.promotionCode, + this.settings); } /** The coupon code to redeem. */ @@ -5442,44 +5844,150 @@ public Builder putExtraParam(String key, Object value) { if (this.extraParams == null) { this.extraParams = new HashMap<>(); } - this.extraParams.put(key, value); - return this; - } + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add#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 index, starting at 0, at which to position the new discount. When not supplied, + * Stripe defaults to appending the discount to the end of the {@code discounts} array. + */ + public Builder setIndex(Long index) { + this.index = index; + return this; + } + + /** The promotion code to redeem. */ + public Builder setPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.Settings + settings) { + this.settings = settings; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class DiscountEnd { + /** + * 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 type of calculation made to determine when the + * discount ends. + */ + @SerializedName("type") + Type type; + + private DiscountEnd(Map extraParams, Type type) { + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add + .DiscountEnd + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add + .DiscountEnd(this.extraParams, 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.DiscountEnd#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.DiscountEnd#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 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add#extraParams} - * for the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); + /** + * Required. The type of calculation made to determine when the + * discount ends. + */ + public Builder setType( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add + .DiscountEnd.Type + type) { + this.type = type; + return this; } - this.extraParams.putAll(map); - return this; } - /** - * The index, starting at 0, at which to position the new discount. When not supplied, - * Stripe defaults to appending the discount to the end of the {@code discounts} array. - */ - public Builder setIndex(Long index) { - this.index = index; - return this; - } + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("amendment_end") + AMENDMENT_END("amendment_end"); - /** The promotion code to redeem. */ - public Builder setPromotionCode(String promotionCode) { - this.promotionCode = promotionCode; - return this; + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } } } @Getter @EqualsAndHashCode(callSuper = false) - public static class DiscountEnd { + public static class Settings { /** * 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} @@ -5490,16 +5998,24 @@ public static class DiscountEnd { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + /** - * Required. The type of calculation made to determine when the - * discount ends. + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if omitted. */ - @SerializedName("type") - Type type; + @SerializedName("start_date") + StartDate startDate; - private DiscountEnd(Map extraParams, Type type) { + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { this.extraParams = extraParams; - this.type = type; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; } public static Builder builder() { @@ -5509,21 +6025,23 @@ public static Builder builder() { public static class Builder { private Map extraParams; - private Type type; + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; /** Finalize and obtain parameter instance from this builder. */ public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add - .DiscountEnd + .Settings build() { return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add - .DiscountEnd(this.extraParams, this.type); + .Settings(this.extraParams, this.servicePeriodAnchorConfig, this.startDate); } /** * 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.DiscountEnd#extraParams} + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.Settings#extraParams} * for the field documentation. */ public Builder putExtraParam(String key, Object value) { @@ -5538,7 +6056,7 @@ public Builder putExtraParam(String key, Object value) { * 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.DiscountEnd#extraParams} + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.Settings#extraParams} * for the field documentation. */ public Builder putAllExtraParam(Map map) { @@ -5549,27 +6067,311 @@ public Builder putAllExtraParam(Map map) { return this; } + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.Settings + .ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + /** - * Required. The type of calculation made to determine when the - * discount ends. + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if + * omitted. */ - public Builder setType( - InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add - .DiscountEnd.Type - type) { - this.type = type; + public Builder setStartDate( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.Settings + .StartDate + startDate) { + this.startDate = startDate; return this; } } - public enum Type implements ApiRequestParams.EnumParam { - @SerializedName("amendment_end") - AMENDMENT_END("amendment_end"); + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add + .Settings.ServicePeriodAnchorConfig + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add + .Settings.ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + public Builder setCustom( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.Settings.ServicePeriodAnchorConfig#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add + .Settings.ServicePeriodAnchorConfig.Custom + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction + .Add.Settings.ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.Settings.ServicePeriodAnchorConfig.Custom#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Add.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("amendment_start") + AMENDMENT_START("amendment_start"), + + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"); @Getter(onMethod_ = {@Override}) private final String value; - Type(String value) { + StartDate(String value) { this.value = value; } } @@ -5707,15 +6509,21 @@ public static class Set { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Set( String coupon, String discount, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -5731,10 +6539,12 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set build() { return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set( - this.coupon, this.discount, this.extraParams, this.promotionCode); + this.coupon, this.discount, this.extraParams, this.promotionCode, this.settings); } /** The coupon code to replace the {@code discounts} array with. */ @@ -5775,14 +6585,414 @@ public Builder putAllExtraParam(Map map) { if (this.extraParams == null) { this.extraParams = new HashMap<>(); } - this.extraParams.putAll(map); - return this; + this.extraParams.putAll(map); + return this; + } + + /** An ID of an existing promotion code to replace the {@code discounts} array with. */ + public Builder setPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set.Settings + settings) { + this.settings = settings; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set + .Settings + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set + .Settings(this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set.Settings#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set.Settings#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set.Settings + .ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if + * omitted. + */ + public Builder setStartDate( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set.Settings + .StartDate + startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set + .Settings.ServicePeriodAnchorConfig + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set + .Settings.ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + public Builder setCustom( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set.Settings.ServicePeriodAnchorConfig#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set + .Settings.ServicePeriodAnchorConfig.Custom + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction + .Set.Settings.ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set.Settings.ServicePeriodAnchorConfig.Custom#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.DiscountAction.Set.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } } - /** An ID of an existing promotion code to replace the {@code discounts} array with. */ - public Builder setPromotionCode(String promotionCode) { - this.promotionCode = promotionCode; - return this; + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("amendment_start") + AMENDMENT_START("amendment_start"), + + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } } } } @@ -6225,17 +7435,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -6253,6 +7469,8 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount build() { @@ -6262,7 +7480,8 @@ public static class Builder { this.discount, this.discountEnd, this.extraParams, - this.promotionCode); + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -6321,6 +7540,15 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount + .Settings + settings) { + this.settings = settings; + return this; + } } @Getter @@ -6535,50 +7763,447 @@ public Builder setInterval( return this; } - /** - * Required. The number of intervals, as an whole number greater - * than 0. Stripe multiplies this by the interval type to get the overall - * duration. - */ - public Builder setIntervalCount(Long intervalCount) { - this.intervalCount = intervalCount; - return this; - } - } + /** + * Required. The number of intervals, as an whole number greater + * than 0. Stripe multiplies this by the interval type to get the overall + * duration. + */ + public Builder setIntervalCount(Long intervalCount) { + this.intervalCount = intervalCount; + return this; + } + } + + public enum Interval implements ApiRequestParams.EnumParam { + @SerializedName("day") + DAY("day"), + + @SerializedName("month") + MONTH("month"), + + @SerializedName("week") + WEEK("week"), + + @SerializedName("year") + YEAR("year"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Interval(String value) { + this.value = value; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("duration") + DURATION("duration"), + + @SerializedName("timestamp") + TIMESTAMP("timestamp"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if + * omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount + .Settings + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add + .Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount.Settings#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount.Settings#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount + .Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or + * promotion code with a service period duration. Defaults to {@code + * amendment_start} if omitted. + */ + public Builder setStartDate( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount + .Settings.StartDate + startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add + .Discount.Settings.ServicePeriodAnchorConfig + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add + .Discount.Settings.ServicePeriodAnchorConfig( + this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + public Builder setCustom( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount + .Settings.ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount.Settings.ServicePeriodAnchorConfig#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if + * omitted. + */ + public Builder setType( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount + .Settings.ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add + .Discount.Settings.ServicePeriodAnchorConfig.Custom + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add + .Discount.Settings.ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Add.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } - public enum Interval implements ApiRequestParams.EnumParam { - @SerializedName("day") - DAY("day"), + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } - @SerializedName("month") - MONTH("month"), + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } - @SerializedName("week") - WEEK("week"), + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), - @SerializedName("year") - YEAR("year"); + @SerializedName("inherit") + INHERIT("inherit"); @Getter(onMethod_ = {@Override}) private final String value; - Interval(String value) { + Type(String value) { this.value = value; } } } - public enum Type implements ApiRequestParams.EnumParam { - @SerializedName("duration") - DURATION("duration"), + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("amendment_start") + AMENDMENT_START("amendment_start"), - @SerializedName("timestamp") - TIMESTAMP("timestamp"); + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"); @Getter(onMethod_ = {@Override}) private final String value; - Type(String value) { + StartDate(String value) { this.value = value; } } @@ -7102,17 +8727,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -7130,6 +8761,8 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount build() { @@ -7139,7 +8772,8 @@ public static class Builder { this.discount, this.discountEnd, this.extraParams, - this.promotionCode); + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -7198,6 +8832,15 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount + .Settings + settings) { + this.settings = settings; + return this; + } } @Getter @@ -7423,39 +9066,436 @@ public Builder setIntervalCount(Long intervalCount) { } } - public enum Interval implements ApiRequestParams.EnumParam { - @SerializedName("day") - DAY("day"), + public enum Interval implements ApiRequestParams.EnumParam { + @SerializedName("day") + DAY("day"), + + @SerializedName("month") + MONTH("month"), + + @SerializedName("week") + WEEK("week"), + + @SerializedName("year") + YEAR("year"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Interval(String value) { + this.value = value; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("duration") + DURATION("duration"), + + @SerializedName("timestamp") + TIMESTAMP("timestamp"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if + * omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount + .Settings + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set + .Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount.Settings#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount.Settings#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount + .Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or + * promotion code with a service period duration. Defaults to {@code + * amendment_start} if omitted. + */ + public Builder setStartDate( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount + .Settings.StartDate + startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set + .Discount.Settings.ServicePeriodAnchorConfig + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set + .Discount.Settings.ServicePeriodAnchorConfig( + this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + public Builder setCustom( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount + .Settings.ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount.Settings.ServicePeriodAnchorConfig#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if + * omitted. + */ + public Builder setType( + InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount + .Settings.ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set + .Discount.Settings.ServicePeriodAnchorConfig.Custom + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set + .Discount.Settings.ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Amendment.ItemAction.Set.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } - @SerializedName("month") - MONTH("month"), + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } - @SerializedName("week") - WEEK("week"), + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } - @SerializedName("year") - YEAR("year"); + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); @Getter(onMethod_ = {@Override}) private final String value; - Interval(String value) { + Type(String value) { this.value = value; } } } - public enum Type implements ApiRequestParams.EnumParam { - @SerializedName("duration") - DURATION("duration"), + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("amendment_start") + AMENDMENT_START("amendment_start"), - @SerializedName("timestamp") - TIMESTAMP("timestamp"); + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"); @Getter(onMethod_ = {@Override}) private final String value; - Type(String value) { + StartDate(String value) { this.value = value; } } @@ -11275,197 +13315,465 @@ private BillingThresholds( this.resetBillingCycleAnchor = resetBillingCycleAnchor; } - public static Builder builder() { - return new Builder(); - } + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long amountGte; + + private Map extraParams; + + private Boolean resetBillingCycleAnchor; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds( + this.amountGte, this.extraParams, this.resetBillingCycleAnchor); + } + + /** + * Monetary threshold that triggers the subscription to advance to a new billing period. + */ + public Builder setAmountGte(Long amountGte) { + this.amountGte = amountGte; + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Indicates if the {@code billing_cycle_anchor} should be reset when a threshold is + * reached. If true, {@code billing_cycle_anchor} will be updated to the date/time the + * threshold was last reached; otherwise, the value will remain unchanged. + */ + public Builder setResetBillingCycleAnchor(Boolean resetBillingCycleAnchor) { + this.resetBillingCycleAnchor = resetBillingCycleAnchor; + return this; + } + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Discount { + /** ID of the coupon to create a new discount for. */ + @SerializedName("coupon") + String coupon; + + /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ + @SerializedName("discount") + String discount; + + /** Details to determine how long the discount should be applied for. */ + @SerializedName("discount_end") + DiscountEnd discountEnd; + + /** + * 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; + + /** ID of the promotion code to create a new discount for. */ + @SerializedName("promotion_code") + String promotionCode; + + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + + private Discount( + String coupon, + String discount, + DiscountEnd discountEnd, + Map extraParams, + String promotionCode, + Settings settings) { + this.coupon = coupon; + this.discount = discount; + this.discountEnd = discountEnd; + this.extraParams = extraParams; + this.promotionCode = promotionCode; + this.settings = settings; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String coupon; + + private String discount; + + private DiscountEnd discountEnd; + + private Map extraParams; + + private String promotionCode; + + private Settings settings; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount( + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); + } + + /** ID of the coupon to create a new discount for. */ + public Builder setCoupon(String coupon) { + this.coupon = coupon; + return this; + } + + /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ + public Builder setDiscount(String discount) { + this.discount = discount; + return this; + } + + /** Details to determine how long the discount should be applied for. */ + public Builder setDiscountEnd( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd discountEnd) { + this.discountEnd = discountEnd; + 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 InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount#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 InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** ID of the promotion code to create a new discount for. */ + public Builder setPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings settings) { + this.settings = settings; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class DiscountEnd { + /** Time span for the redeemed discount. */ + @SerializedName("duration") + Duration 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; + + /** A precise Unix timestamp for the discount to end. Must be in the future. */ + @SerializedName("timestamp") + Long timestamp; + + /** + * Required. The type of calculation made to determine when the discount + * ends. + */ + @SerializedName("type") + Type type; + + private DiscountEnd( + Duration duration, Map extraParams, Long timestamp, Type type) { + this.duration = duration; + this.extraParams = extraParams; + this.timestamp = timestamp; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Duration duration; + + private Map extraParams; + + private Long timestamp; - public static class Builder { - private Long amountGte; + private Type type; - private Map extraParams; + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd( + this.duration, this.extraParams, this.timestamp, this.type); + } - private Boolean resetBillingCycleAnchor; + /** Time span for the redeemed discount. */ + public Builder setDuration( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd.Duration + duration) { + this.duration = duration; + return this; + } - /** Finalize and obtain parameter instance from this builder. */ - public InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds build() { - return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds( - this.amountGte, this.extraParams, this.resetBillingCycleAnchor); - } + /** + * 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd#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; + } - /** - * Monetary threshold that triggers the subscription to advance to a new billing period. - */ - public Builder setAmountGte(Long amountGte) { - this.amountGte = amountGte; - 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd#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 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds#extraParams} for the - * field documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); + /** A precise Unix timestamp for the discount to end. Must be in the future. */ + public Builder setTimestamp(Long timestamp) { + this.timestamp = timestamp; + return this; } - 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds#extraParams} for the - * field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); + /** + * Required. The type of calculation made to determine when the + * discount ends. + */ + public Builder setType( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd.Type type) { + this.type = type; + return this; } - this.extraParams.putAll(map); - return this; } - /** - * Indicates if the {@code billing_cycle_anchor} should be reset when a threshold is - * reached. If true, {@code billing_cycle_anchor} will be updated to the date/time the - * threshold was last reached; otherwise, the value will remain unchanged. - */ - public Builder setResetBillingCycleAnchor(Boolean resetBillingCycleAnchor) { - this.resetBillingCycleAnchor = resetBillingCycleAnchor; - 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; - @Getter - @EqualsAndHashCode(callSuper = false) - public static class Discount { - /** ID of the coupon to create a new discount for. */ - @SerializedName("coupon") - String coupon; + /** + * Required. Specifies a type of interval unit. Either {@code day}, + * {@code week}, {@code month} or {@code year}. + */ + @SerializedName("interval") + Interval interval; - /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ - @SerializedName("discount") - String discount; + /** + * Required. The number of intervals, as an whole number greater than + * 0. Stripe multiplies this by the interval type to get the overall duration. + */ + @SerializedName("interval_count") + Long intervalCount; - /** Details to determine how long the discount should be applied for. */ - @SerializedName("discount_end") - DiscountEnd discountEnd; + private Duration( + Map extraParams, Interval interval, Long intervalCount) { + this.extraParams = extraParams; + this.interval = interval; + this.intervalCount = intervalCount; + } - /** - * 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; + public static Builder builder() { + return new Builder(); + } - /** ID of the promotion code to create a new discount for. */ - @SerializedName("promotion_code") - String promotionCode; + public static class Builder { + private Map extraParams; - private Discount( - String coupon, - String discount, - DiscountEnd discountEnd, - Map extraParams, - String promotionCode) { - this.coupon = coupon; - this.discount = discount; - this.discountEnd = discountEnd; - this.extraParams = extraParams; - this.promotionCode = promotionCode; - } + private Interval interval; - public static Builder builder() { - return new Builder(); - } + private Long intervalCount; - public static class Builder { - private String coupon; + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd.Duration + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd + .Duration(this.extraParams, this.interval, this.intervalCount); + } - private String discount; + /** + * 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd.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; + } - private DiscountEnd discountEnd; + /** + * 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd.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; + } - private Map extraParams; + /** + * Required. Specifies a type of interval unit. Either {@code day}, + * {@code week}, {@code month} or {@code year}. + */ + public Builder setInterval( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd.Duration + .Interval + interval) { + this.interval = interval; + return this; + } - private String promotionCode; + /** + * Required. The number of intervals, as an whole number greater than + * 0. Stripe multiplies this by the interval type to get the overall duration. + */ + public Builder setIntervalCount(Long intervalCount) { + this.intervalCount = intervalCount; + return this; + } + } - /** Finalize and obtain parameter instance from this builder. */ - public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount build() { - return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); - } + public enum Interval implements ApiRequestParams.EnumParam { + @SerializedName("day") + DAY("day"), - /** ID of the coupon to create a new discount for. */ - public Builder setCoupon(String coupon) { - this.coupon = coupon; - return this; - } + @SerializedName("month") + MONTH("month"), - /** ID of an existing discount on the object (or one of its ancestors) to reuse. */ - public Builder setDiscount(String discount) { - this.discount = discount; - return this; - } + @SerializedName("week") + WEEK("week"), - /** Details to determine how long the discount should be applied for. */ - public Builder setDiscountEnd( - InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd discountEnd) { - this.discountEnd = discountEnd; - return this; - } + @SerializedName("year") + YEAR("year"); - /** - * 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 InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount#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; - } + @Getter(onMethod_ = {@Override}) + private final String value; - /** - * 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 InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount#extraParams} - * for the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); + Interval(String value) { + this.value = value; + } } - this.extraParams.putAll(map); - return this; } - /** ID of the promotion code to create a new discount for. */ - public Builder setPromotionCode(String promotionCode) { - this.promotionCode = promotionCode; - return this; + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("duration") + DURATION("duration"), + + @SerializedName("timestamp") + TIMESTAMP("timestamp"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } } } @Getter @EqualsAndHashCode(callSuper = false) - public static class DiscountEnd { - /** Time span for the redeemed discount. */ - @SerializedName("duration") - Duration duration; - + public static class Settings { /** * 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. @@ -11476,23 +13784,24 @@ public static class DiscountEnd { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; - /** A precise Unix timestamp for the discount to end. Must be in the future. */ - @SerializedName("timestamp") - Long timestamp; + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; /** - * Required. The type of calculation made to determine when the discount - * ends. + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code phase_start} if omitted. */ - @SerializedName("type") - Type type; + @SerializedName("start_date") + StartDate startDate; - private DiscountEnd( - Duration duration, Map extraParams, Long timestamp, Type type) { - this.duration = duration; + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { this.extraParams = extraParams; - this.timestamp = timestamp; - this.type = type; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; } public static Builder builder() { @@ -11500,34 +13809,24 @@ public static Builder builder() { } public static class Builder { - private Duration duration; - private Map extraParams; - private Long timestamp; + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; - private Type type; + private StartDate startDate; /** Finalize and obtain parameter instance from this builder. */ - public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd build() { - return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd( - this.duration, this.extraParams, this.timestamp, this.type); - } - - /** Time span for the redeemed discount. */ - public Builder setDuration( - InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd.Duration - duration) { - this.duration = duration; - return this; + public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); } /** * 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd#extraParams} - * for the field documentation. + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings#extraParams} for + * the field documentation. */ public Builder putExtraParam(String key, Object value) { if (this.extraParams == null) { @@ -11541,8 +13840,8 @@ public Builder putExtraParam(String key, Object value) { * 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd#extraParams} - * for the field documentation. + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings#extraParams} for + * the field documentation. */ public Builder putAllExtraParam(Map map) { if (this.extraParams == null) { @@ -11552,26 +13851,36 @@ public Builder putAllExtraParam(Map map) { return this; } - /** A precise Unix timestamp for the discount to end. Must be in the future. */ - public Builder setTimestamp(Long timestamp) { - this.timestamp = timestamp; + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings + .ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; return this; } /** - * Required. The type of calculation made to determine when the - * discount ends. + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code phase_start} if omitted. */ - public Builder setType( - InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd.Type type) { - this.type = type; + public Builder setStartDate( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings.StartDate + startDate) { + this.startDate = startDate; return this; } } @Getter @EqualsAndHashCode(callSuper = false) - public static class Duration { + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + /** * 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} @@ -11582,25 +13891,15 @@ public static class Duration { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; - /** - * Required. Specifies a type of interval unit. Either {@code day}, - * {@code week}, {@code month} or {@code year}. - */ - @SerializedName("interval") - Interval interval; - - /** - * Required. The number of intervals, as an whole number greater than - * 0. Stripe multiplies this by the interval type to get the overall duration. - */ - @SerializedName("interval_count") - Long intervalCount; + /** The type of service period anchor config. Defaults to {@code inherit} if omitted. */ + @SerializedName("type") + Type type; - private Duration( - Map extraParams, Interval interval, Long intervalCount) { + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; this.extraParams = extraParams; - this.interval = interval; - this.intervalCount = intervalCount; + this.type = type; } public static Builder builder() { @@ -11608,24 +13907,36 @@ public static Builder builder() { } public static class Builder { - private Map extraParams; + private Custom custom; - private Interval interval; + private Map extraParams; - private Long intervalCount; + private Type type; /** Finalize and obtain parameter instance from this builder. */ - public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd.Duration + public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings + .ServicePeriodAnchorConfig build() { - return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd - .Duration(this.extraParams, this.interval, this.intervalCount); + return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd.Duration#extraParams} + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings.ServicePeriodAnchorConfig#extraParams} * for the field documentation. */ public Builder putExtraParam(String key, Object value) { @@ -11640,7 +13951,7 @@ public Builder putExtraParam(String key, Object value) { * 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd.Duration#extraParams} + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings.ServicePeriodAnchorConfig#extraParams} * for the field documentation. */ public Builder putAllExtraParam(Map map) { @@ -11652,60 +13963,194 @@ public Builder putAllExtraParam(Map map) { } /** - * Required. Specifies a type of interval unit. Either {@code day}, - * {@code week}, {@code month} or {@code year}. + * The type of service period anchor config. Defaults to {@code inherit} if omitted. */ - public Builder setInterval( - InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.DiscountEnd.Duration - .Interval - interval) { - this.interval = interval; + public Builder setType( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; return this; } + } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { /** - * Required. The number of intervals, as an whole number greater than - * 0. Stripe multiplies this by the interval type to get the overall duration. + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. */ - public Builder setIntervalCount(Long intervalCount) { - this.intervalCount = intervalCount; - return this; - } - } + @SerializedName("day_of_month") + Long dayOfMonth; - public enum Interval implements ApiRequestParams.EnumParam { - @SerializedName("day") - DAY("day"), + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ @SerializedName("month") - MONTH("month"), + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } - @SerializedName("week") - WEEK("week"), + public static Builder builder() { + return new Builder(); + } - @SerializedName("year") - YEAR("year"); + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); @Getter(onMethod_ = {@Override}) private final String value; - Interval(String value) { + Type(String value) { this.value = value; } } } - public enum Type implements ApiRequestParams.EnumParam { - @SerializedName("duration") - DURATION("duration"), + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), - @SerializedName("timestamp") - TIMESTAMP("timestamp"); + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("phase_start") + PHASE_START("phase_start"); @Getter(onMethod_ = {@Override}) private final String value; - Type(String value) { + StartDate(String value) { this.value = value; } } @@ -12587,17 +15032,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -12615,6 +15066,8 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount build() { return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount( @@ -12622,7 +15075,8 @@ public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount build() { this.discount, this.discountEnd, this.extraParams, - this.promotionCode); + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -12656,39 +15110,298 @@ public Builder putExtraParam(String key, Object value) { if (this.extraParams == null) { this.extraParams = new HashMap<>(); } - this.extraParams.put(key, value); - return this; - } + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** ID of the promotion code to create a new discount for. */ + public Builder setPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings settings) { + this.settings = settings; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class DiscountEnd { + /** Time span for the redeemed discount. */ + @SerializedName("duration") + Duration 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; + + /** A precise Unix timestamp for the discount to end. Must be in the future. */ + @SerializedName("timestamp") + Long timestamp; + + /** + * Required. The type of calculation made to determine when the + * discount ends. + */ + @SerializedName("type") + Type type; + + private DiscountEnd( + Duration duration, Map extraParams, Long timestamp, Type type) { + this.duration = duration; + this.extraParams = extraParams; + this.timestamp = timestamp; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Duration duration; + + private Map extraParams; + + private Long timestamp; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount + .DiscountEnd(this.duration, this.extraParams, this.timestamp, this.type); + } + + /** Time span for the redeemed discount. */ + public Builder setDuration( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd + .Duration + duration) { + this.duration = duration; + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd#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 precise Unix timestamp for the discount to end. Must be in the future. */ + public Builder setTimestamp(Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Required. The type of calculation made to determine when the + * discount ends. + */ + public Builder setType( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd.Type + type) { + this.type = type; + 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; + + /** + * Required. Specifies a type of interval unit. Either {@code day}, + * {@code week}, {@code month} or {@code year}. + */ + @SerializedName("interval") + Interval interval; + + /** + * Required. The number of intervals, as an whole number greater than + * 0. Stripe multiplies this by the interval type to get the overall duration. + */ + @SerializedName("interval_count") + Long intervalCount; + + private Duration( + Map extraParams, Interval interval, Long intervalCount) { + this.extraParams = extraParams; + this.interval = interval; + this.intervalCount = intervalCount; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Interval interval; + + private Long intervalCount; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd + .Duration + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount + .DiscountEnd.Duration(this.extraParams, this.interval, this.intervalCount); + } + + /** + * 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd.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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd.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; + } + + /** + * Required. Specifies a type of interval unit. Either {@code day}, + * {@code week}, {@code month} or {@code year}. + */ + public Builder setInterval( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd + .Duration.Interval + interval) { + this.interval = interval; + return this; + } + + /** + * Required. The number of intervals, as an whole number greater + * than 0. Stripe multiplies this by the interval type to get the overall duration. + */ + public Builder setIntervalCount(Long intervalCount) { + this.intervalCount = intervalCount; + 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount#extraParams} for the - * field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); + public enum Interval implements ApiRequestParams.EnumParam { + @SerializedName("day") + DAY("day"), + + @SerializedName("month") + MONTH("month"), + + @SerializedName("week") + WEEK("week"), + + @SerializedName("year") + YEAR("year"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Interval(String value) { + this.value = value; + } } - this.extraParams.putAll(map); - return this; } - /** ID of the promotion code to create a new discount for. */ - public Builder setPromotionCode(String promotionCode) { - this.promotionCode = promotionCode; - return this; + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("duration") + DURATION("duration"), + + @SerializedName("timestamp") + TIMESTAMP("timestamp"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } } } @Getter @EqualsAndHashCode(callSuper = false) - public static class DiscountEnd { - /** Time span for the redeemed discount. */ - @SerializedName("duration") - Duration duration; - + public static class Settings { /** * 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} @@ -12699,23 +15412,24 @@ public static class DiscountEnd { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; - /** A precise Unix timestamp for the discount to end. Must be in the future. */ - @SerializedName("timestamp") - Long timestamp; + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; /** - * Required. The type of calculation made to determine when the - * discount ends. + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code phase_start} if omitted. */ - @SerializedName("type") - Type type; + @SerializedName("start_date") + StartDate startDate; - private DiscountEnd( - Duration duration, Map extraParams, Long timestamp, Type type) { - this.duration = duration; + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { this.extraParams = extraParams; - this.timestamp = timestamp; - this.type = type; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; } public static Builder builder() { @@ -12723,35 +15437,24 @@ public static Builder builder() { } public static class Builder { - private Duration duration; - private Map extraParams; - private Long timestamp; + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; - private Type type; + private StartDate startDate; /** Finalize and obtain parameter instance from this builder. */ - public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd + public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings build() { - return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount - .DiscountEnd(this.duration, this.extraParams, this.timestamp, this.type); - } - - /** Time span for the redeemed discount. */ - public Builder setDuration( - InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd - .Duration - duration) { - this.duration = duration; - return this; + return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); } /** * 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd#extraParams} + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings#extraParams} * for the field documentation. */ public Builder putExtraParam(String key, Object value) { @@ -12766,7 +15469,7 @@ public Builder putExtraParam(String key, Object value) { * 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd#extraParams} + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings#extraParams} * for the field documentation. */ public Builder putAllExtraParam(Map map) { @@ -12777,27 +15480,36 @@ public Builder putAllExtraParam(Map map) { return this; } - /** A precise Unix timestamp for the discount to end. Must be in the future. */ - public Builder setTimestamp(Long timestamp) { - this.timestamp = timestamp; + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; return this; } /** - * Required. The type of calculation made to determine when the - * discount ends. + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code phase_start} if omitted. */ - public Builder setType( - InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd.Type - type) { - this.type = type; + public Builder setStartDate( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings.StartDate + startDate) { + this.startDate = startDate; return this; } } @Getter @EqualsAndHashCode(callSuper = false) - public static class Duration { + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + /** * 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 @@ -12809,24 +15521,16 @@ public static class Duration { Map extraParams; /** - * Required. Specifies a type of interval unit. Either {@code day}, - * {@code week}, {@code month} or {@code year}. - */ - @SerializedName("interval") - Interval interval; - - /** - * Required. The number of intervals, as an whole number greater than - * 0. Stripe multiplies this by the interval type to get the overall duration. + * The type of service period anchor config. Defaults to {@code inherit} if omitted. */ - @SerializedName("interval_count") - Long intervalCount; + @SerializedName("type") + Type type; - private Duration( - Map extraParams, Interval interval, Long intervalCount) { + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; this.extraParams = extraParams; - this.interval = interval; - this.intervalCount = intervalCount; + this.type = type; } public static Builder builder() { @@ -12834,25 +15538,37 @@ public static Builder builder() { } public static class Builder { - private Map extraParams; + private Custom custom; - private Interval interval; + private Map extraParams; - private Long intervalCount; + private Type type; /** Finalize and obtain parameter instance from this builder. */ - public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd - .Duration + public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig build() { - return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount - .DiscountEnd.Duration(this.extraParams, this.interval, this.intervalCount); + return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + public Builder setCustom( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd.Duration#extraParams} + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings.ServicePeriodAnchorConfig#extraParams} * for the field documentation. */ public Builder putExtraParam(String key, Object value) { @@ -12867,7 +15583,7 @@ public Builder putExtraParam(String key, Object value) { * 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 - * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd.Duration#extraParams} + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings.ServicePeriodAnchorConfig#extraParams} * for the field documentation. */ public Builder putAllExtraParam(Map map) { @@ -12879,60 +15595,194 @@ public Builder putAllExtraParam(Map map) { } /** - * Required. Specifies a type of interval unit. Either {@code day}, - * {@code week}, {@code month} or {@code year}. + * The type of service period anchor config. Defaults to {@code inherit} if omitted. */ - public Builder setInterval( - InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.DiscountEnd - .Duration.Interval - interval) { - this.interval = interval; + public Builder setType( + InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; return this; } + } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { /** - * Required. The number of intervals, as an whole number greater - * than 0. Stripe multiplies this by the interval type to get the overall duration. + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. */ - public Builder setIntervalCount(Long intervalCount) { - this.intervalCount = intervalCount; - return this; - } - } + @SerializedName("day_of_month") + Long dayOfMonth; - public enum Interval implements ApiRequestParams.EnumParam { - @SerializedName("day") - DAY("day"), + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ @SerializedName("month") - MONTH("month"), + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } - @SerializedName("week") - WEEK("week"), + public static Builder builder() { + return new Builder(); + } - @SerializedName("year") - YEAR("year"); + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount + .Settings.ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); @Getter(onMethod_ = {@Override}) private final String value; - Interval(String value) { + Type(String value) { this.value = value; } } } - public enum Type implements ApiRequestParams.EnumParam { - @SerializedName("duration") - DURATION("duration"), + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), - @SerializedName("timestamp") - TIMESTAMP("timestamp"); + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("phase_start") + PHASE_START("phase_start"); @Getter(onMethod_ = {@Override}) private final String value; - Type(String value) { + StartDate(String value) { this.value = value; } } @@ -16246,17 +19096,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -16274,10 +19130,17 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount build() { return new InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -16335,6 +19198,13 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -16591,6 +19461,395 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code now} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings build() { + return new InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings#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 + * InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings + .ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code now} if omitted. + */ + public Builder setStartDate( + InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings.StartDate + startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings + .ServicePeriodAnchorConfig + build() { + return new InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings.ServicePeriodAnchorConfig#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 + * InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + public Builder setType( + InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("subscription_service_cycle_anchor") + SUBSCRIPTION_SERVICE_CYCLE_ANCHOR("subscription_service_cycle_anchor"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("now") + NOW("now"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter diff --git a/src/main/java/com/stripe/param/QuoteCreateParams.java b/src/main/java/com/stripe/param/QuoteCreateParams.java index 493d91ed975..776baffb886 100644 --- a/src/main/java/com/stripe/param/QuoteCreateParams.java +++ b/src/main/java/com/stripe/param/QuoteCreateParams.java @@ -2268,19 +2268,25 @@ public static class AddDiscount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private AddDiscount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, Long index, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.index = index; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -2300,6 +2306,8 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public QuoteCreateParams.Line.Action.AddDiscount build() { return new QuoteCreateParams.Line.Action.AddDiscount( @@ -2308,7 +2316,8 @@ public QuoteCreateParams.Line.Action.AddDiscount build() { this.discountEnd, this.extraParams, this.index, - this.promotionCode); + this.promotionCode, + this.settings); } /** The coupon code to redeem. */ @@ -2372,6 +2381,12 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings(QuoteCreateParams.Line.Action.AddDiscount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -2467,6 +2482,387 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteCreateParams.Line.Action.AddDiscount.Settings build() { + return new QuoteCreateParams.Line.Action.AddDiscount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * QuoteCreateParams.Line.Action.AddDiscount.Settings#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 + * QuoteCreateParams.Line.Action.AddDiscount.Settings#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + QuoteCreateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + public Builder setStartDate( + QuoteCreateParams.Line.Action.AddDiscount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteCreateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig + build() { + return new QuoteCreateParams.Line.Action.AddDiscount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + QuoteCreateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig + .Custom + custom) { + this.custom = custom; + 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 + * QuoteCreateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig#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 + * QuoteCreateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + QuoteCreateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteCreateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig + .Custom + build() { + return new QuoteCreateParams.Line.Action.AddDiscount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * QuoteCreateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig.Custom#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 + * QuoteCreateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("line_start") + LINE_START("line_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter @@ -2736,17 +3132,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -2764,6 +3166,8 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public QuoteCreateParams.Line.Action.AddItem.Discount build() { return new QuoteCreateParams.Line.Action.AddItem.Discount( @@ -2771,7 +3175,8 @@ public QuoteCreateParams.Line.Action.AddItem.Discount build() { this.discount, this.discountEnd, this.extraParams, - this.promotionCode); + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -2826,6 +3231,13 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + QuoteCreateParams.Line.Action.AddItem.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -3076,6 +3488,392 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteCreateParams.Line.Action.AddItem.Discount.Settings build() { + return new QuoteCreateParams.Line.Action.AddItem.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * QuoteCreateParams.Line.Action.AddItem.Discount.Settings#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 + * QuoteCreateParams.Line.Action.AddItem.Discount.Settings#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + QuoteCreateParams.Line.Action.AddItem.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + public Builder setStartDate( + QuoteCreateParams.Line.Action.AddItem.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteCreateParams.Line.Action.AddItem.Discount.Settings + .ServicePeriodAnchorConfig + build() { + return new QuoteCreateParams.Line.Action.AddItem.Discount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + public Builder setCustom( + QuoteCreateParams.Line.Action.AddItem.Discount.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * QuoteCreateParams.Line.Action.AddItem.Discount.Settings.ServicePeriodAnchorConfig#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 + * QuoteCreateParams.Line.Action.AddItem.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + QuoteCreateParams.Line.Action.AddItem.Discount.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteCreateParams.Line.Action.AddItem.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new QuoteCreateParams.Line.Action.AddItem.Discount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * QuoteCreateParams.Line.Action.AddItem.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * QuoteCreateParams.Line.Action.AddItem.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("line_start") + LINE_START("line_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter @@ -3401,12 +4199,21 @@ public static class SetDiscount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private SetDiscount( - String coupon, String discount, Map extraParams, String promotionCode) { + String coupon, + String discount, + Map extraParams, + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -3422,10 +4229,12 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public QuoteCreateParams.Line.Action.SetDiscount build() { return new QuoteCreateParams.Line.Action.SetDiscount( - this.coupon, this.discount, this.extraParams, this.promotionCode); + this.coupon, this.discount, this.extraParams, this.promotionCode, this.settings); } /** The coupon code to replace the {@code discounts} array with. */ @@ -3434,44 +4243,431 @@ public Builder setCoupon(String coupon) { return this; } - /** An ID of an existing discount to replace the {@code discounts} array with. */ - public Builder setDiscount(String discount) { - this.discount = discount; - return this; - } + /** An ID of an existing discount to replace the {@code discounts} array with. */ + public Builder setDiscount(String discount) { + this.discount = discount; + 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 QuoteCreateParams.Line.Action.SetDiscount#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 QuoteCreateParams.Line.Action.SetDiscount#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** An ID of an existing promotion code to replace the {@code discounts} array with. */ + public Builder setPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings(QuoteCreateParams.Line.Action.SetDiscount.Settings settings) { + this.settings = settings; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteCreateParams.Line.Action.SetDiscount.Settings build() { + return new QuoteCreateParams.Line.Action.SetDiscount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * QuoteCreateParams.Line.Action.SetDiscount.Settings#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 + * QuoteCreateParams.Line.Action.SetDiscount.Settings#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + QuoteCreateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + public Builder setStartDate( + QuoteCreateParams.Line.Action.SetDiscount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteCreateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig + build() { + return new QuoteCreateParams.Line.Action.SetDiscount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + QuoteCreateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig + .Custom + custom) { + this.custom = custom; + 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 + * QuoteCreateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig#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 + * QuoteCreateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + QuoteCreateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteCreateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig + .Custom + build() { + return new QuoteCreateParams.Line.Action.SetDiscount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * QuoteCreateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig.Custom#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 + * QuoteCreateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + 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 QuoteCreateParams.Line.Action.SetDiscount#extraParams} for the field - * documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } } - 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 QuoteCreateParams.Line.Action.SetDiscount#extraParams} for the field - * documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } } - this.extraParams.putAll(map); - return this; } - /** An ID of an existing promotion code to replace the {@code discounts} array with. */ - public Builder setPromotionCode(String promotionCode) { - this.promotionCode = promotionCode; - return this; + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("line_start") + LINE_START("line_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } } } } @@ -3764,17 +4960,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -3792,6 +4994,8 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public QuoteCreateParams.Line.Action.SetItem.Discount build() { return new QuoteCreateParams.Line.Action.SetItem.Discount( @@ -3799,7 +5003,8 @@ public QuoteCreateParams.Line.Action.SetItem.Discount build() { this.discount, this.discountEnd, this.extraParams, - this.promotionCode); + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -3854,6 +5059,13 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + QuoteCreateParams.Line.Action.SetItem.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -4104,6 +5316,392 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteCreateParams.Line.Action.SetItem.Discount.Settings build() { + return new QuoteCreateParams.Line.Action.SetItem.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * QuoteCreateParams.Line.Action.SetItem.Discount.Settings#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 + * QuoteCreateParams.Line.Action.SetItem.Discount.Settings#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + QuoteCreateParams.Line.Action.SetItem.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + public Builder setStartDate( + QuoteCreateParams.Line.Action.SetItem.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteCreateParams.Line.Action.SetItem.Discount.Settings + .ServicePeriodAnchorConfig + build() { + return new QuoteCreateParams.Line.Action.SetItem.Discount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + public Builder setCustom( + QuoteCreateParams.Line.Action.SetItem.Discount.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * QuoteCreateParams.Line.Action.SetItem.Discount.Settings.ServicePeriodAnchorConfig#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 + * QuoteCreateParams.Line.Action.SetItem.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + QuoteCreateParams.Line.Action.SetItem.Discount.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteCreateParams.Line.Action.SetItem.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new QuoteCreateParams.Line.Action.SetItem.Discount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * QuoteCreateParams.Line.Action.SetItem.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * QuoteCreateParams.Line.Action.SetItem.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("line_start") + LINE_START("line_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter diff --git a/src/main/java/com/stripe/param/QuoteUpdateParams.java b/src/main/java/com/stripe/param/QuoteUpdateParams.java index b1ad4ffd917..843147a2a82 100644 --- a/src/main/java/com/stripe/param/QuoteUpdateParams.java +++ b/src/main/java/com/stripe/param/QuoteUpdateParams.java @@ -2202,19 +2202,25 @@ public static class AddDiscount { @SerializedName("promotion_code") Object promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private AddDiscount( Object coupon, Object discount, DiscountEnd discountEnd, Map extraParams, Long index, - Object promotionCode) { + Object promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.index = index; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -2234,6 +2240,8 @@ public static class Builder { private Object promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public QuoteUpdateParams.Line.Action.AddDiscount build() { return new QuoteUpdateParams.Line.Action.AddDiscount( @@ -2242,7 +2250,8 @@ public QuoteUpdateParams.Line.Action.AddDiscount build() { this.discountEnd, this.extraParams, this.index, - this.promotionCode); + this.promotionCode, + this.settings); } /** The coupon code to redeem. */ @@ -2324,6 +2333,12 @@ public Builder setPromotionCode(EmptyParam promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings(QuoteUpdateParams.Line.Action.AddDiscount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -2419,6 +2434,387 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteUpdateParams.Line.Action.AddDiscount.Settings build() { + return new QuoteUpdateParams.Line.Action.AddDiscount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * QuoteUpdateParams.Line.Action.AddDiscount.Settings#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 + * QuoteUpdateParams.Line.Action.AddDiscount.Settings#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + QuoteUpdateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + public Builder setStartDate( + QuoteUpdateParams.Line.Action.AddDiscount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteUpdateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig + build() { + return new QuoteUpdateParams.Line.Action.AddDiscount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + QuoteUpdateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig + .Custom + custom) { + this.custom = custom; + 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 + * QuoteUpdateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig#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 + * QuoteUpdateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + QuoteUpdateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteUpdateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig + .Custom + build() { + return new QuoteUpdateParams.Line.Action.AddDiscount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * QuoteUpdateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig.Custom#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 + * QuoteUpdateParams.Line.Action.AddDiscount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("line_start") + LINE_START("line_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter @@ -2700,17 +3096,23 @@ public static class Discount { @SerializedName("promotion_code") Object promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( Object coupon, Object discount, DiscountEnd discountEnd, Map extraParams, - Object promotionCode) { + Object promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -2728,6 +3130,8 @@ public static class Builder { private Object promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public QuoteUpdateParams.Line.Action.AddItem.Discount build() { return new QuoteUpdateParams.Line.Action.AddItem.Discount( @@ -2735,7 +3139,8 @@ public QuoteUpdateParams.Line.Action.AddItem.Discount build() { this.discount, this.discountEnd, this.extraParams, - this.promotionCode); + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -2808,6 +3213,13 @@ public Builder setPromotionCode(EmptyParam promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + QuoteUpdateParams.Line.Action.AddItem.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -3058,6 +3470,392 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteUpdateParams.Line.Action.AddItem.Discount.Settings build() { + return new QuoteUpdateParams.Line.Action.AddItem.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * QuoteUpdateParams.Line.Action.AddItem.Discount.Settings#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 + * QuoteUpdateParams.Line.Action.AddItem.Discount.Settings#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + QuoteUpdateParams.Line.Action.AddItem.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + public Builder setStartDate( + QuoteUpdateParams.Line.Action.AddItem.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteUpdateParams.Line.Action.AddItem.Discount.Settings + .ServicePeriodAnchorConfig + build() { + return new QuoteUpdateParams.Line.Action.AddItem.Discount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + public Builder setCustom( + QuoteUpdateParams.Line.Action.AddItem.Discount.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * QuoteUpdateParams.Line.Action.AddItem.Discount.Settings.ServicePeriodAnchorConfig#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 + * QuoteUpdateParams.Line.Action.AddItem.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + QuoteUpdateParams.Line.Action.AddItem.Discount.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteUpdateParams.Line.Action.AddItem.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new QuoteUpdateParams.Line.Action.AddItem.Discount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * QuoteUpdateParams.Line.Action.AddItem.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * QuoteUpdateParams.Line.Action.AddItem.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("line_start") + LINE_START("line_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter @@ -3407,12 +4205,21 @@ public static class SetDiscount { @SerializedName("promotion_code") Object promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private SetDiscount( - Object coupon, Object discount, Map extraParams, Object promotionCode) { + Object coupon, + Object discount, + Map extraParams, + Object promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -3428,10 +4235,12 @@ public static class Builder { private Object promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public QuoteUpdateParams.Line.Action.SetDiscount build() { return new QuoteUpdateParams.Line.Action.SetDiscount( - this.coupon, this.discount, this.extraParams, this.promotionCode); + this.coupon, this.discount, this.extraParams, this.promotionCode, this.settings); } /** The coupon code to replace the {@code discounts} array with. */ @@ -3446,56 +4255,443 @@ public Builder setCoupon(EmptyParam coupon) { return this; } - /** An ID of an existing discount to replace the {@code discounts} array with. */ - public Builder setDiscount(String discount) { - this.discount = discount; - return this; - } + /** An ID of an existing discount to replace the {@code discounts} array with. */ + public Builder setDiscount(String discount) { + this.discount = discount; + return this; + } + + /** An ID of an existing discount to replace the {@code discounts} array with. */ + public Builder setDiscount(EmptyParam discount) { + this.discount = discount; + 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 QuoteUpdateParams.Line.Action.SetDiscount#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 QuoteUpdateParams.Line.Action.SetDiscount#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** An ID of an existing promotion code to replace the {@code discounts} array with. */ + public Builder setPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** An ID of an existing promotion code to replace the {@code discounts} array with. */ + public Builder setPromotionCode(EmptyParam promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings(QuoteUpdateParams.Line.Action.SetDiscount.Settings settings) { + this.settings = settings; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteUpdateParams.Line.Action.SetDiscount.Settings build() { + return new QuoteUpdateParams.Line.Action.SetDiscount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * QuoteUpdateParams.Line.Action.SetDiscount.Settings#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 + * QuoteUpdateParams.Line.Action.SetDiscount.Settings#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + QuoteUpdateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + public Builder setStartDate( + QuoteUpdateParams.Line.Action.SetDiscount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteUpdateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig + build() { + return new QuoteUpdateParams.Line.Action.SetDiscount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + QuoteUpdateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig + .Custom + custom) { + this.custom = custom; + 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 + * QuoteUpdateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig#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 + * QuoteUpdateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + QuoteUpdateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteUpdateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig + .Custom + build() { + return new QuoteUpdateParams.Line.Action.SetDiscount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * QuoteUpdateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig.Custom#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 + * QuoteUpdateParams.Line.Action.SetDiscount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); - /** An ID of an existing discount to replace the {@code discounts} array with. */ - public Builder setDiscount(EmptyParam discount) { - this.discount = discount; - return this; - } + @Getter(onMethod_ = {@Override}) + private final String value; - /** - * 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 QuoteUpdateParams.Line.Action.SetDiscount#extraParams} for the field - * documentation. - */ - public Builder putExtraParam(String key, Object value) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); + Type(String value) { + this.value = value; + } } - 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 QuoteUpdateParams.Line.Action.SetDiscount#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 enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), - /** An ID of an existing promotion code to replace the {@code discounts} array with. */ - public Builder setPromotionCode(String promotionCode) { - this.promotionCode = promotionCode; - return this; - } + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), - /** An ID of an existing promotion code to replace the {@code discounts} array with. */ - public Builder setPromotionCode(EmptyParam promotionCode) { - this.promotionCode = promotionCode; - return this; + @SerializedName("line_start") + LINE_START("line_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } } } } @@ -3800,17 +4996,23 @@ public static class Discount { @SerializedName("promotion_code") Object promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( Object coupon, Object discount, DiscountEnd discountEnd, Map extraParams, - Object promotionCode) { + Object promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -3828,6 +5030,8 @@ public static class Builder { private Object promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public QuoteUpdateParams.Line.Action.SetItem.Discount build() { return new QuoteUpdateParams.Line.Action.SetItem.Discount( @@ -3835,7 +5039,8 @@ public QuoteUpdateParams.Line.Action.SetItem.Discount build() { this.discount, this.discountEnd, this.extraParams, - this.promotionCode); + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -3908,6 +5113,13 @@ public Builder setPromotionCode(EmptyParam promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + QuoteUpdateParams.Line.Action.SetItem.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -4158,6 +5370,392 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteUpdateParams.Line.Action.SetItem.Discount.Settings build() { + return new QuoteUpdateParams.Line.Action.SetItem.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * QuoteUpdateParams.Line.Action.SetItem.Discount.Settings#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 + * QuoteUpdateParams.Line.Action.SetItem.Discount.Settings#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + QuoteUpdateParams.Line.Action.SetItem.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code line_start} if omitted. + */ + public Builder setStartDate( + QuoteUpdateParams.Line.Action.SetItem.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteUpdateParams.Line.Action.SetItem.Discount.Settings + .ServicePeriodAnchorConfig + build() { + return new QuoteUpdateParams.Line.Action.SetItem.Discount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + public Builder setCustom( + QuoteUpdateParams.Line.Action.SetItem.Discount.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * QuoteUpdateParams.Line.Action.SetItem.Discount.Settings.ServicePeriodAnchorConfig#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 + * QuoteUpdateParams.Line.Action.SetItem.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + QuoteUpdateParams.Line.Action.SetItem.Discount.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public QuoteUpdateParams.Line.Action.SetItem.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new QuoteUpdateParams.Line.Action.SetItem.Discount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * QuoteUpdateParams.Line.Action.SetItem.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * QuoteUpdateParams.Line.Action.SetItem.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("line_start") + LINE_START("line_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter diff --git a/src/main/java/com/stripe/param/SubscriptionCreateParams.java b/src/main/java/com/stripe/param/SubscriptionCreateParams.java index f16792a604f..295575637ae 100644 --- a/src/main/java/com/stripe/param/SubscriptionCreateParams.java +++ b/src/main/java/com/stripe/param/SubscriptionCreateParams.java @@ -3449,17 +3449,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -3477,10 +3483,17 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionCreateParams.Discount build() { return new SubscriptionCreateParams.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -3532,6 +3545,12 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings(SubscriptionCreateParams.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -3774,147 +3793,10 @@ public enum Type implements ApiRequestParams.EnumParam { } } } - } - - @Getter - @EqualsAndHashCode(callSuper = false) - public static class InvoiceSettings { - /** - * The account tax IDs associated with the subscription. Will be set on invoices generated by - * the subscription. - */ - @SerializedName("account_tax_ids") - Object accountTaxIds; - - /** - * 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 connected account that issues the invoice. The invoice is presented with the branding and - * support information of the specified account. - */ - @SerializedName("issuer") - Issuer issuer; - - private InvoiceSettings(Object accountTaxIds, Map extraParams, Issuer issuer) { - this.accountTaxIds = accountTaxIds; - this.extraParams = extraParams; - this.issuer = issuer; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Object accountTaxIds; - - private Map extraParams; - - private Issuer issuer; - - /** Finalize and obtain parameter instance from this builder. */ - public SubscriptionCreateParams.InvoiceSettings build() { - return new SubscriptionCreateParams.InvoiceSettings( - this.accountTaxIds, this.extraParams, this.issuer); - } - - /** - * Add an element to `accountTaxIds` list. A list is initialized for the first `add/addAll` - * call, and subsequent calls adds additional elements to the original list. See {@link - * SubscriptionCreateParams.InvoiceSettings#accountTaxIds} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder addAccountTaxId(String element) { - if (this.accountTaxIds == null || this.accountTaxIds instanceof EmptyParam) { - this.accountTaxIds = new ArrayList(); - } - ((List) this.accountTaxIds).add(element); - return this; - } - - /** - * Add all elements to `accountTaxIds` list. A list is initialized for the first `add/addAll` - * call, and subsequent calls adds additional elements to the original list. See {@link - * SubscriptionCreateParams.InvoiceSettings#accountTaxIds} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder addAllAccountTaxId(List elements) { - if (this.accountTaxIds == null || this.accountTaxIds instanceof EmptyParam) { - this.accountTaxIds = new ArrayList(); - } - ((List) this.accountTaxIds).addAll(elements); - return this; - } - - /** - * The account tax IDs associated with the subscription. Will be set on invoices generated by - * the subscription. - */ - public Builder setAccountTaxIds(EmptyParam accountTaxIds) { - this.accountTaxIds = accountTaxIds; - return this; - } - - /** - * The account tax IDs associated with the subscription. Will be set on invoices generated by - * the subscription. - */ - public Builder setAccountTaxIds(List accountTaxIds) { - this.accountTaxIds = accountTaxIds; - 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 - * SubscriptionCreateParams.InvoiceSettings#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 SubscriptionCreateParams.InvoiceSettings#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 connected account that issues the invoice. The invoice is presented with the branding - * and support information of the specified account. - */ - public Builder setIssuer(SubscriptionCreateParams.InvoiceSettings.Issuer issuer) { - this.issuer = issuer; - return this; - } - } @Getter @EqualsAndHashCode(callSuper = false) - public static class Issuer { - /** The connected account being referenced when {@code type} is {@code account}. */ - @SerializedName("account") - String account; - + public static class Settings { /** * 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. @@ -3924,14 +3806,24 @@ public static class Issuer { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; - /** Required. Type of the account referenced in the request. */ - @SerializedName("type") - Type type; + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; - private Issuer(String account, Map extraParams, Type type) { - this.account = account; + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code now} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { this.extraParams = extraParams; - this.type = type; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; } public static Builder builder() { @@ -3939,29 +3831,23 @@ public static Builder builder() { } public static class Builder { - private String account; - private Map extraParams; - private Type type; + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; - /** Finalize and obtain parameter instance from this builder. */ - public SubscriptionCreateParams.InvoiceSettings.Issuer build() { - return new SubscriptionCreateParams.InvoiceSettings.Issuer( - this.account, this.extraParams, this.type); - } + private StartDate startDate; - /** The connected account being referenced when {@code type} is {@code account}. */ - public Builder setAccount(String account) { - this.account = account; - return this; + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionCreateParams.Discount.Settings build() { + return new SubscriptionCreateParams.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); } /** * 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 SubscriptionCreateParams.InvoiceSettings.Issuer#extraParams} for the - * field documentation. + * map. See {@link SubscriptionCreateParams.Discount.Settings#extraParams} for the field + * documentation. */ public Builder putExtraParam(String key, Object value) { if (this.extraParams == null) { @@ -3974,8 +3860,8 @@ public Builder putExtraParam(String key, Object value) { /** * 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 SubscriptionCreateParams.InvoiceSettings.Issuer#extraParams} for the - * field documentation. + * map. See {@link SubscriptionCreateParams.Discount.Settings#extraParams} for the field + * documentation. */ public Builder putAllExtraParam(Map map) { if (this.extraParams == null) { @@ -3985,72 +3871,578 @@ public Builder putAllExtraParam(Map map) { return this; } - /** Required. Type of the account referenced in the request. */ - public Builder setType(SubscriptionCreateParams.InvoiceSettings.Issuer.Type type) { - this.type = type; + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionCreateParams.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code now} if omitted. + */ + public Builder setStartDate( + SubscriptionCreateParams.Discount.Settings.StartDate startDate) { + this.startDate = startDate; return this; } } - public enum Type implements ApiRequestParams.EnumParam { - @SerializedName("account") - ACCOUNT("account"), + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + @SerializedName("custom") + Custom custom; - @SerializedName("self") - SELF("self"); + /** + * 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; - @Getter(onMethod_ = {@Override}) - private final String value; + /** + * The type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + @SerializedName("type") + Type type; - Type(String value) { - this.value = value; + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; } - } - } - } - @Getter - @EqualsAndHashCode(callSuper = false) - public static class Item { - /** - * Define thresholds at which an invoice will be sent, and the subscription advanced to a new - * billing period. Pass an empty string to remove previously-defined thresholds. - */ - @SerializedName("billing_thresholds") - Object billingThresholds; + public static Builder builder() { + return new Builder(); + } - /** The trial offer to apply to this subscription item. */ - @SerializedName("current_trial") - CurrentTrial currentTrial; + public static class Builder { + private Custom custom; - /** The coupons to redeem into discounts for the subscription item. */ - @SerializedName("discounts") - Object discounts; + private Map extraParams; - /** - * 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 Type type; - /** - * Set of key-value pairs that you can attach - * to an object. This can be useful for storing additional information about the object in a - * structured format. Individual keys can be unset by posting an empty value to them. All keys - * can be unset by posting an empty value to {@code metadata}. - */ - @SerializedName("metadata") - Map metadata; + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionCreateParams.Discount.Settings.ServicePeriodAnchorConfig build() { + return new SubscriptionCreateParams.Discount.Settings.ServicePeriodAnchorConfig( + this.custom, this.extraParams, this.type); + } - /** Plan ID for this item, as a string. */ - @SerializedName("plan") - String plan; + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + public Builder setCustom( + SubscriptionCreateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom custom) { + this.custom = custom; + return this; + } - /** The ID of the price object. */ - @SerializedName("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 + * SubscriptionCreateParams.Discount.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionCreateParams.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + public Builder setType( + SubscriptionCreateParams.Discount.Settings.ServicePeriodAnchorConfig.Type type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 to + * 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionCreateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom + build() { + return new SubscriptionCreateParams.Discount.Settings.ServicePeriodAnchorConfig + .Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionCreateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionCreateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("subscription_service_cycle_anchor") + SUBSCRIPTION_SERVICE_CYCLE_ANCHOR("subscription_service_cycle_anchor"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("now") + NOW("now"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class InvoiceSettings { + /** + * The account tax IDs associated with the subscription. Will be set on invoices generated by + * the subscription. + */ + @SerializedName("account_tax_ids") + Object accountTaxIds; + + /** + * 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 connected account that issues the invoice. The invoice is presented with the branding and + * support information of the specified account. + */ + @SerializedName("issuer") + Issuer issuer; + + private InvoiceSettings(Object accountTaxIds, Map extraParams, Issuer issuer) { + this.accountTaxIds = accountTaxIds; + this.extraParams = extraParams; + this.issuer = issuer; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object accountTaxIds; + + private Map extraParams; + + private Issuer issuer; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionCreateParams.InvoiceSettings build() { + return new SubscriptionCreateParams.InvoiceSettings( + this.accountTaxIds, this.extraParams, this.issuer); + } + + /** + * Add an element to `accountTaxIds` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * SubscriptionCreateParams.InvoiceSettings#accountTaxIds} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAccountTaxId(String element) { + if (this.accountTaxIds == null || this.accountTaxIds instanceof EmptyParam) { + this.accountTaxIds = new ArrayList(); + } + ((List) this.accountTaxIds).add(element); + return this; + } + + /** + * Add all elements to `accountTaxIds` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * SubscriptionCreateParams.InvoiceSettings#accountTaxIds} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllAccountTaxId(List elements) { + if (this.accountTaxIds == null || this.accountTaxIds instanceof EmptyParam) { + this.accountTaxIds = new ArrayList(); + } + ((List) this.accountTaxIds).addAll(elements); + return this; + } + + /** + * The account tax IDs associated with the subscription. Will be set on invoices generated by + * the subscription. + */ + public Builder setAccountTaxIds(EmptyParam accountTaxIds) { + this.accountTaxIds = accountTaxIds; + return this; + } + + /** + * The account tax IDs associated with the subscription. Will be set on invoices generated by + * the subscription. + */ + public Builder setAccountTaxIds(List accountTaxIds) { + this.accountTaxIds = accountTaxIds; + 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 + * SubscriptionCreateParams.InvoiceSettings#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 SubscriptionCreateParams.InvoiceSettings#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 connected account that issues the invoice. The invoice is presented with the branding + * and support information of the specified account. + */ + public Builder setIssuer(SubscriptionCreateParams.InvoiceSettings.Issuer issuer) { + this.issuer = issuer; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Issuer { + /** The connected account being referenced when {@code type} is {@code account}. */ + @SerializedName("account") + String account; + + /** + * 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. Type of the account referenced in the request. */ + @SerializedName("type") + Type type; + + private Issuer(String account, Map extraParams, Type type) { + this.account = account; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String account; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionCreateParams.InvoiceSettings.Issuer build() { + return new SubscriptionCreateParams.InvoiceSettings.Issuer( + this.account, this.extraParams, this.type); + } + + /** The connected account being referenced when {@code type} is {@code account}. */ + public Builder setAccount(String account) { + this.account = account; + 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 SubscriptionCreateParams.InvoiceSettings.Issuer#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 SubscriptionCreateParams.InvoiceSettings.Issuer#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. Type of the account referenced in the request. */ + public Builder setType(SubscriptionCreateParams.InvoiceSettings.Issuer.Type type) { + this.type = type; + return this; + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("account") + ACCOUNT("account"), + + @SerializedName("self") + SELF("self"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Item { + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new + * billing period. Pass an empty string to remove previously-defined thresholds. + */ + @SerializedName("billing_thresholds") + Object billingThresholds; + + /** The trial offer to apply to this subscription item. */ + @SerializedName("current_trial") + CurrentTrial currentTrial; + + /** The coupons to redeem into discounts for the subscription item. */ + @SerializedName("discounts") + Object discounts; + + /** + * 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; + + /** + * Set of key-value pairs that you can attach + * to an object. This can be useful for storing additional information about the object in a + * structured format. Individual keys can be unset by posting an empty value to them. All keys + * can be unset by posting an empty value to {@code metadata}. + */ + @SerializedName("metadata") + Map metadata; + + /** Plan ID for this item, as a string. */ + @SerializedName("plan") + String plan; + + /** The ID of the price object. */ + @SerializedName("price") String price; /** @@ -4554,17 +4946,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -4582,10 +4980,17 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionCreateParams.Item.Discount build() { return new SubscriptionCreateParams.Item.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -4640,6 +5045,12 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings(SubscriptionCreateParams.Item.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -4885,6 +5296,386 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code now} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionCreateParams.Item.Discount.Settings build() { + return new SubscriptionCreateParams.Item.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 SubscriptionCreateParams.Item.Discount.Settings#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 SubscriptionCreateParams.Item.Discount.Settings#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionCreateParams.Item.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code now} if omitted. + */ + public Builder setStartDate( + SubscriptionCreateParams.Item.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionCreateParams.Item.Discount.Settings.ServicePeriodAnchorConfig + build() { + return new SubscriptionCreateParams.Item.Discount.Settings.ServicePeriodAnchorConfig( + this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + SubscriptionCreateParams.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * SubscriptionCreateParams.Item.Discount.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionCreateParams.Item.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + public Builder setType( + SubscriptionCreateParams.Item.Discount.Settings.ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionCreateParams.Item.Discount.Settings.ServicePeriodAnchorConfig + .Custom + build() { + return new SubscriptionCreateParams.Item.Discount.Settings.ServicePeriodAnchorConfig + .Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionCreateParams.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionCreateParams.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("subscription_service_cycle_anchor") + SUBSCRIPTION_SERVICE_CYCLE_ANCHOR("subscription_service_cycle_anchor"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("now") + NOW("now"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter diff --git a/src/main/java/com/stripe/param/SubscriptionItemCreateParams.java b/src/main/java/com/stripe/param/SubscriptionItemCreateParams.java index a697b844bee..d0f25052d66 100644 --- a/src/main/java/com/stripe/param/SubscriptionItemCreateParams.java +++ b/src/main/java/com/stripe/param/SubscriptionItemCreateParams.java @@ -722,17 +722,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -750,10 +756,17 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionItemCreateParams.Discount build() { return new SubscriptionItemCreateParams.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -805,6 +818,12 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings(SubscriptionItemCreateParams.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -1047,6 +1066,380 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code now} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionItemCreateParams.Discount.Settings build() { + return new SubscriptionItemCreateParams.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 SubscriptionItemCreateParams.Discount.Settings#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 SubscriptionItemCreateParams.Discount.Settings#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionItemCreateParams.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code now} if omitted. + */ + public Builder setStartDate( + SubscriptionItemCreateParams.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionItemCreateParams.Discount.Settings.ServicePeriodAnchorConfig build() { + return new SubscriptionItemCreateParams.Discount.Settings.ServicePeriodAnchorConfig( + this.custom, this.extraParams, this.type); + } + + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + public Builder setCustom( + SubscriptionItemCreateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * SubscriptionItemCreateParams.Discount.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionItemCreateParams.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + public Builder setType( + SubscriptionItemCreateParams.Discount.Settings.ServicePeriodAnchorConfig.Type type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 to + * 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionItemCreateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom + build() { + return new SubscriptionItemCreateParams.Discount.Settings.ServicePeriodAnchorConfig + .Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionItemCreateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionItemCreateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("subscription_service_cycle_anchor") + SUBSCRIPTION_SERVICE_CYCLE_ANCHOR("subscription_service_cycle_anchor"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("now") + NOW("now"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter diff --git a/src/main/java/com/stripe/param/SubscriptionItemUpdateParams.java b/src/main/java/com/stripe/param/SubscriptionItemUpdateParams.java index a97da85a5e3..bb1f2c7a313 100644 --- a/src/main/java/com/stripe/param/SubscriptionItemUpdateParams.java +++ b/src/main/java/com/stripe/param/SubscriptionItemUpdateParams.java @@ -767,17 +767,23 @@ public static class Discount { @SerializedName("promotion_code") Object promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( Object coupon, Object discount, DiscountEnd discountEnd, Map extraParams, - Object promotionCode) { + Object promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -795,10 +801,17 @@ public static class Builder { private Object promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionItemUpdateParams.Discount build() { return new SubscriptionItemUpdateParams.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -868,6 +881,12 @@ public Builder setPromotionCode(EmptyParam promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings(SubscriptionItemUpdateParams.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -1110,6 +1129,380 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code now} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionItemUpdateParams.Discount.Settings build() { + return new SubscriptionItemUpdateParams.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 SubscriptionItemUpdateParams.Discount.Settings#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 SubscriptionItemUpdateParams.Discount.Settings#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionItemUpdateParams.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code now} if omitted. + */ + public Builder setStartDate( + SubscriptionItemUpdateParams.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionItemUpdateParams.Discount.Settings.ServicePeriodAnchorConfig build() { + return new SubscriptionItemUpdateParams.Discount.Settings.ServicePeriodAnchorConfig( + this.custom, this.extraParams, this.type); + } + + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + public Builder setCustom( + SubscriptionItemUpdateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * SubscriptionItemUpdateParams.Discount.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionItemUpdateParams.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + public Builder setType( + SubscriptionItemUpdateParams.Discount.Settings.ServicePeriodAnchorConfig.Type type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 to + * 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionItemUpdateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom + build() { + return new SubscriptionItemUpdateParams.Discount.Settings.ServicePeriodAnchorConfig + .Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionItemUpdateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionItemUpdateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("subscription_service_cycle_anchor") + SUBSCRIPTION_SERVICE_CYCLE_ANCHOR("subscription_service_cycle_anchor"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("now") + NOW("now"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter diff --git a/src/main/java/com/stripe/param/SubscriptionScheduleAmendParams.java b/src/main/java/com/stripe/param/SubscriptionScheduleAmendParams.java index c612c898370..2cabe52d162 100644 --- a/src/main/java/com/stripe/param/SubscriptionScheduleAmendParams.java +++ b/src/main/java/com/stripe/param/SubscriptionScheduleAmendParams.java @@ -1683,19 +1683,25 @@ public static class Add { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Add( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, Long index, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.index = index; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -1715,6 +1721,8 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add build() { return new SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add( @@ -1723,7 +1731,8 @@ public SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add build() { this.discountEnd, this.extraParams, this.index, - this.promotionCode); + this.promotionCode, + this.settings); } /** The coupon code to redeem. */ @@ -1790,6 +1799,13 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -1887,6 +1903,391 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings build() { + return new SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings#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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings + .ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if omitted. + */ + public Builder setStartDate( + SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings.StartDate + startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings + .ServicePeriodAnchorConfig + build() { + return new SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Add.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("amendment_start") + AMENDMENT_START("amendment_start"), + + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter @@ -2016,12 +2417,21 @@ public static class Set { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Set( - String coupon, String discount, Map extraParams, String promotionCode) { + String coupon, + String discount, + Map extraParams, + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -2037,10 +2447,12 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set build() { return new SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set( - this.coupon, this.discount, this.extraParams, this.promotionCode); + this.coupon, this.discount, this.extraParams, this.promotionCode, this.settings); } /** The coupon code to replace the {@code discounts} array with. */ @@ -2049,46 +2461,438 @@ public Builder setCoupon(String coupon) { return this; } - /** An ID of an existing discount to replace the {@code discounts} array with. */ - public Builder setDiscount(String discount) { - this.discount = discount; - return this; - } + /** An ID of an existing discount to replace the {@code discounts} array with. */ + public Builder setDiscount(String discount) { + this.discount = discount; + 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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set#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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** An ID of an existing promotion code to replace the {@code discounts} array with. */ + public Builder setPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings settings) { + this.settings = settings; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings build() { + return new SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings#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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings + .ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if omitted. + */ + public Builder setStartDate( + SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings.StartDate + startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings + .ServicePeriodAnchorConfig + build() { + return new SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); - /** - * 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 - * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set#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; - } + @Getter(onMethod_ = {@Override}) + private final String value; - /** - * 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 - * SubscriptionScheduleAmendParams.Amendment.DiscountAction.Set#extraParams} for the field - * documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); + Type(String value) { + this.value = value; + } } - this.extraParams.putAll(map); - return this; } - /** An ID of an existing promotion code to replace the {@code discounts} array with. */ - public Builder setPromotionCode(String promotionCode) { - this.promotionCode = promotionCode; - return this; + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("amendment_start") + AMENDMENT_START("amendment_start"), + + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } } } } @@ -2514,17 +3318,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -2542,6 +3352,8 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount build() { return new SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount( @@ -2549,7 +3361,8 @@ public SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount build() this.discount, this.discountEnd, this.extraParams, - this.promotionCode); + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -2607,6 +3420,14 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings + settings) { + this.settings = settings; + return this; + } } @Getter @@ -2817,49 +3638,440 @@ public Builder setInterval( return this; } - /** - * Required. The number of intervals, as an whole number greater - * than 0. Stripe multiplies this by the interval type to get the overall duration. - */ - public Builder setIntervalCount(Long intervalCount) { - this.intervalCount = intervalCount; - return this; + /** + * Required. The number of intervals, as an whole number greater + * than 0. Stripe multiplies this by the interval type to get the overall duration. + */ + public Builder setIntervalCount(Long intervalCount) { + this.intervalCount = intervalCount; + return this; + } + } + + public enum Interval implements ApiRequestParams.EnumParam { + @SerializedName("day") + DAY("day"), + + @SerializedName("month") + MONTH("month"), + + @SerializedName("week") + WEEK("week"), + + @SerializedName("year") + YEAR("year"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Interval(String value) { + this.value = value; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("duration") + DURATION("duration"), + + @SerializedName("timestamp") + TIMESTAMP("timestamp"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings + build() { + return new SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount + .Settings(this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings#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 + * SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings + .ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if + * omitted. + */ + public Builder setStartDate( + SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings + .StartDate + startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings + .ServicePeriodAnchorConfig + build() { + return new SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount + .Settings.ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + public Builder setCustom( + SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); } - } - public enum Interval implements ApiRequestParams.EnumParam { - @SerializedName("day") - DAY("day"), + public static class Builder { + private Long dayOfMonth; - @SerializedName("month") - MONTH("month"), + private Map extraParams; - @SerializedName("week") - WEEK("week"), + private Long hour; - @SerializedName("year") - YEAR("year"); + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount + .Settings.ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionScheduleAmendParams.Amendment.ItemAction.Add.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); @Getter(onMethod_ = {@Override}) private final String value; - Interval(String value) { + Type(String value) { this.value = value; } } } - public enum Type implements ApiRequestParams.EnumParam { - @SerializedName("duration") - DURATION("duration"), + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("amendment_start") + AMENDMENT_START("amendment_start"), - @SerializedName("timestamp") - TIMESTAMP("timestamp"); + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"); @Getter(onMethod_ = {@Override}) private final String value; - Type(String value) { + StartDate(String value) { this.value = value; } } @@ -3367,17 +4579,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -3395,6 +4613,8 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount build() { return new SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount( @@ -3402,7 +4622,8 @@ public SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount build() this.discount, this.discountEnd, this.extraParams, - this.promotionCode); + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -3460,6 +4681,14 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings + settings) { + this.settings = settings; + return this; + } } @Getter @@ -3717,6 +4946,397 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings + build() { + return new SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount + .Settings(this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings#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 + * SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings + .ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code amendment_start} if + * omitted. + */ + public Builder setStartDate( + SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings + .StartDate + startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings + .ServicePeriodAnchorConfig + build() { + return new SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount + .Settings.ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to + * specify. + */ + public Builder setCustom( + SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount + .Settings.ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges + * from 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionScheduleAmendParams.Amendment.ItemAction.Set.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("amendment_start") + AMENDMENT_START("amendment_start"), + + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter diff --git a/src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java b/src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java index 3e5d3c216f3..2e4d810dd30 100644 --- a/src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java +++ b/src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java @@ -4421,17 +4421,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -4449,10 +4455,17 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionScheduleCreateParams.Phase.Discount build() { return new SubscriptionScheduleCreateParams.Phase.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -4507,6 +4520,13 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + SubscriptionScheduleCreateParams.Phase.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -4756,6 +4776,383 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code phase_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleCreateParams.Phase.Discount.Settings build() { + return new SubscriptionScheduleCreateParams.Phase.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 SubscriptionScheduleCreateParams.Phase.Discount.Settings#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 SubscriptionScheduleCreateParams.Phase.Discount.Settings#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionScheduleCreateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code phase_start} if omitted. + */ + public Builder setStartDate( + SubscriptionScheduleCreateParams.Phase.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleCreateParams.Phase.Discount.Settings + .ServicePeriodAnchorConfig + build() { + return new SubscriptionScheduleCreateParams.Phase.Discount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + SubscriptionScheduleCreateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig + .Custom + custom) { + this.custom = custom; + 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 + * SubscriptionScheduleCreateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionScheduleCreateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. */ + public Builder setType( + SubscriptionScheduleCreateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig + .Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleCreateParams.Phase.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new SubscriptionScheduleCreateParams.Phase.Discount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionScheduleCreateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionScheduleCreateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("phase_start") + PHASE_START("phase_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter @@ -5610,17 +6007,23 @@ public static class Discount { @SerializedName("promotion_code") String promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( String coupon, String discount, DiscountEnd discountEnd, Map extraParams, - String promotionCode) { + String promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -5638,10 +6041,17 @@ public static class Builder { private String promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionScheduleCreateParams.Phase.Item.Discount build() { return new SubscriptionScheduleCreateParams.Phase.Item.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -5696,6 +6106,13 @@ public Builder setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -5948,6 +6365,390 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code phase_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings build() { + return new SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings#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 + * SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code phase_start} if omitted. + */ + public Builder setStartDate( + SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig + build() { + return new SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionScheduleCreateParams.Phase.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("phase_start") + PHASE_START("phase_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter diff --git a/src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java b/src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java index a50e7ff074b..1267152fecb 100644 --- a/src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java +++ b/src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java @@ -4342,17 +4342,23 @@ public static class Discount { @SerializedName("promotion_code") Object promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( Object coupon, Object discount, DiscountEnd discountEnd, Map extraParams, - Object promotionCode) { + Object promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -4370,10 +4376,17 @@ public static class Builder { private Object promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionScheduleUpdateParams.Phase.Discount build() { return new SubscriptionScheduleUpdateParams.Phase.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -4446,6 +4459,13 @@ public Builder setPromotionCode(EmptyParam promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + SubscriptionScheduleUpdateParams.Phase.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -4695,6 +4715,383 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code phase_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleUpdateParams.Phase.Discount.Settings build() { + return new SubscriptionScheduleUpdateParams.Phase.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 SubscriptionScheduleUpdateParams.Phase.Discount.Settings#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 SubscriptionScheduleUpdateParams.Phase.Discount.Settings#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionScheduleUpdateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code phase_start} if omitted. + */ + public Builder setStartDate( + SubscriptionScheduleUpdateParams.Phase.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleUpdateParams.Phase.Discount.Settings + .ServicePeriodAnchorConfig + build() { + return new SubscriptionScheduleUpdateParams.Phase.Discount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + SubscriptionScheduleUpdateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig + .Custom + custom) { + this.custom = custom; + 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 + * SubscriptionScheduleUpdateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionScheduleUpdateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. */ + public Builder setType( + SubscriptionScheduleUpdateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig + .Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleUpdateParams.Phase.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new SubscriptionScheduleUpdateParams.Phase.Discount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionScheduleUpdateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionScheduleUpdateParams.Phase.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("phase_start") + PHASE_START("phase_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter @@ -5576,17 +5973,23 @@ public static class Discount { @SerializedName("promotion_code") Object promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( Object coupon, Object discount, DiscountEnd discountEnd, Map extraParams, - Object promotionCode) { + Object promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -5604,10 +6007,17 @@ public static class Builder { private Object promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionScheduleUpdateParams.Phase.Item.Discount build() { return new SubscriptionScheduleUpdateParams.Phase.Item.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -5680,6 +6090,13 @@ public Builder setPromotionCode(EmptyParam promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings( + SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -5932,6 +6349,390 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code phase_start} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings build() { + return new SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 + * SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings#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 + * SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code phase_start} if omitted. + */ + public Builder setStartDate( + SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code inherit} if omitted. */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig + build() { + return new SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig(this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code inherit} if omitted. + */ + public Builder setType( + SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig.Custom + build() { + return new SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings + .ServicePeriodAnchorConfig.Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from + * 1 to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionScheduleUpdateParams.Phase.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("inherit") + INHERIT("inherit"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("phase_start") + PHASE_START("phase_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter diff --git a/src/main/java/com/stripe/param/SubscriptionUpdateParams.java b/src/main/java/com/stripe/param/SubscriptionUpdateParams.java index 6a7d6ce9e85..ad6b1f11146 100644 --- a/src/main/java/com/stripe/param/SubscriptionUpdateParams.java +++ b/src/main/java/com/stripe/param/SubscriptionUpdateParams.java @@ -3368,17 +3368,23 @@ public static class Discount { @SerializedName("promotion_code") Object promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( Object coupon, Object discount, DiscountEnd discountEnd, Map extraParams, - Object promotionCode) { + Object promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -3396,10 +3402,17 @@ public static class Builder { private Object promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionUpdateParams.Discount build() { return new SubscriptionUpdateParams.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -3469,6 +3482,12 @@ public Builder setPromotionCode(EmptyParam promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings(SubscriptionUpdateParams.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -3711,147 +3730,10 @@ public enum Type implements ApiRequestParams.EnumParam { } } } - } - - @Getter - @EqualsAndHashCode(callSuper = false) - public static class InvoiceSettings { - /** - * The account tax IDs associated with the subscription. Will be set on invoices generated by - * the subscription. - */ - @SerializedName("account_tax_ids") - Object accountTaxIds; - - /** - * 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 connected account that issues the invoice. The invoice is presented with the branding and - * support information of the specified account. - */ - @SerializedName("issuer") - Issuer issuer; - - private InvoiceSettings(Object accountTaxIds, Map extraParams, Issuer issuer) { - this.accountTaxIds = accountTaxIds; - this.extraParams = extraParams; - this.issuer = issuer; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Object accountTaxIds; - - private Map extraParams; - - private Issuer issuer; - - /** Finalize and obtain parameter instance from this builder. */ - public SubscriptionUpdateParams.InvoiceSettings build() { - return new SubscriptionUpdateParams.InvoiceSettings( - this.accountTaxIds, this.extraParams, this.issuer); - } - - /** - * Add an element to `accountTaxIds` list. A list is initialized for the first `add/addAll` - * call, and subsequent calls adds additional elements to the original list. See {@link - * SubscriptionUpdateParams.InvoiceSettings#accountTaxIds} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder addAccountTaxId(String element) { - if (this.accountTaxIds == null || this.accountTaxIds instanceof EmptyParam) { - this.accountTaxIds = new ArrayList(); - } - ((List) this.accountTaxIds).add(element); - return this; - } - - /** - * Add all elements to `accountTaxIds` list. A list is initialized for the first `add/addAll` - * call, and subsequent calls adds additional elements to the original list. See {@link - * SubscriptionUpdateParams.InvoiceSettings#accountTaxIds} for the field documentation. - */ - @SuppressWarnings("unchecked") - public Builder addAllAccountTaxId(List elements) { - if (this.accountTaxIds == null || this.accountTaxIds instanceof EmptyParam) { - this.accountTaxIds = new ArrayList(); - } - ((List) this.accountTaxIds).addAll(elements); - return this; - } - - /** - * The account tax IDs associated with the subscription. Will be set on invoices generated by - * the subscription. - */ - public Builder setAccountTaxIds(EmptyParam accountTaxIds) { - this.accountTaxIds = accountTaxIds; - return this; - } - - /** - * The account tax IDs associated with the subscription. Will be set on invoices generated by - * the subscription. - */ - public Builder setAccountTaxIds(List accountTaxIds) { - this.accountTaxIds = accountTaxIds; - 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 - * SubscriptionUpdateParams.InvoiceSettings#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 SubscriptionUpdateParams.InvoiceSettings#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 connected account that issues the invoice. The invoice is presented with the branding - * and support information of the specified account. - */ - public Builder setIssuer(SubscriptionUpdateParams.InvoiceSettings.Issuer issuer) { - this.issuer = issuer; - return this; - } - } @Getter @EqualsAndHashCode(callSuper = false) - public static class Issuer { - /** The connected account being referenced when {@code type} is {@code account}. */ - @SerializedName("account") - Object account; - + public static class Settings { /** * 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. @@ -3861,14 +3743,24 @@ public static class Issuer { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; - /** Required. Type of the account referenced in the request. */ - @SerializedName("type") - Type type; + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; - private Issuer(Object account, Map extraParams, Type type) { - this.account = account; + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code now} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { this.extraParams = extraParams; - this.type = type; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; } public static Builder builder() { @@ -3876,35 +3768,23 @@ public static Builder builder() { } public static class Builder { - private Object account; - private Map extraParams; - private Type type; - - /** Finalize and obtain parameter instance from this builder. */ - public SubscriptionUpdateParams.InvoiceSettings.Issuer build() { - return new SubscriptionUpdateParams.InvoiceSettings.Issuer( - this.account, this.extraParams, this.type); - } + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; - /** The connected account being referenced when {@code type} is {@code account}. */ - public Builder setAccount(String account) { - this.account = account; - return this; - } + private StartDate startDate; - /** The connected account being referenced when {@code type} is {@code account}. */ - public Builder setAccount(EmptyParam account) { - this.account = account; - return this; + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionUpdateParams.Discount.Settings build() { + return new SubscriptionUpdateParams.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); } /** * 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 SubscriptionUpdateParams.InvoiceSettings.Issuer#extraParams} for the - * field documentation. + * map. See {@link SubscriptionUpdateParams.Discount.Settings#extraParams} for the field + * documentation. */ public Builder putExtraParam(String key, Object value) { if (this.extraParams == null) { @@ -3917,8 +3797,8 @@ public Builder putExtraParam(String key, Object value) { /** * 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 SubscriptionUpdateParams.InvoiceSettings.Issuer#extraParams} for the - * field documentation. + * map. See {@link SubscriptionUpdateParams.Discount.Settings#extraParams} for the field + * documentation. */ public Builder putAllExtraParam(Map map) { if (this.extraParams == null) { @@ -3928,67 +3808,579 @@ public Builder putAllExtraParam(Map map) { return this; } - /** Required. Type of the account referenced in the request. */ - public Builder setType(SubscriptionUpdateParams.InvoiceSettings.Issuer.Type type) { - this.type = type; + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionUpdateParams.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code now} if omitted. + */ + public Builder setStartDate( + SubscriptionUpdateParams.Discount.Settings.StartDate startDate) { + this.startDate = startDate; return this; } } - public enum Type implements ApiRequestParams.EnumParam { - @SerializedName("account") - ACCOUNT("account"), + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + @SerializedName("custom") + Custom custom; - @SerializedName("self") - SELF("self"); + /** + * 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; - @Getter(onMethod_ = {@Override}) - private final String value; + /** + * The type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + @SerializedName("type") + Type type; - Type(String value) { - this.value = value; + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; } - } - } - } - @Getter - @EqualsAndHashCode(callSuper = false) - public static class Item { - /** - * Define thresholds at which an invoice will be sent, and the subscription advanced to a new - * billing period. Pass an empty string to remove previously-defined thresholds. - */ - @SerializedName("billing_thresholds") - Object billingThresholds; + public static Builder builder() { + return new Builder(); + } - /** - * Delete all usage for a given subscription item. You must pass this when deleting a usage - * records subscription item. {@code clear_usage} has no effect if the plan has a billing meter - * attached. - */ - @SerializedName("clear_usage") - Boolean clearUsage; + public static class Builder { + private Custom custom; - /** The trial offer to apply to this subscription item. */ - @SerializedName("current_trial") - CurrentTrial currentTrial; + private Map extraParams; - /** A flag that, if set to {@code true}, will delete the specified item. */ - @SerializedName("deleted") - Boolean deleted; + private Type type; - /** The coupons to redeem into discounts for the subscription item. */ - @SerializedName("discounts") - Object discounts; + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionUpdateParams.Discount.Settings.ServicePeriodAnchorConfig build() { + return new SubscriptionUpdateParams.Discount.Settings.ServicePeriodAnchorConfig( + this.custom, this.extraParams, this.type); + } - /** - * 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) + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + public Builder setCustom( + SubscriptionUpdateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom custom) { + this.custom = custom; + 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 + * SubscriptionUpdateParams.Discount.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionUpdateParams.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + public Builder setType( + SubscriptionUpdateParams.Discount.Settings.ServicePeriodAnchorConfig.Type type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 to + * 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionUpdateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom + build() { + return new SubscriptionUpdateParams.Discount.Settings.ServicePeriodAnchorConfig + .Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionUpdateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionUpdateParams.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("subscription_service_cycle_anchor") + SUBSCRIPTION_SERVICE_CYCLE_ANCHOR("subscription_service_cycle_anchor"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("now") + NOW("now"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class InvoiceSettings { + /** + * The account tax IDs associated with the subscription. Will be set on invoices generated by + * the subscription. + */ + @SerializedName("account_tax_ids") + Object accountTaxIds; + + /** + * 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 connected account that issues the invoice. The invoice is presented with the branding and + * support information of the specified account. + */ + @SerializedName("issuer") + Issuer issuer; + + private InvoiceSettings(Object accountTaxIds, Map extraParams, Issuer issuer) { + this.accountTaxIds = accountTaxIds; + this.extraParams = extraParams; + this.issuer = issuer; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object accountTaxIds; + + private Map extraParams; + + private Issuer issuer; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionUpdateParams.InvoiceSettings build() { + return new SubscriptionUpdateParams.InvoiceSettings( + this.accountTaxIds, this.extraParams, this.issuer); + } + + /** + * Add an element to `accountTaxIds` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * SubscriptionUpdateParams.InvoiceSettings#accountTaxIds} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAccountTaxId(String element) { + if (this.accountTaxIds == null || this.accountTaxIds instanceof EmptyParam) { + this.accountTaxIds = new ArrayList(); + } + ((List) this.accountTaxIds).add(element); + return this; + } + + /** + * Add all elements to `accountTaxIds` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * SubscriptionUpdateParams.InvoiceSettings#accountTaxIds} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder addAllAccountTaxId(List elements) { + if (this.accountTaxIds == null || this.accountTaxIds instanceof EmptyParam) { + this.accountTaxIds = new ArrayList(); + } + ((List) this.accountTaxIds).addAll(elements); + return this; + } + + /** + * The account tax IDs associated with the subscription. Will be set on invoices generated by + * the subscription. + */ + public Builder setAccountTaxIds(EmptyParam accountTaxIds) { + this.accountTaxIds = accountTaxIds; + return this; + } + + /** + * The account tax IDs associated with the subscription. Will be set on invoices generated by + * the subscription. + */ + public Builder setAccountTaxIds(List accountTaxIds) { + this.accountTaxIds = accountTaxIds; + 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 + * SubscriptionUpdateParams.InvoiceSettings#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 SubscriptionUpdateParams.InvoiceSettings#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 connected account that issues the invoice. The invoice is presented with the branding + * and support information of the specified account. + */ + public Builder setIssuer(SubscriptionUpdateParams.InvoiceSettings.Issuer issuer) { + this.issuer = issuer; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Issuer { + /** The connected account being referenced when {@code type} is {@code account}. */ + @SerializedName("account") + Object account; + + /** + * 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. Type of the account referenced in the request. */ + @SerializedName("type") + Type type; + + private Issuer(Object account, Map extraParams, Type type) { + this.account = account; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Object account; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionUpdateParams.InvoiceSettings.Issuer build() { + return new SubscriptionUpdateParams.InvoiceSettings.Issuer( + this.account, this.extraParams, this.type); + } + + /** The connected account being referenced when {@code type} is {@code account}. */ + public Builder setAccount(String account) { + this.account = account; + return this; + } + + /** The connected account being referenced when {@code type} is {@code account}. */ + public Builder setAccount(EmptyParam account) { + this.account = account; + 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 SubscriptionUpdateParams.InvoiceSettings.Issuer#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 SubscriptionUpdateParams.InvoiceSettings.Issuer#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. Type of the account referenced in the request. */ + public Builder setType(SubscriptionUpdateParams.InvoiceSettings.Issuer.Type type) { + this.type = type; + return this; + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("account") + ACCOUNT("account"), + + @SerializedName("self") + SELF("self"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Item { + /** + * Define thresholds at which an invoice will be sent, and the subscription advanced to a new + * billing period. Pass an empty string to remove previously-defined thresholds. + */ + @SerializedName("billing_thresholds") + Object billingThresholds; + + /** + * Delete all usage for a given subscription item. You must pass this when deleting a usage + * records subscription item. {@code clear_usage} has no effect if the plan has a billing meter + * attached. + */ + @SerializedName("clear_usage") + Boolean clearUsage; + + /** The trial offer to apply to this subscription item. */ + @SerializedName("current_trial") + CurrentTrial currentTrial; + + /** A flag that, if set to {@code true}, will delete the specified item. */ + @SerializedName("deleted") + Boolean deleted; + + /** The coupons to redeem into discounts for the subscription item. */ + @SerializedName("discounts") + Object discounts; + + /** + * 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; /** Subscription item to update. */ @@ -4597,17 +4989,23 @@ public static class Discount { @SerializedName("promotion_code") Object promotionCode; + /** Settings for discount application including service period anchoring. */ + @SerializedName("settings") + Settings settings; + private Discount( Object coupon, Object discount, DiscountEnd discountEnd, Map extraParams, - Object promotionCode) { + Object promotionCode, + Settings settings) { this.coupon = coupon; this.discount = discount; this.discountEnd = discountEnd; this.extraParams = extraParams; this.promotionCode = promotionCode; + this.settings = settings; } public static Builder builder() { @@ -4625,10 +5023,17 @@ public static class Builder { private Object promotionCode; + private Settings settings; + /** Finalize and obtain parameter instance from this builder. */ public SubscriptionUpdateParams.Item.Discount build() { return new SubscriptionUpdateParams.Item.Discount( - this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode); + this.coupon, + this.discount, + this.discountEnd, + this.extraParams, + this.promotionCode, + this.settings); } /** ID of the coupon to create a new discount for. */ @@ -4701,6 +5106,12 @@ public Builder setPromotionCode(EmptyParam promotionCode) { this.promotionCode = promotionCode; return this; } + + /** Settings for discount application including service period anchoring. */ + public Builder setSettings(SubscriptionUpdateParams.Item.Discount.Settings settings) { + this.settings = settings; + return this; + } } @Getter @@ -4946,6 +5357,386 @@ public enum Type implements ApiRequestParams.EnumParam { } } } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Settings { + /** + * 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; + + /** Configures service period cycle anchoring. */ + @SerializedName("service_period_anchor_config") + ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + /** + * The start date of the discount's service period when applying a coupon or promotion code + * with a service period duration. Defaults to {@code now} if omitted. + */ + @SerializedName("start_date") + StartDate startDate; + + private Settings( + Map extraParams, + ServicePeriodAnchorConfig servicePeriodAnchorConfig, + StartDate startDate) { + this.extraParams = extraParams; + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + this.startDate = startDate; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private ServicePeriodAnchorConfig servicePeriodAnchorConfig; + + private StartDate startDate; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionUpdateParams.Item.Discount.Settings build() { + return new SubscriptionUpdateParams.Item.Discount.Settings( + this.extraParams, this.servicePeriodAnchorConfig, this.startDate); + } + + /** + * 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 SubscriptionUpdateParams.Item.Discount.Settings#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 SubscriptionUpdateParams.Item.Discount.Settings#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** Configures service period cycle anchoring. */ + public Builder setServicePeriodAnchorConfig( + SubscriptionUpdateParams.Item.Discount.Settings.ServicePeriodAnchorConfig + servicePeriodAnchorConfig) { + this.servicePeriodAnchorConfig = servicePeriodAnchorConfig; + return this; + } + + /** + * The start date of the discount's service period when applying a coupon or promotion + * code with a service period duration. Defaults to {@code now} if omitted. + */ + public Builder setStartDate( + SubscriptionUpdateParams.Item.Discount.Settings.StartDate startDate) { + this.startDate = startDate; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class ServicePeriodAnchorConfig { + /** Anchor the service period to a custom date. Type must be {@code custom} to specify. */ + @SerializedName("custom") + Custom custom; + + /** + * 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 type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + @SerializedName("type") + Type type; + + private ServicePeriodAnchorConfig( + Custom custom, Map extraParams, Type type) { + this.custom = custom; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Custom custom; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionUpdateParams.Item.Discount.Settings.ServicePeriodAnchorConfig + build() { + return new SubscriptionUpdateParams.Item.Discount.Settings.ServicePeriodAnchorConfig( + this.custom, this.extraParams, this.type); + } + + /** + * Anchor the service period to a custom date. Type must be {@code custom} to specify. + */ + public Builder setCustom( + SubscriptionUpdateParams.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom + custom) { + this.custom = custom; + 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 + * SubscriptionUpdateParams.Item.Discount.Settings.ServicePeriodAnchorConfig#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 + * SubscriptionUpdateParams.Item.Discount.Settings.ServicePeriodAnchorConfig#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 type of service period anchor config. Defaults to {@code + * subscription_service_cycle_anchor} if omitted. + */ + public Builder setType( + SubscriptionUpdateParams.Item.Discount.Settings.ServicePeriodAnchorConfig.Type + type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Custom { + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + @SerializedName("day_of_month") + Long dayOfMonth; + + /** + * 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 hour of the day the anchor should be. Ranges from 0 to 23. */ + @SerializedName("hour") + Long hour; + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + @SerializedName("minute") + Long minute; + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + @SerializedName("month") + Long month; + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + @SerializedName("second") + Long second; + + private Custom( + Long dayOfMonth, + Map extraParams, + Long hour, + Long minute, + Long month, + Long second) { + this.dayOfMonth = dayOfMonth; + this.extraParams = extraParams; + this.hour = hour; + this.minute = minute; + this.month = month; + this.second = second; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long dayOfMonth; + + private Map extraParams; + + private Long hour; + + private Long minute; + + private Long month; + + private Long second; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionUpdateParams.Item.Discount.Settings.ServicePeriodAnchorConfig + .Custom + build() { + return new SubscriptionUpdateParams.Item.Discount.Settings.ServicePeriodAnchorConfig + .Custom( + this.dayOfMonth, + this.extraParams, + this.hour, + this.minute, + this.month, + this.second); + } + + /** + * Required. The day of the month the anchor should be. Ranges from 1 + * to 31. + */ + public Builder setDayOfMonth(Long dayOfMonth) { + this.dayOfMonth = dayOfMonth; + 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 + * SubscriptionUpdateParams.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 + * SubscriptionUpdateParams.Item.Discount.Settings.ServicePeriodAnchorConfig.Custom#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 hour of the day the anchor should be. Ranges from 0 to 23. */ + public Builder setHour(Long hour) { + this.hour = hour; + return this; + } + + /** The minute of the hour the anchor should be. Ranges from 0 to 59. */ + public Builder setMinute(Long minute) { + this.minute = minute; + return this; + } + + /** The month to start full cycle periods. Ranges from 1 to 12. */ + public Builder setMonth(Long month) { + this.month = month; + return this; + } + + /** The second of the minute the anchor should be. Ranges from 0 to 59. */ + public Builder setSecond(Long second) { + this.second = second; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("custom") + CUSTOM("custom"), + + @SerializedName("subscription_service_cycle_anchor") + SUBSCRIPTION_SERVICE_CYCLE_ANCHOR("subscription_service_cycle_anchor"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + public enum StartDate implements ApiRequestParams.EnumParam { + @SerializedName("current_period_end") + CURRENT_PERIOD_END("current_period_end"), + + @SerializedName("current_period_start") + CURRENT_PERIOD_START("current_period_start"), + + @SerializedName("now") + NOW("now"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + StartDate(String value) { + this.value = value; + } + } + } } @Getter diff --git a/src/main/java/com/stripe/param/checkout/SessionCreateParams.java b/src/main/java/com/stripe/param/checkout/SessionCreateParams.java index 513eb654202..532337be4be 100644 --- a/src/main/java/com/stripe/param/checkout/SessionCreateParams.java +++ b/src/main/java/com/stripe/param/checkout/SessionCreateParams.java @@ -4940,7 +4940,10 @@ public enum Duration implements ApiRequestParams.EnumParam { ONCE("once"), @SerializedName("repeating") - REPEATING("repeating"); + REPEATING("repeating"), + + @SerializedName("service_period") + SERVICE_PERIOD("service_period"); @Getter(onMethod_ = {@Override}) private final String value; diff --git a/src/main/java/com/stripe/param/checkout/SessionUpdateParams.java b/src/main/java/com/stripe/param/checkout/SessionUpdateParams.java index f984abc0368..afdedfc7d26 100644 --- a/src/main/java/com/stripe/param/checkout/SessionUpdateParams.java +++ b/src/main/java/com/stripe/param/checkout/SessionUpdateParams.java @@ -1312,7 +1312,10 @@ public enum Duration implements ApiRequestParams.EnumParam { ONCE("once"), @SerializedName("repeating") - REPEATING("repeating"); + REPEATING("repeating"), + + @SerializedName("service_period") + SERVICE_PERIOD("service_period"); @Getter(onMethod_ = {@Override}) private final String value; diff --git a/src/main/java/com/stripe/service/FrMealVouchersOnboardingService.java b/src/main/java/com/stripe/service/FrMealVouchersOnboardingService.java new file mode 100644 index 00000000000..ba071f28ae6 --- /dev/null +++ b/src/main/java/com/stripe/service/FrMealVouchersOnboardingService.java @@ -0,0 +1,124 @@ +// File generated from our OpenAPI spec +package com.stripe.service; + +import com.google.gson.reflect.TypeToken; +import com.stripe.exception.StripeException; +import com.stripe.model.FrMealVouchersOnboarding; +import com.stripe.model.StripeCollection; +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.FrMealVouchersOnboardingCreateParams; +import com.stripe.param.FrMealVouchersOnboardingListParams; +import com.stripe.param.FrMealVouchersOnboardingRetrieveParams; +import com.stripe.param.FrMealVouchersOnboardingUpdateParams; + +public final class FrMealVouchersOnboardingService extends ApiService { + public FrMealVouchersOnboardingService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + /** Lists French Meal Vouchers Onboarding objects. */ + public StripeCollection list(FrMealVouchersOnboardingListParams params) + throws StripeException { + return list(params, (RequestOptions) null); + } + /** Lists French Meal Vouchers Onboarding objects. */ + public StripeCollection list(RequestOptions options) + throws StripeException { + return list((FrMealVouchersOnboardingListParams) null, options); + } + /** Lists French Meal Vouchers Onboarding objects. */ + public StripeCollection list() throws StripeException { + return list((FrMealVouchersOnboardingListParams) null, (RequestOptions) null); + } + /** Lists French Meal Vouchers Onboarding objects. */ + public StripeCollection list( + FrMealVouchersOnboardingListParams params, RequestOptions options) throws StripeException { + String path = "/v1/fr_meal_vouchers_onboardings"; + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request( + request, new TypeToken>() {}.getType()); + } + /** + * Creates a French Meal Vouchers Onboarding object that represents a restaurant’s onboarding + * status and starts the onboarding process. + */ + public FrMealVouchersOnboarding create(FrMealVouchersOnboardingCreateParams params) + throws StripeException { + return create(params, (RequestOptions) null); + } + /** + * Creates a French Meal Vouchers Onboarding object that represents a restaurant’s onboarding + * status and starts the onboarding process. + */ + public FrMealVouchersOnboarding create( + FrMealVouchersOnboardingCreateParams params, RequestOptions options) throws StripeException { + String path = "/v1/fr_meal_vouchers_onboardings"; + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, FrMealVouchersOnboarding.class); + } + /** Retrieves the details of a French Meal Vouchers Onboarding object. */ + public FrMealVouchersOnboarding retrieve(String id, FrMealVouchersOnboardingRetrieveParams params) + throws StripeException { + return retrieve(id, params, (RequestOptions) null); + } + /** Retrieves the details of a French Meal Vouchers Onboarding object. */ + public FrMealVouchersOnboarding retrieve(String id, RequestOptions options) + throws StripeException { + return retrieve(id, (FrMealVouchersOnboardingRetrieveParams) null, options); + } + /** Retrieves the details of a French Meal Vouchers Onboarding object. */ + public FrMealVouchersOnboarding retrieve(String id) throws StripeException { + return retrieve(id, (FrMealVouchersOnboardingRetrieveParams) null, (RequestOptions) null); + } + /** Retrieves the details of a French Meal Vouchers Onboarding object. */ + public FrMealVouchersOnboarding retrieve( + String id, FrMealVouchersOnboardingRetrieveParams params, RequestOptions options) + throws StripeException { + String path = String.format("/v1/fr_meal_vouchers_onboardings/%s", ApiResource.urlEncodeId(id)); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, FrMealVouchersOnboarding.class); + } + /** Updates the details of a restaurant’s French Meal Vouchers Onboarding object. */ + public FrMealVouchersOnboarding update(String id, FrMealVouchersOnboardingUpdateParams params) + throws StripeException { + return update(id, params, (RequestOptions) null); + } + /** Updates the details of a restaurant’s French Meal Vouchers Onboarding object. */ + public FrMealVouchersOnboarding update( + String id, FrMealVouchersOnboardingUpdateParams params, RequestOptions options) + throws StripeException { + String path = String.format("/v1/fr_meal_vouchers_onboardings/%s", ApiResource.urlEncodeId(id)); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, FrMealVouchersOnboarding.class); + } +} diff --git a/src/main/java/com/stripe/service/V1Services.java b/src/main/java/com/stripe/service/V1Services.java index 0540e4a1c39..b4e6baa77a5 100644 --- a/src/main/java/com/stripe/service/V1Services.java +++ b/src/main/java/com/stripe/service/V1Services.java @@ -145,6 +145,10 @@ public com.stripe.service.ForwardingService forwarding() { return new com.stripe.service.ForwardingService(this.getResponseGetter()); } + public com.stripe.service.FrMealVouchersOnboardingService frMealVouchersOnboardings() { + return new com.stripe.service.FrMealVouchersOnboardingService(this.getResponseGetter()); + } + public com.stripe.service.FxQuoteService fxQuotes() { return new com.stripe.service.FxQuoteService(this.getResponseGetter()); } From c21b10fbf8f743edb61e362f479e5dc3ad8a3b68 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 23 Jan 2026 17:47:26 +0000 Subject: [PATCH 2/2] Update generated code for v2156 and --- CODEGEN_VERSION | 2 +- OPENAPI_VERSION | 2 +- src/main/java/com/stripe/model/Coupon.java | 18 +++ .../com/stripe/param/CouponCreateParams.java | 131 +++++++++++++++++- 4 files changed, 149 insertions(+), 4 deletions(-) diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index f0d8c5cf5ee..d0f436205d2 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -8989becedb2153519066ec2233cbf5880b938188 \ No newline at end of file +8c8709034677788a8c86b775cd16f40ecb5fb7db \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 8d0138b868d..2af218b4480 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2155 \ No newline at end of file +v2156 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/Coupon.java b/src/main/java/com/stripe/model/Coupon.java index a9625673df4..b5085568b02 100644 --- a/src/main/java/com/stripe/model/Coupon.java +++ b/src/main/java/com/stripe/model/Coupon.java @@ -460,6 +460,24 @@ public static class ServicePeriod extends StripeObject { @SerializedName("interval_count") Long intervalCount; + + @SerializedName("iterations") + Iterations iterations; + + /** + * For more details about Iterations, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Iterations extends StripeObject { + @SerializedName("count") + Long count; + + @SerializedName("type") + String type; + } } @Override diff --git a/src/main/java/com/stripe/param/CouponCreateParams.java b/src/main/java/com/stripe/param/CouponCreateParams.java index cb37db49957..ec609e4fc23 100644 --- a/src/main/java/com/stripe/param/CouponCreateParams.java +++ b/src/main/java/com/stripe/param/CouponCreateParams.java @@ -746,10 +746,19 @@ public static class ServicePeriod { @SerializedName("interval_count") Long intervalCount; - private ServicePeriod(Map extraParams, Interval interval, Long intervalCount) { + /** Specifies the number of times the coupon is contiguously applied. */ + @SerializedName("iterations") + Iterations iterations; + + private ServicePeriod( + Map extraParams, + Interval interval, + Long intervalCount, + Iterations iterations) { this.extraParams = extraParams; this.interval = interval; this.intervalCount = intervalCount; + this.iterations = iterations; } public static Builder builder() { @@ -763,10 +772,12 @@ public static class Builder { private Long intervalCount; + private Iterations iterations; + /** Finalize and obtain parameter instance from this builder. */ public CouponCreateParams.ServicePeriod build() { return new CouponCreateParams.ServicePeriod( - this.extraParams, this.interval, this.intervalCount); + this.extraParams, this.interval, this.intervalCount, this.iterations); } /** @@ -811,6 +822,122 @@ public Builder setIntervalCount(Long intervalCount) { this.intervalCount = intervalCount; return this; } + + /** Specifies the number of times the coupon is contiguously applied. */ + public Builder setIterations(CouponCreateParams.ServicePeriod.Iterations iterations) { + this.iterations = iterations; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Iterations { + /** + * The number of iterations the service period will repeat for. Only used when type is {@code + * count}, defaults to 1. + */ + @SerializedName("count") + Long count; + + /** + * 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 type of iterations, defaults to {@code count} if omitted. + */ + @SerializedName("type") + Type type; + + private Iterations(Long count, Map extraParams, Type type) { + this.count = count; + this.extraParams = extraParams; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Long count; + + private Map extraParams; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public CouponCreateParams.ServicePeriod.Iterations build() { + return new CouponCreateParams.ServicePeriod.Iterations( + this.count, this.extraParams, this.type); + } + + /** + * The number of iterations the service period will repeat for. Only used when type is + * {@code count}, defaults to 1. + */ + public Builder setCount(Long count) { + this.count = count; + 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 CouponCreateParams.ServicePeriod.Iterations#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 CouponCreateParams.ServicePeriod.Iterations#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 type of iterations, defaults to {@code count} if omitted. + */ + public Builder setType(CouponCreateParams.ServicePeriod.Iterations.Type type) { + this.type = type; + return this; + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("count") + COUNT("count"), + + @SerializedName("forever") + FOREVER("forever"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } } public enum Interval implements ApiRequestParams.EnumParam {