diff --git a/API_VERSION b/API_VERSION index 50609624505..e9da0dac3b5 100644 --- a/API_VERSION +++ b/API_VERSION @@ -1 +1 @@ -441c0fcde75bcbf836f1a1810d5b9cfe8e8a7da4 \ No newline at end of file +f7784849b5189b7bdf4d850b41365cec53d174b2 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 81ad24fd492..1ed5292e71c 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2116 \ No newline at end of file +v2120 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/Discount.java b/src/main/java/com/stripe/model/Discount.java index 3657fe6b56d..b69e6dc3545 100644 --- a/src/main/java/com/stripe/model/Discount.java +++ b/src/main/java/com/stripe/model/Discount.java @@ -85,6 +85,13 @@ public class Discount extends StripeObject implements HasId { @Setter(lombok.AccessLevel.NONE) ExpandableField promotionCode; + /** + * The subscription schedule that this coupon is applied to, if it is applied to a particular + * subscription schedule. + */ + @SerializedName("schedule") + String schedule; + @SerializedName("source") Source source; diff --git a/src/main/java/com/stripe/model/EventDataClassLookup.java b/src/main/java/com/stripe/model/EventDataClassLookup.java index d0539b7496e..0827965b3b5 100644 --- a/src/main/java/com/stripe/model/EventDataClassLookup.java +++ b/src/main/java/com/stripe/model/EventDataClassLookup.java @@ -203,6 +203,7 @@ public final class EventDataClassLookup { classLookup.put( "issuing.personalization_design", com.stripe.model.issuing.PersonalizationDesign.class); classLookup.put("issuing.physical_bundle", com.stripe.model.issuing.PhysicalBundle.class); + classLookup.put("issuing.program", com.stripe.model.issuing.Program.class); classLookup.put("issuing.settlement", com.stripe.model.issuing.Settlement.class); classLookup.put("issuing.token", com.stripe.model.issuing.Token.class); classLookup.put("issuing.transaction", com.stripe.model.issuing.Transaction.class); diff --git a/src/main/java/com/stripe/model/Invoice.java b/src/main/java/com/stripe/model/Invoice.java index 70efca9c777..05eb732b7f0 100644 --- a/src/main/java/com/stripe/model/Invoice.java +++ b/src/main/java/com/stripe/model/Invoice.java @@ -2327,6 +2327,10 @@ public static class Parent extends StripeObject { @SerializedName("quote_details") QuoteDetails quoteDetails; + /** Details about the schedule that generated this invoice. */ + @SerializedName("schedule_details") + ScheduleDetails scheduleDetails; + /** Details about the subscription that generated this invoice. */ @SerializedName("subscription_details") SubscriptionDetails subscriptionDetails; @@ -2334,8 +2338,8 @@ public static class Parent extends StripeObject { /** * The type of parent that generated this invoice * - *

One of {@code billing_cadence_details}, {@code quote_details}, or {@code - * subscription_details}. + *

One of {@code billing_cadence_details}, {@code quote_details}, {@code schedule_details}, + * or {@code subscription_details}. */ @SerializedName("type") String type; @@ -2366,6 +2370,19 @@ public static class QuoteDetails extends StripeObject { String quote; } + /** + * For more details about ScheduleDetails, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ScheduleDetails extends StripeObject { + /** The schedule that generated this invoice. */ + @SerializedName("schedule") + String schedule; + } + /** * For more details about SubscriptionDetails, please refer to the API Reference. diff --git a/src/main/java/com/stripe/model/InvoiceItem.java b/src/main/java/com/stripe/model/InvoiceItem.java index 5e7cf8426e8..861247d2afe 100644 --- a/src/main/java/com/stripe/model/InvoiceItem.java +++ b/src/main/java/com/stripe/model/InvoiceItem.java @@ -547,6 +547,10 @@ public static class Parent extends StripeObject { @SerializedName("rate_card_subscription_details") RateCardSubscriptionDetails rateCardSubscriptionDetails; + /** Details about the subscription schedule that generated this invoice item. */ + @SerializedName("schedule_details") + ScheduleDetails scheduleDetails; + /** Details about the subscription that generated this invoice item. */ @SerializedName("subscription_details") SubscriptionDetails subscriptionDetails; @@ -555,7 +559,7 @@ public static class Parent extends StripeObject { * The type of parent that generated this invoice item * *

One of {@code license_fee_subscription_details}, {@code rate_card_subscription_details}, - * or {@code subscription_details}. + * {@code schedule_details}, or {@code subscription_details}. */ @SerializedName("type") String type; @@ -610,6 +614,19 @@ public static class RateCardSubscriptionDetails extends StripeObject { String rateCardVersion; } + /** + * For more details about ScheduleDetails, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ScheduleDetails extends StripeObject { + /** The subscription schedule that generated this invoice item. */ + @SerializedName("schedule") + String schedule; + } + /** * For more details about SubscriptionDetails, please refer to the API Reference. diff --git a/src/main/java/com/stripe/model/InvoiceLineItem.java b/src/main/java/com/stripe/model/InvoiceLineItem.java index ef70059938d..4fdf1868382 100644 --- a/src/main/java/com/stripe/model/InvoiceLineItem.java +++ b/src/main/java/com/stripe/model/InvoiceLineItem.java @@ -403,6 +403,10 @@ public static class Parent extends StripeObject { @SerializedName("rate_card_subscription_details") RateCardSubscriptionDetails rateCardSubscriptionDetails; + /** Details about the subscription schedule that generated this line item. */ + @SerializedName("schedule_details") + ScheduleDetails scheduleDetails; + /** Details about the subscription item that generated this line item. */ @SerializedName("subscription_item_details") SubscriptionItemDetails subscriptionItemDetails; @@ -411,7 +415,8 @@ public static class Parent extends StripeObject { * The type of parent that generated this line item * *

One of {@code invoice_item_details}, {@code license_fee_subscription_details}, {@code - * rate_card_subscription_details}, or {@code subscription_item_details}. + * rate_card_subscription_details}, {@code schedule_details}, or {@code + * subscription_item_details}. */ @SerializedName("type") String type; @@ -532,6 +537,19 @@ public static class RateCardSubscriptionDetails extends StripeObject { String rateCardVersion; } + /** + * For more details about ScheduleDetails, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ScheduleDetails extends StripeObject { + /** The subscription schedule that generated this line item. */ + @SerializedName("schedule") + String schedule; + } + /** * For more details about SubscriptionItemDetails, please refer to the API Reference. diff --git a/src/main/java/com/stripe/model/QuotePreviewInvoice.java b/src/main/java/com/stripe/model/QuotePreviewInvoice.java index 1f0058d6137..d833648a08e 100644 --- a/src/main/java/com/stripe/model/QuotePreviewInvoice.java +++ b/src/main/java/com/stripe/model/QuotePreviewInvoice.java @@ -1195,6 +1195,10 @@ public static class Parent extends StripeObject { @SerializedName("quote_details") QuoteDetails quoteDetails; + /** Details about the schedule that generated this invoice. */ + @SerializedName("schedule_details") + ScheduleDetails scheduleDetails; + /** Details about the subscription that generated this invoice. */ @SerializedName("subscription_details") SubscriptionDetails subscriptionDetails; @@ -1202,8 +1206,8 @@ public static class Parent extends StripeObject { /** * The type of parent that generated this invoice * - *

One of {@code billing_cadence_details}, {@code quote_details}, or {@code - * subscription_details}. + *

One of {@code billing_cadence_details}, {@code quote_details}, {@code schedule_details}, + * or {@code subscription_details}. */ @SerializedName("type") String type; @@ -1234,6 +1238,19 @@ public static class QuoteDetails extends StripeObject { String quote; } + /** + * For more details about ScheduleDetails, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ScheduleDetails extends StripeObject { + /** The schedule that generated this invoice. */ + @SerializedName("schedule") + String schedule; + } + /** * For more details about SubscriptionDetails, please refer to the API Reference. diff --git a/src/main/java/com/stripe/model/QuotePreviewSubscriptionSchedule.java b/src/main/java/com/stripe/model/QuotePreviewSubscriptionSchedule.java index 7c31549af0f..1b6a780de16 100644 --- a/src/main/java/com/stripe/model/QuotePreviewSubscriptionSchedule.java +++ b/src/main/java/com/stripe/model/QuotePreviewSubscriptionSchedule.java @@ -48,6 +48,10 @@ public class QuotePreviewSubscriptionSchedule extends ApiResource implements Has @SerializedName("billing_mode") BillingMode billingMode; + /** Billing schedules for this subscription schedule. */ + @SerializedName("billing_schedules") + List billingSchedules; + /** * Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch. */ @@ -105,6 +109,12 @@ public class QuotePreviewSubscriptionSchedule extends ApiResource implements Has @SerializedName("last_price_migration_error") LastPriceMigrationError lastPriceMigrationError; + /** The most recent invoice this subscription schedule has generated. */ + @SerializedName("latest_invoice") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField latestInvoice; + /** * Has the value {@code true} if the object exists in live mode or the value {@code false} if the * object exists in test mode. @@ -206,6 +216,24 @@ public void setCustomerObject(Customer expandableObject) { this.customer = new ExpandableField(expandableObject.getId(), expandableObject); } + /** Get ID of expandable {@code latestInvoice} object. */ + public String getLatestInvoice() { + return (this.latestInvoice != null) ? this.latestInvoice.getId() : null; + } + + public void setLatestInvoice(String id) { + this.latestInvoice = ApiResource.setExpandableFieldId(id, this.latestInvoice); + } + + /** Get expanded {@code latestInvoice}. */ + public Invoice getLatestInvoiceObject() { + return (this.latestInvoice != null) ? this.latestInvoice.getExpanded() : null; + } + + public void setLatestInvoiceObject(Invoice expandableObject) { + this.latestInvoice = new ExpandableField(expandableObject.getId(), expandableObject); + } + /** Get ID of expandable {@code subscription} object. */ public String getSubscription() { return (this.subscription != null) ? this.subscription.getId() : null; @@ -354,6 +382,226 @@ public static class Flexible extends StripeObject { } } + /** Sets the billing schedule for the subscription. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class BillingSchedule extends StripeObject { + /** Specifies which subscription items the billing schedule applies to. */ + @SerializedName("applies_to") + List appliesTo; + + /** Specifies the start of the billing period. */ + @SerializedName("bill_from") + BillFrom billFrom; + + /** Specifies the billing period. */ + @SerializedName("bill_until") + BillUntil billUntil; + + /** Unique identifier for the billing schedule. */ + @SerializedName("key") + String key; + + /** Represents the entities that the billing schedule applies to. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AppliesTo extends StripeObject { + /** The billing schedule will apply to the subscription item with the given price ID. */ + @SerializedName("price") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField price; + + /** + * Controls which subscription items the billing schedule applies to. + * + *

Equal to {@code price}. + */ + @SerializedName("type") + String type; + + /** Get ID of expandable {@code price} object. */ + public String getPrice() { + return (this.price != null) ? this.price.getId() : null; + } + + public void setPrice(String id) { + this.price = ApiResource.setExpandableFieldId(id, this.price); + } + + /** Get expanded {@code price}. */ + public Price getPriceObject() { + return (this.price != null) ? this.price.getExpanded() : null; + } + + public void setPriceObject(Price expandableObject) { + this.price = new ExpandableField(expandableObject.getId(), expandableObject); + } + } + + /** Specifies the start of the billing period. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class BillFrom extends StripeObject { + /** Use an index to specify the position of an amendment to start prebilling with. */ + @SerializedName("amendment_start") + AmendmentStart amendmentStart; + + /** The time the billing schedule applies from. */ + @SerializedName("computed_timestamp") + Long computedTimestamp; + + /** Lets you bill the period starting from a particular Quote line. */ + @SerializedName("line_starts_at") + LineStartsAt lineStartsAt; + + /** Timestamp is calculated from the request time. */ + @SerializedName("relative") + Relative relative; + + /** + * Use a precise Unix timestamp for prebilling to start. Must be earlier than {@code + * bill_until}. + */ + @SerializedName("timestamp") + Long timestamp; + + /** + * Describes how the billing schedule determines the start date. Possible values are {@code + * timestamp}, {@code relative}, {@code amendment_start}, {@code now}, {@code + * quote_acceptance_date}, {@code line_starts_at}, or {@code pause_collection_start}. + * + *

One of {@code amendment_start}, {@code line_starts_at}, {@code now}, {@code + * pause_collection_start}, {@code quote_acceptance_date}, {@code relative}, or {@code + * timestamp}. + */ + @SerializedName("type") + String type; + + /** Use an index to specify the position of an amendment to start prebilling with. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AmendmentStart extends StripeObject { + /** Use an index to specify the position of an amendment to start prebilling with. */ + @SerializedName("index") + Long index; + } + + /** The timestamp the given line starts at. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class LineStartsAt extends StripeObject implements HasId { + /** Unique identifier for the object. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + } + + /** Timestamp is calculated from the request time. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Relative extends StripeObject { + /** + * Specifies billing duration. Possible values are {@code day}, {@code week}, {@code month}, + * or {@code year}. + * + *

One of {@code day}, {@code month}, {@code week}, or {@code year}. + */ + @SerializedName("interval") + String interval; + + /** The multiplier applied to the interval. */ + @SerializedName("interval_count") + Long intervalCount; + } + } + + /** Specifies the billing period. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class BillUntil extends StripeObject { + /** Use an index to specify the position of an amendment to end prebilling with. */ + @SerializedName("amendment_end") + AmendmentEnd amendmentEnd; + + /** The timestamp the billing schedule will apply until. */ + @SerializedName("computed_timestamp") + Long computedTimestamp; + + /** Specifies the billing period. */ + @SerializedName("duration") + Duration duration; + + /** Lets you bill the period ending at a particular Quote line. */ + @SerializedName("line_ends_at") + LineEndsAt lineEndsAt; + + /** If specified, the billing schedule will apply until the specified timestamp. */ + @SerializedName("timestamp") + Long timestamp; + + /** + * Describes how the billing schedule will determine the end date. Either {@code duration} or + * {@code timestamp}. + * + *

One of {@code amendment_end}, {@code duration}, {@code line_ends_at}, {@code + * schedule_end}, {@code timestamp}, or {@code upcoming_invoice}. + */ + @SerializedName("type") + String type; + + /** Use an index to specify the position of an amendment to end prebilling with. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AmendmentEnd extends StripeObject { + /** Use an index to specify the position of an amendment to end prebilling with. */ + @SerializedName("index") + Long index; + } + + /** + * Configures the {@code bill_until} date based on the provided {@code interval} and {@code + * interval_count}. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Duration extends StripeObject { + /** + * Specifies billing duration. Either {@code day}, {@code week}, {@code month} or {@code + * year}. + * + *

One of {@code day}, {@code month}, {@code week}, or {@code year}. + */ + @SerializedName("interval") + String interval; + + /** The multiplier applied to the interval. */ + @SerializedName("interval_count") + Long intervalCount; + } + + /** The timestamp the given line ends at. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class LineEndsAt extends StripeObject implements HasId { + /** Unique identifier for the object. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + } + } + } + /** * For more details about CurrentPhase, please refer to the API Reference. @@ -449,6 +697,19 @@ public static class DefaultSettings extends StripeObject { @Setter(lombok.AccessLevel.NONE) ExpandableField onBehalfOf; + /** + * Configures how the subscription schedule handles billing for phase transitions. Possible + * values are {@code phase_start} (default) or {@code billing_period_start}. {@code phase_start} + * bills based on the current state of the subscription, ignoring changes scheduled in future + * phases. {@code billing_period_start} bills predictively for upcoming phase transitions within + * the current billing cycle, including pricing changes and service period adjustments that will + * occur before the next invoice. + * + *

One of {@code billing_period_start}, or {@code phase_start}. + */ + @SerializedName("phase_effective_at") + String phaseEffectiveAt; + /** * The account (if any) the associated subscription's payments will be attributed to for tax * reporting, and where funds from each payment will be transferred to for each of the @@ -1922,6 +2183,7 @@ public void setResponseGetter(StripeResponseGetter responseGetter) { trySetResponseGetter(customer, responseGetter); trySetResponseGetter(defaultSettings, responseGetter); trySetResponseGetter(lastPriceMigrationError, responseGetter); + trySetResponseGetter(latestInvoice, responseGetter); trySetResponseGetter(prebilling, responseGetter); trySetResponseGetter(subscription, responseGetter); trySetResponseGetter(testClock, responseGetter); diff --git a/src/main/java/com/stripe/model/SubscriptionSchedule.java b/src/main/java/com/stripe/model/SubscriptionSchedule.java index 090e4a87ffd..f9ffad4c27b 100644 --- a/src/main/java/com/stripe/model/SubscriptionSchedule.java +++ b/src/main/java/com/stripe/model/SubscriptionSchedule.java @@ -60,6 +60,10 @@ public class SubscriptionSchedule extends ApiResource @SerializedName("billing_mode") BillingMode billingMode; + /** Billing schedules for this subscription schedule. */ + @SerializedName("billing_schedules") + List billingSchedules; + /** * Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch. */ @@ -117,6 +121,12 @@ public class SubscriptionSchedule extends ApiResource @SerializedName("last_price_migration_error") LastPriceMigrationError lastPriceMigrationError; + /** The most recent invoice this subscription schedule has generated. */ + @SerializedName("latest_invoice") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField latestInvoice; + /** * Has the value {@code true} if the object exists in live mode or the value {@code false} if the * object exists in test mode. @@ -219,6 +229,24 @@ public void setCustomerObject(Customer expandableObject) { this.customer = new ExpandableField(expandableObject.getId(), expandableObject); } + /** Get ID of expandable {@code latestInvoice} object. */ + public String getLatestInvoice() { + return (this.latestInvoice != null) ? this.latestInvoice.getId() : null; + } + + public void setLatestInvoice(String id) { + this.latestInvoice = ApiResource.setExpandableFieldId(id, this.latestInvoice); + } + + /** Get expanded {@code latestInvoice}. */ + public Invoice getLatestInvoiceObject() { + return (this.latestInvoice != null) ? this.latestInvoice.getExpanded() : null; + } + + public void setLatestInvoiceObject(Invoice expandableObject) { + this.latestInvoice = new ExpandableField(expandableObject.getId(), expandableObject); + } + /** Get ID of expandable {@code subscription} object. */ public String getSubscription() { return (this.subscription != null) ? this.subscription.getId() : null; @@ -669,6 +697,226 @@ public static class Flexible extends StripeObject { } } + /** Sets the billing schedule for the subscription. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class BillingSchedule extends StripeObject { + /** Specifies which subscription items the billing schedule applies to. */ + @SerializedName("applies_to") + List appliesTo; + + /** Specifies the start of the billing period. */ + @SerializedName("bill_from") + BillFrom billFrom; + + /** Specifies the billing period. */ + @SerializedName("bill_until") + BillUntil billUntil; + + /** Unique identifier for the billing schedule. */ + @SerializedName("key") + String key; + + /** Represents the entities that the billing schedule applies to. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AppliesTo extends StripeObject { + /** The billing schedule will apply to the subscription item with the given price ID. */ + @SerializedName("price") + @Getter(lombok.AccessLevel.NONE) + @Setter(lombok.AccessLevel.NONE) + ExpandableField price; + + /** + * Controls which subscription items the billing schedule applies to. + * + *

Equal to {@code price}. + */ + @SerializedName("type") + String type; + + /** Get ID of expandable {@code price} object. */ + public String getPrice() { + return (this.price != null) ? this.price.getId() : null; + } + + public void setPrice(String id) { + this.price = ApiResource.setExpandableFieldId(id, this.price); + } + + /** Get expanded {@code price}. */ + public Price getPriceObject() { + return (this.price != null) ? this.price.getExpanded() : null; + } + + public void setPriceObject(Price expandableObject) { + this.price = new ExpandableField(expandableObject.getId(), expandableObject); + } + } + + /** Specifies the start of the billing period. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class BillFrom extends StripeObject { + /** Use an index to specify the position of an amendment to start prebilling with. */ + @SerializedName("amendment_start") + AmendmentStart amendmentStart; + + /** The time the billing schedule applies from. */ + @SerializedName("computed_timestamp") + Long computedTimestamp; + + /** Lets you bill the period starting from a particular Quote line. */ + @SerializedName("line_starts_at") + LineStartsAt lineStartsAt; + + /** Timestamp is calculated from the request time. */ + @SerializedName("relative") + Relative relative; + + /** + * Use a precise Unix timestamp for prebilling to start. Must be earlier than {@code + * bill_until}. + */ + @SerializedName("timestamp") + Long timestamp; + + /** + * Describes how the billing schedule determines the start date. Possible values are {@code + * timestamp}, {@code relative}, {@code amendment_start}, {@code now}, {@code + * quote_acceptance_date}, {@code line_starts_at}, or {@code pause_collection_start}. + * + *

One of {@code amendment_start}, {@code line_starts_at}, {@code now}, {@code + * pause_collection_start}, {@code quote_acceptance_date}, {@code relative}, or {@code + * timestamp}. + */ + @SerializedName("type") + String type; + + /** Use an index to specify the position of an amendment to start prebilling with. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AmendmentStart extends StripeObject { + /** Use an index to specify the position of an amendment to start prebilling with. */ + @SerializedName("index") + Long index; + } + + /** The timestamp the given line starts at. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class LineStartsAt extends StripeObject implements HasId { + /** Unique identifier for the object. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + } + + /** Timestamp is calculated from the request time. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Relative extends StripeObject { + /** + * Specifies billing duration. Possible values are {@code day}, {@code week}, {@code month}, + * or {@code year}. + * + *

One of {@code day}, {@code month}, {@code week}, or {@code year}. + */ + @SerializedName("interval") + String interval; + + /** The multiplier applied to the interval. */ + @SerializedName("interval_count") + Long intervalCount; + } + } + + /** Specifies the billing period. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class BillUntil extends StripeObject { + /** Use an index to specify the position of an amendment to end prebilling with. */ + @SerializedName("amendment_end") + AmendmentEnd amendmentEnd; + + /** The timestamp the billing schedule will apply until. */ + @SerializedName("computed_timestamp") + Long computedTimestamp; + + /** Specifies the billing period. */ + @SerializedName("duration") + Duration duration; + + /** Lets you bill the period ending at a particular Quote line. */ + @SerializedName("line_ends_at") + LineEndsAt lineEndsAt; + + /** If specified, the billing schedule will apply until the specified timestamp. */ + @SerializedName("timestamp") + Long timestamp; + + /** + * Describes how the billing schedule will determine the end date. Either {@code duration} or + * {@code timestamp}. + * + *

One of {@code amendment_end}, {@code duration}, {@code line_ends_at}, {@code + * schedule_end}, {@code timestamp}, or {@code upcoming_invoice}. + */ + @SerializedName("type") + String type; + + /** Use an index to specify the position of an amendment to end prebilling with. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class AmendmentEnd extends StripeObject { + /** Use an index to specify the position of an amendment to end prebilling with. */ + @SerializedName("index") + Long index; + } + + /** + * Configures the {@code bill_until} date based on the provided {@code interval} and {@code + * interval_count}. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Duration extends StripeObject { + /** + * Specifies billing duration. Either {@code day}, {@code week}, {@code month} or {@code + * year}. + * + *

One of {@code day}, {@code month}, {@code week}, or {@code year}. + */ + @SerializedName("interval") + String interval; + + /** The multiplier applied to the interval. */ + @SerializedName("interval_count") + Long intervalCount; + } + + /** The timestamp the given line ends at. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class LineEndsAt extends StripeObject implements HasId { + /** Unique identifier for the object. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + } + } + } + /** * For more details about CurrentPhase, please refer to the API Reference. @@ -764,6 +1012,19 @@ public static class DefaultSettings extends StripeObject { @Setter(lombok.AccessLevel.NONE) ExpandableField onBehalfOf; + /** + * Configures how the subscription schedule handles billing for phase transitions. Possible + * values are {@code phase_start} (default) or {@code billing_period_start}. {@code phase_start} + * bills based on the current state of the subscription, ignoring changes scheduled in future + * phases. {@code billing_period_start} bills predictively for upcoming phase transitions within + * the current billing cycle, including pricing changes and service period adjustments that will + * occur before the next invoice. + * + *

One of {@code billing_period_start}, or {@code phase_start}. + */ + @SerializedName("phase_effective_at") + String phaseEffectiveAt; + /** * The account (if any) the associated subscription's payments will be attributed to for tax * reporting, and where funds from each payment will be transferred to for each of the @@ -2235,6 +2496,7 @@ public void setResponseGetter(StripeResponseGetter responseGetter) { trySetResponseGetter(customer, responseGetter); trySetResponseGetter(defaultSettings, responseGetter); trySetResponseGetter(lastPriceMigrationError, responseGetter); + trySetResponseGetter(latestInvoice, responseGetter); trySetResponseGetter(prebilling, responseGetter); trySetResponseGetter(subscription, responseGetter); trySetResponseGetter(testClock, responseGetter); diff --git a/src/main/java/com/stripe/model/delegatedcheckout/RequestedSession.java b/src/main/java/com/stripe/model/delegatedcheckout/RequestedSession.java index 722683582b9..ef1a1210d9a 100644 --- a/src/main/java/com/stripe/model/delegatedcheckout/RequestedSession.java +++ b/src/main/java/com/stripe/model/delegatedcheckout/RequestedSession.java @@ -705,6 +705,31 @@ public static class TotalDetails extends StripeObject { /** The amount tax of the total details. */ @SerializedName("amount_tax") Long amountTax; + + /** The applicable fees of the total details. */ + @SerializedName("applicable_fees") + List applicableFees; + + /** + * For more details about ApplicableFee, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ApplicableFee extends StripeObject { + /** The amount of the applicable fee. */ + @SerializedName("amount") + Long amount; + + /** The description of the applicable fee. */ + @SerializedName("description") + String description; + + /** The display name of the applicable fee. */ + @SerializedName("display_name") + String displayName; + } } @Override diff --git a/src/main/java/com/stripe/model/issuing/Program.java b/src/main/java/com/stripe/model/issuing/Program.java new file mode 100644 index 00000000000..db8c824ee42 --- /dev/null +++ b/src/main/java/com/stripe/model/issuing/Program.java @@ -0,0 +1,199 @@ +// File generated from our OpenAPI spec +package com.stripe.model.issuing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.HasId; +import com.stripe.model.MetadataStore; +import com.stripe.net.ApiRequest; +import com.stripe.net.ApiRequestParams; +import com.stripe.net.ApiResource; +import com.stripe.net.BaseAddress; +import com.stripe.net.RequestOptions; +import com.stripe.param.issuing.ProgramCreateParams; +import com.stripe.param.issuing.ProgramListParams; +import com.stripe.param.issuing.ProgramRetrieveParams; +import com.stripe.param.issuing.ProgramUpdateParams; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** An Issuing {@code Program} represents a card program that the user has access to. */ +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class Program extends ApiResource implements HasId, MetadataStore { + /** Time at which the object was created. Measured in seconds since the Unix epoch. */ + @SerializedName("created") + Long created; + + /** Unique identifier for the object. */ + @Getter(onMethod_ = {@Override}) + @SerializedName("id") + String id; + + /** + * Whether or not this is the "default" issuing program new cards are created on. Only + * one active {@code is_default} program at the same time. + */ + @SerializedName("is_default") + Boolean isDefault; + + /** + * Set of key-value pairs that you can attach + * to an object. This can be useful for storing additional information about the object in a + * structured format. + */ + @Getter(onMethod_ = {@Override}) + @SerializedName("metadata") + Map metadata; + + /** + * String representing the object's type. Objects of the same type share the same value. + * + *

