diff --git a/CHANGELOG.md b/CHANGELOG.md index 189ca6459be..8d95c5a138f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 31.2.0 - 2026-01-16 +* [#2144](https://github.com/stripe/stripe-java/pull/2144) Update generated code + * Add support for event notifications `V2CoreAccountClosedEvent`, `V2CoreAccountCreatedEvent`, `V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEvent`, `V2CoreAccountIncludingConfigurationCustomerUpdatedEvent`, `V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEvent`, `V2CoreAccountIncludingConfigurationMerchantUpdatedEvent`, `V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEvent`, `V2CoreAccountIncludingConfigurationRecipientUpdatedEvent`, `V2CoreAccountIncludingDefaultsUpdatedEvent`, `V2CoreAccountIncludingFutureRequirementsUpdatedEvent`, `V2CoreAccountIncludingIdentityUpdatedEvent`, `V2CoreAccountIncludingRequirementsUpdatedEvent`, and `V2CoreAccountUpdatedEvent` with related object `v2.core.Account` + * Add support for event notification `V2CoreAccountLinkReturnedEvent` + * Add support for event notifications `V2CoreAccountPersonCreatedEvent`, `V2CoreAccountPersonDeletedEvent`, and `V2CoreAccountPersonUpdatedEvent` with related object `v2.core.AccountPerson` + ## 31.2.0-alpha.3 - 2026-01-14 * [#2143](https://github.com/stripe/stripe-java/pull/2143) Update generated code for private-preview * Add support for `riskDetails` on `delegatedcheckout.RequestedSession` diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index f95a559817a..81e38dd3bef 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -4ec19847e2d6cb16e17bd2ad2aee2bf48d86013c \ No newline at end of file +c250368ba89214c80bc8de3e4fc5d2094c5502cc \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 5e8e56a7f85..4c7a9ad2bfe 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2151 \ No newline at end of file +v2153 \ No newline at end of file diff --git a/src/main/java/com/stripe/model/Subscription.java b/src/main/java/com/stripe/model/Subscription.java index 3f72ba63f1e..8ff6648628c 100644 --- a/src/main/java/com/stripe/model/Subscription.java +++ b/src/main/java/com/stripe/model/Subscription.java @@ -15,7 +15,6 @@ import com.stripe.param.SubscriptionCreateParams; import com.stripe.param.SubscriptionListParams; import com.stripe.param.SubscriptionMigrateParams; -import com.stripe.param.SubscriptionPauseParams; import com.stripe.param.SubscriptionResumeParams; import com.stripe.param.SubscriptionRetrieveParams; import com.stripe.param.SubscriptionSearchParams; @@ -968,58 +967,6 @@ public Subscription migrate(SubscriptionMigrateParams params, RequestOptions opt return getResponseGetter().request(request, Subscription.class); } - /** - * Pauses a subscription by transitioning it to the paused status. A paused subscription does not - * generate invoices and will not advance to new billing periods. The subscription can be resumed - * later using the resume endpoint. Cannot pause subscriptions with attached schedules. - */ - public Subscription pause(Map params) throws StripeException { - return pause(params, (RequestOptions) null); - } - - /** - * Pauses a subscription by transitioning it to the paused status. A paused subscription does not - * generate invoices and will not advance to new billing periods. The subscription can be resumed - * later using the resume endpoint. Cannot pause subscriptions with attached schedules. - */ - public Subscription pause(Map params, RequestOptions options) - throws StripeException { - String path = - String.format("/v1/subscriptions/%s/pause", ApiResource.urlEncodeId(this.getId())); - ApiRequest request = - new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options); - return getResponseGetter().request(request, Subscription.class); - } - - /** - * Pauses a subscription by transitioning it to the paused status. A paused subscription does not - * generate invoices and will not advance to new billing periods. The subscription can be resumed - * later using the resume endpoint. Cannot pause subscriptions with attached schedules. - */ - public Subscription pause(SubscriptionPauseParams params) throws StripeException { - return pause(params, (RequestOptions) null); - } - - /** - * Pauses a subscription by transitioning it to the paused status. A paused subscription does not - * generate invoices and will not advance to new billing periods. The subscription can be resumed - * later using the resume endpoint. Cannot pause subscriptions with attached schedules. - */ - public Subscription pause(SubscriptionPauseParams params, RequestOptions options) - throws StripeException { - String path = - String.format("/v1/subscriptions/%s/pause", 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, Subscription.class); - } - /** * Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor * and creating prorations. If a resumption invoice is generated, it must be paid or marked diff --git a/src/main/java/com/stripe/param/SubscriptionPauseParams.java b/src/main/java/com/stripe/param/SubscriptionPauseParams.java deleted file mode 100644 index 67fbc645c89..00000000000 --- a/src/main/java/com/stripe/param/SubscriptionPauseParams.java +++ /dev/null @@ -1,274 +0,0 @@ -// File generated from our OpenAPI spec -package com.stripe.param; - -import com.google.gson.annotations.SerializedName; -import com.stripe.net.ApiRequestParams; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import lombok.EqualsAndHashCode; -import lombok.Getter; - -@Getter -@EqualsAndHashCode(callSuper = false) -public class SubscriptionPauseParams extends ApiRequestParams { - /** Controls what to bill for when pausing the subscription. */ - @SerializedName("bill_for") - BillFor billFor; - - /** 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; - - /** - * Determines how to handle debits and credits when pausing. The default is {@code - * pending_invoice_item}. - */ - @SerializedName("invoicing_behavior") - InvoicingBehavior invoicingBehavior; - - /** Required. The type of pause to apply. */ - @SerializedName("type") - Type type; - - private SubscriptionPauseParams( - BillFor billFor, - List expand, - Map extraParams, - InvoicingBehavior invoicingBehavior, - Type type) { - this.billFor = billFor; - this.expand = expand; - this.extraParams = extraParams; - this.invoicingBehavior = invoicingBehavior; - this.type = type; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private BillFor billFor; - - private List expand; - - private Map extraParams; - - private InvoicingBehavior invoicingBehavior; - - private Type type; - - /** Finalize and obtain parameter instance from this builder. */ - public SubscriptionPauseParams build() { - return new SubscriptionPauseParams( - this.billFor, this.expand, this.extraParams, this.invoicingBehavior, this.type); - } - - /** Controls what to bill for when pausing the subscription. */ - public Builder setBillFor(SubscriptionPauseParams.BillFor billFor) { - this.billFor = billFor; - 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 - * SubscriptionPauseParams#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 - * SubscriptionPauseParams#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 - * SubscriptionPauseParams#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 SubscriptionPauseParams#extraParams} for the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - - /** - * Determines how to handle debits and credits when pausing. The default is {@code - * pending_invoice_item}. - */ - public Builder setInvoicingBehavior( - SubscriptionPauseParams.InvoicingBehavior invoicingBehavior) { - this.invoicingBehavior = invoicingBehavior; - return this; - } - - /** Required. The type of pause to apply. */ - public Builder setType(SubscriptionPauseParams.Type type) { - this.type = type; - return this; - } - } - - @Getter - @EqualsAndHashCode(callSuper = false) - public static class BillFor { - /** - * 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; - - /** - * Controls whether to debit for accrued metered usage in the current billing period. The - * default is {@code false}. - */ - @SerializedName("outstanding_usage") - Boolean outstandingUsage; - - /** - * Controls whether to credit for licensed items in the current billing period. The default is - * {@code false}. - */ - @SerializedName("unused_time") - Boolean unusedTime; - - private BillFor(Map extraParams, Boolean outstandingUsage, Boolean unusedTime) { - this.extraParams = extraParams; - this.outstandingUsage = outstandingUsage; - this.unusedTime = unusedTime; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Map extraParams; - - private Boolean outstandingUsage; - - private Boolean unusedTime; - - /** Finalize and obtain parameter instance from this builder. */ - public SubscriptionPauseParams.BillFor build() { - return new SubscriptionPauseParams.BillFor( - this.extraParams, this.outstandingUsage, this.unusedTime); - } - - /** - * 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 - * SubscriptionPauseParams.BillFor#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 SubscriptionPauseParams.BillFor#extraParams} for the field documentation. - */ - public Builder putAllExtraParam(Map map) { - if (this.extraParams == null) { - this.extraParams = new HashMap<>(); - } - this.extraParams.putAll(map); - return this; - } - - /** - * Controls whether to debit for accrued metered usage in the current billing period. The - * default is {@code false}. - */ - public Builder setOutstandingUsage(Boolean outstandingUsage) { - this.outstandingUsage = outstandingUsage; - return this; - } - - /** - * Controls whether to credit for licensed items in the current billing period. The default is - * {@code false}. - */ - public Builder setUnusedTime(Boolean unusedTime) { - this.unusedTime = unusedTime; - return this; - } - } - } - - public enum InvoicingBehavior implements ApiRequestParams.EnumParam { - @SerializedName("invoice") - INVOICE("invoice"), - - @SerializedName("pending_invoice_item") - PENDING_INVOICE_ITEM("pending_invoice_item"); - - @Getter(onMethod_ = {@Override}) - private final String value; - - InvoicingBehavior(String value) { - this.value = value; - } - } - - public enum Type implements ApiRequestParams.EnumParam { - @SerializedName("subscription") - SUBSCRIPTION("subscription"); - - @Getter(onMethod_ = {@Override}) - private final String value; - - Type(String value) { - this.value = value; - } - } -} diff --git a/src/main/java/com/stripe/service/SubscriptionService.java b/src/main/java/com/stripe/service/SubscriptionService.java index 1613c3ae1a4..8ddcf9cc3a9 100644 --- a/src/main/java/com/stripe/service/SubscriptionService.java +++ b/src/main/java/com/stripe/service/SubscriptionService.java @@ -19,7 +19,6 @@ import com.stripe.param.SubscriptionCreateParams; import com.stripe.param.SubscriptionListParams; import com.stripe.param.SubscriptionMigrateParams; -import com.stripe.param.SubscriptionPauseParams; import com.stripe.param.SubscriptionResumeParams; import com.stripe.param.SubscriptionRetrieveParams; import com.stripe.param.SubscriptionSearchParams; @@ -582,34 +581,6 @@ public Subscription migrate( options); return this.request(request, Subscription.class); } - /** - * Pauses a subscription by transitioning it to the paused status. A paused subscription does not - * generate invoices and will not advance to new billing periods. The subscription can be resumed - * later using the resume endpoint. Cannot pause subscriptions with attached schedules. - */ - public Subscription pause(String subscription, SubscriptionPauseParams params) - throws StripeException { - return pause(subscription, params, (RequestOptions) null); - } - /** - * Pauses a subscription by transitioning it to the paused status. A paused subscription does not - * generate invoices and will not advance to new billing periods. The subscription can be resumed - * later using the resume endpoint. Cannot pause subscriptions with attached schedules. - */ - public Subscription pause( - String subscription, SubscriptionPauseParams params, RequestOptions options) - throws StripeException { - String path = - String.format("/v1/subscriptions/%s/pause", ApiResource.urlEncodeId(subscription)); - ApiRequest request = - new ApiRequest( - BaseAddress.API, - ApiResource.RequestMethod.POST, - path, - ApiRequestParams.paramsToMap(params), - options); - return this.request(request, Subscription.class); - } /** * Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor * and creating prorations. If a resumption invoice is generated, it must be paid or marked