Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// 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.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.Getter;
@Getter
public class QuoteCreateParams extends ApiRequestParams {
/**
* Set to true to allow quote lines to have {@code starts_at} in the past if collection is paused
* between {@code starts_at} and now.
*/
@SerializedName("allow_backdated_lines")
Boolean allowBackdatedLines;
/**
* The amount of the application fee (if any) that will be requested to be applied to the payment
* and transferred to the application owner's Stripe account. There cannot be any line items with
* recurring prices when using this field.
*/
@SerializedName("application_fee_amount")
Object applicationFeeAmount;
/**
* A non-negative decimal between 0 and 100, with at most two decimal places. This represents the
* percentage of the subscription invoice total that will be transferred to the application
* owner's Stripe account. There must be at least 1 line item with a recurring price to use this
* field.
*/
@SerializedName("application_fee_percent")
Object applicationFeePercent;
/** Settings for automatic tax lookup for this quote and resulting invoices and subscriptions. */
@SerializedName("automatic_tax")
AutomaticTax automaticTax;
/**
* Either {@code charge_automatically}, or {@code send_invoice}. When charging automatically,
* Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice
* finalization using the default payment method attached to the subscription or customer. When
* sending an invoice, Stripe will email your customer an invoice with payment instructions and
* mark the subscription as {@code active}. Defaults to {@code charge_automatically}.
*/
@SerializedName("collection_method")
CollectionMethod collectionMethod;
/**
* The customer for which this quote belongs to. A customer is required before finalizing the
* quote. Once specified, it cannot be changed.
*/
@SerializedName("customer")
String customer;
/** The tax rates that will apply to any line item that does not have {@code tax_rates} set. */
@SerializedName("default_tax_rates")
Object defaultTaxRates;
/**
* A description that will be displayed on the quote PDF. If no value is passed, the default
* description configured in your quote template settings will be
* used.
*/
@SerializedName("description")
Object description;
/** The discounts applied to the quote. */
@SerializedName("discounts")
Object discounts;
/** Specifies which fields in the response should be expanded. */
@SerializedName("expand")
List expand;
/**
* A future timestamp on which the quote will be canceled if in {@code open} or {@code draft}
* status. Measured in seconds since the Unix epoch. If no value is passed, the default expiration
* date configured in your quote
* template settings will be used.
*/
@SerializedName("expires_at")
Long expiresAt;
/**
* 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 footer that will be displayed on the quote PDF. If no value is passed, the default footer
* configured in your quote template
* settings will be used.
*/
@SerializedName("footer")
Object footer;
/**
* Clone an existing quote. The new quote will be created in {@code status=draft}. When using this
* parameter, you cannot specify any other parameters except for {@code expires_at}.
*/
@SerializedName("from_quote")
FromQuote fromQuote;
/**
* A header that will be displayed on the quote PDF. If no value is passed, the default header
* configured in your quote template
* settings will be used.
*/
@SerializedName("header")
Object header;
/** All invoices will be billed using the specified settings. */
@SerializedName("invoice_settings")
InvoiceSettings invoiceSettings;
/**
* A list of line items the customer is being quoted for. Each line item includes information
* about the product, the quantity, and the resulting cost.
*/
@SerializedName("line_items")
List lineItems;
/**
* A list of quote lines on the quote. These
* lines describe changes, in the order provided, that will be used to create new subscription
* schedules or update existing subscription schedules when the quote is accepted.
*/
@SerializedName("lines")
List lines;
/**
* 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;
/** The account on behalf of which to charge. */
@SerializedName("on_behalf_of")
Object onBehalfOf;
/**
* When creating a subscription or subscription schedule, the specified configuration data will be
* used. There must be at least one line item with a recurring price for a subscription or
* subscription schedule to be created. A subscription schedule is created if {@code
* subscription_data[effective_date]} is present and in the future, otherwise a subscription is
* created.
*/
@SerializedName("subscription_data")
SubscriptionData subscriptionData;
/**
* List representing overrides for {@code subscription_data} configurations for specific
* subscription schedules.
*/
@SerializedName("subscription_data_overrides")
List subscriptionDataOverrides;
/** ID of the test clock to attach to the quote. */
@SerializedName("test_clock")
String testClock;
/** The data with which to automatically create a Transfer for each of the invoices. */
@SerializedName("transfer_data")
Object transferData;
private QuoteCreateParams(
Boolean allowBackdatedLines,
Object applicationFeeAmount,
Object applicationFeePercent,
AutomaticTax automaticTax,
CollectionMethod collectionMethod,
String customer,
Object defaultTaxRates,
Object description,
Object discounts,
List expand,
Long expiresAt,
Map extraParams,
Object footer,
FromQuote fromQuote,
Object header,
InvoiceSettings invoiceSettings,
List lineItems,
List lines,
Map metadata,
Object onBehalfOf,
SubscriptionData subscriptionData,
List subscriptionDataOverrides,
String testClock,
Object transferData) {
this.allowBackdatedLines = allowBackdatedLines;
this.applicationFeeAmount = applicationFeeAmount;
this.applicationFeePercent = applicationFeePercent;
this.automaticTax = automaticTax;
this.collectionMethod = collectionMethod;
this.customer = customer;
this.defaultTaxRates = defaultTaxRates;
this.description = description;
this.discounts = discounts;
this.expand = expand;
this.expiresAt = expiresAt;
this.extraParams = extraParams;
this.footer = footer;
this.fromQuote = fromQuote;
this.header = header;
this.invoiceSettings = invoiceSettings;
this.lineItems = lineItems;
this.lines = lines;
this.metadata = metadata;
this.onBehalfOf = onBehalfOf;
this.subscriptionData = subscriptionData;
this.subscriptionDataOverrides = subscriptionDataOverrides;
this.testClock = testClock;
this.transferData = transferData;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Boolean allowBackdatedLines;
private Object applicationFeeAmount;
private Object applicationFeePercent;
private AutomaticTax automaticTax;
private CollectionMethod collectionMethod;
private String customer;
private Object defaultTaxRates;
private Object description;
private Object discounts;
private List expand;
private Long expiresAt;
private Map extraParams;
private Object footer;
private FromQuote fromQuote;
private Object header;
private InvoiceSettings invoiceSettings;
private List lineItems;
private List lines;
private Map metadata;
private Object onBehalfOf;
private SubscriptionData subscriptionData;
private List subscriptionDataOverrides;
private String testClock;
private Object transferData;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams build() {
return new QuoteCreateParams(
this.allowBackdatedLines,
this.applicationFeeAmount,
this.applicationFeePercent,
this.automaticTax,
this.collectionMethod,
this.customer,
this.defaultTaxRates,
this.description,
this.discounts,
this.expand,
this.expiresAt,
this.extraParams,
this.footer,
this.fromQuote,
this.header,
this.invoiceSettings,
this.lineItems,
this.lines,
this.metadata,
this.onBehalfOf,
this.subscriptionData,
this.subscriptionDataOverrides,
this.testClock,
this.transferData);
}
/**
* Set to true to allow quote lines to have {@code starts_at} in the past if collection is
* paused between {@code starts_at} and now.
*/
public Builder setAllowBackdatedLines(Boolean allowBackdatedLines) {
this.allowBackdatedLines = allowBackdatedLines;
return this;
}
/**
* The amount of the application fee (if any) that will be requested to be applied to the
* payment and transferred to the application owner's Stripe account. There cannot be any line
* items with recurring prices when using this field.
*/
public Builder setApplicationFeeAmount(Long applicationFeeAmount) {
this.applicationFeeAmount = applicationFeeAmount;
return this;
}
/**
* The amount of the application fee (if any) that will be requested to be applied to the
* payment and transferred to the application owner's Stripe account. There cannot be any line
* items with recurring prices when using this field.
*/
public Builder setApplicationFeeAmount(EmptyParam applicationFeeAmount) {
this.applicationFeeAmount = applicationFeeAmount;
return this;
}
/**
* A non-negative decimal between 0 and 100, with at most two decimal places. This represents
* the percentage of the subscription invoice total that will be transferred to the application
* owner's Stripe account. There must be at least 1 line item with a recurring price to use this
* field.
*/
public Builder setApplicationFeePercent(BigDecimal applicationFeePercent) {
this.applicationFeePercent = applicationFeePercent;
return this;
}
/**
* A non-negative decimal between 0 and 100, with at most two decimal places. This represents
* the percentage of the subscription invoice total that will be transferred to the application
* owner's Stripe account. There must be at least 1 line item with a recurring price to use this
* field.
*/
public Builder setApplicationFeePercent(EmptyParam applicationFeePercent) {
this.applicationFeePercent = applicationFeePercent;
return this;
}
/**
* Settings for automatic tax lookup for this quote and resulting invoices and subscriptions.
*/
public Builder setAutomaticTax(QuoteCreateParams.AutomaticTax automaticTax) {
this.automaticTax = automaticTax;
return this;
}
/**
* Either {@code charge_automatically}, or {@code send_invoice}. When charging automatically,
* Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice
* finalization using the default payment method attached to the subscription or customer. When
* sending an invoice, Stripe will email your customer an invoice with payment instructions and
* mark the subscription as {@code active}. Defaults to {@code charge_automatically}.
*/
public Builder setCollectionMethod(QuoteCreateParams.CollectionMethod collectionMethod) {
this.collectionMethod = collectionMethod;
return this;
}
/**
* The customer for which this quote belongs to. A customer is required before finalizing the
* quote. Once specified, it cannot be changed.
*/
public Builder setCustomer(String customer) {
this.customer = customer;
return this;
}
/**
* Add an element to `defaultTaxRates` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams#defaultTaxRates} for the field documentation.
*/
@SuppressWarnings("unchecked")
public Builder addDefaultTaxRate(String element) {
if (this.defaultTaxRates == null || this.defaultTaxRates instanceof EmptyParam) {
this.defaultTaxRates = new ArrayList();
}
((List) this.defaultTaxRates).add(element);
return this;
}
/**
* Add all elements to `defaultTaxRates` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams#defaultTaxRates} for the field documentation.
*/
@SuppressWarnings("unchecked")
public Builder addAllDefaultTaxRate(List elements) {
if (this.defaultTaxRates == null || this.defaultTaxRates instanceof EmptyParam) {
this.defaultTaxRates = new ArrayList();
}
((List) this.defaultTaxRates).addAll(elements);
return this;
}
/** The tax rates that will apply to any line item that does not have {@code tax_rates} set. */
public Builder setDefaultTaxRates(EmptyParam defaultTaxRates) {
this.defaultTaxRates = defaultTaxRates;
return this;
}
/** The tax rates that will apply to any line item that does not have {@code tax_rates} set. */
public Builder setDefaultTaxRates(List defaultTaxRates) {
this.defaultTaxRates = defaultTaxRates;
return this;
}
/**
* A description that will be displayed on the quote PDF. If no value is passed, the default
* description configured in your quote template settings will
* be used.
*/
public Builder setDescription(String description) {
this.description = description;
return this;
}
/**
* A description that will be displayed on the quote PDF. If no value is passed, the default
* description configured in your quote template settings will
* be used.
*/
public Builder setDescription(EmptyParam description) {
this.description = description;
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
* QuoteCreateParams#discounts} for the field documentation.
*/
@SuppressWarnings("unchecked")
public Builder addDiscount(QuoteCreateParams.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
* QuoteCreateParams#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 discounts applied to the quote. */
public Builder setDiscounts(EmptyParam discounts) {
this.discounts = discounts;
return this;
}
/** The discounts applied to the quote. */
public Builder setDiscounts(List discounts) {
this.discounts = discounts;
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
* QuoteCreateParams#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
* QuoteCreateParams#expand} for the field documentation.
*/
public Builder addAllExpand(List elements) {
if (this.expand == null) {
this.expand = new ArrayList<>();
}
this.expand.addAll(elements);
return this;
}
/**
* A future timestamp on which the quote will be canceled if in {@code open} or {@code draft}
* status. Measured in seconds since the Unix epoch. If no value is passed, the default
* expiration date configured in your quote template settings will
* be used.
*/
public Builder setExpiresAt(Long expiresAt) {
this.expiresAt = expiresAt;
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#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#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 footer that will be displayed on the quote PDF. If no value is passed, the default footer
* configured in your quote
* template settings will be used.
*/
public Builder setFooter(String footer) {
this.footer = footer;
return this;
}
/**
* A footer that will be displayed on the quote PDF. If no value is passed, the default footer
* configured in your quote
* template settings will be used.
*/
public Builder setFooter(EmptyParam footer) {
this.footer = footer;
return this;
}
/**
* Clone an existing quote. The new quote will be created in {@code status=draft}. When using
* this parameter, you cannot specify any other parameters except for {@code expires_at}.
*/
public Builder setFromQuote(QuoteCreateParams.FromQuote fromQuote) {
this.fromQuote = fromQuote;
return this;
}
/**
* A header that will be displayed on the quote PDF. If no value is passed, the default header
* configured in your quote
* template settings will be used.
*/
public Builder setHeader(String header) {
this.header = header;
return this;
}
/**
* A header that will be displayed on the quote PDF. If no value is passed, the default header
* configured in your quote
* template settings will be used.
*/
public Builder setHeader(EmptyParam header) {
this.header = header;
return this;
}
/** All invoices will be billed using the specified settings. */
public Builder setInvoiceSettings(QuoteCreateParams.InvoiceSettings invoiceSettings) {
this.invoiceSettings = invoiceSettings;
return this;
}
/**
* Add an element to `lineItems` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams#lineItems} for the field documentation.
*/
public Builder addLineItem(QuoteCreateParams.LineItem element) {
if (this.lineItems == null) {
this.lineItems = new ArrayList<>();
}
this.lineItems.add(element);
return this;
}
/**
* Add all elements to `lineItems` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams#lineItems} for the field documentation.
*/
public Builder addAllLineItem(List elements) {
if (this.lineItems == null) {
this.lineItems = new ArrayList<>();
}
this.lineItems.addAll(elements);
return this;
}
/**
* Add an element to `lines` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams#lines} for the field documentation.
*/
public Builder addLine(QuoteCreateParams.Line element) {
if (this.lines == null) {
this.lines = new ArrayList<>();
}
this.lines.add(element);
return this;
}
/**
* Add all elements to `lines` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams#lines} for the field documentation.
*/
public Builder addAllLine(List elements) {
if (this.lines == null) {
this.lines = new ArrayList<>();
}
this.lines.addAll(elements);
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
* QuoteCreateParams#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 QuoteCreateParams#metadata} for the field documentation.
*/
public Builder putAllMetadata(Map map) {
if (this.metadata == null) {
this.metadata = new HashMap<>();
}
this.metadata.putAll(map);
return this;
}
/** The account on behalf of which to charge. */
public Builder setOnBehalfOf(String onBehalfOf) {
this.onBehalfOf = onBehalfOf;
return this;
}
/** The account on behalf of which to charge. */
public Builder setOnBehalfOf(EmptyParam onBehalfOf) {
this.onBehalfOf = onBehalfOf;
return this;
}
/**
* When creating a subscription or subscription schedule, the specified configuration data will
* be used. There must be at least one line item with a recurring price for a subscription or
* subscription schedule to be created. A subscription schedule is created if {@code
* subscription_data[effective_date]} is present and in the future, otherwise a subscription is
* created.
*/
public Builder setSubscriptionData(QuoteCreateParams.SubscriptionData subscriptionData) {
this.subscriptionData = subscriptionData;
return this;
}
/**
* Add an element to `subscriptionDataOverrides` list. A list is initialized for the first
* `add/addAll` call, and subsequent calls adds additional elements to the original list. See
* {@link QuoteCreateParams#subscriptionDataOverrides} for the field documentation.
*/
public Builder addSubscriptionDataOverride(QuoteCreateParams.SubscriptionDataOverride element) {
if (this.subscriptionDataOverrides == null) {
this.subscriptionDataOverrides = new ArrayList<>();
}
this.subscriptionDataOverrides.add(element);
return this;
}
/**
* Add all elements to `subscriptionDataOverrides` list. A list is initialized for the first
* `add/addAll` call, and subsequent calls adds additional elements to the original list. See
* {@link QuoteCreateParams#subscriptionDataOverrides} for the field documentation.
*/
public Builder addAllSubscriptionDataOverride(
List elements) {
if (this.subscriptionDataOverrides == null) {
this.subscriptionDataOverrides = new ArrayList<>();
}
this.subscriptionDataOverrides.addAll(elements);
return this;
}
/** ID of the test clock to attach to the quote. */
public Builder setTestClock(String testClock) {
this.testClock = testClock;
return this;
}
/** The data with which to automatically create a Transfer for each of the invoices. */
public Builder setTransferData(QuoteCreateParams.TransferData transferData) {
this.transferData = transferData;
return this;
}
/** The data with which to automatically create a Transfer for each of the invoices. */
public Builder setTransferData(EmptyParam transferData) {
this.transferData = transferData;
return this;
}
}
@Getter
public static class AutomaticTax {
/**
* Required. Controls whether Stripe will automatically compute tax on the
* resulting invoices or subscriptions as well as the quote itself.
*/
@SerializedName("enabled")
Boolean enabled;
/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* The account that's liable for tax. If set, the business address and tax registrations
* required to perform the tax calculation are loaded from this account. The tax transaction is
* returned in the report of the connected account.
*/
@SerializedName("liability")
Liability liability;
private AutomaticTax(Boolean enabled, Map extraParams, Liability liability) {
this.enabled = enabled;
this.extraParams = extraParams;
this.liability = liability;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Boolean enabled;
private Map extraParams;
private Liability liability;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.AutomaticTax build() {
return new QuoteCreateParams.AutomaticTax(this.enabled, this.extraParams, this.liability);
}
/**
* Required. Controls whether Stripe will automatically compute tax on the
* resulting invoices or subscriptions as well as the quote itself.
*/
public Builder setEnabled(Boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
* call, and subsequent calls add additional key/value pairs to the original map. See {@link
* QuoteCreateParams.AutomaticTax#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.AutomaticTax#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 account that's liable for tax. If set, the business address and tax registrations
* required to perform the tax calculation are loaded from this account. The tax transaction
* is returned in the report of the connected account.
*/
public Builder setLiability(QuoteCreateParams.AutomaticTax.Liability liability) {
this.liability = liability;
return this;
}
}
@Getter
public static class Liability {
/** 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 Liability(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 QuoteCreateParams.AutomaticTax.Liability build() {
return new QuoteCreateParams.AutomaticTax.Liability(
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 QuoteCreateParams.AutomaticTax.Liability#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.AutomaticTax.Liability#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(QuoteCreateParams.AutomaticTax.Liability.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
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;
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;
}
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;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Discount build() {
return new QuoteCreateParams.Discount(
this.coupon, this.discount, this.discountEnd, this.extraParams, this.promotionCode);
}
/** 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(QuoteCreateParams.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
* QuoteCreateParams.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 QuoteCreateParams.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;
}
}
@Getter
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 QuoteCreateParams.Discount.DiscountEnd build() {
return new QuoteCreateParams.Discount.DiscountEnd(
this.duration, this.extraParams, this.timestamp, this.type);
}
/** Time span for the redeemed discount. */
public Builder setDuration(QuoteCreateParams.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 QuoteCreateParams.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 QuoteCreateParams.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(QuoteCreateParams.Discount.DiscountEnd.Type type) {
this.type = type;
return this;
}
}
@Getter
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 QuoteCreateParams.Discount.DiscountEnd.Duration build() {
return new QuoteCreateParams.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 QuoteCreateParams.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 QuoteCreateParams.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(
QuoteCreateParams.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;
}
}
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
public static class FromQuote {
/**
* 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;
/** Whether this quote is a revision of the previous quote. */
@SerializedName("is_revision")
Boolean isRevision;
/** Required. The {@code id} of the quote that will be cloned. */
@SerializedName("quote")
String quote;
private FromQuote(Map extraParams, Boolean isRevision, String quote) {
this.extraParams = extraParams;
this.isRevision = isRevision;
this.quote = quote;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private Boolean isRevision;
private String quote;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.FromQuote build() {
return new QuoteCreateParams.FromQuote(this.extraParams, this.isRevision, this.quote);
}
/**
* 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.FromQuote#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.FromQuote#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Whether this quote is a revision of the previous quote. */
public Builder setIsRevision(Boolean isRevision) {
this.isRevision = isRevision;
return this;
}
/** Required. The {@code id} of the quote that will be cloned. */
public Builder setQuote(String quote) {
this.quote = quote;
return this;
}
}
}
@Getter
public static class InvoiceSettings {
/**
* Number of days within which a customer must pay the invoice generated by this quote. This
* value will be {@code null} for quotes where {@code collection_method=charge_automatically}.
*/
@SerializedName("days_until_due")
Long daysUntilDue;
/**
* 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(Long daysUntilDue, Map extraParams, Issuer issuer) {
this.daysUntilDue = daysUntilDue;
this.extraParams = extraParams;
this.issuer = issuer;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Long daysUntilDue;
private Map extraParams;
private Issuer issuer;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.InvoiceSettings build() {
return new QuoteCreateParams.InvoiceSettings(
this.daysUntilDue, this.extraParams, this.issuer);
}
/**
* Number of days within which a customer must pay the invoice generated by this quote. This
* value will be {@code null} for quotes where {@code collection_method=charge_automatically}.
*/
public Builder setDaysUntilDue(Long daysUntilDue) {
this.daysUntilDue = daysUntilDue;
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.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 QuoteCreateParams.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(QuoteCreateParams.InvoiceSettings.Issuer issuer) {
this.issuer = issuer;
return this;
}
}
@Getter
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 QuoteCreateParams.InvoiceSettings.Issuer build() {
return new QuoteCreateParams.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 QuoteCreateParams.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 QuoteCreateParams.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(QuoteCreateParams.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
public static class Line {
/** An array of operations the quote line performs. */
@SerializedName("actions")
List actions;
/** Details to identify the subscription schedule the quote line applies to. */
@SerializedName("applies_to")
AppliesTo appliesTo;
/**
* For point-in-time quote lines (having no {@code ends_at} timestamp), this attribute lets you
* set or remove whether the subscription's billing cycle anchor is reset at the Quote Line
* {@code starts_at} timestamp.For time-span based quote lines (having both {@code starts_at}
* and {@code ends_at}), the only valid value is {@code automatic}, which removes any previously
* configured billing cycle anchor resets during the window of time spanning the quote line.
*/
@SerializedName("billing_cycle_anchor")
BillingCycleAnchor billingCycleAnchor;
/**
* A point-in-time operation that cancels an existing subscription schedule at the line's
* starts_at timestamp. Currently only compatible with {@code quote_acceptance_date} for {@code
* starts_at}. When using cancel_subscription_schedule, the subscription schedule on the quote
* remains unalterable, except for modifications to the metadata, collection_method or
* invoice_settings.
*/
@SerializedName("cancel_subscription_schedule")
CancelSubscriptionSchedule cancelSubscriptionSchedule;
/**
* Details to identify the end of the time range modified by the proposed change. If not
* supplied, the quote line is considered a point-in-time operation that only affects the exact
* timestamp at {@code starts_at}, and a restricted set of attributes is supported on the quote
* line.
*/
@SerializedName("ends_at")
EndsAt endsAt;
/**
* 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;
/**
* Changes to how Stripe handles prorations during the quote line's time span. Affects if and
* how prorations are created when a future phase starts.
*/
@SerializedName("proration_behavior")
ProrationBehavior prorationBehavior;
/**
* Defines how to pause collection for the underlying subscription throughout the duration of
* the amendment.
*/
@SerializedName("set_pause_collection")
SetPauseCollection setPauseCollection;
/**
* Timestamp helper to end the underlying schedule early, based on the acompanying line's start
* or end date.
*/
@SerializedName("set_schedule_end")
SetScheduleEnd setScheduleEnd;
/** Details to identify the earliest timestamp where the proposed change should take effect. */
@SerializedName("starts_at")
StartsAt startsAt;
/** Settings related to subscription trials. */
@SerializedName("trial_settings")
TrialSettings trialSettings;
private Line(
List actions,
AppliesTo appliesTo,
BillingCycleAnchor billingCycleAnchor,
CancelSubscriptionSchedule cancelSubscriptionSchedule,
EndsAt endsAt,
Map extraParams,
ProrationBehavior prorationBehavior,
SetPauseCollection setPauseCollection,
SetScheduleEnd setScheduleEnd,
StartsAt startsAt,
TrialSettings trialSettings) {
this.actions = actions;
this.appliesTo = appliesTo;
this.billingCycleAnchor = billingCycleAnchor;
this.cancelSubscriptionSchedule = cancelSubscriptionSchedule;
this.endsAt = endsAt;
this.extraParams = extraParams;
this.prorationBehavior = prorationBehavior;
this.setPauseCollection = setPauseCollection;
this.setScheduleEnd = setScheduleEnd;
this.startsAt = startsAt;
this.trialSettings = trialSettings;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private List actions;
private AppliesTo appliesTo;
private BillingCycleAnchor billingCycleAnchor;
private CancelSubscriptionSchedule cancelSubscriptionSchedule;
private EndsAt endsAt;
private Map extraParams;
private ProrationBehavior prorationBehavior;
private SetPauseCollection setPauseCollection;
private SetScheduleEnd setScheduleEnd;
private StartsAt startsAt;
private TrialSettings trialSettings;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line build() {
return new QuoteCreateParams.Line(
this.actions,
this.appliesTo,
this.billingCycleAnchor,
this.cancelSubscriptionSchedule,
this.endsAt,
this.extraParams,
this.prorationBehavior,
this.setPauseCollection,
this.setScheduleEnd,
this.startsAt,
this.trialSettings);
}
/**
* Add an element to `actions` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line#actions} for the field documentation.
*/
public Builder addAction(QuoteCreateParams.Line.Action element) {
if (this.actions == null) {
this.actions = new ArrayList<>();
}
this.actions.add(element);
return this;
}
/**
* Add all elements to `actions` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line#actions} for the field documentation.
*/
public Builder addAllAction(List elements) {
if (this.actions == null) {
this.actions = new ArrayList<>();
}
this.actions.addAll(elements);
return this;
}
/** Details to identify the subscription schedule the quote line applies to. */
public Builder setAppliesTo(QuoteCreateParams.Line.AppliesTo appliesTo) {
this.appliesTo = appliesTo;
return this;
}
/**
* For point-in-time quote lines (having no {@code ends_at} timestamp), this attribute lets
* you set or remove whether the subscription's billing cycle anchor is reset at the Quote
* Line {@code starts_at} timestamp.For time-span based quote lines (having both {@code
* starts_at} and {@code ends_at}), the only valid value is {@code automatic}, which removes
* any previously configured billing cycle anchor resets during the window of time spanning
* the quote line.
*/
public Builder setBillingCycleAnchor(
QuoteCreateParams.Line.BillingCycleAnchor billingCycleAnchor) {
this.billingCycleAnchor = billingCycleAnchor;
return this;
}
/**
* A point-in-time operation that cancels an existing subscription schedule at the line's
* starts_at timestamp. Currently only compatible with {@code quote_acceptance_date} for
* {@code starts_at}. When using cancel_subscription_schedule, the subscription schedule on
* the quote remains unalterable, except for modifications to the metadata, collection_method
* or invoice_settings.
*/
public Builder setCancelSubscriptionSchedule(
QuoteCreateParams.Line.CancelSubscriptionSchedule cancelSubscriptionSchedule) {
this.cancelSubscriptionSchedule = cancelSubscriptionSchedule;
return this;
}
/**
* Details to identify the end of the time range modified by the proposed change. If not
* supplied, the quote line is considered a point-in-time operation that only affects the
* exact timestamp at {@code starts_at}, and a restricted set of attributes is supported on
* the quote line.
*/
public Builder setEndsAt(QuoteCreateParams.Line.EndsAt endsAt) {
this.endsAt = endsAt;
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#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#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Changes to how Stripe handles prorations during the quote line's time span. Affects if and
* how prorations are created when a future phase starts.
*/
public Builder setProrationBehavior(
QuoteCreateParams.Line.ProrationBehavior prorationBehavior) {
this.prorationBehavior = prorationBehavior;
return this;
}
/**
* Defines how to pause collection for the underlying subscription throughout the duration of
* the amendment.
*/
public Builder setSetPauseCollection(
QuoteCreateParams.Line.SetPauseCollection setPauseCollection) {
this.setPauseCollection = setPauseCollection;
return this;
}
/**
* Timestamp helper to end the underlying schedule early, based on the acompanying line's
* start or end date.
*/
public Builder setSetScheduleEnd(QuoteCreateParams.Line.SetScheduleEnd setScheduleEnd) {
this.setScheduleEnd = setScheduleEnd;
return this;
}
/**
* Details to identify the earliest timestamp where the proposed change should take effect.
*/
public Builder setStartsAt(QuoteCreateParams.Line.StartsAt startsAt) {
this.startsAt = startsAt;
return this;
}
/** Settings related to subscription trials. */
public Builder setTrialSettings(QuoteCreateParams.Line.TrialSettings trialSettings) {
this.trialSettings = trialSettings;
return this;
}
}
@Getter
public static class Action {
/** Details for the {@code add_discount} type. */
@SerializedName("add_discount")
AddDiscount addDiscount;
/** Details for the {@code add_item} type. */
@SerializedName("add_item")
AddItem addItem;
/** Details for the {@code add_metadata} type: specify a hash of key-value pairs. */
@SerializedName("add_metadata")
Map addMetadata;
/**
* 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;
/** Details for the {@code remove_discount} type. */
@SerializedName("remove_discount")
RemoveDiscount removeDiscount;
/** Details for the {@code remove_item} type. */
@SerializedName("remove_item")
RemoveItem removeItem;
/** Details for the {@code remove_metadata} type: specify an array of metadata keys. */
@SerializedName("remove_metadata")
List removeMetadata;
/** Details for the {@code set_discounts} type. */
@SerializedName("set_discounts")
List setDiscounts;
/** Details for the {@code set_items} type. */
@SerializedName("set_items")
List setItems;
/** Details for the {@code set_metadata} type: specify an array of key-value pairs. */
@SerializedName("set_metadata")
Object setMetadata;
/** Required. The type of action the quote line performs. */
@SerializedName("type")
Type type;
private Action(
AddDiscount addDiscount,
AddItem addItem,
Map addMetadata,
Map extraParams,
RemoveDiscount removeDiscount,
RemoveItem removeItem,
List removeMetadata,
List setDiscounts,
List setItems,
Object setMetadata,
Type type) {
this.addDiscount = addDiscount;
this.addItem = addItem;
this.addMetadata = addMetadata;
this.extraParams = extraParams;
this.removeDiscount = removeDiscount;
this.removeItem = removeItem;
this.removeMetadata = removeMetadata;
this.setDiscounts = setDiscounts;
this.setItems = setItems;
this.setMetadata = setMetadata;
this.type = type;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private AddDiscount addDiscount;
private AddItem addItem;
private Map addMetadata;
private Map extraParams;
private RemoveDiscount removeDiscount;
private RemoveItem removeItem;
private List removeMetadata;
private List setDiscounts;
private List setItems;
private Object setMetadata;
private Type type;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.Action build() {
return new QuoteCreateParams.Line.Action(
this.addDiscount,
this.addItem,
this.addMetadata,
this.extraParams,
this.removeDiscount,
this.removeItem,
this.removeMetadata,
this.setDiscounts,
this.setItems,
this.setMetadata,
this.type);
}
/** Details for the {@code add_discount} type. */
public Builder setAddDiscount(QuoteCreateParams.Line.Action.AddDiscount addDiscount) {
this.addDiscount = addDiscount;
return this;
}
/** Details for the {@code add_item} type. */
public Builder setAddItem(QuoteCreateParams.Line.Action.AddItem addItem) {
this.addItem = addItem;
return this;
}
/**
* Add a key/value pair to `addMetadata` map. 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#addMetadata} for the field documentation.
*/
public Builder putAddMetadata(String key, String value) {
if (this.addMetadata == null) {
this.addMetadata = new HashMap<>();
}
this.addMetadata.put(key, value);
return this;
}
/**
* Add all map key/value pairs to `addMetadata` map. 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#addMetadata} for the field documentation.
*/
public Builder putAllAddMetadata(Map map) {
if (this.addMetadata == null) {
this.addMetadata = new HashMap<>();
}
this.addMetadata.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 QuoteCreateParams.Line.Action#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#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Details for the {@code remove_discount} type. */
public Builder setRemoveDiscount(
QuoteCreateParams.Line.Action.RemoveDiscount removeDiscount) {
this.removeDiscount = removeDiscount;
return this;
}
/** Details for the {@code remove_item} type. */
public Builder setRemoveItem(QuoteCreateParams.Line.Action.RemoveItem removeItem) {
this.removeItem = removeItem;
return this;
}
/**
* Add an element to `removeMetadata` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line.Action#removeMetadata} for the field documentation.
*/
public Builder addRemoveMetadata(String element) {
if (this.removeMetadata == null) {
this.removeMetadata = new ArrayList<>();
}
this.removeMetadata.add(element);
return this;
}
/**
* Add all elements to `removeMetadata` list. A list is initialized for the first
* `add/addAll` call, and subsequent calls adds additional elements to the original list.
* See {@link QuoteCreateParams.Line.Action#removeMetadata} for the field documentation.
*/
public Builder addAllRemoveMetadata(List elements) {
if (this.removeMetadata == null) {
this.removeMetadata = new ArrayList<>();
}
this.removeMetadata.addAll(elements);
return this;
}
/**
* Add an element to `setDiscounts` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line.Action#setDiscounts} for the field documentation.
*/
public Builder addSetDiscount(QuoteCreateParams.Line.Action.SetDiscount element) {
if (this.setDiscounts == null) {
this.setDiscounts = new ArrayList<>();
}
this.setDiscounts.add(element);
return this;
}
/**
* Add all elements to `setDiscounts` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line.Action#setDiscounts} for the field documentation.
*/
public Builder addAllSetDiscount(List elements) {
if (this.setDiscounts == null) {
this.setDiscounts = new ArrayList<>();
}
this.setDiscounts.addAll(elements);
return this;
}
/**
* Add an element to `setItems` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line.Action#setItems} for the field documentation.
*/
public Builder addSetItem(QuoteCreateParams.Line.Action.SetItem element) {
if (this.setItems == null) {
this.setItems = new ArrayList<>();
}
this.setItems.add(element);
return this;
}
/**
* Add all elements to `setItems` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line.Action#setItems} for the field documentation.
*/
public Builder addAllSetItem(List elements) {
if (this.setItems == null) {
this.setItems = new ArrayList<>();
}
this.setItems.addAll(elements);
return this;
}
/**
* Add a key/value pair to `setMetadata` map. 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#setMetadata} for the field documentation.
*/
@SuppressWarnings("unchecked")
public Builder putSetMetadata(String key, String value) {
if (this.setMetadata == null || this.setMetadata instanceof EmptyParam) {
this.setMetadata = new HashMap();
}
((Map) this.setMetadata).put(key, value);
return this;
}
/**
* Add all map key/value pairs to `setMetadata` map. 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#setMetadata} for the field documentation.
*/
@SuppressWarnings("unchecked")
public Builder putAllSetMetadata(Map map) {
if (this.setMetadata == null || this.setMetadata instanceof EmptyParam) {
this.setMetadata = new HashMap();
}
((Map) this.setMetadata).putAll(map);
return this;
}
/** Details for the {@code set_metadata} type: specify an array of key-value pairs. */
public Builder setSetMetadata(EmptyParam setMetadata) {
this.setMetadata = setMetadata;
return this;
}
/** Details for the {@code set_metadata} type: specify an array of key-value pairs. */
public Builder setSetMetadata(Map setMetadata) {
this.setMetadata = setMetadata;
return this;
}
/** Required. The type of action the quote line performs. */
public Builder setType(QuoteCreateParams.Line.Action.Type type) {
this.type = type;
return this;
}
}
@Getter
public static class AddDiscount {
/** The coupon code to redeem. */
@SerializedName("coupon")
String coupon;
/** An ID of an existing discount for a coupon that was already redeemed. */
@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;
/**
* 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.
*/
@SerializedName("index")
Long index;
/** The promotion code to redeem. */
@SerializedName("promotion_code")
String promotionCode;
private AddDiscount(
String coupon,
String discount,
DiscountEnd discountEnd,
Map extraParams,
Long index,
String promotionCode) {
this.coupon = coupon;
this.discount = discount;
this.discountEnd = discountEnd;
this.extraParams = extraParams;
this.index = index;
this.promotionCode = promotionCode;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String coupon;
private String discount;
private DiscountEnd discountEnd;
private Map extraParams;
private Long index;
private String promotionCode;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.Action.AddDiscount build() {
return new QuoteCreateParams.Line.Action.AddDiscount(
this.coupon,
this.discount,
this.discountEnd,
this.extraParams,
this.index,
this.promotionCode);
}
/** The coupon code to redeem. */
public Builder setCoupon(String coupon) {
this.coupon = coupon;
return this;
}
/** An ID of an existing discount for a coupon that was already redeemed. */
public Builder setDiscount(String discount) {
this.discount = discount;
return this;
}
/** Details to determine how long the discount should be applied for. */
public Builder setDiscountEnd(
QuoteCreateParams.Line.Action.AddDiscount.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 QuoteCreateParams.Line.Action.AddDiscount#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#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;
}
}
@Getter
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 QuoteCreateParams.Line.Action.AddDiscount.DiscountEnd build() {
return new QuoteCreateParams.Line.Action.AddDiscount.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
* QuoteCreateParams.Line.Action.AddDiscount.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
* QuoteCreateParams.Line.Action.AddDiscount.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;
}
/**
* Required. The type of calculation made to determine when the
* discount ends.
*/
public Builder setType(
QuoteCreateParams.Line.Action.AddDiscount.DiscountEnd.Type type) {
this.type = type;
return this;
}
}
public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("line_ends_at")
LINE_ENDS_AT("line_ends_at");
@Getter(onMethod_ = {@Override})
private final String value;
Type(String value) {
this.value = value;
}
}
}
}
@Getter
public static class AddItem {
/**
* The discounts applied to the item. Subscription item discounts are applied before
* subscription discounts.
*/
@SerializedName("discounts")
List 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;
/** Required. The ID of the price object. */
@SerializedName("price")
String price;
/** Quantity for this item. */
@SerializedName("quantity")
Long quantity;
/**
* The tax rates that apply to this subscription item. When set, the {@code
* default_tax_rates} on the subscription do not apply to this {@code subscription_item}.
*/
@SerializedName("tax_rates")
List taxRates;
/** Options that configure the trial on the subscription item. */
@SerializedName("trial")
Trial trial;
private AddItem(
List discounts,
Map extraParams,
Map metadata,
String price,
Long quantity,
List taxRates,
Trial trial) {
this.discounts = discounts;
this.extraParams = extraParams;
this.metadata = metadata;
this.price = price;
this.quantity = quantity;
this.taxRates = taxRates;
this.trial = trial;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private List discounts;
private Map extraParams;
private Map metadata;
private String price;
private Long quantity;
private List taxRates;
private Trial trial;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.Action.AddItem build() {
return new QuoteCreateParams.Line.Action.AddItem(
this.discounts,
this.extraParams,
this.metadata,
this.price,
this.quantity,
this.taxRates,
this.trial);
}
/**
* 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
* QuoteCreateParams.Line.Action.AddItem#discounts} for the field documentation.
*/
public Builder addDiscount(QuoteCreateParams.Line.Action.AddItem.Discount element) {
if (this.discounts == null) {
this.discounts = new ArrayList<>();
}
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
* QuoteCreateParams.Line.Action.AddItem#discounts} for the field documentation.
*/
public Builder addAllDiscount(
List elements) {
if (this.discounts == null) {
this.discounts = new ArrayList<>();
}
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 QuoteCreateParams.Line.Action.AddItem#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#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 QuoteCreateParams.Line.Action.AddItem#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 QuoteCreateParams.Line.Action.AddItem#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. The ID of the price object. */
public Builder setPrice(String price) {
this.price = price;
return this;
}
/** Quantity for this item. */
public Builder setQuantity(Long quantity) {
this.quantity = quantity;
return this;
}
/**
* Add an element to `taxRates` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line.Action.AddItem#taxRates} for the field documentation.
*/
public Builder addTaxRate(String element) {
if (this.taxRates == null) {
this.taxRates = new ArrayList<>();
}
this.taxRates.add(element);
return this;
}
/**
* Add all elements to `taxRates` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line.Action.AddItem#taxRates} for the field documentation.
*/
public Builder addAllTaxRate(List elements) {
if (this.taxRates == null) {
this.taxRates = new ArrayList<>();
}
this.taxRates.addAll(elements);
return this;
}
/** Options that configure the trial on the subscription item. */
public Builder setTrial(QuoteCreateParams.Line.Action.AddItem.Trial trial) {
this.trial = trial;
return this;
}
}
@Getter
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;
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;
}
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;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.Action.AddItem.Discount build() {
return new QuoteCreateParams.Line.Action.AddItem.Discount(
this.coupon,
this.discount,
this.discountEnd,
this.extraParams,
this.promotionCode);
}
/** 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(
QuoteCreateParams.Line.Action.AddItem.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 QuoteCreateParams.Line.Action.AddItem.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 QuoteCreateParams.Line.Action.AddItem.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;
}
}
@Getter
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 QuoteCreateParams.Line.Action.AddItem.Discount.DiscountEnd build() {
return new QuoteCreateParams.Line.Action.AddItem.Discount.DiscountEnd(
this.duration, this.extraParams, this.timestamp, this.type);
}
/** Time span for the redeemed discount. */
public Builder setDuration(
QuoteCreateParams.Line.Action.AddItem.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
* QuoteCreateParams.Line.Action.AddItem.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
* QuoteCreateParams.Line.Action.AddItem.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(
QuoteCreateParams.Line.Action.AddItem.Discount.DiscountEnd.Type type) {
this.type = type;
return this;
}
}
@Getter
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 QuoteCreateParams.Line.Action.AddItem.Discount.DiscountEnd.Duration build() {
return new QuoteCreateParams.Line.Action.AddItem.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
* QuoteCreateParams.Line.Action.AddItem.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
* QuoteCreateParams.Line.Action.AddItem.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(
QuoteCreateParams.Line.Action.AddItem.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;
}
}
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
public static class Trial {
/**
* List of price IDs which, if present on the subscription following a paid trial,
* constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
*/
@SerializedName("converts_to")
List convertsTo;
/**
* 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. Determines the type of trial for this item. */
@SerializedName("type")
Type type;
private Trial(List convertsTo, Map extraParams, Type type) {
this.convertsTo = convertsTo;
this.extraParams = extraParams;
this.type = type;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private List convertsTo;
private Map extraParams;
private Type type;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.Action.AddItem.Trial build() {
return new QuoteCreateParams.Line.Action.AddItem.Trial(
this.convertsTo, this.extraParams, this.type);
}
/**
* Add an element to `convertsTo` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line.Action.AddItem.Trial#convertsTo} for the field documentation.
*/
public Builder addConvertsTo(String element) {
if (this.convertsTo == null) {
this.convertsTo = new ArrayList<>();
}
this.convertsTo.add(element);
return this;
}
/**
* Add all elements to `convertsTo` list. A list is initialized for the first
* `add/addAll` call, and subsequent calls adds additional elements to the original
* list. See {@link QuoteCreateParams.Line.Action.AddItem.Trial#convertsTo} for the
* field documentation.
*/
public Builder addAllConvertsTo(List elements) {
if (this.convertsTo == null) {
this.convertsTo = new ArrayList<>();
}
this.convertsTo.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 QuoteCreateParams.Line.Action.AddItem.Trial#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.Trial#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. Determines the type of trial for this item. */
public Builder setType(QuoteCreateParams.Line.Action.AddItem.Trial.Type type) {
this.type = type;
return this;
}
}
public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("free")
FREE("free"),
@SerializedName("paid")
PAID("paid");
@Getter(onMethod_ = {@Override})
private final String value;
Type(String value) {
this.value = value;
}
}
}
}
@Getter
public static class RemoveDiscount {
/** The coupon code to remove from the {@code discounts} array. */
@SerializedName("coupon")
String coupon;
/** The ID of a discount to remove from the {@code discounts} array. */
@SerializedName("discount")
String discount;
/**
* 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 a promotion code to remove from the {@code discounts} array. */
@SerializedName("promotion_code")
String promotionCode;
private RemoveDiscount(
String coupon, String discount, Map extraParams, String promotionCode) {
this.coupon = coupon;
this.discount = discount;
this.extraParams = extraParams;
this.promotionCode = promotionCode;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String coupon;
private String discount;
private Map extraParams;
private String promotionCode;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.Action.RemoveDiscount build() {
return new QuoteCreateParams.Line.Action.RemoveDiscount(
this.coupon, this.discount, this.extraParams, this.promotionCode);
}
/** The coupon code to remove from the {@code discounts} array. */
public Builder setCoupon(String coupon) {
this.coupon = coupon;
return this;
}
/** The ID of a discount to remove from the {@code discounts} array. */
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.RemoveDiscount#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.RemoveDiscount#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 a promotion code to remove from the {@code discounts} array. */
public Builder setPromotionCode(String promotionCode) {
this.promotionCode = promotionCode;
return this;
}
}
}
@Getter
public static class RemoveItem {
/**
* 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. ID of a price to remove. */
@SerializedName("price")
String price;
private RemoveItem(Map extraParams, String price) {
this.extraParams = extraParams;
this.price = price;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private String price;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.Action.RemoveItem build() {
return new QuoteCreateParams.Line.Action.RemoveItem(this.extraParams, this.price);
}
/**
* Add a key/value pair to `extraParams` map. A map is initialized for the first
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original
* map. See {@link QuoteCreateParams.Line.Action.RemoveItem#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.RemoveItem#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. ID of a price to remove. */
public Builder setPrice(String price) {
this.price = price;
return this;
}
}
}
@Getter
public static class SetDiscount {
/** The coupon code to replace the {@code discounts} array with. */
@SerializedName("coupon")
String coupon;
/** An ID of an existing discount to replace the {@code discounts} array with. */
@SerializedName("discount")
String discount;
/**
* 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;
/** An ID of an existing promotion code to replace the {@code discounts} array with. */
@SerializedName("promotion_code")
String promotionCode;
private SetDiscount(
String coupon, String discount, Map extraParams, String promotionCode) {
this.coupon = coupon;
this.discount = discount;
this.extraParams = extraParams;
this.promotionCode = promotionCode;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String coupon;
private String discount;
private Map extraParams;
private String promotionCode;
/** 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);
}
/** The coupon code to replace the {@code discounts} array with. */
public Builder setCoupon(String coupon) {
this.coupon = 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;
}
/**
* 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;
}
}
}
@Getter
public static class SetItem {
/**
* If an item with the {@code price} already exists, passing this will override the {@code
* discounts} array on the subscription item that matches that price. Otherwise, the {@code
* items} array is cleared and a single new item is added with the supplied {@code
* discounts}.
*/
@SerializedName("discounts")
List 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;
/**
* If an item with the {@code price} already exists, passing this will override the {@code
* metadata} on the subscription item that matches that price. Otherwise, the {@code items}
* array is cleared and a single new item is added with the supplied {@code metadata}.
*/
@SerializedName("metadata")
Map metadata;
/** Required. The ID of the price object. */
@SerializedName("price")
String price;
/**
* If an item with the {@code price} already exists, passing this will override the quantity
* on the subscription item that matches that price. Otherwise, the {@code items} array is
* cleared and a single new item is added with the supplied {@code quantity}.
*/
@SerializedName("quantity")
Long quantity;
/**
* If an item with the {@code price} already exists, passing this will override the {@code
* tax_rates} array on the subscription item that matches that price. Otherwise, the {@code
* items} array is cleared and a single new item is added with the supplied {@code
* tax_rates}.
*/
@SerializedName("tax_rates")
List taxRates;
/**
* If an item with the {@code price} already exists, passing this will override the {@code
* trial} configuration on the subscription item that matches that price. Otherwise, the
* {@code items} array is cleared and a single new item is added with the supplied {@code
* trial}.
*/
@SerializedName("trial")
Trial trial;
private SetItem(
List discounts,
Map extraParams,
Map metadata,
String price,
Long quantity,
List taxRates,
Trial trial) {
this.discounts = discounts;
this.extraParams = extraParams;
this.metadata = metadata;
this.price = price;
this.quantity = quantity;
this.taxRates = taxRates;
this.trial = trial;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private List discounts;
private Map extraParams;
private Map metadata;
private String price;
private Long quantity;
private List taxRates;
private Trial trial;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.Action.SetItem build() {
return new QuoteCreateParams.Line.Action.SetItem(
this.discounts,
this.extraParams,
this.metadata,
this.price,
this.quantity,
this.taxRates,
this.trial);
}
/**
* 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
* QuoteCreateParams.Line.Action.SetItem#discounts} for the field documentation.
*/
public Builder addDiscount(QuoteCreateParams.Line.Action.SetItem.Discount element) {
if (this.discounts == null) {
this.discounts = new ArrayList<>();
}
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
* QuoteCreateParams.Line.Action.SetItem#discounts} for the field documentation.
*/
public Builder addAllDiscount(
List elements) {
if (this.discounts == null) {
this.discounts = new ArrayList<>();
}
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 QuoteCreateParams.Line.Action.SetItem#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#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 QuoteCreateParams.Line.Action.SetItem#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 QuoteCreateParams.Line.Action.SetItem#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. The ID of the price object. */
public Builder setPrice(String price) {
this.price = price;
return this;
}
/**
* If an item with the {@code price} already exists, passing this will override the
* quantity on the subscription item that matches that price. Otherwise, the {@code items}
* array is cleared and a single new item is added with the supplied {@code quantity}.
*/
public Builder setQuantity(Long quantity) {
this.quantity = quantity;
return this;
}
/**
* Add an element to `taxRates` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line.Action.SetItem#taxRates} for the field documentation.
*/
public Builder addTaxRate(String element) {
if (this.taxRates == null) {
this.taxRates = new ArrayList<>();
}
this.taxRates.add(element);
return this;
}
/**
* Add all elements to `taxRates` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line.Action.SetItem#taxRates} for the field documentation.
*/
public Builder addAllTaxRate(List elements) {
if (this.taxRates == null) {
this.taxRates = new ArrayList<>();
}
this.taxRates.addAll(elements);
return this;
}
/**
* If an item with the {@code price} already exists, passing this will override the {@code
* trial} configuration on the subscription item that matches that price. Otherwise, the
* {@code items} array is cleared and a single new item is added with the supplied {@code
* trial}.
*/
public Builder setTrial(QuoteCreateParams.Line.Action.SetItem.Trial trial) {
this.trial = trial;
return this;
}
}
@Getter
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;
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;
}
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;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.Action.SetItem.Discount build() {
return new QuoteCreateParams.Line.Action.SetItem.Discount(
this.coupon,
this.discount,
this.discountEnd,
this.extraParams,
this.promotionCode);
}
/** 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(
QuoteCreateParams.Line.Action.SetItem.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 QuoteCreateParams.Line.Action.SetItem.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 QuoteCreateParams.Line.Action.SetItem.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;
}
}
@Getter
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 QuoteCreateParams.Line.Action.SetItem.Discount.DiscountEnd build() {
return new QuoteCreateParams.Line.Action.SetItem.Discount.DiscountEnd(
this.duration, this.extraParams, this.timestamp, this.type);
}
/** Time span for the redeemed discount. */
public Builder setDuration(
QuoteCreateParams.Line.Action.SetItem.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
* QuoteCreateParams.Line.Action.SetItem.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
* QuoteCreateParams.Line.Action.SetItem.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(
QuoteCreateParams.Line.Action.SetItem.Discount.DiscountEnd.Type type) {
this.type = type;
return this;
}
}
@Getter
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 QuoteCreateParams.Line.Action.SetItem.Discount.DiscountEnd.Duration build() {
return new QuoteCreateParams.Line.Action.SetItem.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
* QuoteCreateParams.Line.Action.SetItem.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
* QuoteCreateParams.Line.Action.SetItem.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(
QuoteCreateParams.Line.Action.SetItem.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;
}
}
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
public static class Trial {
/**
* List of price IDs which, if present on the subscription following a paid trial,
* constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
*/
@SerializedName("converts_to")
List convertsTo;
/**
* 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. Determines the type of trial for this item. */
@SerializedName("type")
Type type;
private Trial(List convertsTo, Map extraParams, Type type) {
this.convertsTo = convertsTo;
this.extraParams = extraParams;
this.type = type;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private List convertsTo;
private Map extraParams;
private Type type;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.Action.SetItem.Trial build() {
return new QuoteCreateParams.Line.Action.SetItem.Trial(
this.convertsTo, this.extraParams, this.type);
}
/**
* Add an element to `convertsTo` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* QuoteCreateParams.Line.Action.SetItem.Trial#convertsTo} for the field documentation.
*/
public Builder addConvertsTo(String element) {
if (this.convertsTo == null) {
this.convertsTo = new ArrayList<>();
}
this.convertsTo.add(element);
return this;
}
/**
* Add all elements to `convertsTo` list. A list is initialized for the first
* `add/addAll` call, and subsequent calls adds additional elements to the original
* list. See {@link QuoteCreateParams.Line.Action.SetItem.Trial#convertsTo} for the
* field documentation.
*/
public Builder addAllConvertsTo(List elements) {
if (this.convertsTo == null) {
this.convertsTo = new ArrayList<>();
}
this.convertsTo.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 QuoteCreateParams.Line.Action.SetItem.Trial#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.Trial#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. Determines the type of trial for this item. */
public Builder setType(QuoteCreateParams.Line.Action.SetItem.Trial.Type type) {
this.type = type;
return this;
}
}
public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("free")
FREE("free"),
@SerializedName("paid")
PAID("paid");
@Getter(onMethod_ = {@Override})
private final String value;
Type(String value) {
this.value = value;
}
}
}
}
public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("add_discount")
ADD_DISCOUNT("add_discount"),
@SerializedName("add_item")
ADD_ITEM("add_item"),
@SerializedName("add_metadata")
ADD_METADATA("add_metadata"),
@SerializedName("clear_discounts")
CLEAR_DISCOUNTS("clear_discounts"),
@SerializedName("clear_metadata")
CLEAR_METADATA("clear_metadata"),
@SerializedName("remove_discount")
REMOVE_DISCOUNT("remove_discount"),
@SerializedName("remove_item")
REMOVE_ITEM("remove_item"),
@SerializedName("remove_metadata")
REMOVE_METADATA("remove_metadata"),
@SerializedName("set_discounts")
SET_DISCOUNTS("set_discounts"),
@SerializedName("set_items")
SET_ITEMS("set_items"),
@SerializedName("set_metadata")
SET_METADATA("set_metadata");
@Getter(onMethod_ = {@Override})
private final String value;
Type(String value) {
this.value = value;
}
}
}
@Getter
public static class AppliesTo {
/**
* 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 custom string that identifies a new subscription schedule being created upon quote
* acceptance. All quote lines with the same {@code new_reference} field will be applied to
* the creation of a new subscription schedule.
*/
@SerializedName("new_reference")
String newReference;
/** The ID of the schedule the line applies to. */
@SerializedName("subscription_schedule")
String subscriptionSchedule;
/**
* Required. Describes whether the quote line is affecting a new schedule or
* an existing schedule.
*/
@SerializedName("type")
Type type;
private AppliesTo(
Map extraParams,
String newReference,
String subscriptionSchedule,
Type type) {
this.extraParams = extraParams;
this.newReference = newReference;
this.subscriptionSchedule = subscriptionSchedule;
this.type = type;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private String newReference;
private String subscriptionSchedule;
private Type type;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.AppliesTo build() {
return new QuoteCreateParams.Line.AppliesTo(
this.extraParams, this.newReference, this.subscriptionSchedule, 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 QuoteCreateParams.Line.AppliesTo#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.AppliesTo#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 custom string that identifies a new subscription schedule being created upon quote
* acceptance. All quote lines with the same {@code new_reference} field will be applied to
* the creation of a new subscription schedule.
*/
public Builder setNewReference(String newReference) {
this.newReference = newReference;
return this;
}
/** The ID of the schedule the line applies to. */
public Builder setSubscriptionSchedule(String subscriptionSchedule) {
this.subscriptionSchedule = subscriptionSchedule;
return this;
}
/**
* Required. Describes whether the quote line is affecting a new schedule
* or an existing schedule.
*/
public Builder setType(QuoteCreateParams.Line.AppliesTo.Type type) {
this.type = type;
return this;
}
}
public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("new_reference")
NEW_REFERENCE("new_reference"),
@SerializedName("subscription_schedule")
SUBSCRIPTION_SCHEDULE("subscription_schedule");
@Getter(onMethod_ = {@Override})
private final String value;
Type(String value) {
this.value = value;
}
}
}
@Getter
public static class CancelSubscriptionSchedule {
/**
* Required. Timestamp helper to cancel the underlying schedule on the
* accompanying line's start date. Must be set to {@code line_starts_at}.
*/
@SerializedName("cancel_at")
CancelAt cancelAt;
/**
* 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;
/**
* If the subscription schedule is {@code active}, indicates if a final invoice will be
* generated that contains any un-invoiced metered usage and new/pending proration invoice
* items. Boolean that defaults to {@code true}.
*/
@SerializedName("invoice_now")
Boolean invoiceNow;
/**
* If the subscription schedule is {@code active}, indicates if the cancellation should be
* prorated. Boolean that defaults to {@code true}.
*/
@SerializedName("prorate")
Boolean prorate;
private CancelSubscriptionSchedule(
CancelAt cancelAt, Map extraParams, Boolean invoiceNow, Boolean prorate) {
this.cancelAt = cancelAt;
this.extraParams = extraParams;
this.invoiceNow = invoiceNow;
this.prorate = prorate;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private CancelAt cancelAt;
private Map extraParams;
private Boolean invoiceNow;
private Boolean prorate;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.CancelSubscriptionSchedule build() {
return new QuoteCreateParams.Line.CancelSubscriptionSchedule(
this.cancelAt, this.extraParams, this.invoiceNow, this.prorate);
}
/**
* Required. Timestamp helper to cancel the underlying schedule on the
* accompanying line's start date. Must be set to {@code line_starts_at}.
*/
public Builder setCancelAt(
QuoteCreateParams.Line.CancelSubscriptionSchedule.CancelAt cancelAt) {
this.cancelAt = cancelAt;
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.CancelSubscriptionSchedule#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.CancelSubscriptionSchedule#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* If the subscription schedule is {@code active}, indicates if a final invoice will be
* generated that contains any un-invoiced metered usage and new/pending proration invoice
* items. Boolean that defaults to {@code true}.
*/
public Builder setInvoiceNow(Boolean invoiceNow) {
this.invoiceNow = invoiceNow;
return this;
}
/**
* If the subscription schedule is {@code active}, indicates if the cancellation should be
* prorated. Boolean that defaults to {@code true}.
*/
public Builder setProrate(Boolean prorate) {
this.prorate = prorate;
return this;
}
}
public enum CancelAt implements ApiRequestParams.EnumParam {
@SerializedName("line_starts_at")
LINE_STARTS_AT("line_starts_at");
@Getter(onMethod_ = {@Override})
private final String value;
CancelAt(String value) {
this.value = value;
}
}
}
@Getter
public static class EndsAt {
/** Use the {@code end} time of a given discount. */
@SerializedName("discount_end")
DiscountEnd discountEnd;
/** Time span for the quote line starting from the {@code starts_at} date. */
@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. */
@SerializedName("timestamp")
Long timestamp;
/** Required. Select a way to pass in {@code ends_at}. */
@SerializedName("type")
Type type;
private EndsAt(
DiscountEnd discountEnd,
Duration duration,
Map extraParams,
Long timestamp,
Type type) {
this.discountEnd = discountEnd;
this.duration = duration;
this.extraParams = extraParams;
this.timestamp = timestamp;
this.type = type;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private DiscountEnd discountEnd;
private Duration duration;
private Map extraParams;
private Long timestamp;
private Type type;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.EndsAt build() {
return new QuoteCreateParams.Line.EndsAt(
this.discountEnd, this.duration, this.extraParams, this.timestamp, this.type);
}
/** Use the {@code end} time of a given discount. */
public Builder setDiscountEnd(QuoteCreateParams.Line.EndsAt.DiscountEnd discountEnd) {
this.discountEnd = discountEnd;
return this;
}
/** Time span for the quote line starting from the {@code starts_at} date. */
public Builder setDuration(QuoteCreateParams.Line.EndsAt.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 QuoteCreateParams.Line.EndsAt#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.EndsAt#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. */
public Builder setTimestamp(Long timestamp) {
this.timestamp = timestamp;
return this;
}
/** Required. Select a way to pass in {@code ends_at}. */
public Builder setType(QuoteCreateParams.Line.EndsAt.Type type) {
this.type = type;
return this;
}
}
@Getter
public static class DiscountEnd {
/** Required. The ID of a specific discount. */
@SerializedName("discount")
String discount;
/**
* 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 DiscountEnd(String discount, Map extraParams) {
this.discount = discount;
this.extraParams = extraParams;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String discount;
private Map extraParams;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.EndsAt.DiscountEnd build() {
return new QuoteCreateParams.Line.EndsAt.DiscountEnd(this.discount, this.extraParams);
}
/** Required. The ID of a specific discount. */
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.EndsAt.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 QuoteCreateParams.Line.EndsAt.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;
}
}
}
@Getter
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 QuoteCreateParams.Line.EndsAt.Duration build() {
return new QuoteCreateParams.Line.EndsAt.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 QuoteCreateParams.Line.EndsAt.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 QuoteCreateParams.Line.EndsAt.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(QuoteCreateParams.Line.EndsAt.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;
}
}
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("billing_period_end")
BILLING_PERIOD_END("billing_period_end"),
@SerializedName("discount_end")
DISCOUNT_END("discount_end"),
@SerializedName("duration")
DURATION("duration"),
@SerializedName("quote_acceptance_date")
QUOTE_ACCEPTANCE_DATE("quote_acceptance_date"),
@SerializedName("schedule_end")
SCHEDULE_END("schedule_end"),
@SerializedName("timestamp")
TIMESTAMP("timestamp"),
@SerializedName("upcoming_invoice")
UPCOMING_INVOICE("upcoming_invoice");
@Getter(onMethod_ = {@Override})
private final String value;
Type(String value) {
this.value = value;
}
}
}
@Getter
public static class SetPauseCollection {
/**
* 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;
/** Details of the pause_collection behavior to apply to the amendment. */
@SerializedName("set")
Set set;
/** Required. Determines the type of the pause_collection amendment. */
@SerializedName("type")
Type type;
private SetPauseCollection(Map extraParams, Set set, Type type) {
this.extraParams = extraParams;
this.set = set;
this.type = type;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private Set set;
private Type type;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.SetPauseCollection build() {
return new QuoteCreateParams.Line.SetPauseCollection(
this.extraParams, this.set, 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 QuoteCreateParams.Line.SetPauseCollection#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.SetPauseCollection#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/** Details of the pause_collection behavior to apply to the amendment. */
public Builder setSet(QuoteCreateParams.Line.SetPauseCollection.Set set) {
this.set = set;
return this;
}
/** Required. Determines the type of the pause_collection amendment. */
public Builder setType(QuoteCreateParams.Line.SetPauseCollection.Type type) {
this.type = type;
return this;
}
}
@Getter
public static class Set {
/**
* Required. The payment collection behavior for this subscription while
* paused. One of {@code keep_as_draft}, {@code mark_uncollectible}, or {@code void}.
*/
@SerializedName("behavior")
Behavior behavior;
/**
* 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 Set(Behavior behavior, Map extraParams) {
this.behavior = behavior;
this.extraParams = extraParams;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Behavior behavior;
private Map extraParams;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.SetPauseCollection.Set build() {
return new QuoteCreateParams.Line.SetPauseCollection.Set(
this.behavior, this.extraParams);
}
/**
* Required. The payment collection behavior for this subscription while
* paused. One of {@code keep_as_draft}, {@code mark_uncollectible}, or {@code void}.
*/
public Builder setBehavior(
QuoteCreateParams.Line.SetPauseCollection.Set.Behavior behavior) {
this.behavior = behavior;
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.SetPauseCollection.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 QuoteCreateParams.Line.SetPauseCollection.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;
}
}
public enum Behavior implements ApiRequestParams.EnumParam {
@SerializedName("keep_as_draft")
KEEP_AS_DRAFT("keep_as_draft"),
@SerializedName("mark_uncollectible")
MARK_UNCOLLECTIBLE("mark_uncollectible"),
@SerializedName("void")
VOID("void");
@Getter(onMethod_ = {@Override})
private final String value;
Behavior(String value) {
this.value = value;
}
}
}
public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("remove")
REMOVE("remove"),
@SerializedName("set")
SET("set");
@Getter(onMethod_ = {@Override})
private final String value;
Type(String value) {
this.value = value;
}
}
}
@Getter
public static class StartsAt {
/** Use the {@code end} time of a given discount. */
@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;
/** The timestamp the given line ends at. */
@SerializedName("line_ends_at")
LineEndsAt lineEndsAt;
/** A precise Unix timestamp. */
@SerializedName("timestamp")
Long timestamp;
/** Required. Select a way to pass in {@code starts_at}. */
@SerializedName("type")
Type type;
private StartsAt(
DiscountEnd discountEnd,
Map extraParams,
LineEndsAt lineEndsAt,
Long timestamp,
Type type) {
this.discountEnd = discountEnd;
this.extraParams = extraParams;
this.lineEndsAt = lineEndsAt;
this.timestamp = timestamp;
this.type = type;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private DiscountEnd discountEnd;
private Map extraParams;
private LineEndsAt lineEndsAt;
private Long timestamp;
private Type type;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.StartsAt build() {
return new QuoteCreateParams.Line.StartsAt(
this.discountEnd, this.extraParams, this.lineEndsAt, this.timestamp, this.type);
}
/** Use the {@code end} time of a given discount. */
public Builder setDiscountEnd(QuoteCreateParams.Line.StartsAt.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 QuoteCreateParams.Line.StartsAt#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.StartsAt#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 timestamp the given line ends at. */
public Builder setLineEndsAt(QuoteCreateParams.Line.StartsAt.LineEndsAt lineEndsAt) {
this.lineEndsAt = lineEndsAt;
return this;
}
/** A precise Unix timestamp. */
public Builder setTimestamp(Long timestamp) {
this.timestamp = timestamp;
return this;
}
/** Required. Select a way to pass in {@code starts_at}. */
public Builder setType(QuoteCreateParams.Line.StartsAt.Type type) {
this.type = type;
return this;
}
}
@Getter
public static class DiscountEnd {
/** Required. The ID of a specific discount. */
@SerializedName("discount")
String discount;
/**
* 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 DiscountEnd(String discount, Map extraParams) {
this.discount = discount;
this.extraParams = extraParams;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String discount;
private Map extraParams;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.StartsAt.DiscountEnd build() {
return new QuoteCreateParams.Line.StartsAt.DiscountEnd(this.discount, this.extraParams);
}
/** Required. The ID of a specific discount. */
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.StartsAt.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 QuoteCreateParams.Line.StartsAt.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;
}
}
}
@Getter
public static class LineEndsAt {
/**
* 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 position of the previous quote line in the {@code lines} array after which this line
* should begin. Indexes start from 0 and must be less than the index of the current line in
* the array.
*/
@SerializedName("index")
Long index;
private LineEndsAt(Map extraParams, Long index) {
this.extraParams = extraParams;
this.index = index;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private Long index;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.StartsAt.LineEndsAt build() {
return new QuoteCreateParams.Line.StartsAt.LineEndsAt(this.extraParams, this.index);
}
/**
* 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.StartsAt.LineEndsAt#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.StartsAt.LineEndsAt#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 position of the previous quote line in the {@code lines} array after which this
* line should begin. Indexes start from 0 and must be less than the index of the current
* line in the array.
*/
public Builder setIndex(Long index) {
this.index = index;
return this;
}
}
}
public enum Type implements ApiRequestParams.EnumParam {
@SerializedName("discount_end")
DISCOUNT_END("discount_end"),
@SerializedName("line_ends_at")
LINE_ENDS_AT("line_ends_at"),
@SerializedName("now")
NOW("now"),
@SerializedName("quote_acceptance_date")
QUOTE_ACCEPTANCE_DATE("quote_acceptance_date"),
@SerializedName("schedule_end")
SCHEDULE_END("schedule_end"),
@SerializedName("timestamp")
TIMESTAMP("timestamp"),
@SerializedName("upcoming_invoice")
UPCOMING_INVOICE("upcoming_invoice");
@Getter(onMethod_ = {@Override})
private final String value;
Type(String value) {
this.value = value;
}
}
}
@Getter
public static class TrialSettings {
/** Defines how the subscription should behave when a trial ends. */
@SerializedName("end_behavior")
EndBehavior endBehavior;
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
* name in this param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
private TrialSettings(EndBehavior endBehavior, Map extraParams) {
this.endBehavior = endBehavior;
this.extraParams = extraParams;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private EndBehavior endBehavior;
private Map extraParams;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.TrialSettings build() {
return new QuoteCreateParams.Line.TrialSettings(this.endBehavior, this.extraParams);
}
/** Defines how the subscription should behave when a trial ends. */
public Builder setEndBehavior(
QuoteCreateParams.Line.TrialSettings.EndBehavior endBehavior) {
this.endBehavior = endBehavior;
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.TrialSettings#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.TrialSettings#extraParams} for the field
* documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
}
@Getter
public static class EndBehavior {
/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field
* (serialized) name in this param object. Effectively, this map is flattened to its parent
* instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map extraParams;
/**
* Configure how an opt-in following a paid trial is billed when using {@code
* billing_behavior: prorate_up_front}.
*/
@SerializedName("prorate_up_front")
ProrateUpFront prorateUpFront;
private EndBehavior(Map extraParams, ProrateUpFront prorateUpFront) {
this.extraParams = extraParams;
this.prorateUpFront = prorateUpFront;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Map extraParams;
private ProrateUpFront prorateUpFront;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.Line.TrialSettings.EndBehavior build() {
return new QuoteCreateParams.Line.TrialSettings.EndBehavior(
this.extraParams, this.prorateUpFront);
}
/**
* 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.TrialSettings.EndBehavior#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}
/**
* Add all map key/value pairs to `extraParams` map. A map is initialized for the first
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original
* map. See {@link QuoteCreateParams.Line.TrialSettings.EndBehavior#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
/**
* Configure how an opt-in following a paid trial is billed when using {@code
* billing_behavior: prorate_up_front}.
*/
public Builder setProrateUpFront(
QuoteCreateParams.Line.TrialSettings.EndBehavior.ProrateUpFront prorateUpFront) {
this.prorateUpFront = prorateUpFront;
return this;
}
}
public enum ProrateUpFront implements ApiRequestParams.EnumParam {
@SerializedName("defer")
DEFER("defer"),
@SerializedName("include")
INCLUDE("include");
@Getter(onMethod_ = {@Override})
private final String value;
ProrateUpFront(String value) {
this.value = value;
}
}
}
}
public enum BillingCycleAnchor implements ApiRequestParams.EnumParam {
@SerializedName("automatic")
AUTOMATIC("automatic"),
@SerializedName("line_starts_at")
LINE_STARTS_AT("line_starts_at");
@Getter(onMethod_ = {@Override})
private final String value;
BillingCycleAnchor(String value) {
this.value = value;
}
}
public enum ProrationBehavior implements ApiRequestParams.EnumParam {
@SerializedName("always_invoice")
ALWAYS_INVOICE("always_invoice"),
@SerializedName("create_prorations")
CREATE_PRORATIONS("create_prorations"),
@SerializedName("none")
NONE("none");
@Getter(onMethod_ = {@Override})
private final String value;
ProrationBehavior(String value) {
this.value = value;
}
}
public enum SetScheduleEnd implements ApiRequestParams.EnumParam {
@SerializedName("line_ends_at")
LINE_ENDS_AT("line_ends_at"),
@SerializedName("line_starts_at")
LINE_STARTS_AT("line_starts_at");
@Getter(onMethod_ = {@Override})
private final String value;
SetScheduleEnd(String value) {
this.value = value;
}
}
}
@Getter
public static class LineItem {
/** The discounts applied to this line 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;
/** 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;
/** The quantity of the line item. */
@SerializedName("quantity")
Long quantity;
/**
* The tax rates which apply to the line item. When set, the {@code default_tax_rates} on the
* quote do not apply to this line item.
*/
@SerializedName("tax_rates")
Object taxRates;
private LineItem(
Object discounts,
Map extraParams,
String price,
PriceData priceData,
Long quantity,
Object taxRates) {
this.discounts = discounts;
this.extraParams = extraParams;
this.price = price;
this.priceData = priceData;
this.quantity = quantity;
this.taxRates = taxRates;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Object discounts;
private Map extraParams;
private String price;
private PriceData priceData;
private Long quantity;
private Object taxRates;
/** Finalize and obtain parameter instance from this builder. */
public QuoteCreateParams.LineItem build() {
return new QuoteCreateParams.LineItem(
this.discounts,
this.extraParams,
this.price,
this.priceData,
this.quantity,
this.taxRates);
}
/**
* 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
* QuoteCreateParams.LineItem#discounts} for the field documentation.
*/
@SuppressWarnings("unchecked")
public Builder addDiscount(QuoteCreateParams.LineItem.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
* QuoteCreateParams.LineItem#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 discounts applied to this line item. */
public Builder setDiscounts(EmptyParam discounts) {
this.discounts = discounts;
return this;
}
/** The discounts applied to this line item. */
public Builder setDiscounts(List