Equal to {@code issuing.program}. + */ + @SerializedName("object") + String object; + + /** The platform's Issuing Program for which this program is associated. */ + @SerializedName("platform_program") + String platformProgram; + + /** Create a {@code Program} object. */ + public static Program create(Map params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Create a {@code Program} object. */ + public static Program create(Map params, RequestOptions options) + throws StripeException { + String path = "/v1/issuing/programs"; + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); + return getGlobalResponseGetter().request(request, Program.class); + } + + /** Create a {@code Program} object. */ + public static Program create(ProgramCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + + /** Create a {@code Program} object. */ + public static Program create(ProgramCreateParams params, RequestOptions options) + throws StripeException { + String path = "/v1/issuing/programs"; + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, Program.class); + } + + /** List all of the programs the given Issuing user has access to. */ + public static ProgramCollection list(Map params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** List all of the programs the given Issuing user has access to. */ + public static ProgramCollection list(Map params, RequestOptions options) + throws StripeException { + String path = "/v1/issuing/programs"; + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options); + return getGlobalResponseGetter().request(request, ProgramCollection.class); + } + + /** List all of the programs the given Issuing user has access to. */ + public static ProgramCollection list(ProgramListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + + /** List all of the programs the given Issuing user has access to. */ + public static ProgramCollection list(ProgramListParams params, RequestOptions options) + throws StripeException { + String path = "/v1/issuing/programs"; + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, ProgramCollection.class); + } + + /** Retrieves the program specified by the given id. */ + public static Program retrieve(String program) throws StripeException { + return retrieve(program, (Map) null, (RequestOptions) null); + } + + /** Retrieves the program specified by the given id. */ + public static Program retrieve(String program, RequestOptions options) throws StripeException { + return retrieve(program, (Map) null, options); + } + + /** Retrieves the program specified by the given id. */ + public static Program retrieve(String program, Map params, RequestOptions options) + throws StripeException { + String path = String.format("/v1/issuing/programs/%s", ApiResource.urlEncodeId(program)); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options); + return getGlobalResponseGetter().request(request, Program.class); + } + + /** Retrieves the program specified by the given id. */ + public static Program retrieve( + String program, ProgramRetrieveParams params, RequestOptions options) throws StripeException { + String path = String.format("/v1/issuing/programs/%s", ApiResource.urlEncodeId(program)); + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return getGlobalResponseGetter().request(request, Program.class); + } + + /** Updates a {@code Program} object. */ + @Override + public Program update(Map params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates a {@code Program} object. */ + @Override + public Program update(Map params, RequestOptions options) throws StripeException { + String path = String.format("/v1/issuing/programs/%s", ApiResource.urlEncodeId(this.getId())); + ApiRequest request = + new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); + return getResponseGetter().request(request, Program.class); + } + + /** Updates a {@code Program} object. */ + public Program update(ProgramUpdateParams params) throws StripeException { + return update(params, (RequestOptions) null); + } + + /** Updates a {@code Program} object. */ + public Program update(ProgramUpdateParams params, RequestOptions options) throws StripeException { + String path = String.format("/v1/issuing/programs/%s", ApiResource.urlEncodeId(this.getId())); + ApiResource.checkNullTypedParams(path, params); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return getResponseGetter().request(request, Program.class); + } +} diff --git a/src/main/java/com/stripe/model/issuing/ProgramCollection.java b/src/main/java/com/stripe/model/issuing/ProgramCollection.java new file mode 100644 index 00000000000..a636b869dc0 --- /dev/null +++ b/src/main/java/com/stripe/model/issuing/ProgramCollection.java @@ -0,0 +1,6 @@ +// File generated from our OpenAPI spec +package com.stripe.model.issuing; + +import com.stripe.model.StripeCollection; + +public class ProgramCollection extends StripeCollection {} diff --git a/src/main/java/com/stripe/param/InvoiceCreatePreviewParams.java b/src/main/java/com/stripe/param/InvoiceCreatePreviewParams.java index 0a9d04b7185..719e624b2b4 100644 --- a/src/main/java/com/stripe/param/InvoiceCreatePreviewParams.java +++ b/src/main/java/com/stripe/param/InvoiceCreatePreviewParams.java @@ -3519,6 +3519,10 @@ public static class ScheduleDetails { @SerializedName("billing_mode") BillingMode billingMode; + /** Sets the billing schedules for the subscription schedule. */ + @SerializedName("billing_schedules") + List billingSchedules; + /** * Behavior of the subscription schedule and underlying subscription when it ends. Possible * values are {@code release} or {@code cancel} with the default being {@code release}. {@code @@ -3560,6 +3564,7 @@ private ScheduleDetails( List amendments, BillingBehavior billingBehavior, BillingMode billingMode, + List billingSchedules, EndBehavior endBehavior, Map extraParams, List phases, @@ -3568,6 +3573,7 @@ private ScheduleDetails( this.amendments = amendments; this.billingBehavior = billingBehavior; this.billingMode = billingMode; + this.billingSchedules = billingSchedules; this.endBehavior = endBehavior; this.extraParams = extraParams; this.phases = phases; @@ -3586,6 +3592,8 @@ public static class Builder { private BillingMode billingMode; + private List billingSchedules; + private EndBehavior endBehavior; private Map extraParams; @@ -3602,6 +3610,7 @@ public InvoiceCreatePreviewParams.ScheduleDetails build() { this.amendments, this.billingBehavior, this.billingMode, + this.billingSchedules, this.endBehavior, this.extraParams, this.phases, @@ -3656,6 +3665,35 @@ public Builder setBillingMode( return this; } + /** + * Add an element to `billingSchedules` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * InvoiceCreatePreviewParams.ScheduleDetails#billingSchedules} for the field documentation. + */ + public Builder addBillingSchedule( + InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule element) { + if (this.billingSchedules == null) { + this.billingSchedules = new ArrayList<>(); + } + this.billingSchedules.add(element); + return this; + } + + /** + * Add all elements to `billingSchedules` list. A list is initialized for the first + * `add/addAll` call, and subsequent calls adds additional elements to the original list. See + * {@link InvoiceCreatePreviewParams.ScheduleDetails#billingSchedules} for the field + * documentation. + */ + public Builder addAllBillingSchedule( + List elements) { + if (this.billingSchedules == null) { + this.billingSchedules = new ArrayList<>(); + } + this.billingSchedules.addAll(elements); + return this; + } + /** * Behavior of the subscription schedule and underlying subscription when it ends. Possible * values are {@code release} or {@code cancel} with the default being {@code release}. {@code @@ -8063,6 +8101,504 @@ public enum Type implements ApiRequestParams.EnumParam { } } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class BillingSchedule { + /** Configure billing schedule differently for individual subscription items. */ + @SerializedName("applies_to") + List appliesTo; + + /** The end date for the billing schedule. */ + @SerializedName("bill_until") + BillUntil billUntil; + + /** + * 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; + + /** + * Specify a key for the billing schedule. Must be unique to this field, alphanumeric, and up + * to 200 characters. If not provided, a unique key will be generated. + */ + @SerializedName("key") + String key; + + private BillingSchedule( + List appliesTo, + BillUntil billUntil, + Map extraParams, + String key) { + this.appliesTo = appliesTo; + this.billUntil = billUntil; + this.extraParams = extraParams; + this.key = key; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List + appliesTo; + + private BillUntil billUntil; + + private Map extraParams; + + private String key; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule( + this.appliesTo, this.billUntil, this.extraParams, this.key); + } + + /** + * Add an element to `appliesTo` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule#appliesTo} for the field + * documentation. + */ + public Builder addAppliesTo( + InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.AppliesTo element) { + if (this.appliesTo == null) { + this.appliesTo = new ArrayList<>(); + } + this.appliesTo.add(element); + return this; + } + + /** + * Add all elements to `appliesTo` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule#appliesTo} for the field + * documentation. + */ + public Builder addAllAppliesTo( + List elements) { + if (this.appliesTo == null) { + this.appliesTo = new ArrayList<>(); + } + this.appliesTo.addAll(elements); + return this; + } + + /** The end date for the billing schedule. */ + public Builder setBillUntil( + InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.BillUntil billUntil) { + this.billUntil = billUntil; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule#extraParams} + * for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Specify a key for the billing schedule. Must be unique to this field, alphanumeric, and + * up to 200 characters. If not provided, a unique key will be generated. + */ + public Builder setKey(String key) { + this.key = key; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + 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; + + /** The ID of the price object. */ + @SerializedName("price") + String price; + + /** + * Required. Controls which subscription items the billing schedule applies + * to. + */ + @SerializedName("type") + Type type; + + private AppliesTo(Map extraParams, String price, Type type) { + this.extraParams = extraParams; + this.price = price; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String price; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.AppliesTo build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.AppliesTo( + this.extraParams, this.price, this.type); + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link + * InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.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 + * InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.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; + } + + /** The ID of the price object. */ + public Builder setPrice(String price) { + this.price = price; + return this; + } + + /** + * Required. Controls which subscription items the billing schedule + * applies to. + */ + public Builder setType( + InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.AppliesTo.Type type) { + this.type = type; + return this; + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("price") + PRICE("price"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class BillUntil { + /** Specifies the billing period. */ + @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; + + /** The end date of the billing schedule. */ + @SerializedName("timestamp") + Long timestamp; + + /** + * Required. Describes how the billing schedule will determine the end + * date. Either {@code duration} or {@code timestamp}. + */ + @SerializedName("type") + Type type; + + private BillUntil( + Duration duration, Map extraParams, Long timestamp, Type type) { + this.duration = duration; + this.extraParams = extraParams; + this.timestamp = timestamp; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Duration duration; + + private Map extraParams; + + private Long timestamp; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.BillUntil build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.BillUntil( + this.duration, this.extraParams, this.timestamp, this.type); + } + + /** Specifies the billing period. */ + public Builder setDuration( + InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.BillUntil.Duration + duration) { + this.duration = duration; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link + * InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.BillUntil#extraParams} for + * the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link + * InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.BillUntil#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 end date of the billing schedule. */ + public Builder setTimestamp(Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Required. Describes how the billing schedule will determine the end + * date. Either {@code duration} or {@code timestamp}. + */ + public Builder setType( + InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.BillUntil.Type type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Duration { + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field + * (serialized) name in this param object. Effectively, this map is flattened to its + * parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. Specifies billing duration. Either {@code day}, {@code + * week}, {@code month} or {@code year}. + */ + @SerializedName("interval") + Interval interval; + + /** The multiplier applied to the interval. */ + @SerializedName("interval_count") + Long intervalCount; + + private Duration(Map extraParams, Interval interval, Long intervalCount) { + this.extraParams = extraParams; + this.interval = interval; + this.intervalCount = intervalCount; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Interval interval; + + private Long intervalCount; + + /** Finalize and obtain parameter instance from this builder. */ + public InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.BillUntil.Duration + build() { + return new InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.BillUntil + .Duration(this.extraParams, this.interval, this.intervalCount); + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the + * original map. See {@link + * InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.BillUntil.Duration#extraParams} + * for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the + * original map. See {@link + * InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.BillUntil.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 billing duration. Either {@code day}, {@code + * week}, {@code month} or {@code year}. + */ + public Builder setInterval( + InvoiceCreatePreviewParams.ScheduleDetails.BillingSchedule.BillUntil.Duration + .Interval + interval) { + this.interval = interval; + return this; + } + + /** The multiplier applied to the interval. */ + 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("amendment_end") + AMENDMENT_END("amendment_end"), + + @SerializedName("duration") + DURATION("duration"), + + @SerializedName("line_ends_at") + LINE_ENDS_AT("line_ends_at"), + + @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 @EqualsAndHashCode(callSuper = false) public static class Phase { diff --git a/src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java b/src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java index 41efb7c5983..2a1257e225d 100644 --- a/src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java +++ b/src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java @@ -29,6 +29,10 @@ public class SubscriptionScheduleCreateParams extends ApiRequestParams { @SerializedName("billing_mode") BillingMode billingMode; + /** Sets the billing schedules for the subscription schedule. */ + @SerializedName("billing_schedules") + List billingSchedules; + /** The identifier of the customer to create the subscription schedule for. */ @SerializedName("customer") String customer; @@ -105,6 +109,7 @@ public class SubscriptionScheduleCreateParams extends ApiRequestParams { private SubscriptionScheduleCreateParams( BillingBehavior billingBehavior, BillingMode billingMode, + List billingSchedules, String customer, String customerAccount, DefaultSettings defaultSettings, @@ -118,6 +123,7 @@ private SubscriptionScheduleCreateParams( Object startDate) { this.billingBehavior = billingBehavior; this.billingMode = billingMode; + this.billingSchedules = billingSchedules; this.customer = customer; this.customerAccount = customerAccount; this.defaultSettings = defaultSettings; @@ -140,6 +146,8 @@ public static class Builder { private BillingMode billingMode; + private List billingSchedules; + private String customer; private String customerAccount; @@ -167,6 +175,7 @@ public SubscriptionScheduleCreateParams build() { return new SubscriptionScheduleCreateParams( this.billingBehavior, this.billingMode, + this.billingSchedules, this.customer, this.customerAccount, this.defaultSettings, @@ -199,6 +208,33 @@ public Builder setBillingMode(SubscriptionScheduleCreateParams.BillingMode billi return this; } + /** + * Add an element to `billingSchedules` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * SubscriptionScheduleCreateParams#billingSchedules} for the field documentation. + */ + public Builder addBillingSchedule(SubscriptionScheduleCreateParams.BillingSchedule element) { + if (this.billingSchedules == null) { + this.billingSchedules = new ArrayList<>(); + } + this.billingSchedules.add(element); + return this; + } + + /** + * Add all elements to `billingSchedules` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * SubscriptionScheduleCreateParams#billingSchedules} for the field documentation. + */ + public Builder addAllBillingSchedule( + List elements) { + if (this.billingSchedules == null) { + this.billingSchedules = new ArrayList<>(); + } + this.billingSchedules.addAll(elements); + return this; + } + /** The identifier of the customer to create the subscription schedule for. */ public Builder setCustomer(String customer) { this.customer = customer; @@ -592,6 +628,491 @@ public enum Type implements ApiRequestParams.EnumParam { } } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class BillingSchedule { + /** Configure billing schedule differently for individual subscription items. */ + @SerializedName("applies_to") + List appliesTo; + + /** Required. The end date for the billing schedule. */ + @SerializedName("bill_until") + BillUntil billUntil; + + /** + * 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; + + /** + * Specify a key for the billing schedule. Must be unique to this field, alphanumeric, and up to + * 200 characters. If not provided, a unique key will be generated. + */ + @SerializedName("key") + String key; + + private BillingSchedule( + List appliesTo, + BillUntil billUntil, + Map extraParams, + String key) { + this.appliesTo = appliesTo; + this.billUntil = billUntil; + this.extraParams = extraParams; + this.key = key; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List appliesTo; + + private BillUntil billUntil; + + private Map extraParams; + + private String key; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleCreateParams.BillingSchedule build() { + return new SubscriptionScheduleCreateParams.BillingSchedule( + this.appliesTo, this.billUntil, this.extraParams, this.key); + } + + /** + * Add an element to `appliesTo` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * SubscriptionScheduleCreateParams.BillingSchedule#appliesTo} for the field documentation. + */ + public Builder addAppliesTo( + SubscriptionScheduleCreateParams.BillingSchedule.AppliesTo element) { + if (this.appliesTo == null) { + this.appliesTo = new ArrayList<>(); + } + this.appliesTo.add(element); + return this; + } + + /** + * Add all elements to `appliesTo` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * SubscriptionScheduleCreateParams.BillingSchedule#appliesTo} for the field documentation. + */ + public Builder addAllAppliesTo( + List elements) { + if (this.appliesTo == null) { + this.appliesTo = new ArrayList<>(); + } + this.appliesTo.addAll(elements); + return this; + } + + /** Required. The end date for the billing schedule. */ + public Builder setBillUntil( + SubscriptionScheduleCreateParams.BillingSchedule.BillUntil billUntil) { + this.billUntil = billUntil; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * SubscriptionScheduleCreateParams.BillingSchedule#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link SubscriptionScheduleCreateParams.BillingSchedule#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Specify a key for the billing schedule. Must be unique to this field, alphanumeric, and up + * to 200 characters. If not provided, a unique key will be generated. + */ + public Builder setKey(String key) { + this.key = key; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + 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; + + /** The ID of the price object. */ + @SerializedName("price") + String price; + + /** + * Required. Controls which subscription items the billing schedule applies + * to. + */ + @SerializedName("type") + Type type; + + private AppliesTo(Map extraParams, String price, Type type) { + this.extraParams = extraParams; + this.price = price; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String price; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleCreateParams.BillingSchedule.AppliesTo build() { + return new SubscriptionScheduleCreateParams.BillingSchedule.AppliesTo( + this.extraParams, this.price, 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 SubscriptionScheduleCreateParams.BillingSchedule.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 SubscriptionScheduleCreateParams.BillingSchedule.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; + } + + /** The ID of the price object. */ + public Builder setPrice(String price) { + this.price = price; + return this; + } + + /** + * Required. Controls which subscription items the billing schedule applies + * to. + */ + public Builder setType( + SubscriptionScheduleCreateParams.BillingSchedule.AppliesTo.Type type) { + this.type = type; + return this; + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("price") + PRICE("price"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class BillUntil { + /** Specifies the billing period. */ + @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; + + /** The end date of the billing schedule. */ + @SerializedName("timestamp") + Long timestamp; + + /** + * Required. Describes how the billing schedule will determine the end date. + * Either {@code duration} or {@code timestamp}. + */ + @SerializedName("type") + Type type; + + private BillUntil( + 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 SubscriptionScheduleCreateParams.BillingSchedule.BillUntil build() { + return new SubscriptionScheduleCreateParams.BillingSchedule.BillUntil( + this.duration, this.extraParams, this.timestamp, this.type); + } + + /** Specifies the billing period. */ + public Builder setDuration( + SubscriptionScheduleCreateParams.BillingSchedule.BillUntil.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 SubscriptionScheduleCreateParams.BillingSchedule.BillUntil#extraParams} + * for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link SubscriptionScheduleCreateParams.BillingSchedule.BillUntil#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 end date of the billing schedule. */ + public Builder setTimestamp(Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Required. Describes how the billing schedule will determine the end + * date. Either {@code duration} or {@code timestamp}. + */ + public Builder setType( + SubscriptionScheduleCreateParams.BillingSchedule.BillUntil.Type type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Duration { + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field + * (serialized) name in this param object. Effectively, this map is flattened to its parent + * instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. Specifies billing duration. Either {@code day}, {@code week}, + * {@code month} or {@code year}. + */ + @SerializedName("interval") + Interval interval; + + /** The multiplier applied to the interval. */ + @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 SubscriptionScheduleCreateParams.BillingSchedule.BillUntil.Duration build() { + return new SubscriptionScheduleCreateParams.BillingSchedule.BillUntil.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 + * SubscriptionScheduleCreateParams.BillingSchedule.BillUntil.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 + * SubscriptionScheduleCreateParams.BillingSchedule.BillUntil.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 billing duration. Either {@code day}, {@code + * week}, {@code month} or {@code year}. + */ + public Builder setInterval( + SubscriptionScheduleCreateParams.BillingSchedule.BillUntil.Duration.Interval + interval) { + this.interval = interval; + return this; + } + + /** The multiplier applied to the interval. */ + 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("amendment_end") + AMENDMENT_END("amendment_end"), + + @SerializedName("duration") + DURATION("duration"), + + @SerializedName("line_ends_at") + LINE_ENDS_AT("line_ends_at"), + + @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 @EqualsAndHashCode(callSuper = false) public static class DefaultSettings { @@ -671,6 +1192,17 @@ public static class DefaultSettings { @SerializedName("on_behalf_of") Object onBehalfOf; + /** + * Configures how the subscription schedule handles billing for phase transitions. Possible + * values are {@code phase_start} (default) or {@code billing_period_start}. {@code phase_start} + * bills based on the current state of the subscription, ignoring changes scheduled in future + * phases. {@code billing_period_start} bills predictively for upcoming phase transitions within + * the current billing cycle, including pricing changes and service period adjustments that will + * occur before the next invoice. + */ + @SerializedName("phase_effective_at") + PhaseEffectiveAt phaseEffectiveAt; + /** * The data with which to automatically create a Transfer for each of the associated * subscription's invoices. @@ -689,6 +1221,7 @@ private DefaultSettings( Map extraParams, InvoiceSettings invoiceSettings, Object onBehalfOf, + PhaseEffectiveAt phaseEffectiveAt, Object transferData) { this.applicationFeePercent = applicationFeePercent; this.automaticTax = automaticTax; @@ -700,6 +1233,7 @@ private DefaultSettings( this.extraParams = extraParams; this.invoiceSettings = invoiceSettings; this.onBehalfOf = onBehalfOf; + this.phaseEffectiveAt = phaseEffectiveAt; this.transferData = transferData; } @@ -728,6 +1262,8 @@ public static class Builder { private Object onBehalfOf; + private PhaseEffectiveAt phaseEffectiveAt; + private Object transferData; /** Finalize and obtain parameter instance from this builder. */ @@ -743,6 +1279,7 @@ public SubscriptionScheduleCreateParams.DefaultSettings build() { this.extraParams, this.invoiceSettings, this.onBehalfOf, + this.phaseEffectiveAt, this.transferData); } @@ -892,6 +1429,20 @@ public Builder setOnBehalfOf(EmptyParam onBehalfOf) { return this; } + /** + * Configures how the subscription schedule handles billing for phase transitions. Possible + * values are {@code phase_start} (default) or {@code billing_period_start}. {@code + * phase_start} bills based on the current state of the subscription, ignoring changes + * scheduled in future phases. {@code billing_period_start} bills predictively for upcoming + * phase transitions within the current billing cycle, including pricing changes and service + * period adjustments that will occur before the next invoice. + */ + public Builder setPhaseEffectiveAt( + SubscriptionScheduleCreateParams.DefaultSettings.PhaseEffectiveAt phaseEffectiveAt) { + this.phaseEffectiveAt = phaseEffectiveAt; + return this; + } + /** * The data with which to automatically create a Transfer for each of the associated * subscription's invoices. @@ -1605,6 +2156,21 @@ public enum CollectionMethod implements ApiRequestParams.EnumParam { this.value = value; } } + + public enum PhaseEffectiveAt implements ApiRequestParams.EnumParam { + @SerializedName("billing_period_start") + BILLING_PERIOD_START("billing_period_start"), + + @SerializedName("phase_start") + PHASE_START("phase_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + PhaseEffectiveAt(String value) { + this.value = value; + } + } } @Getter diff --git a/src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java b/src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java index 08871c2c8c7..f8ff0ad89fb 100644 --- a/src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java +++ b/src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java @@ -25,6 +25,10 @@ public class SubscriptionScheduleUpdateParams extends ApiRequestParams { @SerializedName("billing_behavior") BillingBehavior billingBehavior; + /** Sets the billing schedules for the subscription schedule. */ + @SerializedName("billing_schedules") + List billingSchedules; + /** Object representing the subscription schedule's default settings. */ @SerializedName("default_settings") DefaultSettings defaultSettings; @@ -83,6 +87,7 @@ public class SubscriptionScheduleUpdateParams extends ApiRequestParams { private SubscriptionScheduleUpdateParams( BillingBehavior billingBehavior, + List billingSchedules, DefaultSettings defaultSettings, EndBehavior endBehavior, List expand, @@ -92,6 +97,7 @@ private SubscriptionScheduleUpdateParams( Prebilling prebilling, ProrationBehavior prorationBehavior) { this.billingBehavior = billingBehavior; + this.billingSchedules = billingSchedules; this.defaultSettings = defaultSettings; this.endBehavior = endBehavior; this.expand = expand; @@ -109,6 +115,8 @@ public static Builder builder() { public static class Builder { private BillingBehavior billingBehavior; + private List billingSchedules; + private DefaultSettings defaultSettings; private EndBehavior endBehavior; @@ -129,6 +137,7 @@ public static class Builder { public SubscriptionScheduleUpdateParams build() { return new SubscriptionScheduleUpdateParams( this.billingBehavior, + this.billingSchedules, this.defaultSettings, this.endBehavior, this.expand, @@ -152,6 +161,33 @@ public Builder setBillingBehavior( return this; } + /** + * Add an element to `billingSchedules` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * SubscriptionScheduleUpdateParams#billingSchedules} for the field documentation. + */ + public Builder addBillingSchedule(SubscriptionScheduleUpdateParams.BillingSchedule element) { + if (this.billingSchedules == null) { + this.billingSchedules = new ArrayList<>(); + } + this.billingSchedules.add(element); + return this; + } + + /** + * Add all elements to `billingSchedules` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * SubscriptionScheduleUpdateParams#billingSchedules} for the field documentation. + */ + public Builder addAllBillingSchedule( + List elements) { + if (this.billingSchedules == null) { + this.billingSchedules = new ArrayList<>(); + } + this.billingSchedules.addAll(elements); + return this; + } + /** Object representing the subscription schedule's default settings. */ public Builder setDefaultSettings( SubscriptionScheduleUpdateParams.DefaultSettings defaultSettings) { @@ -316,6 +352,506 @@ public Builder setProrationBehavior( } } + @Getter + @EqualsAndHashCode(callSuper = false) + public static class BillingSchedule { + /** Configure billing schedule differently for individual subscription items. */ + @SerializedName("applies_to") + List appliesTo; + + /** The end date for the billing schedule. */ + @SerializedName("bill_until") + BillUntil billUntil; + + /** + * 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; + + /** + * Specify a key for the billing schedule. Must be unique to this field, alphanumeric, and up to + * 200 characters. If not provided, a unique key will be generated. + */ + @SerializedName("key") + Object key; + + private BillingSchedule( + List appliesTo, + BillUntil billUntil, + Map extraParams, + Object key) { + this.appliesTo = appliesTo; + this.billUntil = billUntil; + this.extraParams = extraParams; + this.key = key; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List appliesTo; + + private BillUntil billUntil; + + private Map extraParams; + + private Object key; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleUpdateParams.BillingSchedule build() { + return new SubscriptionScheduleUpdateParams.BillingSchedule( + this.appliesTo, this.billUntil, this.extraParams, this.key); + } + + /** + * Add an element to `appliesTo` list. A list is initialized for the first `add/addAll` call, + * and subsequent calls adds additional elements to the original list. See {@link + * SubscriptionScheduleUpdateParams.BillingSchedule#appliesTo} for the field documentation. + */ + public Builder addAppliesTo( + SubscriptionScheduleUpdateParams.BillingSchedule.AppliesTo element) { + if (this.appliesTo == null) { + this.appliesTo = new ArrayList<>(); + } + this.appliesTo.add(element); + return this; + } + + /** + * Add all elements to `appliesTo` list. A list is initialized for the first `add/addAll` + * call, and subsequent calls adds additional elements to the original list. See {@link + * SubscriptionScheduleUpdateParams.BillingSchedule#appliesTo} for the field documentation. + */ + public Builder addAllAppliesTo( + List elements) { + if (this.appliesTo == null) { + this.appliesTo = new ArrayList<>(); + } + this.appliesTo.addAll(elements); + return this; + } + + /** The end date for the billing schedule. */ + public Builder setBillUntil( + SubscriptionScheduleUpdateParams.BillingSchedule.BillUntil billUntil) { + this.billUntil = billUntil; + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * SubscriptionScheduleUpdateParams.BillingSchedule#extraParams} for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link SubscriptionScheduleUpdateParams.BillingSchedule#extraParams} for the field + * documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Specify a key for the billing schedule. Must be unique to this field, alphanumeric, and up + * to 200 characters. If not provided, a unique key will be generated. + */ + public Builder setKey(String key) { + this.key = key; + return this; + } + + /** + * Specify a key for the billing schedule. Must be unique to this field, alphanumeric, and up + * to 200 characters. If not provided, a unique key will be generated. + */ + public Builder setKey(EmptyParam key) { + this.key = key; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + 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; + + /** The ID of the price object. */ + @SerializedName("price") + Object price; + + /** + * Required. Controls which subscription items the billing schedule applies + * to. + */ + @SerializedName("type") + Type type; + + private AppliesTo(Map extraParams, Object price, Type type) { + this.extraParams = extraParams; + this.price = price; + this.type = type; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private Object price; + + private Type type; + + /** Finalize and obtain parameter instance from this builder. */ + public SubscriptionScheduleUpdateParams.BillingSchedule.AppliesTo build() { + return new SubscriptionScheduleUpdateParams.BillingSchedule.AppliesTo( + this.extraParams, this.price, 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 SubscriptionScheduleUpdateParams.BillingSchedule.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 SubscriptionScheduleUpdateParams.BillingSchedule.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; + } + + /** The ID of the price object. */ + public Builder setPrice(String price) { + this.price = price; + return this; + } + + /** The ID of the price object. */ + public Builder setPrice(EmptyParam price) { + this.price = price; + return this; + } + + /** + * Required. Controls which subscription items the billing schedule applies + * to. + */ + public Builder setType( + SubscriptionScheduleUpdateParams.BillingSchedule.AppliesTo.Type type) { + this.type = type; + return this; + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("price") + PRICE("price"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class BillUntil { + /** Specifies the billing period. */ + @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; + + /** The end date of the billing schedule. */ + @SerializedName("timestamp") + Long timestamp; + + /** + * Required. Describes how the billing schedule will determine the end date. + * Either {@code duration} or {@code timestamp}. + */ + @SerializedName("type") + Type type; + + private BillUntil( + 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 SubscriptionScheduleUpdateParams.BillingSchedule.BillUntil build() { + return new SubscriptionScheduleUpdateParams.BillingSchedule.BillUntil( + this.duration, this.extraParams, this.timestamp, this.type); + } + + /** Specifies the billing period. */ + public Builder setDuration( + SubscriptionScheduleUpdateParams.BillingSchedule.BillUntil.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 SubscriptionScheduleUpdateParams.BillingSchedule.BillUntil#extraParams} + * for the field documentation. + */ + public Builder putExtraParam(String key, Object value) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original + * map. See {@link SubscriptionScheduleUpdateParams.BillingSchedule.BillUntil#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 end date of the billing schedule. */ + public Builder setTimestamp(Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Required. Describes how the billing schedule will determine the end + * date. Either {@code duration} or {@code timestamp}. + */ + public Builder setType( + SubscriptionScheduleUpdateParams.BillingSchedule.BillUntil.Type type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Duration { + /** + * Map of extra parameters for custom features not available in this client library. The + * content in this map is not serialized under this field's {@code @SerializedName} value. + * Instead, each key/value pair is serialized as if the key is a root-level field + * (serialized) name in this param object. Effectively, this map is flattened to its parent + * instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. Specifies billing duration. Either {@code day}, {@code week}, + * {@code month} or {@code year}. + */ + @SerializedName("interval") + Interval interval; + + /** The multiplier applied to the interval. */ + @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 SubscriptionScheduleUpdateParams.BillingSchedule.BillUntil.Duration build() { + return new SubscriptionScheduleUpdateParams.BillingSchedule.BillUntil.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 + * SubscriptionScheduleUpdateParams.BillingSchedule.BillUntil.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 + * SubscriptionScheduleUpdateParams.BillingSchedule.BillUntil.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 billing duration. Either {@code day}, {@code + * week}, {@code month} or {@code year}. + */ + public Builder setInterval( + SubscriptionScheduleUpdateParams.BillingSchedule.BillUntil.Duration.Interval + interval) { + this.interval = interval; + return this; + } + + /** The multiplier applied to the interval. */ + 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("amendment_end") + AMENDMENT_END("amendment_end"), + + @SerializedName("duration") + DURATION("duration"), + + @SerializedName("line_ends_at") + LINE_ENDS_AT("line_ends_at"), + + @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 @EqualsAndHashCode(callSuper = false) public static class DefaultSettings { @@ -395,6 +931,17 @@ public static class DefaultSettings { @SerializedName("on_behalf_of") Object onBehalfOf; + /** + * Configures how the subscription schedule handles billing for phase transitions. Possible + * values are {@code phase_start} (default) or {@code billing_period_start}. {@code phase_start} + * bills based on the current state of the subscription, ignoring changes scheduled in future + * phases. {@code billing_period_start} bills predictively for upcoming phase transitions within + * the current billing cycle, including pricing changes and service period adjustments that will + * occur before the next invoice. + */ + @SerializedName("phase_effective_at") + PhaseEffectiveAt phaseEffectiveAt; + /** * The data with which to automatically create a Transfer for each of the associated * subscription's invoices. @@ -413,6 +960,7 @@ private DefaultSettings( Map extraParams, InvoiceSettings invoiceSettings, Object onBehalfOf, + PhaseEffectiveAt phaseEffectiveAt, Object transferData) { this.applicationFeePercent = applicationFeePercent; this.automaticTax = automaticTax; @@ -424,6 +972,7 @@ private DefaultSettings( this.extraParams = extraParams; this.invoiceSettings = invoiceSettings; this.onBehalfOf = onBehalfOf; + this.phaseEffectiveAt = phaseEffectiveAt; this.transferData = transferData; } @@ -452,6 +1001,8 @@ public static class Builder { private Object onBehalfOf; + private PhaseEffectiveAt phaseEffectiveAt; + private Object transferData; /** Finalize and obtain parameter instance from this builder. */ @@ -467,6 +1018,7 @@ public SubscriptionScheduleUpdateParams.DefaultSettings build() { this.extraParams, this.invoiceSettings, this.onBehalfOf, + this.phaseEffectiveAt, this.transferData); } @@ -626,6 +1178,20 @@ public Builder setOnBehalfOf(EmptyParam onBehalfOf) { return this; } + /** + * Configures how the subscription schedule handles billing for phase transitions. Possible + * values are {@code phase_start} (default) or {@code billing_period_start}. {@code + * phase_start} bills based on the current state of the subscription, ignoring changes + * scheduled in future phases. {@code billing_period_start} bills predictively for upcoming + * phase transitions within the current billing cycle, including pricing changes and service + * period adjustments that will occur before the next invoice. + */ + public Builder setPhaseEffectiveAt( + SubscriptionScheduleUpdateParams.DefaultSettings.PhaseEffectiveAt phaseEffectiveAt) { + this.phaseEffectiveAt = phaseEffectiveAt; + return this; + } + /** * The data with which to automatically create a Transfer for each of the associated * subscription's invoices. @@ -1357,6 +1923,21 @@ public enum CollectionMethod implements ApiRequestParams.EnumParam { this.value = value; } } + + public enum PhaseEffectiveAt implements ApiRequestParams.EnumParam { + @SerializedName("billing_period_start") + BILLING_PERIOD_START("billing_period_start"), + + @SerializedName("phase_start") + PHASE_START("phase_start"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + PhaseEffectiveAt(String value) { + this.value = value; + } + } } @Getter diff --git a/src/main/java/com/stripe/param/issuing/ProgramCreateParams.java b/src/main/java/com/stripe/param/issuing/ProgramCreateParams.java new file mode 100644 index 00000000000..f021954d9f6 --- /dev/null +++ b/src/main/java/com/stripe/param/issuing/ProgramCreateParams.java @@ -0,0 +1,133 @@ +// File generated from our OpenAPI spec +package com.stripe.param.issuing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +@Getter +@EqualsAndHashCode(callSuper = false) +public class ProgramCreateParams extends ApiRequestParams { + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** If true, makes the specified program the default for the given account. */ + @SerializedName("is_default") + Boolean isDefault; + + /** Required. The program to use as the parent for the new program to create. */ + @SerializedName("platform_program") + String platformProgram; + + private ProgramCreateParams( + List expand, + Map extraParams, + Boolean isDefault, + String platformProgram) { + this.expand = expand; + this.extraParams = extraParams; + this.isDefault = isDefault; + this.platformProgram = platformProgram; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List expand; + + private Map extraParams; + + private Boolean isDefault; + + private String platformProgram; + + /** Finalize and obtain parameter instance from this builder. */ + public ProgramCreateParams build() { + return new ProgramCreateParams( + this.expand, this.extraParams, this.isDefault, this.platformProgram); + } + + /** + * 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 + * ProgramCreateParams#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 + * ProgramCreateParams#expand} for the field documentation. + */ + public Builder addAllExpand(List elements) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.addAll(elements); + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * ProgramCreateParams#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 ProgramCreateParams#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 true, makes the specified program the default for the given account. */ + public Builder setIsDefault(Boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + * Required. The program to use as the parent for the new program to create. + */ + public Builder setPlatformProgram(String platformProgram) { + this.platformProgram = platformProgram; + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/issuing/ProgramListParams.java b/src/main/java/com/stripe/param/issuing/ProgramListParams.java new file mode 100644 index 00000000000..26a259f7c59 --- /dev/null +++ b/src/main/java/com/stripe/param/issuing/ProgramListParams.java @@ -0,0 +1,171 @@ +// File generated from our OpenAPI spec +package com.stripe.param.issuing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +@Getter +@EqualsAndHashCode(callSuper = false) +public class ProgramListParams extends ApiRequestParams { + /** + * A cursor for use in pagination. {@code ending_before} is an object ID that defines your place + * in the list. For instance, if you make a list request and receive 100 objects, starting with + * {@code obj_bar}, your subsequent call can include {@code ending_before=obj_bar} in order to + * fetch the previous page of the list. + */ + @SerializedName("ending_before") + String endingBefore; + + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * A limit on the number of objects to be returned. Limit can range between 1 and 100, and the + * default is 10. + */ + @SerializedName("limit") + Long limit; + + /** + * A cursor for use in pagination. {@code starting_after} is an object ID that defines your place + * in the list. For instance, if you make a list request and receive 100 objects, ending with + * {@code obj_foo}, your subsequent call can include {@code starting_after=obj_foo} in order to + * fetch the next page of the list. + */ + @SerializedName("starting_after") + String startingAfter; + + private ProgramListParams( + String endingBefore, + List expand, + Map extraParams, + Long limit, + String startingAfter) { + this.endingBefore = endingBefore; + this.expand = expand; + this.extraParams = extraParams; + this.limit = limit; + this.startingAfter = startingAfter; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String endingBefore; + + private List expand; + + private Map extraParams; + + private Long limit; + + private String startingAfter; + + /** Finalize and obtain parameter instance from this builder. */ + public ProgramListParams build() { + return new ProgramListParams( + this.endingBefore, this.expand, this.extraParams, this.limit, this.startingAfter); + } + + /** + * A cursor for use in pagination. {@code ending_before} is an object ID that defines your place + * in the list. For instance, if you make a list request and receive 100 objects, starting with + * {@code obj_bar}, your subsequent call can include {@code ending_before=obj_bar} in order to + * fetch the previous page of the list. + */ + public Builder setEndingBefore(String endingBefore) { + this.endingBefore = endingBefore; + return this; + } + + /** + * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * ProgramListParams#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 + * ProgramListParams#expand} for the field documentation. + */ + public Builder addAllExpand(List elements) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.addAll(elements); + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * ProgramListParams#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 ProgramListParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * A limit on the number of objects to be returned. Limit can range between 1 and 100, and the + * default is 10. + */ + public Builder setLimit(Long limit) { + this.limit = limit; + return this; + } + + /** + * A cursor for use in pagination. {@code starting_after} is an object ID that defines your + * place in the list. For instance, if you make a list request and receive 100 objects, ending + * with {@code obj_foo}, your subsequent call can include {@code starting_after=obj_foo} in + * order to fetch the next page of the list. + */ + public Builder setStartingAfter(String startingAfter) { + this.startingAfter = startingAfter; + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/issuing/ProgramRetrieveParams.java b/src/main/java/com/stripe/param/issuing/ProgramRetrieveParams.java new file mode 100644 index 00000000000..4ebf9028b4b --- /dev/null +++ b/src/main/java/com/stripe/param/issuing/ProgramRetrieveParams.java @@ -0,0 +1,100 @@ +// File generated from our OpenAPI spec +package com.stripe.param.issuing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +@Getter +@EqualsAndHashCode(callSuper = false) +public class ProgramRetrieveParams extends ApiRequestParams { + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + private ProgramRetrieveParams(List expand, Map extraParams) { + this.expand = expand; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List expand; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public ProgramRetrieveParams build() { + return new ProgramRetrieveParams(this.expand, this.extraParams); + } + + /** + * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and + * subsequent calls adds additional elements to the original list. See {@link + * ProgramRetrieveParams#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 + * ProgramRetrieveParams#expand} for the field documentation. + */ + public Builder addAllExpand(List elements) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.addAll(elements); + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * ProgramRetrieveParams#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 ProgramRetrieveParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } +} diff --git a/src/main/java/com/stripe/param/issuing/ProgramUpdateParams.java b/src/main/java/com/stripe/param/issuing/ProgramUpdateParams.java new file mode 100644 index 00000000000..02fa170111e --- /dev/null +++ b/src/main/java/com/stripe/param/issuing/ProgramUpdateParams.java @@ -0,0 +1,177 @@ +// File generated from our OpenAPI spec +package com.stripe.param.issuing; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import com.stripe.param.common.EmptyParam; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +@Getter +@EqualsAndHashCode(callSuper = false) +public class ProgramUpdateParams extends ApiRequestParams { + /** Specifies which fields in the response should be expanded. */ + @SerializedName("expand") + List expand; + + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** If true, makes the specified program the default. */ + @SerializedName("is_default") + Boolean isDefault; + + /** + * Set of key-value pairs that you can attach + * to an object. This can be useful for storing additional information about the object in a + * structured format. Individual keys can be unset by posting an empty value to them. All keys can + * be unset by posting an empty value to {@code metadata}. + */ + @SerializedName("metadata") + Object metadata; + + private ProgramUpdateParams( + List expand, Map extraParams, Boolean isDefault, Object metadata) { + this.expand = expand; + this.extraParams = extraParams; + this.isDefault = isDefault; + this.metadata = metadata; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private List expand; + + private Map extraParams; + + private Boolean isDefault; + + private Object metadata; + + /** Finalize and obtain parameter instance from this builder. */ + public ProgramUpdateParams build() { + return new ProgramUpdateParams(this.expand, this.extraParams, this.isDefault, this.metadata); + } + + /** + * 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 + * ProgramUpdateParams#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 + * ProgramUpdateParams#expand} for the field documentation. + */ + public Builder addAllExpand(List elements) { + if (this.expand == null) { + this.expand = new ArrayList<>(); + } + this.expand.addAll(elements); + return this; + } + + /** + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` + * call, and subsequent calls add additional key/value pairs to the original map. See {@link + * ProgramUpdateParams#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 ProgramUpdateParams#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 true, makes the specified program the default. */ + public Builder setIsDefault(Boolean isDefault) { + this.isDefault = isDefault; + 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 + * ProgramUpdateParams#metadata} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder putMetadata(String key, String value) { + if (this.metadata == null || this.metadata instanceof EmptyParam) { + this.metadata = new HashMap(); + } + ((Map) this.metadata).put(key, value); + return this; + } + + /** + * Add all map key/value pairs to `metadata` map. A map is initialized for the first + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. + * See {@link ProgramUpdateParams#metadata} for the field documentation. + */ + @SuppressWarnings("unchecked") + public Builder putAllMetadata(Map map) { + if (this.metadata == null || this.metadata instanceof EmptyParam) { + this.metadata = new HashMap(); + } + ((Map) this.metadata).putAll(map); + return this; + } + + /** + * 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}. + */ + public Builder setMetadata(EmptyParam metadata) { + this.metadata = metadata; + return this; + } + + /** + * 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}. + */ + public Builder setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + } +} diff --git a/src/main/java/com/stripe/service/IssuingService.java b/src/main/java/com/stripe/service/IssuingService.java index 14d9786dccf..4b244204485 100644 --- a/src/main/java/com/stripe/service/IssuingService.java +++ b/src/main/java/com/stripe/service/IssuingService.java @@ -45,6 +45,10 @@ public com.stripe.service.issuing.PhysicalBundleService physicalBundles() { return new com.stripe.service.issuing.PhysicalBundleService(this.getResponseGetter()); } + public com.stripe.service.issuing.ProgramService programs() { + return new com.stripe.service.issuing.ProgramService(this.getResponseGetter()); + } + public com.stripe.service.issuing.TokenService tokens() { return new com.stripe.service.issuing.TokenService(this.getResponseGetter()); } diff --git a/src/main/java/com/stripe/service/issuing/ProgramService.java b/src/main/java/com/stripe/service/issuing/ProgramService.java new file mode 100644 index 00000000000..28fec89dae6 --- /dev/null +++ b/src/main/java/com/stripe/service/issuing/ProgramService.java @@ -0,0 +1,116 @@ +// File generated from our OpenAPI spec +package com.stripe.service.issuing; + +import com.google.gson.reflect.TypeToken; +import com.stripe.exception.StripeException; +import com.stripe.model.StripeCollection; +import com.stripe.model.issuing.Program; +import com.stripe.net.ApiRequest; +import com.stripe.net.ApiRequestParams; +import com.stripe.net.ApiResource; +import com.stripe.net.ApiService; +import com.stripe.net.BaseAddress; +import com.stripe.net.RequestOptions; +import com.stripe.net.StripeResponseGetter; +import com.stripe.param.issuing.ProgramCreateParams; +import com.stripe.param.issuing.ProgramListParams; +import com.stripe.param.issuing.ProgramRetrieveParams; +import com.stripe.param.issuing.ProgramUpdateParams; + +public final class ProgramService extends ApiService { + public ProgramService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + /** List all of the programs the given Issuing user has access to. */ + public StripeCollection list(ProgramListParams params) throws StripeException { + return list(params, (RequestOptions) null); + } + /** List all of the programs the given Issuing user has access to. */ + public StripeCollection list(RequestOptions options) throws StripeException { + return list((ProgramListParams) null, options); + } + /** List all of the programs the given Issuing user has access to. */ + public StripeCollection list() throws StripeException { + return list((ProgramListParams) null, (RequestOptions) null); + } + /** List all of the programs the given Issuing user has access to. */ + public StripeCollection list(ProgramListParams params, RequestOptions options) + throws StripeException { + String path = "/v1/issuing/programs"; + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, new TypeToken>() {}.getType()); + } + /** Create a {@code Program} object. */ + public Program create(ProgramCreateParams params) throws StripeException { + return create(params, (RequestOptions) null); + } + /** Create a {@code Program} object. */ + public Program create(ProgramCreateParams params, RequestOptions options) throws StripeException { + String path = "/v1/issuing/programs"; + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, Program.class); + } + /** Retrieves the program specified by the given id. */ + public Program retrieve(String program, ProgramRetrieveParams params) throws StripeException { + return retrieve(program, params, (RequestOptions) null); + } + /** Retrieves the program specified by the given id. */ + public Program retrieve(String program, RequestOptions options) throws StripeException { + return retrieve(program, (ProgramRetrieveParams) null, options); + } + /** Retrieves the program specified by the given id. */ + public Program retrieve(String program) throws StripeException { + return retrieve(program, (ProgramRetrieveParams) null, (RequestOptions) null); + } + /** Retrieves the program specified by the given id. */ + public Program retrieve(String program, ProgramRetrieveParams params, RequestOptions options) + throws StripeException { + String path = String.format("/v1/issuing/programs/%s", ApiResource.urlEncodeId(program)); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.GET, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, Program.class); + } + /** Updates a {@code Program} object. */ + public Program update(String program, ProgramUpdateParams params) throws StripeException { + return update(program, params, (RequestOptions) null); + } + /** Updates a {@code Program} object. */ + public Program update(String program, RequestOptions options) throws StripeException { + return update(program, (ProgramUpdateParams) null, options); + } + /** Updates a {@code Program} object. */ + public Program update(String program) throws StripeException { + return update(program, (ProgramUpdateParams) null, (RequestOptions) null); + } + /** Updates a {@code Program} object. */ + public Program update(String program, ProgramUpdateParams params, RequestOptions options) + throws StripeException { + String path = String.format("/v1/issuing/programs/%s", ApiResource.urlEncodeId(program)); + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, Program.class); + } +}