diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index 1b3017c055fc..46dccda447e4 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -85839f80afcaccd622aa30bf53a414cdffbd57bc \ No newline at end of file +7b0e14a8a4b606fa2cc641579a18e077e25aaac9 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index dea428aab5c9..d7096ed4ff23 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2369 \ No newline at end of file +v2391 \ No newline at end of file diff --git a/src/main/java/com/stripe/StripeClient.java b/src/main/java/com/stripe/StripeClient.java index c6e814ddd760..7b470d6c41f7 100644 --- a/src/main/java/com/stripe/StripeClient.java +++ b/src/main/java/com/stripe/StripeClient.java @@ -2,6 +2,7 @@ import com.stripe.exception.SignatureVerificationException; import com.stripe.exception.StripeException; +import com.stripe.model.Event; import com.stripe.model.StripeObject; import com.stripe.model.v2.core.EventNotification; import com.stripe.net.*; @@ -115,9 +116,10 @@ public EventNotification parseEventNotification(String payload, String sigHeader } /** - * Returns an StripeEvent instance using the provided JSON payload. Throws a JsonSyntaxException - * if the payload is not valid JSON, and a SignatureVerificationException if the signature - * verification fails for any reason. + * Constructs a thin event + * notification from an incoming webhook after verifying its authenticity. To work with a + * webhook that has already been verified (i.e. one from a cloud provider, an asynchronous queue, + * or during testing), see {@code parseEventNotificationWithoutVerification}. * * @param payload the payload sent by Stripe. * @param sigHeader the contents of the signature header sent by Stripe. @@ -174,6 +176,45 @@ public com.stripe.model.Event constructEvent( return event; } + /** + * Constructs a snapshot + * event from an incoming webhook without first verifying its authenticity. Should be used + * after calling {@code Webhook.Signature.verifyHeader(...)} or with input from a trusted source + * (such as AWS EventBridge, + * or Azure Event Grid + * payload). Or, to verify & construct in a single call, use {@code constructEvent(...)} + * instead. + * + * @param payload the JSON payload: a raw Stripe Event or an AWS EventBridge/Azure Event Grid + * envelope. + * @return the Event instance. + * @throws IllegalArgumentException if the payload is a thin event notification, or if the format + * is not recognized. + */ + public com.stripe.model.Event constructEventWithoutVerification(String payload) { + Event event = Webhook.constructEventWithoutVerification(payload); + event.setResponseGetter(this.getResponseGetter()); + return event; + } + + /** + * Constructs a thin event + * notification from an incoming webhook without first verifying its authenticity. Should be + * used after calling {@code Webhook.Signature.verifyHeader(...)} or with input from a trusted + * source (such as AWS + * EventBridge, or Azure Event + * Grid payload). Or, to verify & parse in a single call, use {@code + * parseEventNotification(...)} instead. + * + * @param payload the JSON payload: a raw Stripe Event, or an AWS EventBridge/Azure Event Grid + * envelope. + * @return the EventNotification instance. + * @throws IllegalArgumentException if the payload format is not recognized. + */ + public EventNotification parseEventNotificationWithoutVerification(String payload) { + return EventNotification.fromJson(Webhook.maybeExtractFromCloudProviderEnvelope(payload), this); + } + // The beginning of the section generated from our OpenAPI spec public com.stripe.service.V1Services v1() { return new com.stripe.service.V1Services(this.getResponseGetter()); diff --git a/src/main/java/com/stripe/StripeEventNotificationHandler.java b/src/main/java/com/stripe/StripeEventNotificationHandler.java index 7ec7c78e0832..96193719f948 100644 --- a/src/main/java/com/stripe/StripeEventNotificationHandler.java +++ b/src/main/java/com/stripe/StripeEventNotificationHandler.java @@ -16,9 +16,17 @@ import com.stripe.events.V1ApplicationFeeRefundUpdatedEventNotification; import com.stripe.events.V1ApplicationFeeRefundedEventNotification; import com.stripe.events.V1BalanceAvailableEventNotification; +import com.stripe.events.V1BalanceSettingsUpdatedEventNotification; import com.stripe.events.V1BillingAlertTriggeredEventNotification; +import com.stripe.events.V1BillingCreditBalanceTransactionCreatedEventNotification; +import com.stripe.events.V1BillingCreditGrantCreatedEventNotification; +import com.stripe.events.V1BillingCreditGrantUpdatedEventNotification; +import com.stripe.events.V1BillingMeterCreatedEventNotification; +import com.stripe.events.V1BillingMeterDeactivatedEventNotification; import com.stripe.events.V1BillingMeterErrorReportTriggeredEventNotification; import com.stripe.events.V1BillingMeterNoMeterFoundEventNotification; +import com.stripe.events.V1BillingMeterReactivatedEventNotification; +import com.stripe.events.V1BillingMeterUpdatedEventNotification; import com.stripe.events.V1BillingPortalConfigurationCreatedEventNotification; import com.stripe.events.V1BillingPortalConfigurationUpdatedEventNotification; import com.stripe.events.V1BillingPortalSessionCreatedEventNotification; @@ -71,13 +79,18 @@ import com.stripe.events.V1CustomerUpdatedEventNotification; import com.stripe.events.V1EntitlementsActiveEntitlementSummaryUpdatedEventNotification; import com.stripe.events.V1FileCreatedEventNotification; +import com.stripe.events.V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification; import com.stripe.events.V1FinancialConnectionsAccountCreatedEventNotification; import com.stripe.events.V1FinancialConnectionsAccountDeactivatedEventNotification; import com.stripe.events.V1FinancialConnectionsAccountDisconnectedEventNotification; +import com.stripe.events.V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification; import com.stripe.events.V1FinancialConnectionsAccountReactivatedEventNotification; import com.stripe.events.V1FinancialConnectionsAccountRefreshedBalanceEventNotification; import com.stripe.events.V1FinancialConnectionsAccountRefreshedOwnershipEventNotification; import com.stripe.events.V1FinancialConnectionsAccountRefreshedTransactionsEventNotification; +import com.stripe.events.V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification; +import com.stripe.events.V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification; +import com.stripe.events.V1FinancialConnectionsAccountUpcomingDeactivationEventNotification; import com.stripe.events.V1IdentityVerificationSessionCanceledEventNotification; import com.stripe.events.V1IdentityVerificationSessionCreatedEventNotification; import com.stripe.events.V1IdentityVerificationSessionProcessingEventNotification; @@ -93,6 +106,7 @@ import com.stripe.events.V1InvoiceOverpaidEventNotification; import com.stripe.events.V1InvoicePaidEventNotification; import com.stripe.events.V1InvoicePaymentActionRequiredEventNotification; +import com.stripe.events.V1InvoicePaymentAttemptRequiredEventNotification; import com.stripe.events.V1InvoicePaymentFailedEventNotification; import com.stripe.events.V1InvoicePaymentPaidEventNotification; import com.stripe.events.V1InvoicePaymentSucceededEventNotification; @@ -616,12 +630,48 @@ public StripeEventNotificationHandler onV1BalanceAvailable( return this; } + public StripeEventNotificationHandler onV1BalanceSettingsUpdated( + Callback callback) { + this.register("v1.balance_settings.updated", callback); + return this; + } + public StripeEventNotificationHandler onV1BillingAlertTriggered( Callback callback) { this.register("v1.billing.alert.triggered", callback); return this; } + public StripeEventNotificationHandler onV1BillingCreditBalanceTransactionCreated( + Callback callback) { + this.register("v1.billing.credit_balance_transaction.created", callback); + return this; + } + + public StripeEventNotificationHandler onV1BillingCreditGrantCreated( + Callback callback) { + this.register("v1.billing.credit_grant.created", callback); + return this; + } + + public StripeEventNotificationHandler onV1BillingCreditGrantUpdated( + Callback callback) { + this.register("v1.billing.credit_grant.updated", callback); + return this; + } + + public StripeEventNotificationHandler onV1BillingMeterCreated( + Callback callback) { + this.register("v1.billing.meter.created", callback); + return this; + } + + public StripeEventNotificationHandler onV1BillingMeterDeactivated( + Callback callback) { + this.register("v1.billing.meter.deactivated", callback); + return this; + } + public StripeEventNotificationHandler onV1BillingMeterErrorReportTriggered( Callback callback) { this.register("v1.billing.meter.error_report_triggered", callback); @@ -634,6 +684,18 @@ public StripeEventNotificationHandler onV1BillingMeterNoMeterFound( return this; } + public StripeEventNotificationHandler onV1BillingMeterReactivated( + Callback callback) { + this.register("v1.billing.meter.reactivated", callback); + return this; + } + + public StripeEventNotificationHandler onV1BillingMeterUpdated( + Callback callback) { + this.register("v1.billing.meter.updated", callback); + return this; + } + public StripeEventNotificationHandler onV1BillingPortalConfigurationCreated( Callback callback) { this.register("v1.billing_portal.configuration.created", callback); @@ -946,6 +1008,12 @@ public StripeEventNotificationHandler onV1FileCreated( return this; } + public StripeEventNotificationHandler onV1FinancialConnectionsAccountAccountNumbersUpdated( + Callback callback) { + this.register("v1.financial_connections.account.account_numbers_updated", callback); + return this; + } + public StripeEventNotificationHandler onV1FinancialConnectionsAccountCreated( Callback callback) { this.register("v1.financial_connections.account.created", callback); @@ -964,6 +1032,14 @@ public StripeEventNotificationHandler onV1FinancialConnectionsAccountDisconnecte return this; } + public StripeEventNotificationHandler + onV1FinancialConnectionsAccountExpectedDeactivationDateUpdated( + Callback + callback) { + this.register("v1.financial_connections.account.expected_deactivation_date_updated", callback); + return this; + } + public StripeEventNotificationHandler onV1FinancialConnectionsAccountReactivated( Callback callback) { this.register("v1.financial_connections.account.reactivated", callback); @@ -988,6 +1064,28 @@ public StripeEventNotificationHandler onV1FinancialConnectionsAccountRefreshedTr return this; } + public StripeEventNotificationHandler + onV1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdated( + Callback + callback) { + this.register( + "v1.financial_connections.account.supported_payment_method_types_updated", callback); + return this; + } + + public StripeEventNotificationHandler onV1FinancialConnectionsAccountUpcomingAccountNumberExpiry( + Callback + callback) { + this.register("v1.financial_connections.account.upcoming_account_number_expiry", callback); + return this; + } + + public StripeEventNotificationHandler onV1FinancialConnectionsAccountUpcomingDeactivation( + Callback callback) { + this.register("v1.financial_connections.account.upcoming_deactivation", callback); + return this; + } + public StripeEventNotificationHandler onV1IdentityVerificationSessionCanceled( Callback callback) { this.register("v1.identity.verification_session.canceled", callback); @@ -1078,6 +1176,12 @@ public StripeEventNotificationHandler onV1InvoicePaymentActionRequired( return this; } + public StripeEventNotificationHandler onV1InvoicePaymentAttemptRequired( + Callback callback) { + this.register("v1.invoice.payment_attempt_required", callback); + return this; + } + public StripeEventNotificationHandler onV1InvoicePaymentFailed( Callback callback) { this.register("v1.invoice.payment_failed", callback); diff --git a/src/main/java/com/stripe/events/V1BalanceSettingsUpdatedEvent.java b/src/main/java/com/stripe/events/V1BalanceSettingsUpdatedEvent.java new file mode 100644 index 000000000000..d5b3f7ed3bde --- /dev/null +++ b/src/main/java/com/stripe/events/V1BalanceSettingsUpdatedEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.BalanceSettings; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1BalanceSettingsUpdatedEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public BalanceSettings fetchRelatedObject() throws StripeException { + return (BalanceSettings) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1BalanceSettingsUpdatedEventNotification.java b/src/main/java/com/stripe/events/V1BalanceSettingsUpdatedEventNotification.java new file mode 100644 index 000000000000..757a504f8f07 --- /dev/null +++ b/src/main/java/com/stripe/events/V1BalanceSettingsUpdatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.BalanceSettings; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1BalanceSettingsUpdatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public BalanceSettings fetchRelatedObject() throws StripeException { + return (BalanceSettings) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1BalanceSettingsUpdatedEvent fetchEvent() throws StripeException { + return (V1BalanceSettingsUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingCreditBalanceTransactionCreatedEvent.java b/src/main/java/com/stripe/events/V1BillingCreditBalanceTransactionCreatedEvent.java new file mode 100644 index 000000000000..a65e478ef877 --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingCreditBalanceTransactionCreatedEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.CreditBalanceTransaction; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1BillingCreditBalanceTransactionCreatedEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public CreditBalanceTransaction fetchRelatedObject() throws StripeException { + return (CreditBalanceTransaction) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingCreditBalanceTransactionCreatedEventNotification.java b/src/main/java/com/stripe/events/V1BillingCreditBalanceTransactionCreatedEventNotification.java new file mode 100644 index 000000000000..55a304acfd7f --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingCreditBalanceTransactionCreatedEventNotification.java @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.CreditBalanceTransaction; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1BillingCreditBalanceTransactionCreatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public CreditBalanceTransaction fetchRelatedObject() throws StripeException { + return (CreditBalanceTransaction) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1BillingCreditBalanceTransactionCreatedEvent fetchEvent() throws StripeException { + return (V1BillingCreditBalanceTransactionCreatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingCreditGrantCreatedEvent.java b/src/main/java/com/stripe/events/V1BillingCreditGrantCreatedEvent.java new file mode 100644 index 000000000000..78322dda86d5 --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingCreditGrantCreatedEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.CreditGrant; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1BillingCreditGrantCreatedEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public CreditGrant fetchRelatedObject() throws StripeException { + return (CreditGrant) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingCreditGrantCreatedEventNotification.java b/src/main/java/com/stripe/events/V1BillingCreditGrantCreatedEventNotification.java new file mode 100644 index 000000000000..4f788cdfedb3 --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingCreditGrantCreatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.CreditGrant; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1BillingCreditGrantCreatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public CreditGrant fetchRelatedObject() throws StripeException { + return (CreditGrant) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1BillingCreditGrantCreatedEvent fetchEvent() throws StripeException { + return (V1BillingCreditGrantCreatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingCreditGrantUpdatedEvent.java b/src/main/java/com/stripe/events/V1BillingCreditGrantUpdatedEvent.java new file mode 100644 index 000000000000..592b154bd482 --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingCreditGrantUpdatedEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.CreditGrant; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1BillingCreditGrantUpdatedEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public CreditGrant fetchRelatedObject() throws StripeException { + return (CreditGrant) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingCreditGrantUpdatedEventNotification.java b/src/main/java/com/stripe/events/V1BillingCreditGrantUpdatedEventNotification.java new file mode 100644 index 000000000000..f10414eddc9b --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingCreditGrantUpdatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.CreditGrant; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1BillingCreditGrantUpdatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public CreditGrant fetchRelatedObject() throws StripeException { + return (CreditGrant) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1BillingCreditGrantUpdatedEvent fetchEvent() throws StripeException { + return (V1BillingCreditGrantUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingMeterCreatedEvent.java b/src/main/java/com/stripe/events/V1BillingMeterCreatedEvent.java new file mode 100644 index 000000000000..fd182a11d323 --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingMeterCreatedEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.Meter; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1BillingMeterCreatedEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Meter fetchRelatedObject() throws StripeException { + return (Meter) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingMeterCreatedEventNotification.java b/src/main/java/com/stripe/events/V1BillingMeterCreatedEventNotification.java new file mode 100644 index 000000000000..3176f7137edb --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingMeterCreatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.Meter; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1BillingMeterCreatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Meter fetchRelatedObject() throws StripeException { + return (Meter) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1BillingMeterCreatedEvent fetchEvent() throws StripeException { + return (V1BillingMeterCreatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingMeterDeactivatedEvent.java b/src/main/java/com/stripe/events/V1BillingMeterDeactivatedEvent.java new file mode 100644 index 000000000000..d1a498b67b8a --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingMeterDeactivatedEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.Meter; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1BillingMeterDeactivatedEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Meter fetchRelatedObject() throws StripeException { + return (Meter) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingMeterDeactivatedEventNotification.java b/src/main/java/com/stripe/events/V1BillingMeterDeactivatedEventNotification.java new file mode 100644 index 000000000000..6d62248b7924 --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingMeterDeactivatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.Meter; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1BillingMeterDeactivatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Meter fetchRelatedObject() throws StripeException { + return (Meter) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1BillingMeterDeactivatedEvent fetchEvent() throws StripeException { + return (V1BillingMeterDeactivatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingMeterReactivatedEvent.java b/src/main/java/com/stripe/events/V1BillingMeterReactivatedEvent.java new file mode 100644 index 000000000000..4206152f28d8 --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingMeterReactivatedEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.Meter; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1BillingMeterReactivatedEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Meter fetchRelatedObject() throws StripeException { + return (Meter) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingMeterReactivatedEventNotification.java b/src/main/java/com/stripe/events/V1BillingMeterReactivatedEventNotification.java new file mode 100644 index 000000000000..646e7467053a --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingMeterReactivatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.Meter; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1BillingMeterReactivatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Meter fetchRelatedObject() throws StripeException { + return (Meter) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1BillingMeterReactivatedEvent fetchEvent() throws StripeException { + return (V1BillingMeterReactivatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingMeterUpdatedEvent.java b/src/main/java/com/stripe/events/V1BillingMeterUpdatedEvent.java new file mode 100644 index 000000000000..357e935bc663 --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingMeterUpdatedEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.Meter; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1BillingMeterUpdatedEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Meter fetchRelatedObject() throws StripeException { + return (Meter) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1BillingMeterUpdatedEventNotification.java b/src/main/java/com/stripe/events/V1BillingMeterUpdatedEventNotification.java new file mode 100644 index 000000000000..c84fe6e9b423 --- /dev/null +++ b/src/main/java/com/stripe/events/V1BillingMeterUpdatedEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.billing.Meter; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1BillingMeterUpdatedEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Meter fetchRelatedObject() throws StripeException { + return (Meter) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1BillingMeterUpdatedEvent fetchEvent() throws StripeException { + return (V1BillingMeterUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1FinancialConnectionsAccountAccountNumbersUpdatedEvent.java b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountAccountNumbersUpdatedEvent.java new file mode 100644 index 000000000000..2e8afc7760d6 --- /dev/null +++ b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountAccountNumbersUpdatedEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.financialconnections.Account; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1FinancialConnectionsAccountAccountNumbersUpdatedEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification.java b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification.java new file mode 100644 index 000000000000..63cb47de4439 --- /dev/null +++ b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification.java @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.financialconnections.Account; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1FinancialConnectionsAccountAccountNumbersUpdatedEvent fetchEvent() + throws StripeException { + return (V1FinancialConnectionsAccountAccountNumbersUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent.java b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent.java new file mode 100644 index 000000000000..314cdda4f440 --- /dev/null +++ b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.financialconnections.Account; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification.java b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification.java new file mode 100644 index 000000000000..12284b9f7b46 --- /dev/null +++ b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification.java @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.financialconnections.Account; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent fetchEvent() + throws StripeException { + return (V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent.java b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent.java new file mode 100644 index 000000000000..fa234037f1a1 --- /dev/null +++ b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent.java @@ -0,0 +1,23 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.financialconnections.Account; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent + extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification.java b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification.java new file mode 100644 index 000000000000..f362a9e7aea5 --- /dev/null +++ b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification.java @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.financialconnections.Account; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent fetchEvent() + throws StripeException { + return (V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent) + super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent.java b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent.java new file mode 100644 index 000000000000..fc466b6ae4ce --- /dev/null +++ b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.financialconnections.Account; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification.java b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification.java new file mode 100644 index 000000000000..0deac5a7c0f9 --- /dev/null +++ b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification.java @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.financialconnections.Account; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent fetchEvent() + throws StripeException { + return (V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1FinancialConnectionsAccountUpcomingDeactivationEvent.java b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountUpcomingDeactivationEvent.java new file mode 100644 index 000000000000..32df99179400 --- /dev/null +++ b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountUpcomingDeactivationEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.financialconnections.Account; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1FinancialConnectionsAccountUpcomingDeactivationEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1FinancialConnectionsAccountUpcomingDeactivationEventNotification.java b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountUpcomingDeactivationEventNotification.java new file mode 100644 index 000000000000..0e54defbbfc0 --- /dev/null +++ b/src/main/java/com/stripe/events/V1FinancialConnectionsAccountUpcomingDeactivationEventNotification.java @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.financialconnections.Account; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1FinancialConnectionsAccountUpcomingDeactivationEventNotification + extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Account fetchRelatedObject() throws StripeException { + return (Account) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1FinancialConnectionsAccountUpcomingDeactivationEvent fetchEvent() + throws StripeException { + return (V1FinancialConnectionsAccountUpcomingDeactivationEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V1InvoicePaymentAttemptRequiredEvent.java b/src/main/java/com/stripe/events/V1InvoicePaymentAttemptRequiredEvent.java new file mode 100644 index 000000000000..b7189f23d15e --- /dev/null +++ b/src/main/java/com/stripe/events/V1InvoicePaymentAttemptRequiredEvent.java @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.Invoice; +import com.stripe.model.v2.core.Event; +import com.stripe.model.v2.core.Event.RelatedObject; +import lombok.Getter; + +@Getter +public final class V1InvoicePaymentAttemptRequiredEvent extends Event { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Invoice fetchRelatedObject() throws StripeException { + return (Invoice) super.fetchRelatedObject(this.relatedObject); + } +} diff --git a/src/main/java/com/stripe/events/V1InvoicePaymentAttemptRequiredEventNotification.java b/src/main/java/com/stripe/events/V1InvoicePaymentAttemptRequiredEventNotification.java new file mode 100644 index 000000000000..39bc4194a96a --- /dev/null +++ b/src/main/java/com/stripe/events/V1InvoicePaymentAttemptRequiredEventNotification.java @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +package com.stripe.events; + +import com.google.gson.annotations.SerializedName; +import com.stripe.exception.StripeException; +import com.stripe.model.Invoice; +import com.stripe.model.v2.core.Event.RelatedObject; +import com.stripe.model.v2.core.EventNotification; +import lombok.Getter; + +@Getter +public final class V1InvoicePaymentAttemptRequiredEventNotification extends EventNotification { + @SerializedName("related_object") + + /** Object containing the reference to API resource relevant to the event. */ + RelatedObject relatedObject; + + /** Retrieves the related object from the API. Make an API request on every call. */ + public Invoice fetchRelatedObject() throws StripeException { + return (Invoice) super.fetchRelatedObject(this.relatedObject); + } + /** Retrieve the corresponding full event from the Stripe API. */ + @Override + public V1InvoicePaymentAttemptRequiredEvent fetchEvent() throws StripeException { + return (V1InvoicePaymentAttemptRequiredEvent) super.fetchEvent(); + } +} diff --git a/src/main/java/com/stripe/events/V2CoreHealthAuthorizationRateDropFiringEvent.java b/src/main/java/com/stripe/events/V2CoreHealthAuthorizationRateDropFiringEvent.java index 8b2b2846776e..50b21a4e12c0 100644 --- a/src/main/java/com/stripe/events/V2CoreHealthAuthorizationRateDropFiringEvent.java +++ b/src/main/java/com/stripe/events/V2CoreHealthAuthorizationRateDropFiringEvent.java @@ -74,13 +74,16 @@ public static final class Impact { BigDecimal previousPercentage; public static final class Dimension { + /** The acquirer dimension. */ + @SerializedName("acquirer") + String acquirer; /** The issuer dimension. */ @SerializedName("issuer") String issuer; /** * The type of the dimension. * - *

Equal to {@code issuer}. + *

One of {@code acquirer}, or {@code issuer}. */ @SerializedName("type") String type; diff --git a/src/main/java/com/stripe/events/V2CoreHealthAuthorizationRateDropResolvedEvent.java b/src/main/java/com/stripe/events/V2CoreHealthAuthorizationRateDropResolvedEvent.java index 1cb21f4728a8..71d2555d2589 100644 --- a/src/main/java/com/stripe/events/V2CoreHealthAuthorizationRateDropResolvedEvent.java +++ b/src/main/java/com/stripe/events/V2CoreHealthAuthorizationRateDropResolvedEvent.java @@ -77,13 +77,16 @@ public static final class Impact { BigDecimal previousPercentage; public static final class Dimension { + /** The acquirer dimension. */ + @SerializedName("acquirer") + String acquirer; /** The issuer dimension. */ @SerializedName("issuer") String issuer; /** * The type of the dimension. * - *

Equal to {@code issuer}. + *

One of {@code acquirer}, or {@code issuer}. */ @SerializedName("type") String type; diff --git a/src/main/java/com/stripe/model/Account.java b/src/main/java/com/stripe/model/Account.java index 70fb83cd864f..26e9c88a48bb 100644 --- a/src/main/java/com/stripe/model/Account.java +++ b/src/main/java/com/stripe/model/Account.java @@ -1530,8 +1530,8 @@ public static class Capabilities extends StripeObject { String sepaDebitPayments; /** - * The status of the Sequra capability of the account, or whether the account can directly - * process Sequra payments. + * The status of the SeQura capability of the account, or whether the account can directly + * process SeQura payments. * *

One of {@code active}, {@code inactive}, or {@code pending}. */ diff --git a/src/main/java/com/stripe/model/Charge.java b/src/main/java/com/stripe/model/Charge.java index f596cd14c5cc..fe49ec6212c1 100644 --- a/src/main/java/com/stripe/model/Charge.java +++ b/src/main/java/com/stripe/model/Charge.java @@ -3748,12 +3748,12 @@ public static class Link extends StripeObject { String country; /** - * The pricing bundle applied to this Link payment at confirmation time. Maps to a bundle in - * your Stripe pricing contract and on Stripe's published pricing page. Omitted if bundle - * lookup failed at confirmation time. + * The funding source group applied to this Link payment at confirmation time. Maps to a + * bundle in your Stripe pricing contract and on Stripe's published pricing page. Omitted if + * group lookup failed at confirmation time. */ - @SerializedName("pricing_group") - String pricingGroup; + @SerializedName("funding_source_group") + String fundingSourceGroup; } /** @@ -4133,7 +4133,7 @@ public static class Pix extends StripeObject { @SerializedName("fingerprint") String fingerprint; - /** ID of the multi use Mandate generated by the PaymentIntent. */ + /** ID of the multi use Mandate generated by the PaymentIntent or SetupIntent. */ @SerializedName("mandate") String mandate; } @@ -4379,7 +4379,7 @@ public static class SepaDebit extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Sequra extends StripeObject { - /** The Sequra transaction ID associated with this payment. */ + /** The SeQura transaction ID associated with this payment. */ @SerializedName("transaction_id") String transactionId; } @@ -4572,7 +4572,7 @@ public static class Tamara extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Twint extends StripeObject { - /** ID of the multi use Mandate generated by the PaymentIntent. */ + /** ID of the multi use Mandate generated by the PaymentIntent or SetupIntent. */ @SerializedName("mandate") String mandate; } diff --git a/src/main/java/com/stripe/model/CustomerSession.java b/src/main/java/com/stripe/model/CustomerSession.java index b97b87338b04..b0baa05d0d75 100644 --- a/src/main/java/com/stripe/model/CustomerSession.java +++ b/src/main/java/com/stripe/model/CustomerSession.java @@ -153,6 +153,10 @@ public static class Components extends StripeObject { @SerializedName("buy_button") BuyButton buyButton; + /** This hash contains whether the customer portal is enabled. */ + @SerializedName("customer_portal") + CustomerPortal customerPortal; + /** This hash contains whether the customer sheet is enabled and the features it supports. */ @SerializedName("customer_sheet") CustomerSheet customerSheet; @@ -186,6 +190,16 @@ public static class BuyButton extends StripeObject { Boolean enabled; } + /** This hash contains whether the customer portal is enabled. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class CustomerPortal extends StripeObject { + /** Whether the customer portal is enabled. */ + @SerializedName("enabled") + Boolean enabled; + } + /** This hash contains whether the customer sheet is enabled and the features it supports. */ @Getter @Setter diff --git a/src/main/java/com/stripe/model/Invoice.java b/src/main/java/com/stripe/model/Invoice.java index 6f7c53b191e5..82cf77abdfde 100644 --- a/src/main/java/com/stripe/model/Invoice.java +++ b/src/main/java/com/stripe/model/Invoice.java @@ -245,6 +245,10 @@ public class Invoice extends ApiResource implements HasId, MetadataStoreAPI Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class CustomerBalance extends StripeObject { + /** The total amount of customer balance applied to this invoice (automatically + manually). */ + @SerializedName("applied_balance") + Long appliedBalance; + + /** The amount of customer balance automatically applied during invoice finalization. */ + @SerializedName("automatically_applied_balance") + Long automaticallyAppliedBalance; + + /** The total amount of customer balance manually applied after finalization. */ + @SerializedName("manually_applied_balance") + Long manuallyAppliedBalance; + } + /** * For more details about CustomerTaxId, please refer to the API Reference. @@ -2594,6 +2619,13 @@ public static class PaymentMethodOptions extends StripeObject { @SerializedName("bancontact") Bancontact bancontact; + /** + * If paying by {@code billie}, this sub-hash contains details about the Billie payment method + * options to pass to the invoice’s PaymentIntent. + */ + @SerializedName("billie") + Billie billie; + /** * If paying by {@code bizum}, this sub-hash contains details about the Bizum payment method * options to pass to the invoice’s PaymentIntent. @@ -2740,6 +2772,15 @@ public static class Bancontact extends StripeObject { String preferredLanguage; } + /** + * For more details about Billie, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Billie extends StripeObject {} + /** * For more details about Bizum, please refer to the API * Reference. @@ -3557,6 +3598,7 @@ public void setResponseGetter(StripeResponseGetter responseGetter) { trySetResponseGetter(confirmationSecret, responseGetter); trySetResponseGetter(customer, responseGetter); trySetResponseGetter(customerAddress, responseGetter); + trySetResponseGetter(customerBalance, responseGetter); trySetResponseGetter(customerShipping, responseGetter); trySetResponseGetter(defaultPaymentMethod, responseGetter); trySetResponseGetter(defaultSource, responseGetter); diff --git a/src/main/java/com/stripe/model/PaymentAttemptRecord.java b/src/main/java/com/stripe/model/PaymentAttemptRecord.java index 0af92cf9df3b..fc4071e233aa 100644 --- a/src/main/java/com/stripe/model/PaymentAttemptRecord.java +++ b/src/main/java/com/stripe/model/PaymentAttemptRecord.java @@ -3477,7 +3477,7 @@ public static class Pix extends StripeObject { @SerializedName("bank_transaction_id") String bankTransactionId; - /** ID of the multi use Mandate generated by the PaymentIntent. */ + /** ID of the multi use Mandate generated by the PaymentIntent or SetupIntent. */ @SerializedName("mandate") String mandate; } @@ -3723,7 +3723,7 @@ public static class SepaDebit extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Sequra extends StripeObject { - /** The Sequra transaction ID associated with this payment. */ + /** The SeQura transaction ID associated with this payment. */ @SerializedName("transaction_id") String transactionId; } @@ -3916,7 +3916,7 @@ public static class Tamara extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Twint extends StripeObject { - /** ID of the multi use Mandate generated by the PaymentIntent. */ + /** ID of the multi use Mandate generated by the PaymentIntent or SetupIntent. */ @SerializedName("mandate") String mandate; } diff --git a/src/main/java/com/stripe/model/PaymentIntent.java b/src/main/java/com/stripe/model/PaymentIntent.java index 09432b44a719..7d41e1f1ecbf 100644 --- a/src/main/java/com/stripe/model/PaymentIntent.java +++ b/src/main/java/com/stripe/model/PaymentIntent.java @@ -8632,6 +8632,30 @@ public static class Sequra extends StripeObject { */ @SerializedName("capture_method") String captureMethod; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + *

If you provide a Customer with the PaymentIntent, you can use this parameter to attach the payment method to the + * Customer after the PaymentIntent is confirmed and the customer completes any required + * actions. If you don't provide a Customer, you can still attach the payment method to a + * Customer after the transaction completes. + * + *

If the payment method is {@code card_present} and isn't a digital wallet, Stripe creates + * and attaches a generated_card + * payment method representing the card to the Customer instead. + * + *

When processing card payments, Stripe uses {@code setup_future_usage} to help you comply + * with regional legislation and network rules, such as SCA. + * + *

Equal to {@code none}. + */ + @SerializedName("setup_future_usage") + String setupFutureUsage; } /** diff --git a/src/main/java/com/stripe/model/PaymentRecord.java b/src/main/java/com/stripe/model/PaymentRecord.java index bacec65c880e..e55200f1e2e3 100644 --- a/src/main/java/com/stripe/model/PaymentRecord.java +++ b/src/main/java/com/stripe/model/PaymentRecord.java @@ -3550,7 +3550,7 @@ public static class Pix extends StripeObject { @SerializedName("bank_transaction_id") String bankTransactionId; - /** ID of the multi use Mandate generated by the PaymentIntent. */ + /** ID of the multi use Mandate generated by the PaymentIntent or SetupIntent. */ @SerializedName("mandate") String mandate; } @@ -3796,7 +3796,7 @@ public static class SepaDebit extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Sequra extends StripeObject { - /** The Sequra transaction ID associated with this payment. */ + /** The SeQura transaction ID associated with this payment. */ @SerializedName("transaction_id") String transactionId; } @@ -3989,7 +3989,7 @@ public static class Tamara extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Twint extends StripeObject { - /** ID of the multi use Mandate generated by the PaymentIntent. */ + /** ID of the multi use Mandate generated by the PaymentIntent or SetupIntent. */ @SerializedName("mandate") String mandate; } diff --git a/src/main/java/com/stripe/model/QuotePreviewInvoice.java b/src/main/java/com/stripe/model/QuotePreviewInvoice.java index cb4bff3dea54..ed64b4eec252 100644 --- a/src/main/java/com/stripe/model/QuotePreviewInvoice.java +++ b/src/main/java/com/stripe/model/QuotePreviewInvoice.java @@ -218,6 +218,10 @@ public class QuotePreviewInvoice extends ApiResource implements HasId { @SerializedName("customer_address") Address customerAddress; + /** The customer balance amounts applied to this invoice. */ + @SerializedName("customer_balance") + CustomerBalance customerBalance; + /** * The customer's email. Until the invoice is finalized, this field will equal {@code * customer.email}. Once the invoice is finalized, this field will no longer be updated. @@ -1068,6 +1072,27 @@ public static class CustomField extends StripeObject { String value; } + /** + * For more details about CustomerBalance, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class CustomerBalance extends StripeObject { + /** The total amount of customer balance applied to this invoice (automatically + manually). */ + @SerializedName("applied_balance") + Long appliedBalance; + + /** The amount of customer balance automatically applied during invoice finalization. */ + @SerializedName("automatically_applied_balance") + Long automaticallyAppliedBalance; + + /** The total amount of customer balance manually applied after finalization. */ + @SerializedName("manually_applied_balance") + Long manuallyAppliedBalance; + } + /** * For more details about CustomerTaxId, please refer to the API Reference. @@ -1415,6 +1440,13 @@ public static class PaymentMethodOptions extends StripeObject { @SerializedName("bancontact") Bancontact bancontact; + /** + * If paying by {@code billie}, this sub-hash contains details about the Billie payment method + * options to pass to the invoice’s PaymentIntent. + */ + @SerializedName("billie") + Billie billie; + /** * If paying by {@code bizum}, this sub-hash contains details about the Bizum payment method * options to pass to the invoice’s PaymentIntent. @@ -1561,6 +1593,15 @@ public static class Bancontact extends StripeObject { String preferredLanguage; } + /** + * For more details about Billie, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Billie extends StripeObject {} + /** * For more details about Bizum, please refer to the API * Reference. @@ -2378,6 +2419,7 @@ public void setResponseGetter(StripeResponseGetter responseGetter) { trySetResponseGetter(automaticTax, responseGetter); trySetResponseGetter(confirmationSecret, responseGetter); trySetResponseGetter(customerAddress, responseGetter); + trySetResponseGetter(customerBalance, responseGetter); trySetResponseGetter(customerShipping, responseGetter); trySetResponseGetter(defaultPaymentMethod, responseGetter); trySetResponseGetter(defaultSource, responseGetter); diff --git a/src/main/java/com/stripe/model/QuotePreviewSubscriptionSchedule.java b/src/main/java/com/stripe/model/QuotePreviewSubscriptionSchedule.java index d94c6e80e094..c429fb528894 100644 --- a/src/main/java/com/stripe/model/QuotePreviewSubscriptionSchedule.java +++ b/src/main/java/com/stripe/model/QuotePreviewSubscriptionSchedule.java @@ -999,6 +999,9 @@ public static class Pause extends StripeObject { @SerializedName("settings") Settings settings; + @SerializedName("status") + Status status; + /** * For more details about Settings, please refer to the API Reference. @@ -1075,6 +1078,43 @@ public static class UnusedTimeFrom extends StripeObject { } } } + + /** + * For more details about Status, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Status extends StripeObject { + @SerializedName("error") + Errors error; + + /** + * The lifecycle state of the pause operation. + * + *

One of {@code error}, {@code scheduled}, or {@code succeeded}. + */ + @SerializedName("type") + String type; + + /** + * For more details about Errors, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Errors extends StripeObject { + /** A machine-readable error code. */ + @SerializedName("code") + String code; + + /** A description of the error. */ + @SerializedName("message") + String message; + } + } } /** @@ -1092,6 +1132,9 @@ public static class Resume extends StripeObject { @SerializedName("settings") Settings settings; + @SerializedName("status") + Status status; + /** * For more details about Settings, please refer to the API Reference. @@ -1126,6 +1169,44 @@ public static class Settings extends StripeObject { @SerializedName("proration_behavior") String prorationBehavior; } + + /** + * For more details about Status, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Status extends StripeObject { + @SerializedName("error") + Errors error; + + /** + * The lifecycle state of the resume operation. + * + *

One of {@code error}, {@code pending}, {@code requires_action}, {@code scheduled}, or + * {@code succeeded}. + */ + @SerializedName("type") + String type; + + /** + * For more details about Errors, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Errors extends StripeObject { + /** A machine-readable error code. */ + @SerializedName("code") + String code; + + /** A description of the error. */ + @SerializedName("message") + String message; + } + } } } diff --git a/src/main/java/com/stripe/model/Subscription.java b/src/main/java/com/stripe/model/Subscription.java index 41ea56f83e50..808f5bea728e 100644 --- a/src/main/java/com/stripe/model/Subscription.java +++ b/src/main/java/com/stripe/model/Subscription.java @@ -2102,6 +2102,13 @@ public static class PaymentMethodOptions extends StripeObject { @SerializedName("bancontact") Bancontact bancontact; + /** + * This sub-hash contains details about the Billie payment method options to pass to invoices + * created by the subscription. + */ + @SerializedName("billie") + Billie billie; + /** * This sub-hash contains details about the Bizum payment method options to pass to invoices * created by the subscription. @@ -2248,6 +2255,15 @@ public static class Bancontact extends StripeObject { String preferredLanguage; } + /** + * For more details about Billie, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Billie extends StripeObject {} + /** * For more details about Bizum, please refer to the API * Reference. diff --git a/src/main/java/com/stripe/model/SubscriptionSchedule.java b/src/main/java/com/stripe/model/SubscriptionSchedule.java index f6be3428fa80..2ead3fedf6ba 100644 --- a/src/main/java/com/stripe/model/SubscriptionSchedule.java +++ b/src/main/java/com/stripe/model/SubscriptionSchedule.java @@ -1312,6 +1312,9 @@ public static class Pause extends StripeObject { @SerializedName("settings") Settings settings; + @SerializedName("status") + Status status; + /** * For more details about Settings, please refer to the API Reference. @@ -1388,6 +1391,43 @@ public static class UnusedTimeFrom extends StripeObject { } } } + + /** + * For more details about Status, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Status extends StripeObject { + @SerializedName("error") + Errors error; + + /** + * The lifecycle state of the pause operation. + * + *

One of {@code error}, {@code scheduled}, or {@code succeeded}. + */ + @SerializedName("type") + String type; + + /** + * For more details about Errors, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Errors extends StripeObject { + /** A machine-readable error code. */ + @SerializedName("code") + String code; + + /** A description of the error. */ + @SerializedName("message") + String message; + } + } } /** @@ -1405,6 +1445,9 @@ public static class Resume extends StripeObject { @SerializedName("settings") Settings settings; + @SerializedName("status") + Status status; + /** * For more details about Settings, please refer to the API Reference. @@ -1439,6 +1482,44 @@ public static class Settings extends StripeObject { @SerializedName("proration_behavior") String prorationBehavior; } + + /** + * For more details about Status, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Status extends StripeObject { + @SerializedName("error") + Errors error; + + /** + * The lifecycle state of the resume operation. + * + *

One of {@code error}, {@code pending}, {@code requires_action}, {@code scheduled}, or + * {@code succeeded}. + */ + @SerializedName("type") + String type; + + /** + * For more details about Errors, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Errors extends StripeObject { + /** A machine-readable error code. */ + @SerializedName("code") + String code; + + /** A description of the error. */ + @SerializedName("message") + String message; + } + } } } diff --git a/src/main/java/com/stripe/model/billingportal/Session.java b/src/main/java/com/stripe/model/billingportal/Session.java index 4bb3f6433979..afff2ef10fcf 100644 --- a/src/main/java/com/stripe/model/billingportal/Session.java +++ b/src/main/java/com/stripe/model/billingportal/Session.java @@ -186,6 +186,10 @@ public static class Flow extends StripeObject { @SerializedName("after_completion") AfterCompletion afterCompletion; + /** Configuration when {@code flow.type=customer_update}. */ + @SerializedName("customer_update") + CustomerUpdate customerUpdate; + /** Configuration when {@code flow.type=subscription_cancel}. */ @SerializedName("subscription_cancel") SubscriptionCancel subscriptionCancel; @@ -201,8 +205,8 @@ public static class Flow extends StripeObject { /** * Type of flow that the customer will go through. * - *

One of {@code payment_method_update}, {@code subscription_cancel}, {@code - * subscription_update}, or {@code subscription_update_confirm}. + *

One of {@code customer_update}, {@code payment_method_update}, {@code + * subscription_cancel}, {@code subscription_update}, or {@code subscription_update_confirm}. */ @SerializedName("type") String type; @@ -258,6 +262,15 @@ public static class Redirect extends StripeObject { } } + /** + * For more details about CustomerUpdate, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class CustomerUpdate extends StripeObject {} + /** * For more details about SubscriptionCancel, please refer to the API Reference. diff --git a/src/main/java/com/stripe/model/climate/Order.java b/src/main/java/com/stripe/model/climate/Order.java index b96e8a386217..7d10424d9e18 100644 --- a/src/main/java/com/stripe/model/climate/Order.java +++ b/src/main/java/com/stripe/model/climate/Order.java @@ -97,7 +97,10 @@ public class Order extends ApiResource implements HasId, MetadataStore { @SerializedName("delivery_details") List deliveryDetails; - /** The year this order is expected to be delivered. */ + /** + * The year this order is expected to be delivered. If the year is in the past, the order is a + * spot purchase and will be delivered within 30 days of purchase. + */ @SerializedName("expected_delivery_year") Long expectedDeliveryYear; diff --git a/src/main/java/com/stripe/model/climate/Product.java b/src/main/java/com/stripe/model/climate/Product.java index 09ab4dd8ca32..b4730be0890e 100644 --- a/src/main/java/com/stripe/model/climate/Product.java +++ b/src/main/java/com/stripe/model/climate/Product.java @@ -35,7 +35,10 @@ public class Product extends ApiResource implements HasId { @SerializedName("current_prices_per_metric_ton") Map currentPricesPerMetricTon; - /** The year in which the carbon removal is expected to be delivered. */ + /** + * The year in which the carbon removal is expected to be delivered. If the year is in the past, + * this represents spot inventory with guaranteed delivery. + */ @SerializedName("delivery_year") Long deliveryYear; diff --git a/src/main/java/com/stripe/model/crypto/CustomerConsumerWallet.java b/src/main/java/com/stripe/model/crypto/CustomerConsumerWallet.java index bf227f44ffd8..690d3b360ff9 100644 --- a/src/main/java/com/stripe/model/crypto/CustomerConsumerWallet.java +++ b/src/main/java/com/stripe/model/crypto/CustomerConsumerWallet.java @@ -37,9 +37,9 @@ public class CustomerConsumerWallet extends ApiResource implements HasId { /** * The blockchain network for this wallet * - *

One of {@code aptos}, {@code avalanche}, {@code base}, {@code bitcoin}, {@code ethereum}, - * {@code optimism}, {@code polygon}, {@code solana}, {@code stellar}, {@code sui}, {@code tempo}, - * or {@code worldchain}. + *

One of {@code aptos}, {@code avalanche}, {@code base}, {@code bitcoin}, {@code celo}, {@code + * ethereum}, {@code optimism}, {@code polygon}, {@code solana}, {@code stellar}, {@code sui}, + * {@code tempo}, or {@code worldchain}. */ @SerializedName("network") String network; diff --git a/src/main/java/com/stripe/model/crypto/OnrampSession.java b/src/main/java/com/stripe/model/crypto/OnrampSession.java index 5d835fe3c55b..81a9e591143f 100644 --- a/src/main/java/com/stripe/model/crypto/OnrampSession.java +++ b/src/main/java/com/stripe/model/crypto/OnrampSession.java @@ -413,9 +413,9 @@ public static class TransactionDetails extends StripeObject { * The specific crypto network the {@code destination_currency} is settled on. If {@code * destination_networks} is set, it must be a value in that array. * - *

One of {@code avalanche}, {@code base}, {@code bitcoin}, {@code ethereum}, {@code - * optimism}, {@code polygon}, {@code solana}, {@code stellar}, {@code sui}, {@code tempo}, or - * {@code worldchain}. + *

One of {@code avalanche}, {@code base}, {@code bitcoin}, {@code celo}, {@code ethereum}, + * {@code optimism}, {@code polygon}, {@code solana}, {@code stellar}, {@code sui}, {@code + * tempo}, or {@code worldchain}. */ @SerializedName("destination_network") String destinationNetwork; @@ -513,6 +513,10 @@ public static class WalletAddresses extends StripeObject { @SerializedName("bitcoin") String bitcoin; + /** A Celo address. */ + @SerializedName("celo") + String celo; + /** * The end customer's crypto wallet destination tag (for each network) to use for this * transaction. diff --git a/src/main/java/com/stripe/model/financialconnections/Account.java b/src/main/java/com/stripe/model/financialconnections/Account.java index 11f8562c61d5..7460d1bd1079 100644 --- a/src/main/java/com/stripe/model/financialconnections/Account.java +++ b/src/main/java/com/stripe/model/financialconnections/Account.java @@ -62,6 +62,10 @@ public class Account extends ApiResource implements HasId { @SerializedName("category") String category; + /** Per-taxonomy processing state for this account. One entry per subscribed taxonomy. */ + @SerializedName("classification_state") + Map classificationState; + /** Time at which the object was created. Measured in seconds since the Unix epoch. */ @SerializedName("created") Long created; @@ -73,6 +77,10 @@ public class Account extends ApiResource implements HasId { @SerializedName("display_name") String displayName; + /** The state of merchant name enrichment for this account. */ + @SerializedName("enrichment_state") + EnrichmentState enrichmentState; + /** Unique identifier for the object. */ @Getter(onMethod_ = {@Override}) @SerializedName("id") @@ -773,6 +781,45 @@ public static class BalanceRefresh extends StripeObject { String status; } + /** + * For more details about ClassificationState, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class ClassificationState extends StripeObject { + /** The taxonomy classification status for this account. One of 'pending' or 'completed'. */ + @SerializedName("status") + String status; + } + + /** + * For more details about EnrichmentState, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class EnrichmentState extends StripeObject { + /** The enrichment status for merchant name normalization. */ + @SerializedName("merchant") + Merchant merchant; + + /** + * For more details about Merchant, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Merchant extends StripeObject { + /** The merchant enrichment status for this account. One of 'pending' or 'completed'. */ + @SerializedName("status") + String status; + } + } + /** * For more details about InferredBalancesRefresh, please refer to the API Reference. @@ -947,6 +994,7 @@ public void setResponseGetter(StripeResponseGetter responseGetter) { trySetResponseGetter(accountHolder, responseGetter); trySetResponseGetter(balance, responseGetter); trySetResponseGetter(balanceRefresh, responseGetter); + trySetResponseGetter(enrichmentState, responseGetter); trySetResponseGetter(inferredBalancesRefresh, responseGetter); trySetResponseGetter(institution, responseGetter); trySetResponseGetter(ownership, responseGetter); diff --git a/src/main/java/com/stripe/model/financialconnections/Session.java b/src/main/java/com/stripe/model/financialconnections/Session.java index 367e2874730a..666dde2490a3 100644 --- a/src/main/java/com/stripe/model/financialconnections/Session.java +++ b/src/main/java/com/stripe/model/financialconnections/Session.java @@ -323,6 +323,10 @@ public static class Filters extends StripeObject { @SerializedName("countries") List countries; + /** Country from which to filter accounts. */ + @SerializedName("country") + String country; + /** Stripe ID of the institution with which the customer should be directed to log in. */ @SerializedName("institution") String institution; diff --git a/src/main/java/com/stripe/model/financialconnections/Transaction.java b/src/main/java/com/stripe/model/financialconnections/Transaction.java index 42003552cc8c..eaecfe3c7485 100644 --- a/src/main/java/com/stripe/model/financialconnections/Transaction.java +++ b/src/main/java/com/stripe/model/financialconnections/Transaction.java @@ -13,6 +13,7 @@ import com.stripe.net.StripeResponseGetter; import com.stripe.param.financialconnections.TransactionListParams; import com.stripe.param.financialconnections.TransactionRetrieveParams; +import java.util.List; import java.util.Map; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -33,6 +34,10 @@ public class Transaction extends ApiResource implements HasId { @SerializedName("amount") Long amount; + /** Classification labels for this transaction, one entry per subscribed use case. */ + @SerializedName("classifications") + List classifications; + /** * Three-letter ISO currency code, * in lowercase. Must be a supported currency. @@ -44,6 +49,10 @@ public class Transaction extends ApiResource implements HasId { @SerializedName("description") String description; + /** Enriched merchant information for this transaction. */ + @SerializedName("enrichments") + Enrichments enrichments; + /** Unique identifier for the object. */ @Getter(onMethod_ = {@Override}) @SerializedName("id") @@ -162,6 +171,110 @@ public static Transaction retrieve( return getGlobalResponseGetter().request(request, Transaction.class); } + /** + * For more details about Classification, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Classification extends StripeObject { + /** Money movement classification labels for this transaction. */ + @SerializedName("money_movement") + MoneyMovement moneyMovement; + + /** Personal finance classification labels for this transaction. */ + @SerializedName("personal_finance") + PersonalFinance personalFinance; + + /** The taxonomy type for this classification entry. */ + @SerializedName("type") + String type; + + /** + * For more details about MoneyMovement, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class MoneyMovement extends StripeObject { + /** + * Stripe's confidence in this classification. + * + *

One of {@code high}, {@code low}, {@code medium}, or {@code very_high}. + */ + @SerializedName("confidence_level") + String confidenceLevel; + + /** The detailed category label for this transaction. */ + @SerializedName("detailed_label") + String detailedLabel; + + /** The primary category label for this transaction. */ + @SerializedName("primary_label") + String primaryLabel; + } + + /** + * For more details about PersonalFinance, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class PersonalFinance extends StripeObject { + /** + * Stripe's confidence in this classification. + * + *

One of {@code high}, {@code low}, {@code medium}, or {@code very_high}. + */ + @SerializedName("confidence_level") + String confidenceLevel; + + /** The detailed category label for this transaction. */ + @SerializedName("detailed_label") + String detailedLabel; + + /** The primary category label for this transaction. */ + @SerializedName("primary_label") + String primaryLabel; + } + } + + /** + * For more details about Enrichments, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Enrichments extends StripeObject { + @SerializedName("merchant") + Merchant merchant; + + /** + * For more details about Merchant, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Merchant extends StripeObject { + /** + * Stripe's confidence in the enriched merchant name. + * + *

One of {@code high}, {@code low}, {@code medium}, or {@code very_high}. + */ + @SerializedName("confidence_level") + String confidenceLevel; + + /** The normalized merchant name for this transaction. */ + @SerializedName("name") + String name; + } + } + /** * For more details about StatusTransitions, please refer to the API Reference. @@ -182,6 +295,7 @@ public static class StatusTransitions extends StripeObject { @Override public void setResponseGetter(StripeResponseGetter responseGetter) { super.setResponseGetter(responseGetter); + trySetResponseGetter(enrichments, responseGetter); trySetResponseGetter(statusTransitions, responseGetter); } } diff --git a/src/main/java/com/stripe/model/issuing/Authorization.java b/src/main/java/com/stripe/model/issuing/Authorization.java index 4ec437e1888d..8af0a40e7f4e 100644 --- a/src/main/java/com/stripe/model/issuing/Authorization.java +++ b/src/main/java/com/stripe/model/issuing/Authorization.java @@ -1628,6 +1628,14 @@ public static class PendingRequest extends StripeObject { @SerializedName("currency") String currency; + /** The total amount to be held for this authorization request. */ + @SerializedName("hold_amount") + HoldAmount holdAmount; + + /** Breakdown of the amounts contributing to hold_amount. */ + @SerializedName("hold_amount_details") + HoldAmountDetails holdAmountDetails; + /** * If set {@code true}, you may provide amount @@ -1671,6 +1679,76 @@ public static class AmountDetails extends StripeObject { @SerializedName("cashback_amount") Long cashbackAmount; } + + /** + * For more details about HoldAmount, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class HoldAmount extends StripeObject { + /** Three-letter ISO currency code. */ + @SerializedName("currency") + String currency; + + /** The amount in the smallest currency unit. */ + @SerializedName("value") + Long value; + } + + /** + * For more details about HoldAmountDetails, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class HoldAmountDetails extends StripeObject { + @SerializedName("network") + Network network; + + /** + * The reserve amount held for this authorization. Present for certain MCCs that may have + * overcaptures. + */ + @SerializedName("reserve") + Reserve reserve; + + /** + * For more details about Network, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Network extends StripeObject { + /** Three-letter ISO currency code. */ + @SerializedName("currency") + String currency; + + /** The amount in the smallest currency unit. */ + @SerializedName("value") + Long value; + } + + /** + * For more details about Reserve, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Reserve extends StripeObject { + /** Three-letter ISO currency code. */ + @SerializedName("currency") + String currency; + + /** The amount in the smallest currency unit. */ + @SerializedName("value") + Long value; + } + } } /** @@ -1741,6 +1819,14 @@ public static class RequestHistory extends StripeObject { @SerializedName("currency") String currency; + /** The total amount that was held for this authorization request. */ + @SerializedName("hold_amount") + HoldAmount holdAmount; + + /** Breakdown of the amounts contributing to hold_amount. */ + @SerializedName("hold_amount_details") + HoldAmountDetails holdAmountDetails; + /** * The {@code pending_request.merchant_amount} at the time of the request, presented in the * {@code merchant_currency} and in the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class HoldAmount extends StripeObject { + /** Three-letter ISO currency code. */ + @SerializedName("currency") + String currency; + + /** The amount in the smallest currency unit. */ + @SerializedName("value") + Long value; + } + + /** + * For more details about HoldAmountDetails, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class HoldAmountDetails extends StripeObject { + @SerializedName("network") + Network network; + + /** + * The reserve amount held for this authorization. Present for certain MCCs that may have + * overcaptures. + */ + @SerializedName("reserve") + Reserve reserve; + + /** + * For more details about Network, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Network extends StripeObject { + /** Three-letter ISO currency code. */ + @SerializedName("currency") + String currency; + + /** The amount in the smallest currency unit. */ + @SerializedName("value") + Long value; + } + + /** + * For more details about Reserve, please refer to the API Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Reserve extends StripeObject { + /** Three-letter ISO currency code. */ + @SerializedName("currency") + String currency; + + /** The amount in the smallest currency unit. */ + @SerializedName("value") + Long value; + } + } + /** * For more details about NetworkData, please refer to the API Reference. diff --git a/src/main/java/com/stripe/model/issuing/Cardholder.java b/src/main/java/com/stripe/model/issuing/Cardholder.java index 2edc024303c2..4f4c0badb509 100644 --- a/src/main/java/com/stripe/model/issuing/Cardholder.java +++ b/src/main/java/com/stripe/model/issuing/Cardholder.java @@ -99,9 +99,9 @@ public class Cardholder extends ApiResource implements HasId, MetadataStore3D Secure - * flow and one-time password messages sent to the cardholder. + * de}, {@code en}, {@code es}, {@code fr}, or {@code it}. This changes the language of the 3D Secure flow and one-time password + * messages sent to the cardholder. */ @SerializedName("preferred_locales") List preferredLocales; diff --git a/src/main/java/com/stripe/model/v2/EventDataClassLookup.java b/src/main/java/com/stripe/model/v2/EventDataClassLookup.java index 083c624ec4fe..a8dd2e498efe 100644 --- a/src/main/java/com/stripe/model/v2/EventDataClassLookup.java +++ b/src/main/java/com/stripe/model/v2/EventDataClassLookup.java @@ -20,6 +20,7 @@ public final class EventDataClassLookup { classLookup.put("account", com.stripe.model.Account.class); classLookup.put("application_fee", com.stripe.model.ApplicationFee.class); classLookup.put("balance", com.stripe.model.Balance.class); + classLookup.put("balance_settings", com.stripe.model.BalanceSettings.class); classLookup.put("capability", com.stripe.model.Capability.class); classLookup.put("cash_balance", com.stripe.model.CashBalance.class); classLookup.put("charge", com.stripe.model.Charge.class); @@ -57,6 +58,10 @@ public final class EventDataClassLookup { classLookup.put("transfer", com.stripe.model.Transfer.class); classLookup.put("billing.alert", com.stripe.model.billing.Alert.class); + classLookup.put( + "billing.credit_balance_transaction", + com.stripe.model.billing.CreditBalanceTransaction.class); + classLookup.put("billing.credit_grant", com.stripe.model.billing.CreditGrant.class); classLookup.put("billing.meter", com.stripe.model.billing.Meter.class); classLookup.put( @@ -286,6 +291,9 @@ public final class EventDataClassLookup { classLookup.put("v2.signals.account_signal", com.stripe.model.v2.signals.AccountSignal.class); classLookup.put("v2.tax.manual_rule", com.stripe.model.v2.tax.ManualRule.class); + classLookup.put( + "v2.tax.operations_resolve_address_result", + com.stripe.model.v2.tax.OperationsResolveAddressResult.class); eventClassLookup.put( "v1.account.application.authorized", @@ -314,13 +322,32 @@ public final class EventDataClassLookup { eventClassLookup.put( "v1.application_fee.refunded", com.stripe.events.V1ApplicationFeeRefundedEvent.class); eventClassLookup.put("v1.balance.available", com.stripe.events.V1BalanceAvailableEvent.class); + eventClassLookup.put( + "v1.balance_settings.updated", com.stripe.events.V1BalanceSettingsUpdatedEvent.class); eventClassLookup.put( "v1.billing.alert.triggered", com.stripe.events.V1BillingAlertTriggeredEvent.class); + eventClassLookup.put( + "v1.billing.credit_balance_transaction.created", + com.stripe.events.V1BillingCreditBalanceTransactionCreatedEvent.class); + eventClassLookup.put( + "v1.billing.credit_grant.created", + com.stripe.events.V1BillingCreditGrantCreatedEvent.class); + eventClassLookup.put( + "v1.billing.credit_grant.updated", + com.stripe.events.V1BillingCreditGrantUpdatedEvent.class); + eventClassLookup.put( + "v1.billing.meter.created", com.stripe.events.V1BillingMeterCreatedEvent.class); + eventClassLookup.put( + "v1.billing.meter.deactivated", com.stripe.events.V1BillingMeterDeactivatedEvent.class); eventClassLookup.put( "v1.billing.meter.error_report_triggered", com.stripe.events.V1BillingMeterErrorReportTriggeredEvent.class); eventClassLookup.put( "v1.billing.meter.no_meter_found", com.stripe.events.V1BillingMeterNoMeterFoundEvent.class); + eventClassLookup.put( + "v1.billing.meter.reactivated", com.stripe.events.V1BillingMeterReactivatedEvent.class); + eventClassLookup.put( + "v1.billing.meter.updated", com.stripe.events.V1BillingMeterUpdatedEvent.class); eventClassLookup.put( "v1.billing_portal.configuration.created", com.stripe.events.V1BillingPortalConfigurationCreatedEvent.class); @@ -429,6 +456,9 @@ public final class EventDataClassLookup { "v1.entitlements.active_entitlement_summary.updated", com.stripe.events.V1EntitlementsActiveEntitlementSummaryUpdatedEvent.class); eventClassLookup.put("v1.file.created", com.stripe.events.V1FileCreatedEvent.class); + eventClassLookup.put( + "v1.financial_connections.account.account_numbers_updated", + com.stripe.events.V1FinancialConnectionsAccountAccountNumbersUpdatedEvent.class); eventClassLookup.put( "v1.financial_connections.account.created", com.stripe.events.V1FinancialConnectionsAccountCreatedEvent.class); @@ -438,6 +468,9 @@ public final class EventDataClassLookup { eventClassLookup.put( "v1.financial_connections.account.disconnected", com.stripe.events.V1FinancialConnectionsAccountDisconnectedEvent.class); + eventClassLookup.put( + "v1.financial_connections.account.expected_deactivation_date_updated", + com.stripe.events.V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent.class); eventClassLookup.put( "v1.financial_connections.account.reactivated", com.stripe.events.V1FinancialConnectionsAccountReactivatedEvent.class); @@ -450,6 +483,16 @@ public final class EventDataClassLookup { eventClassLookup.put( "v1.financial_connections.account.refreshed_transactions", com.stripe.events.V1FinancialConnectionsAccountRefreshedTransactionsEvent.class); + eventClassLookup.put( + "v1.financial_connections.account.supported_payment_method_types_updated", + com.stripe.events.V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent + .class); + eventClassLookup.put( + "v1.financial_connections.account.upcoming_account_number_expiry", + com.stripe.events.V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent.class); + eventClassLookup.put( + "v1.financial_connections.account.upcoming_deactivation", + com.stripe.events.V1FinancialConnectionsAccountUpcomingDeactivationEvent.class); eventClassLookup.put( "v1.identity.verification_session.canceled", com.stripe.events.V1IdentityVerificationSessionCanceledEvent.class); @@ -482,6 +525,9 @@ public final class EventDataClassLookup { eventClassLookup.put( "v1.invoice.payment_action_required", com.stripe.events.V1InvoicePaymentActionRequiredEvent.class); + eventClassLookup.put( + "v1.invoice.payment_attempt_required", + com.stripe.events.V1InvoicePaymentAttemptRequiredEvent.class); eventClassLookup.put( "v1.invoice.payment_failed", com.stripe.events.V1InvoicePaymentFailedEvent.class); eventClassLookup.put( diff --git a/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java b/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java index 4441a51834b1..92823f3e464f 100644 --- a/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java +++ b/src/main/java/com/stripe/model/v2/EventNotificationClassLookup.java @@ -47,15 +47,37 @@ public final class EventNotificationClassLookup { com.stripe.events.V1ApplicationFeeRefundedEventNotification.class); eventClassLookup.put( "v1.balance.available", com.stripe.events.V1BalanceAvailableEventNotification.class); + eventClassLookup.put( + "v1.balance_settings.updated", + com.stripe.events.V1BalanceSettingsUpdatedEventNotification.class); eventClassLookup.put( "v1.billing.alert.triggered", com.stripe.events.V1BillingAlertTriggeredEventNotification.class); + eventClassLookup.put( + "v1.billing.credit_balance_transaction.created", + com.stripe.events.V1BillingCreditBalanceTransactionCreatedEventNotification.class); + eventClassLookup.put( + "v1.billing.credit_grant.created", + com.stripe.events.V1BillingCreditGrantCreatedEventNotification.class); + eventClassLookup.put( + "v1.billing.credit_grant.updated", + com.stripe.events.V1BillingCreditGrantUpdatedEventNotification.class); + eventClassLookup.put( + "v1.billing.meter.created", com.stripe.events.V1BillingMeterCreatedEventNotification.class); + eventClassLookup.put( + "v1.billing.meter.deactivated", + com.stripe.events.V1BillingMeterDeactivatedEventNotification.class); eventClassLookup.put( "v1.billing.meter.error_report_triggered", com.stripe.events.V1BillingMeterErrorReportTriggeredEventNotification.class); eventClassLookup.put( "v1.billing.meter.no_meter_found", com.stripe.events.V1BillingMeterNoMeterFoundEventNotification.class); + eventClassLookup.put( + "v1.billing.meter.reactivated", + com.stripe.events.V1BillingMeterReactivatedEventNotification.class); + eventClassLookup.put( + "v1.billing.meter.updated", com.stripe.events.V1BillingMeterUpdatedEventNotification.class); eventClassLookup.put( "v1.billing_portal.configuration.created", com.stripe.events.V1BillingPortalConfigurationCreatedEventNotification.class); @@ -189,6 +211,10 @@ public final class EventNotificationClassLookup { "v1.entitlements.active_entitlement_summary.updated", com.stripe.events.V1EntitlementsActiveEntitlementSummaryUpdatedEventNotification.class); eventClassLookup.put("v1.file.created", com.stripe.events.V1FileCreatedEventNotification.class); + eventClassLookup.put( + "v1.financial_connections.account.account_numbers_updated", + com.stripe.events.V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification + .class); eventClassLookup.put( "v1.financial_connections.account.created", com.stripe.events.V1FinancialConnectionsAccountCreatedEventNotification.class); @@ -198,6 +224,10 @@ public final class EventNotificationClassLookup { eventClassLookup.put( "v1.financial_connections.account.disconnected", com.stripe.events.V1FinancialConnectionsAccountDisconnectedEventNotification.class); + eventClassLookup.put( + "v1.financial_connections.account.expected_deactivation_date_updated", + com.stripe.events + .V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification.class); eventClassLookup.put( "v1.financial_connections.account.reactivated", com.stripe.events.V1FinancialConnectionsAccountReactivatedEventNotification.class); @@ -211,6 +241,18 @@ public final class EventNotificationClassLookup { "v1.financial_connections.account.refreshed_transactions", com.stripe.events.V1FinancialConnectionsAccountRefreshedTransactionsEventNotification .class); + eventClassLookup.put( + "v1.financial_connections.account.supported_payment_method_types_updated", + com.stripe.events + .V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification + .class); + eventClassLookup.put( + "v1.financial_connections.account.upcoming_account_number_expiry", + com.stripe.events.V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification + .class); + eventClassLookup.put( + "v1.financial_connections.account.upcoming_deactivation", + com.stripe.events.V1FinancialConnectionsAccountUpcomingDeactivationEventNotification.class); eventClassLookup.put( "v1.identity.verification_session.canceled", com.stripe.events.V1IdentityVerificationSessionCanceledEventNotification.class); @@ -249,6 +291,9 @@ public final class EventNotificationClassLookup { eventClassLookup.put( "v1.invoice.payment_action_required", com.stripe.events.V1InvoicePaymentActionRequiredEventNotification.class); + eventClassLookup.put( + "v1.invoice.payment_attempt_required", + com.stripe.events.V1InvoicePaymentAttemptRequiredEventNotification.class); eventClassLookup.put( "v1.invoice.payment_failed", com.stripe.events.V1InvoicePaymentFailedEventNotification.class); diff --git a/src/main/java/com/stripe/model/v2/core/health/Alert.java b/src/main/java/com/stripe/model/v2/core/health/Alert.java index 9b094f99deb8..07cba38735c3 100644 --- a/src/main/java/com/stripe/model/v2/core/health/Alert.java +++ b/src/main/java/com/stripe/model/v2/core/health/Alert.java @@ -330,14 +330,18 @@ public static class AuthorizationRateDrop extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Dimension extends StripeObject { + /** Populated when type is acquirer. */ + @SerializedName("acquirer") + String acquirer; + /** Populated when type is issuer. */ @SerializedName("issuer") String issuer; /** - * The type of the dimension. Determines which field in dimension_details is populated. + * The type of the dimension. Determines which field is populated. * - *

Equal to {@code issuer}. + *

One of {@code acquirer}, or {@code issuer}. */ @SerializedName("type") String type; diff --git a/src/main/java/com/stripe/model/v2/core/health/AlertHistoryEntry.java b/src/main/java/com/stripe/model/v2/core/health/AlertHistoryEntry.java index 231ddd7b7734..70f3cbee679c 100644 --- a/src/main/java/com/stripe/model/v2/core/health/AlertHistoryEntry.java +++ b/src/main/java/com/stripe/model/v2/core/health/AlertHistoryEntry.java @@ -291,14 +291,18 @@ public static class AuthorizationRateDrop extends StripeObject { @Setter @EqualsAndHashCode(callSuper = false) public static class Dimension extends StripeObject { + /** Populated when type is acquirer. */ + @SerializedName("acquirer") + String acquirer; + /** Populated when type is issuer. */ @SerializedName("issuer") String issuer; /** - * The type of the dimension. Determines which field in dimension_details is populated. + * The type of the dimension. Determines which field is populated. * - *

Equal to {@code issuer}. + *

One of {@code acquirer}, or {@code issuer}. */ @SerializedName("type") String type; diff --git a/src/main/java/com/stripe/model/v2/tax/OperationsResolveAddressResult.java b/src/main/java/com/stripe/model/v2/tax/OperationsResolveAddressResult.java new file mode 100644 index 000000000000..995ab51bfcdc --- /dev/null +++ b/src/main/java/com/stripe/model/v2/tax/OperationsResolveAddressResult.java @@ -0,0 +1,110 @@ +// File generated from our OpenAPI spec +package com.stripe.model.v2.tax; + +import com.google.gson.annotations.SerializedName; +import com.stripe.model.StripeObject; +import java.util.List; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** The result of resolving an address to its tax precision level. */ +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +public class OperationsResolveAddressResult extends StripeObject { + /** The normalized form of the input address. */ + @SerializedName("address") + Address address; + + /** + * Has the value {@code true} if the object exists in live mode or the value {@code false} if the + * object exists in test mode. + */ + @SerializedName("livemode") + Boolean livemode; + + /** + * String representing the object's type. Objects of the same type share the same value of the + * object field. + * + *

Equal to {@code v2.tax.operations_resolve_address_result}. + */ + @SerializedName("object") + String object; + + /** + * The precision level of the resolved address. + * + *

One of {@code none}, {@code address}, {@code city}, {@code country}, {@code postal_code}, + * {@code state}, or {@code street}. + */ + @SerializedName("precision") + String precision; + + /** Details about the precision, including any issues. */ + @SerializedName("precision_details") + PrecisionDetails precisionDetails; + + /** The normalized form of the input address. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Address extends StripeObject { + /** The city. */ + @SerializedName("city") + String city; + + /** The two-letter country code. */ + @SerializedName("country") + String country; + + /** The first line of the street address. */ + @SerializedName("line1") + String line1; + + /** The postal code. */ + @SerializedName("postal_code") + String postalCode; + + /** The state or province. */ + @SerializedName("state") + String state; + } + + /** Details about the precision, including any issues. */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class PrecisionDetails extends StripeObject { + /** Issues preventing higher precision. */ + @SerializedName("issues") + List issues; + + /** + * For more details about Issue, please refer to the API + * Reference. + */ + @Getter + @Setter + @EqualsAndHashCode(callSuper = false) + public static class Issue extends StripeObject { + /** + * A code describing the issue. + * + *

Equal to {@code required_for_improved_precision}. + */ + @SerializedName("code") + String code; + + /** + * The address field with the issue. + * + *

One of {@code city}, {@code country}, {@code line1}, {@code postal_code}, or {@code + * state}. + */ + @SerializedName("field") + String field; + } + } +} diff --git a/src/main/java/com/stripe/net/Webhook.java b/src/main/java/com/stripe/net/Webhook.java index 09505f70873b..e5b8b5d0681e 100644 --- a/src/main/java/com/stripe/net/Webhook.java +++ b/src/main/java/com/stripe/net/Webhook.java @@ -1,5 +1,6 @@ package com.stripe.net; +import com.google.gson.JsonObject; import com.stripe.exception.SignatureVerificationException; import com.stripe.model.Event; import com.stripe.model.StripeObject; @@ -53,9 +54,10 @@ public static Event constructEvent( } /** - * Returns an Event instance using the provided JSON payload. Throws a JsonSyntaxException if the - * payload is not valid JSON, a SignatureVerificationException if the signature verification fails - * for any reason, and an IllegalArgumentException if you pass the wrong type of input. + * Constructs a snapshot + * event from an incoming webhook after verifying its authenticity. To work with a webhook + * that has already been verified (i.e. one from a cloud provider, an asynchronous queue, or + * during testing), see {@code constructEventWithoutVerification}. * * @param payload the payload sent by Stripe. * @param sigHeader the contents of the signature header sent by Stripe. @@ -69,28 +71,90 @@ public static Event constructEvent( public static Event constructEvent( String payload, String sigHeader, String secret, long tolerance, Clock clock) throws SignatureVerificationException { - Event event = - StripeObject.deserializeStripeObject( - payload, Event.class, ApiResource.getGlobalResponseGetter()); + Signature.verifyHeader(payload, sigHeader, secret, tolerance, clock); + + return buildV1Event(payload); + } + + /** + * Constructs a snapshot + * event from an incoming webhook without first verifying its authenticity. Should be used + * after calling {@code Webhook.Signature.verifyHeader(...)} or with input from a trusted source + * (such as AWS EventBridge, + * or Azure Event Grid + * payload). Or, to verify & construct in a single call, use {@code + * Webhook.constructEvent(...)} instead. + * + * @param payload the payload sent by Stripe, or a cloud provider envelope wrapping it. + * @return the Event instance + * @throws IllegalArgumentException if the payload is a v2 thin event notification. + */ + public static Event constructEventWithoutVerification(String payload) { + return buildV1Event(maybeExtractFromCloudProviderEnvelope(payload)); + } - if ("v2.core.event".equals(event.getObject())) { + private static Event buildV1Event(String payload) { + return buildV1Event(ApiResource.GSON.fromJson(payload, JsonObject.class)); + } + + private static Event buildV1Event(JsonObject jsonObject) { + if (jsonObject.has("object") + && "v2.core.event".equals(jsonObject.get("object").getAsString())) { throw new IllegalArgumentException( - "You passed an event notification to Webhook.constructEvent, which expects a webhook payload." - + " Use StripeClient.parseEventNotification instead."); + "You passed an event notification to Webhook method, which expects a webhook payload. Use the corresponding parseEventNotification method instead."); } - Signature.verifyHeader(payload, sigHeader, secret, tolerance, clock); + Event event = + StripeObject.deserializeStripeObject( + jsonObject, Event.class, ApiResource.getGlobalResponseGetter()); + // StripeObjects source their raw JSON object from their last response, but constructed webhooks // don't have that // in order to make the raw object available on parsed events, we fake the response. if (event.getLastResponse() == null) { event.setLastResponse( - new StripeResponse(200, HttpHeaders.of(Collections.emptyMap()), payload)); + new StripeResponse(200, HttpHeaders.of(Collections.emptyMap()), jsonObject.toString())); } return event; } + /** + * Parses a JSON payload (or cloud provider envelope) and returns the inner Stripe event JSON + * object. If the payload is already a raw Stripe event (object is "event" or "v2.core.event"), it + * is returned as-is. If it is an AWS EventBridge or Azure Event Grid envelope, the inner event is + * extracted. Throws {@link IllegalArgumentException} for unrecognized formats. + * + * @param payload the raw JSON string. + * @return the inner event as a {@link JsonObject}. + */ + public static JsonObject maybeExtractFromCloudProviderEnvelope(String payload) { + JsonObject root = ApiResource.GSON.fromJson(payload, JsonObject.class); + + // AWS + // https://docs.stripe.com/event-destinations/eventbridge#event-structure + if (root.has("detail")) { + return root.get("detail").getAsJsonObject(); + } + + // Azure + // https://docs.stripe.com/event-destinations/eventgrid#event-structure + if (root.has("specversion") && root.has("data")) { + return root.get("data").getAsJsonObject(); + } + + // Raw Stripe event passed directly: pass through as-is + if (root.has("object") && root.get("object").isJsonPrimitive()) { + String object = root.get("object").getAsString(); + if ("event".equals(object) || "v2.core.event".equals(object)) { + return root; + } + } + + throw new IllegalArgumentException( + "Unrecognized event format. The payload must be an AWS EventBridge/Azure Event Grid event envelope or a Stripe webhook (thin event notification or snapshot)."); + } + public static final class Signature { public static final String EXPECTED_SCHEME = "v1"; @@ -112,8 +176,10 @@ public static boolean verifyHeader( } /** - * Verifies the signature header sent by Stripe. Throws a SignatureVerificationException if the - * verification fails for any reason. + * Verifies the authenticity (and recency) of a webhook, throwing a {@code + * SignatureVerificationException} if there's a mismatch. Useful for quickly validating incoming + * webhooks before storing them for later processing (at which time you can use the {@code + * *WithoutVerification} methods for parsing). * * @param payload the payload sent by Stripe. * @param sigHeader the contents of the signature header sent by Stripe. @@ -171,6 +237,35 @@ public static boolean verifyHeader( return true; } + /** + * Generates a {@code Stripe-Signature} header for the given payload and secret using the + * current timestamp. + * + * @param payload the payload to sign. + * @param secret the webhook secret. + * @return the generated signature header string. + */ + public static String generateSignatureHeader(String payload, String secret) + throws NoSuchAlgorithmException, InvalidKeyException { + return generateSignatureHeader(payload, secret, Util.getTimeNow()); + } + + /** + * Compute the {@code Stripe-Signature} header for a given webhook body & secret. Useful for + * signing payloads in unit tests. + * + * @param payload the payload to sign. + * @param secret the webhook secret. + * @param timestamp the timestamp to use (seconds since epoch). + * @return the generated signature header string. + */ + public static String generateSignatureHeader(String payload, String secret, long timestamp) + throws NoSuchAlgorithmException, InvalidKeyException { + String payloadToSign = String.format("%d.%s", timestamp, payload); + String signature = computeSignature(payloadToSign, secret); + return String.format("t=%d,%s=%s", timestamp, EXPECTED_SCHEME, signature); + } + /** * Extracts the timestamp in a signature header. * diff --git a/src/main/java/com/stripe/param/CustomerBalanceTransactionCollectionCreateParams.java b/src/main/java/com/stripe/param/CustomerBalanceTransactionCollectionCreateParams.java index 69c60bbbedae..9aa33ee4a07f 100644 --- a/src/main/java/com/stripe/param/CustomerBalanceTransactionCollectionCreateParams.java +++ b/src/main/java/com/stripe/param/CustomerBalanceTransactionCollectionCreateParams.java @@ -21,6 +21,13 @@ public class CustomerBalanceTransactionCollectionCreateParams extends ApiRequest @SerializedName("amount") Long amount; + /** + * Required when {@code type} is {@code applied_to_invoice}. Identifies the open invoice to apply + * the customer's balance credit to. + */ + @SerializedName("applied_to_invoice") + AppliedToInvoice appliedToInvoice; + /** * Required. Three-letter ISO currency code, in lowercase. @@ -58,19 +65,31 @@ public class CustomerBalanceTransactionCollectionCreateParams extends ApiRequest @SerializedName("metadata") Object metadata; + /** + * The type of customer balance transaction. Defaults to {@code adjustment}, which updates the + * customer's credit balance directly. Set to {@code applied_to_invoice} to apply the customer's + * existing credit balance to a specific open invoice. + */ + @SerializedName("type") + Type type; + private CustomerBalanceTransactionCollectionCreateParams( Long amount, + AppliedToInvoice appliedToInvoice, String currency, String description, List expand, Map extraParams, - Object metadata) { + Object metadata, + Type type) { this.amount = amount; + this.appliedToInvoice = appliedToInvoice; this.currency = currency; this.description = description; this.expand = expand; this.extraParams = extraParams; this.metadata = metadata; + this.type = type; } public static Builder builder() { @@ -80,6 +99,8 @@ public static Builder builder() { public static class Builder { private Long amount; + private AppliedToInvoice appliedToInvoice; + private String currency; private String description; @@ -90,15 +111,19 @@ public static class Builder { private Object metadata; + private Type type; + /** Finalize and obtain parameter instance from this builder. */ public CustomerBalanceTransactionCollectionCreateParams build() { return new CustomerBalanceTransactionCollectionCreateParams( this.amount, + this.appliedToInvoice, this.currency, this.description, this.expand, this.extraParams, - this.metadata); + this.metadata, + this.type); } /** @@ -110,6 +135,16 @@ public Builder setAmount(Long amount) { return this; } + /** + * Required when {@code type} is {@code applied_to_invoice}. Identifies the open invoice to + * apply the customer's balance credit to. + */ + public Builder setAppliedToInvoice( + CustomerBalanceTransactionCollectionCreateParams.AppliedToInvoice appliedToInvoice) { + this.appliedToInvoice = appliedToInvoice; + return this; + } + /** * Required. Three-letter ISO currency code, in lowercase. @@ -233,5 +268,108 @@ public Builder setMetadata(Map metadata) { this.metadata = metadata; return this; } + + /** + * The type of customer balance transaction. Defaults to {@code adjustment}, which updates the + * customer's credit balance directly. Set to {@code applied_to_invoice} to apply the customer's + * existing credit balance to a specific open invoice. + */ + public Builder setType(CustomerBalanceTransactionCollectionCreateParams.Type type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class AppliedToInvoice { + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. The ID of the open invoice to apply the customer's balance credit + * to. + */ + @SerializedName("invoice") + String invoice; + + private AppliedToInvoice(Map extraParams, String invoice) { + this.extraParams = extraParams; + this.invoice = invoice; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String invoice; + + /** Finalize and obtain parameter instance from this builder. */ + public CustomerBalanceTransactionCollectionCreateParams.AppliedToInvoice build() { + return new CustomerBalanceTransactionCollectionCreateParams.AppliedToInvoice( + this.extraParams, this.invoice); + } + + /** + * 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 + * CustomerBalanceTransactionCollectionCreateParams.AppliedToInvoice#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 CustomerBalanceTransactionCollectionCreateParams.AppliedToInvoice#extraParams} + * for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Required. The ID of the open invoice to apply the customer's balance + * credit to. + */ + public Builder setInvoice(String invoice) { + this.invoice = invoice; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("adjustment") + ADJUSTMENT("adjustment"), + + @SerializedName("applied_to_invoice") + APPLIED_TO_INVOICE("applied_to_invoice"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } } } diff --git a/src/main/java/com/stripe/param/CustomerBalanceTransactionCreateParams.java b/src/main/java/com/stripe/param/CustomerBalanceTransactionCreateParams.java index 8b68b4dff7ae..73db6595a5c3 100644 --- a/src/main/java/com/stripe/param/CustomerBalanceTransactionCreateParams.java +++ b/src/main/java/com/stripe/param/CustomerBalanceTransactionCreateParams.java @@ -21,6 +21,13 @@ public class CustomerBalanceTransactionCreateParams extends ApiRequestParams { @SerializedName("amount") Long amount; + /** + * Required when {@code type} is {@code applied_to_invoice}. Identifies the open invoice to apply + * the customer's balance credit to. + */ + @SerializedName("applied_to_invoice") + AppliedToInvoice appliedToInvoice; + /** * Required. Three-letter ISO currency code, in lowercase. @@ -58,19 +65,31 @@ public class CustomerBalanceTransactionCreateParams extends ApiRequestParams { @SerializedName("metadata") Object metadata; + /** + * The type of customer balance transaction. Defaults to {@code adjustment}, which updates the + * customer's credit balance directly. Set to {@code applied_to_invoice} to apply the customer's + * existing credit balance to a specific open invoice. + */ + @SerializedName("type") + Type type; + private CustomerBalanceTransactionCreateParams( Long amount, + AppliedToInvoice appliedToInvoice, String currency, String description, List expand, Map extraParams, - Object metadata) { + Object metadata, + Type type) { this.amount = amount; + this.appliedToInvoice = appliedToInvoice; this.currency = currency; this.description = description; this.expand = expand; this.extraParams = extraParams; this.metadata = metadata; + this.type = type; } public static Builder builder() { @@ -80,6 +99,8 @@ public static Builder builder() { public static class Builder { private Long amount; + private AppliedToInvoice appliedToInvoice; + private String currency; private String description; @@ -90,15 +111,19 @@ public static class Builder { private Object metadata; + private Type type; + /** Finalize and obtain parameter instance from this builder. */ public CustomerBalanceTransactionCreateParams build() { return new CustomerBalanceTransactionCreateParams( this.amount, + this.appliedToInvoice, this.currency, this.description, this.expand, this.extraParams, - this.metadata); + this.metadata, + this.type); } /** @@ -110,6 +135,16 @@ public Builder setAmount(Long amount) { return this; } + /** + * Required when {@code type} is {@code applied_to_invoice}. Identifies the open invoice to + * apply the customer's balance credit to. + */ + public Builder setAppliedToInvoice( + CustomerBalanceTransactionCreateParams.AppliedToInvoice appliedToInvoice) { + this.appliedToInvoice = appliedToInvoice; + return this; + } + /** * Required. Three-letter ISO currency code, in lowercase. @@ -231,5 +266,108 @@ public Builder setMetadata(Map metadata) { this.metadata = metadata; return this; } + + /** + * The type of customer balance transaction. Defaults to {@code adjustment}, which updates the + * customer's credit balance directly. Set to {@code applied_to_invoice} to apply the customer's + * existing credit balance to a specific open invoice. + */ + public Builder setType(CustomerBalanceTransactionCreateParams.Type type) { + this.type = type; + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class AppliedToInvoice { + /** + * Map of extra parameters for custom features not available in this client library. The content + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each + * key/value pair is serialized as if the key is a root-level field (serialized) name in this + * param object. Effectively, this map is flattened to its parent instance. + */ + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) + Map extraParams; + + /** + * Required. The ID of the open invoice to apply the customer's balance credit + * to. + */ + @SerializedName("invoice") + String invoice; + + private AppliedToInvoice(Map extraParams, String invoice) { + this.extraParams = extraParams; + this.invoice = invoice; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Map extraParams; + + private String invoice; + + /** Finalize and obtain parameter instance from this builder. */ + public CustomerBalanceTransactionCreateParams.AppliedToInvoice build() { + return new CustomerBalanceTransactionCreateParams.AppliedToInvoice( + this.extraParams, this.invoice); + } + + /** + * 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 + * CustomerBalanceTransactionCreateParams.AppliedToInvoice#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 CustomerBalanceTransactionCreateParams.AppliedToInvoice#extraParams} for the + * field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + + /** + * Required. The ID of the open invoice to apply the customer's balance + * credit to. + */ + public Builder setInvoice(String invoice) { + this.invoice = invoice; + return this; + } + } + } + + public enum Type implements ApiRequestParams.EnumParam { + @SerializedName("adjustment") + ADJUSTMENT("adjustment"), + + @SerializedName("applied_to_invoice") + APPLIED_TO_INVOICE("applied_to_invoice"); + + @Getter(onMethod_ = {@Override}) + private final String value; + + Type(String value) { + this.value = value; + } } } diff --git a/src/main/java/com/stripe/param/InvoiceCreateParams.java b/src/main/java/com/stripe/param/InvoiceCreateParams.java index b1a76fc92cda..5adaaf2a1efc 100644 --- a/src/main/java/com/stripe/param/InvoiceCreateParams.java +++ b/src/main/java/com/stripe/param/InvoiceCreateParams.java @@ -5297,6 +5297,9 @@ public enum PaymentMethodType implements ApiRequestParams.EnumParam { @SerializedName("bancontact") BANCONTACT("bancontact"), + @SerializedName("billie") + BILLIE("billie"), + @SerializedName("bizum") BIZUM("bizum"), @@ -5390,6 +5393,9 @@ public enum PaymentMethodType implements ApiRequestParams.EnumParam { @SerializedName("paypal") PAYPAL("paypal"), + @SerializedName("paypay") + PAYPAY("paypay"), + @SerializedName("payto") PAYTO("payto"), @@ -5432,6 +5438,9 @@ public enum PaymentMethodType implements ApiRequestParams.EnumParam { @SerializedName("us_bank_account") US_BANK_ACCOUNT("us_bank_account"), + @SerializedName("vipps") + VIPPS("vipps"), + @SerializedName("wechat_pay") WECHAT_PAY("wechat_pay"); diff --git a/src/main/java/com/stripe/param/InvoiceUpdateParams.java b/src/main/java/com/stripe/param/InvoiceUpdateParams.java index c532dbccd852..b60a81098689 100644 --- a/src/main/java/com/stripe/param/InvoiceUpdateParams.java +++ b/src/main/java/com/stripe/param/InvoiceUpdateParams.java @@ -5344,6 +5344,9 @@ public enum PaymentMethodType implements ApiRequestParams.EnumParam { @SerializedName("bancontact") BANCONTACT("bancontact"), + @SerializedName("billie") + BILLIE("billie"), + @SerializedName("bizum") BIZUM("bizum"), @@ -5437,6 +5440,9 @@ public enum PaymentMethodType implements ApiRequestParams.EnumParam { @SerializedName("paypal") PAYPAL("paypal"), + @SerializedName("paypay") + PAYPAY("paypay"), + @SerializedName("payto") PAYTO("payto"), @@ -5479,6 +5485,9 @@ public enum PaymentMethodType implements ApiRequestParams.EnumParam { @SerializedName("us_bank_account") US_BANK_ACCOUNT("us_bank_account"), + @SerializedName("vipps") + VIPPS("vipps"), + @SerializedName("wechat_pay") WECHAT_PAY("wechat_pay"); diff --git a/src/main/java/com/stripe/param/PaymentAttemptRecordReportFailedParams.java b/src/main/java/com/stripe/param/PaymentAttemptRecordReportFailedParams.java index b84d6b16550d..9146178e3c3b 100644 --- a/src/main/java/com/stripe/param/PaymentAttemptRecordReportFailedParams.java +++ b/src/main/java/com/stripe/param/PaymentAttemptRecordReportFailedParams.java @@ -33,7 +33,10 @@ public class PaymentAttemptRecordReportFailedParams extends ApiRequestParams { /** * The failure code for this payment attempt. Must be one of {@code - * payment_method_customer_decline} or {@code payment_method_provider_unknown_outcome}. + * payment_method_customer_decline}, {@code payment_method_provider_unknown_outcome}, {@code + * authentication_failure}, {@code expired_payment_method}, {@code incorrect_cvc}, {@code + * incorrect_number}, {@code incorrect_postal_code}, {@code insufficient_funds}, {@code + * processing_error}, or {@code payment_method_restricted}. */ @SerializedName("failure_code") FailureCode failureCode; @@ -172,7 +175,10 @@ public Builder setFailedAt(Long failedAt) { /** * The failure code for this payment attempt. Must be one of {@code - * payment_method_customer_decline} or {@code payment_method_provider_unknown_outcome}. + * payment_method_customer_decline}, {@code payment_method_provider_unknown_outcome}, {@code + * authentication_failure}, {@code expired_payment_method}, {@code incorrect_cvc}, {@code + * incorrect_number}, {@code incorrect_postal_code}, {@code insufficient_funds}, {@code + * processing_error}, or {@code payment_method_restricted}. */ public Builder setFailureCode(PaymentAttemptRecordReportFailedParams.FailureCode failureCode) { this.failureCode = failureCode; @@ -381,9 +387,14 @@ public static class Card { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; - private Card(Checks checks, Map extraParams) { + /** Decline code from the card network for the failed payment. */ + @SerializedName("network_decline_code") + String networkDeclineCode; + + private Card(Checks checks, Map extraParams, String networkDeclineCode) { this.checks = checks; this.extraParams = extraParams; + this.networkDeclineCode = networkDeclineCode; } public static Builder builder() { @@ -395,10 +406,12 @@ public static class Builder { private Map extraParams; + private String networkDeclineCode; + /** Finalize and obtain parameter instance from this builder. */ public PaymentAttemptRecordReportFailedParams.PaymentMethodDetails.Card build() { return new PaymentAttemptRecordReportFailedParams.PaymentMethodDetails.Card( - this.checks, this.extraParams); + this.checks, this.extraParams, this.networkDeclineCode); } /** Verification checks performed on the card. */ @@ -437,6 +450,12 @@ public Builder putAllExtraParam(Map map) { this.extraParams.putAll(map); return this; } + + /** Decline code from the card network for the failed payment. */ + public Builder setNetworkDeclineCode(String networkDeclineCode) { + this.networkDeclineCode = networkDeclineCode; + return this; + } } @Getter @@ -819,11 +838,35 @@ public enum Type implements ApiRequestParams.EnumParam { } public enum FailureCode implements ApiRequestParams.EnumParam { + @SerializedName("authentication_failure") + AUTHENTICATION_FAILURE("authentication_failure"), + + @SerializedName("expired_payment_method") + EXPIRED_PAYMENT_METHOD("expired_payment_method"), + + @SerializedName("incorrect_cvc") + INCORRECT_CVC("incorrect_cvc"), + + @SerializedName("incorrect_number") + INCORRECT_NUMBER("incorrect_number"), + + @SerializedName("incorrect_postal_code") + INCORRECT_POSTAL_CODE("incorrect_postal_code"), + + @SerializedName("insufficient_funds") + INSUFFICIENT_FUNDS("insufficient_funds"), + @SerializedName("payment_method_customer_decline") PAYMENT_METHOD_CUSTOMER_DECLINE("payment_method_customer_decline"), @SerializedName("payment_method_provider_unknown_outcome") - PAYMENT_METHOD_PROVIDER_UNKNOWN_OUTCOME("payment_method_provider_unknown_outcome"); + PAYMENT_METHOD_PROVIDER_UNKNOWN_OUTCOME("payment_method_provider_unknown_outcome"), + + @SerializedName("payment_method_restricted") + PAYMENT_METHOD_RESTRICTED("payment_method_restricted"), + + @SerializedName("processing_error") + PROCESSING_ERROR("processing_error"); @Getter(onMethod_ = {@Override}) private final String value; diff --git a/src/main/java/com/stripe/param/PaymentRecordReportPaymentAttemptFailedParams.java b/src/main/java/com/stripe/param/PaymentRecordReportPaymentAttemptFailedParams.java index fec906677331..93f18893c237 100644 --- a/src/main/java/com/stripe/param/PaymentRecordReportPaymentAttemptFailedParams.java +++ b/src/main/java/com/stripe/param/PaymentRecordReportPaymentAttemptFailedParams.java @@ -33,7 +33,10 @@ public class PaymentRecordReportPaymentAttemptFailedParams extends ApiRequestPar /** * The failure code for this payment attempt. Must be one of {@code - * payment_method_customer_decline} or {@code payment_method_provider_unknown_outcome}. + * payment_method_customer_decline}, {@code payment_method_provider_unknown_outcome}, {@code + * authentication_failure}, {@code expired_payment_method}, {@code incorrect_cvc}, {@code + * incorrect_number}, {@code incorrect_postal_code}, {@code insufficient_funds}, {@code + * processing_error}, or {@code payment_method_restricted}. */ @SerializedName("failure_code") FailureCode failureCode; @@ -173,7 +176,10 @@ public Builder setFailedAt(Long failedAt) { /** * The failure code for this payment attempt. Must be one of {@code - * payment_method_customer_decline} or {@code payment_method_provider_unknown_outcome}. + * payment_method_customer_decline}, {@code payment_method_provider_unknown_outcome}, {@code + * authentication_failure}, {@code expired_payment_method}, {@code incorrect_cvc}, {@code + * incorrect_number}, {@code incorrect_postal_code}, {@code insufficient_funds}, {@code + * processing_error}, or {@code payment_method_restricted}. */ public Builder setFailureCode( PaymentRecordReportPaymentAttemptFailedParams.FailureCode failureCode) { @@ -385,9 +391,14 @@ public static class Card { @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map extraParams; - private Card(Checks checks, Map extraParams) { + /** Decline code from the card network for the failed payment. */ + @SerializedName("network_decline_code") + String networkDeclineCode; + + private Card(Checks checks, Map extraParams, String networkDeclineCode) { this.checks = checks; this.extraParams = extraParams; + this.networkDeclineCode = networkDeclineCode; } public static Builder builder() { @@ -399,10 +410,12 @@ public static class Builder { private Map extraParams; + private String networkDeclineCode; + /** Finalize and obtain parameter instance from this builder. */ public PaymentRecordReportPaymentAttemptFailedParams.PaymentMethodDetails.Card build() { return new PaymentRecordReportPaymentAttemptFailedParams.PaymentMethodDetails.Card( - this.checks, this.extraParams); + this.checks, this.extraParams, this.networkDeclineCode); } /** Verification checks performed on the card. */ @@ -441,6 +454,12 @@ public Builder putAllExtraParam(Map map) { this.extraParams.putAll(map); return this; } + + /** Decline code from the card network for the failed payment. */ + public Builder setNetworkDeclineCode(String networkDeclineCode) { + this.networkDeclineCode = networkDeclineCode; + return this; + } } @Getter @@ -827,11 +846,35 @@ public enum Type implements ApiRequestParams.EnumParam { } public enum FailureCode implements ApiRequestParams.EnumParam { + @SerializedName("authentication_failure") + AUTHENTICATION_FAILURE("authentication_failure"), + + @SerializedName("expired_payment_method") + EXPIRED_PAYMENT_METHOD("expired_payment_method"), + + @SerializedName("incorrect_cvc") + INCORRECT_CVC("incorrect_cvc"), + + @SerializedName("incorrect_number") + INCORRECT_NUMBER("incorrect_number"), + + @SerializedName("incorrect_postal_code") + INCORRECT_POSTAL_CODE("incorrect_postal_code"), + + @SerializedName("insufficient_funds") + INSUFFICIENT_FUNDS("insufficient_funds"), + @SerializedName("payment_method_customer_decline") PAYMENT_METHOD_CUSTOMER_DECLINE("payment_method_customer_decline"), @SerializedName("payment_method_provider_unknown_outcome") - PAYMENT_METHOD_PROVIDER_UNKNOWN_OUTCOME("payment_method_provider_unknown_outcome"); + PAYMENT_METHOD_PROVIDER_UNKNOWN_OUTCOME("payment_method_provider_unknown_outcome"), + + @SerializedName("payment_method_restricted") + PAYMENT_METHOD_RESTRICTED("payment_method_restricted"), + + @SerializedName("processing_error") + PROCESSING_ERROR("processing_error"); @Getter(onMethod_ = {@Override}) private final String value; diff --git a/src/main/java/com/stripe/param/PaymentRecordReportPaymentAttemptParams.java b/src/main/java/com/stripe/param/PaymentRecordReportPaymentAttemptParams.java index c5838838cd62..097544188780 100644 --- a/src/main/java/com/stripe/param/PaymentRecordReportPaymentAttemptParams.java +++ b/src/main/java/com/stripe/param/PaymentRecordReportPaymentAttemptParams.java @@ -301,7 +301,10 @@ public static class Failed { /** * The failure code for this payment attempt. Must be one of {@code - * payment_method_customer_decline} or {@code payment_method_provider_unknown_outcome}. + * payment_method_customer_decline}, {@code payment_method_provider_unknown_outcome}, {@code + * authentication_failure}, {@code expired_payment_method}, {@code incorrect_cvc}, {@code + * incorrect_number}, {@code incorrect_postal_code}, {@code insufficient_funds}, {@code + * processing_error}, or {@code payment_method_restricted}. */ @SerializedName("failure_code") FailureCode failureCode; @@ -390,7 +393,10 @@ public Builder setFailedAt(Long failedAt) { /** * The failure code for this payment attempt. Must be one of {@code - * payment_method_customer_decline} or {@code payment_method_provider_unknown_outcome}. + * payment_method_customer_decline}, {@code payment_method_provider_unknown_outcome}, {@code + * authentication_failure}, {@code expired_payment_method}, {@code incorrect_cvc}, {@code + * incorrect_number}, {@code incorrect_postal_code}, {@code insufficient_funds}, {@code + * processing_error}, or {@code payment_method_restricted}. */ public Builder setFailureCode( PaymentRecordReportPaymentAttemptParams.Failed.FailureCode failureCode) { @@ -625,11 +631,35 @@ public enum Type implements ApiRequestParams.EnumParam { } public enum FailureCode implements ApiRequestParams.EnumParam { + @SerializedName("authentication_failure") + AUTHENTICATION_FAILURE("authentication_failure"), + + @SerializedName("expired_payment_method") + EXPIRED_PAYMENT_METHOD("expired_payment_method"), + + @SerializedName("incorrect_cvc") + INCORRECT_CVC("incorrect_cvc"), + + @SerializedName("incorrect_number") + INCORRECT_NUMBER("incorrect_number"), + + @SerializedName("incorrect_postal_code") + INCORRECT_POSTAL_CODE("incorrect_postal_code"), + + @SerializedName("insufficient_funds") + INSUFFICIENT_FUNDS("insufficient_funds"), + @SerializedName("payment_method_customer_decline") PAYMENT_METHOD_CUSTOMER_DECLINE("payment_method_customer_decline"), @SerializedName("payment_method_provider_unknown_outcome") - PAYMENT_METHOD_PROVIDER_UNKNOWN_OUTCOME("payment_method_provider_unknown_outcome"); + PAYMENT_METHOD_PROVIDER_UNKNOWN_OUTCOME("payment_method_provider_unknown_outcome"), + + @SerializedName("payment_method_restricted") + PAYMENT_METHOD_RESTRICTED("payment_method_restricted"), + + @SerializedName("processing_error") + PROCESSING_ERROR("processing_error"); @Getter(onMethod_ = {@Override}) private final String value; diff --git a/src/main/java/com/stripe/param/PaymentRecordReportPaymentParams.java b/src/main/java/com/stripe/param/PaymentRecordReportPaymentParams.java index ebaceec36c51..bb2c06fbaab8 100644 --- a/src/main/java/com/stripe/param/PaymentRecordReportPaymentParams.java +++ b/src/main/java/com/stripe/param/PaymentRecordReportPaymentParams.java @@ -576,7 +576,10 @@ public static class Failed { /** * The failure code for this payment attempt. Must be one of {@code - * payment_method_customer_decline} or {@code payment_method_provider_unknown_outcome}. + * payment_method_customer_decline}, {@code payment_method_provider_unknown_outcome}, {@code + * authentication_failure}, {@code expired_payment_method}, {@code incorrect_cvc}, {@code + * incorrect_number}, {@code incorrect_postal_code}, {@code insufficient_funds}, {@code + * processing_error}, or {@code payment_method_restricted}. */ @SerializedName("failure_code") FailureCode failureCode; @@ -665,7 +668,10 @@ public Builder setFailedAt(Long failedAt) { /** * The failure code for this payment attempt. Must be one of {@code - * payment_method_customer_decline} or {@code payment_method_provider_unknown_outcome}. + * payment_method_customer_decline}, {@code payment_method_provider_unknown_outcome}, {@code + * authentication_failure}, {@code expired_payment_method}, {@code incorrect_cvc}, {@code + * incorrect_number}, {@code incorrect_postal_code}, {@code insufficient_funds}, {@code + * processing_error}, or {@code payment_method_restricted}. */ public Builder setFailureCode( PaymentRecordReportPaymentParams.Failed.FailureCode failureCode) { @@ -897,11 +903,35 @@ public enum Type implements ApiRequestParams.EnumParam { } public enum FailureCode implements ApiRequestParams.EnumParam { + @SerializedName("authentication_failure") + AUTHENTICATION_FAILURE("authentication_failure"), + + @SerializedName("expired_payment_method") + EXPIRED_PAYMENT_METHOD("expired_payment_method"), + + @SerializedName("incorrect_cvc") + INCORRECT_CVC("incorrect_cvc"), + + @SerializedName("incorrect_number") + INCORRECT_NUMBER("incorrect_number"), + + @SerializedName("incorrect_postal_code") + INCORRECT_POSTAL_CODE("incorrect_postal_code"), + + @SerializedName("insufficient_funds") + INSUFFICIENT_FUNDS("insufficient_funds"), + @SerializedName("payment_method_customer_decline") PAYMENT_METHOD_CUSTOMER_DECLINE("payment_method_customer_decline"), @SerializedName("payment_method_provider_unknown_outcome") - PAYMENT_METHOD_PROVIDER_UNKNOWN_OUTCOME("payment_method_provider_unknown_outcome"); + PAYMENT_METHOD_PROVIDER_UNKNOWN_OUTCOME("payment_method_provider_unknown_outcome"), + + @SerializedName("payment_method_restricted") + PAYMENT_METHOD_RESTRICTED("payment_method_restricted"), + + @SerializedName("processing_error") + PROCESSING_ERROR("processing_error"); @Getter(onMethod_ = {@Override}) private final String value; diff --git a/src/main/java/com/stripe/param/SubscriptionCreateParams.java b/src/main/java/com/stripe/param/SubscriptionCreateParams.java index d9546628768e..8d33d93fb85a 100644 --- a/src/main/java/com/stripe/param/SubscriptionCreateParams.java +++ b/src/main/java/com/stripe/param/SubscriptionCreateParams.java @@ -9935,6 +9935,9 @@ public enum PaymentMethodType implements ApiRequestParams.EnumParam { @SerializedName("bancontact") BANCONTACT("bancontact"), + @SerializedName("billie") + BILLIE("billie"), + @SerializedName("bizum") BIZUM("bizum"), @@ -10028,6 +10031,9 @@ public enum PaymentMethodType implements ApiRequestParams.EnumParam { @SerializedName("paypal") PAYPAL("paypal"), + @SerializedName("paypay") + PAYPAY("paypay"), + @SerializedName("payto") PAYTO("payto"), @@ -10070,6 +10076,9 @@ public enum PaymentMethodType implements ApiRequestParams.EnumParam { @SerializedName("us_bank_account") US_BANK_ACCOUNT("us_bank_account"), + @SerializedName("vipps") + VIPPS("vipps"), + @SerializedName("wechat_pay") WECHAT_PAY("wechat_pay"); diff --git a/src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java b/src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java index 7cb7b10c1e33..592c5f4660b1 100644 --- a/src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java +++ b/src/main/java/com/stripe/param/SubscriptionScheduleCreateParams.java @@ -87,8 +87,8 @@ public class SubscriptionScheduleCreateParams extends ApiRequestParams { Object metadata; /** - * Sets the pause schedules for the subscription schedule. Each entry configures when and how the - * subscription pauses and optionally when and how it resumes. + * Configures the subscription's pause behavior and, optionally, its resume behavior. Only one + * entry is supported. */ @SerializedName("pause_schedules") List pauseSchedules; @@ -2417,7 +2417,7 @@ public static class PauseSchedule { @SerializedName("key") String key; - /** Required. Configuration for when and how the subscription pauses. */ + /** Configuration for when and how the subscription pauses. */ @SerializedName("pause") Pause pause; @@ -2484,7 +2484,7 @@ public Builder setKey(String key) { return this; } - /** Required. Configuration for when and how the subscription pauses. */ + /** Configuration for when and how the subscription pauses. */ public Builder setPause(SubscriptionScheduleCreateParams.PauseSchedule.Pause pause) { this.pause = pause; return this; @@ -3489,7 +3489,7 @@ public static class Settings { /** * Controls whether Stripe attempts payment on the resumption invoice and how payment - * affects the subscription's status. The default is {@code resume_on_payment_attempt}. + * affects the subscription's status. The default is {@code resume_on_payment_success}. */ @SerializedName("payment_behavior") PaymentBehavior paymentBehavior; @@ -3574,7 +3574,7 @@ public Builder putAllExtraParam(Map map) { /** * Controls whether Stripe attempts payment on the resumption invoice and how payment - * affects the subscription's status. The default is {@code resume_on_payment_attempt}. + * affects the subscription's status. The default is {@code resume_on_payment_success}. */ public Builder setPaymentBehavior( SubscriptionScheduleCreateParams.PauseSchedule.Resume.Settings.PaymentBehavior diff --git a/src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java b/src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java index 190d21f5ee25..1b9343f3c24f 100644 --- a/src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java +++ b/src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java @@ -65,9 +65,9 @@ public class SubscriptionScheduleUpdateParams extends ApiRequestParams { Object metadata; /** - * Sets the pause schedules for the subscription schedule. Include a {@code key} to update an - * existing entry or omit it to add a new one. Pass {@code ""} to clear all entries or {@code []} - * to leave them unchanged. + * Configures the subscription's pause behavior and, optionally, its resume behavior. Only one + * entry is supported. Include a key to update an existing entry. Omit to leave an existing pause + * schedule unchanged, or pass "" to clear it. */ @SerializedName("pause_schedules") Object pauseSchedules; @@ -367,9 +367,9 @@ public Builder addAllPauseSchedule( } /** - * Sets the pause schedules for the subscription schedule. Include a {@code key} to update an - * existing entry or omit it to add a new one. Pass {@code ""} to clear all entries or {@code - * []} to leave them unchanged. + * Configures the subscription's pause behavior and, optionally, its resume behavior. Only one + * entry is supported. Include a key to update an existing entry. Omit to leave an existing + * pause schedule unchanged, or pass "" to clear it. */ public Builder setPauseSchedules(EmptyParam pauseSchedules) { this.pauseSchedules = pauseSchedules; @@ -377,9 +377,9 @@ public Builder setPauseSchedules(EmptyParam pauseSchedules) { } /** - * Sets the pause schedules for the subscription schedule. Include a {@code key} to update an - * existing entry or omit it to add a new one. Pass {@code ""} to clear all entries or {@code - * []} to leave them unchanged. + * Configures the subscription's pause behavior and, optionally, its resume behavior. Only one + * entry is supported. Include a key to update an existing entry. Omit to leave an existing + * pause schedule unchanged, or pass "" to clear it. */ public Builder setPauseSchedules( List pauseSchedules) { @@ -2242,9 +2242,9 @@ public static class PauseSchedule { /** Configuration for when and how the subscription resumes. */ @SerializedName("resume") - Resume resume; + Object resume; - private PauseSchedule(Map extraParams, Object key, Pause pause, Resume resume) { + private PauseSchedule(Map extraParams, Object key, Pause pause, Object resume) { this.extraParams = extraParams; this.key = key; this.pause = pause; @@ -2262,7 +2262,7 @@ public static class Builder { private Pause pause; - private Resume resume; + private Object resume; /** Finalize and obtain parameter instance from this builder. */ public SubscriptionScheduleUpdateParams.PauseSchedule build() { @@ -2320,6 +2320,12 @@ public Builder setResume(SubscriptionScheduleUpdateParams.PauseSchedule.Resume r this.resume = resume; return this; } + + /** Configuration for when and how the subscription resumes. */ + public Builder setResume(EmptyParam resume) { + this.resume = resume; + return this; + } } @Getter @@ -3314,7 +3320,7 @@ public static class Settings { /** * Controls whether Stripe attempts payment on the resumption invoice and how payment - * affects the subscription's status. The default is {@code resume_on_payment_attempt}. + * affects the subscription's status. The default is {@code resume_on_payment_success}. */ @SerializedName("payment_behavior") PaymentBehavior paymentBehavior; @@ -3399,7 +3405,7 @@ public Builder putAllExtraParam(Map map) { /** * Controls whether Stripe attempts payment on the resumption invoice and how payment - * affects the subscription's status. The default is {@code resume_on_payment_attempt}. + * affects the subscription's status. The default is {@code resume_on_payment_success}. */ public Builder setPaymentBehavior( SubscriptionScheduleUpdateParams.PauseSchedule.Resume.Settings.PaymentBehavior diff --git a/src/main/java/com/stripe/param/SubscriptionUpdateParams.java b/src/main/java/com/stripe/param/SubscriptionUpdateParams.java index 2102c60c037d..5b1cf8570c45 100644 --- a/src/main/java/com/stripe/param/SubscriptionUpdateParams.java +++ b/src/main/java/com/stripe/param/SubscriptionUpdateParams.java @@ -10135,6 +10135,9 @@ public enum PaymentMethodType implements ApiRequestParams.EnumParam { @SerializedName("bancontact") BANCONTACT("bancontact"), + @SerializedName("billie") + BILLIE("billie"), + @SerializedName("bizum") BIZUM("bizum"), @@ -10228,6 +10231,9 @@ public enum PaymentMethodType implements ApiRequestParams.EnumParam { @SerializedName("paypal") PAYPAL("paypal"), + @SerializedName("paypay") + PAYPAY("paypay"), + @SerializedName("payto") PAYTO("payto"), @@ -10270,6 +10276,9 @@ public enum PaymentMethodType implements ApiRequestParams.EnumParam { @SerializedName("us_bank_account") US_BANK_ACCOUNT("us_bank_account"), + @SerializedName("vipps") + VIPPS("vipps"), + @SerializedName("wechat_pay") WECHAT_PAY("wechat_pay"); diff --git a/src/main/java/com/stripe/param/crypto/OnrampSessionCreateParams.java b/src/main/java/com/stripe/param/crypto/OnrampSessionCreateParams.java index a2a3c92989d5..e221f50b1deb 100644 --- a/src/main/java/com/stripe/param/crypto/OnrampSessionCreateParams.java +++ b/src/main/java/com/stripe/param/crypto/OnrampSessionCreateParams.java @@ -772,6 +772,9 @@ public enum DestinationNetwork implements ApiRequestParams.EnumParam { @SerializedName("bitcoin") BITCOIN("bitcoin"), + @SerializedName("celo") + CELO("celo"), + @SerializedName("ethereum") ETHEREUM("ethereum"), diff --git a/src/main/java/com/stripe/param/crypto/OnrampSessionListParams.java b/src/main/java/com/stripe/param/crypto/OnrampSessionListParams.java index a9b83d09dd8c..fa5f68e304b1 100644 --- a/src/main/java/com/stripe/param/crypto/OnrampSessionListParams.java +++ b/src/main/java/com/stripe/param/crypto/OnrampSessionListParams.java @@ -373,6 +373,9 @@ public enum DestinationNetwork implements ApiRequestParams.EnumParam { @SerializedName("bitcoin") BITCOIN("bitcoin"), + @SerializedName("celo") + CELO("celo"), + @SerializedName("ethereum") ETHEREUM("ethereum"), diff --git a/src/main/java/com/stripe/param/crypto/OnrampTransactionLimitsRetrieveParams.java b/src/main/java/com/stripe/param/crypto/OnrampTransactionLimitsRetrieveParams.java index 8af8926c5751..58cabc120bd2 100644 --- a/src/main/java/com/stripe/param/crypto/OnrampTransactionLimitsRetrieveParams.java +++ b/src/main/java/com/stripe/param/crypto/OnrampTransactionLimitsRetrieveParams.java @@ -179,6 +179,9 @@ public enum DestinationNetwork implements ApiRequestParams.EnumParam { @SerializedName("bitcoin") BITCOIN("bitcoin"), + @SerializedName("celo") + CELO("celo"), + @SerializedName("ethereum") ETHEREUM("ethereum"), diff --git a/src/main/java/com/stripe/param/issuing/CardholderCreateParams.java b/src/main/java/com/stripe/param/issuing/CardholderCreateParams.java index 92abf4242f01..e8fd6e7a4d85 100644 --- a/src/main/java/com/stripe/param/issuing/CardholderCreateParams.java +++ b/src/main/java/com/stripe/param/issuing/CardholderCreateParams.java @@ -74,9 +74,9 @@ public class CardholderCreateParams extends ApiRequestParams { /** * The cardholder’s preferred locales (languages), ordered by preference. Locales can be {@code - * da}, {@code de}, {@code en}, {@code es}, {@code fr}, {@code it}, {@code pl}, or {@code sv}. - * This changes the language of the 3D Secure - * flow and one-time password messages sent to the cardholder. + * de}, {@code en}, {@code es}, {@code fr}, or {@code it}. This changes the language of the 3D Secure flow and one-time password + * messages sent to the cardholder. */ @SerializedName("preferred_locales") List preferredLocales; @@ -4611,12 +4611,18 @@ public enum PreferredLocale implements ApiRequestParams.EnumParam { @SerializedName("fr") FR("fr"), + @SerializedName("hu") + HU("hu"), + @SerializedName("it") IT("it"), @SerializedName("pl") PL("pl"), + @SerializedName("ro") + RO("ro"), + @SerializedName("sv") SV("sv"); diff --git a/src/main/java/com/stripe/param/issuing/CardholderUpdateParams.java b/src/main/java/com/stripe/param/issuing/CardholderUpdateParams.java index aff36d6e36f8..eca05b5efa84 100644 --- a/src/main/java/com/stripe/param/issuing/CardholderUpdateParams.java +++ b/src/main/java/com/stripe/param/issuing/CardholderUpdateParams.java @@ -66,9 +66,9 @@ public class CardholderUpdateParams extends ApiRequestParams { /** * The cardholder’s preferred locales (languages), ordered by preference. Locales can be {@code - * da}, {@code de}, {@code en}, {@code es}, {@code fr}, {@code it}, {@code pl}, or {@code sv}. - * This changes the language of the 3D Secure - * flow and one-time password messages sent to the cardholder. + * de}, {@code en}, {@code es}, {@code fr}, or {@code it}. This changes the language of the 3D Secure flow and one-time password + * messages sent to the cardholder. */ @SerializedName("preferred_locales") List preferredLocales; @@ -4691,12 +4691,18 @@ public enum PreferredLocale implements ApiRequestParams.EnumParam { @SerializedName("fr") FR("fr"), + @SerializedName("hu") + HU("hu"), + @SerializedName("it") IT("it"), @SerializedName("pl") PL("pl"), + @SerializedName("ro") + RO("ro"), + @SerializedName("sv") SV("sv"); diff --git a/src/main/java/com/stripe/param/v2/billing/ContractActivateParams.java b/src/main/java/com/stripe/param/v2/billing/ContractActivateParams.java index ef0fb4a078a6..ef3b09ef2c74 100644 --- a/src/main/java/com/stripe/param/v2/billing/ContractActivateParams.java +++ b/src/main/java/com/stripe/param/v2/billing/ContractActivateParams.java @@ -103,6 +103,9 @@ public enum Include implements ApiRequestParams.EnumParam { @SerializedName("billing_settings") BILLING_SETTINGS("billing_settings"), + @SerializedName("one_time_fees") + ONE_TIME_FEES("one_time_fees"), + @SerializedName("pricing_lines") PRICING_LINES("pricing_lines"), diff --git a/src/main/java/com/stripe/param/v2/billing/ContractCancelParams.java b/src/main/java/com/stripe/param/v2/billing/ContractCancelParams.java index b744cfc7bcda..39566b960541 100644 --- a/src/main/java/com/stripe/param/v2/billing/ContractCancelParams.java +++ b/src/main/java/com/stripe/param/v2/billing/ContractCancelParams.java @@ -280,6 +280,9 @@ public enum Include implements ApiRequestParams.EnumParam { @SerializedName("billing_settings") BILLING_SETTINGS("billing_settings"), + @SerializedName("one_time_fees") + ONE_TIME_FEES("one_time_fees"), + @SerializedName("pricing_lines") PRICING_LINES("pricing_lines"), diff --git a/src/main/java/com/stripe/param/v2/billing/ContractCreateParams.java b/src/main/java/com/stripe/param/v2/billing/ContractCreateParams.java index 80b0cde10b7e..de9af58a0f3e 100644 --- a/src/main/java/com/stripe/param/v2/billing/ContractCreateParams.java +++ b/src/main/java/com/stripe/param/v2/billing/ContractCreateParams.java @@ -3268,6 +3268,9 @@ public enum Include implements ApiRequestParams.EnumParam { @SerializedName("billing_settings") BILLING_SETTINGS("billing_settings"), + @SerializedName("one_time_fees") + ONE_TIME_FEES("one_time_fees"), + @SerializedName("pricing_lines") PRICING_LINES("pricing_lines"), diff --git a/src/main/java/com/stripe/param/v2/billing/ContractListParams.java b/src/main/java/com/stripe/param/v2/billing/ContractListParams.java index 06ce57e8e0a2..a4d792d7e9c3 100644 --- a/src/main/java/com/stripe/param/v2/billing/ContractListParams.java +++ b/src/main/java/com/stripe/param/v2/billing/ContractListParams.java @@ -132,6 +132,9 @@ public enum Include implements ApiRequestParams.EnumParam { @SerializedName("billing_settings") BILLING_SETTINGS("billing_settings"), + @SerializedName("one_time_fees") + ONE_TIME_FEES("one_time_fees"), + @SerializedName("pricing_lines") PRICING_LINES("pricing_lines"), diff --git a/src/main/java/com/stripe/param/v2/billing/ContractRetrieveParams.java b/src/main/java/com/stripe/param/v2/billing/ContractRetrieveParams.java index f7fb50e81be3..4f65a58b6a4d 100644 --- a/src/main/java/com/stripe/param/v2/billing/ContractRetrieveParams.java +++ b/src/main/java/com/stripe/param/v2/billing/ContractRetrieveParams.java @@ -103,6 +103,9 @@ public enum Include implements ApiRequestParams.EnumParam { @SerializedName("billing_settings") BILLING_SETTINGS("billing_settings"), + @SerializedName("one_time_fees") + ONE_TIME_FEES("one_time_fees"), + @SerializedName("pricing_lines") PRICING_LINES("pricing_lines"), diff --git a/src/main/java/com/stripe/param/v2/billing/ContractUpdateParams.java b/src/main/java/com/stripe/param/v2/billing/ContractUpdateParams.java index 8707d64e6452..7fad45942dbd 100644 --- a/src/main/java/com/stripe/param/v2/billing/ContractUpdateParams.java +++ b/src/main/java/com/stripe/param/v2/billing/ContractUpdateParams.java @@ -5026,6 +5026,9 @@ public enum Include implements ApiRequestParams.EnumParam { @SerializedName("billing_settings") BILLING_SETTINGS("billing_settings"), + @SerializedName("one_time_fees") + ONE_TIME_FEES("one_time_fees"), + @SerializedName("pricing_lines") PRICING_LINES("pricing_lines"), diff --git a/src/main/java/com/stripe/param/v2/tax/OperationResolveAddressParams.java b/src/main/java/com/stripe/param/v2/tax/OperationResolveAddressParams.java new file mode 100644 index 000000000000..0e9ae598e2a0 --- /dev/null +++ b/src/main/java/com/stripe/param/v2/tax/OperationResolveAddressParams.java @@ -0,0 +1,206 @@ +// File generated from our OpenAPI spec +package com.stripe.param.v2.tax; + +import com.google.gson.annotations.SerializedName; +import com.stripe.net.ApiRequestParams; +import java.util.HashMap; +import java.util.Map; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +@Getter +@EqualsAndHashCode(callSuper = false) +public class OperationResolveAddressParams extends ApiRequestParams { + /** Required. The address to resolve. */ + @SerializedName("address") + Address address; + + /** + * 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 OperationResolveAddressParams(Address address, Map extraParams) { + this.address = address; + this.extraParams = extraParams; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Address address; + + private Map extraParams; + + /** Finalize and obtain parameter instance from this builder. */ + public OperationResolveAddressParams build() { + return new OperationResolveAddressParams(this.address, this.extraParams); + } + + /** Required. The address to resolve. */ + public Builder setAddress(OperationResolveAddressParams.Address address) { + this.address = address; + 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 + * OperationResolveAddressParams#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 OperationResolveAddressParams#extraParams} for the field documentation. + */ + public Builder putAllExtraParam(Map map) { + if (this.extraParams == null) { + this.extraParams = new HashMap<>(); + } + this.extraParams.putAll(map); + return this; + } + } + + @Getter + @EqualsAndHashCode(callSuper = false) + public static class Address { + /** The city. */ + @SerializedName("city") + String city; + + /** Required. The two-letter country code. */ + @SerializedName("country") + String country; + + /** + * 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 first line of the street address. */ + @SerializedName("line1") + String line1; + + /** The postal code. */ + @SerializedName("postal_code") + String postalCode; + + /** The state or province. */ + @SerializedName("state") + String state; + + private Address( + String city, + String country, + Map extraParams, + String line1, + String postalCode, + String state) { + this.city = city; + this.country = country; + this.extraParams = extraParams; + this.line1 = line1; + this.postalCode = postalCode; + this.state = state; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String city; + + private String country; + + private Map extraParams; + + private String line1; + + private String postalCode; + + private String state; + + /** Finalize and obtain parameter instance from this builder. */ + public OperationResolveAddressParams.Address build() { + return new OperationResolveAddressParams.Address( + this.city, this.country, this.extraParams, this.line1, this.postalCode, this.state); + } + + /** The city. */ + public Builder setCity(String city) { + this.city = city; + return this; + } + + /** Required. The two-letter country code. */ + public Builder setCountry(String country) { + this.country = country; + 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 + * OperationResolveAddressParams.Address#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 OperationResolveAddressParams.Address#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 first line of the street address. */ + public Builder setLine1(String line1) { + this.line1 = line1; + return this; + } + + /** The postal code. */ + public Builder setPostalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** The state or province. */ + public Builder setState(String state) { + this.state = state; + return this; + } + } + } +} diff --git a/src/main/java/com/stripe/service/v2/TaxService.java b/src/main/java/com/stripe/service/v2/TaxService.java index db6c7463658a..670bac0f6c0f 100644 --- a/src/main/java/com/stripe/service/v2/TaxService.java +++ b/src/main/java/com/stripe/service/v2/TaxService.java @@ -12,4 +12,8 @@ public TaxService(StripeResponseGetter responseGetter) { public com.stripe.service.v2.tax.ManualRuleService manualRules() { return new com.stripe.service.v2.tax.ManualRuleService(this.getResponseGetter()); } + + public com.stripe.service.v2.tax.OperationService operations() { + return new com.stripe.service.v2.tax.OperationService(this.getResponseGetter()); + } } diff --git a/src/main/java/com/stripe/service/v2/tax/OperationService.java b/src/main/java/com/stripe/service/v2/tax/OperationService.java new file mode 100644 index 000000000000..de3759647879 --- /dev/null +++ b/src/main/java/com/stripe/service/v2/tax/OperationService.java @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec +package com.stripe.service.v2.tax; + +import com.stripe.exception.StripeException; +import com.stripe.model.v2.tax.OperationsResolveAddressResult; +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.v2.tax.OperationResolveAddressParams; + +public final class OperationService extends ApiService { + public OperationService(StripeResponseGetter responseGetter) { + super(responseGetter); + } + + /** Resolves an address to its tax precision level. */ + public OperationsResolveAddressResult resolveAddress(OperationResolveAddressParams params) + throws StripeException { + return resolveAddress(params, (RequestOptions) null); + } + /** Resolves an address to its tax precision level. */ + public OperationsResolveAddressResult resolveAddress( + OperationResolveAddressParams params, RequestOptions options) throws StripeException { + String path = "/v2/tax/operations/resolve_address"; + ApiRequest request = + new ApiRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + path, + ApiRequestParams.paramsToMap(params), + options); + return this.request(request, OperationsResolveAddressResult.class); + } +} diff --git a/src/test/java/com/stripe/StripeClientTest.java b/src/test/java/com/stripe/StripeClientTest.java index aa97216e5a40..d53110efe614 100644 --- a/src/test/java/com/stripe/StripeClientTest.java +++ b/src/test/java/com/stripe/StripeClientTest.java @@ -246,6 +246,7 @@ public void parsesEventNotificationWithRelatedObject() client.parseEventNotification(v2EventNotificationWithRelatedObject, signature, secret); assertNotNull(eventNotification); assertEquals("evt_234", eventNotification.getId()); + assertEquals("v2.core.event", eventNotification.getObject()); assertEquals("v1.billing.meter.error_report_triggered", eventNotification.getType()); assertEquals(Instant.parse("2022-02-15T00:27:45.330Z"), eventNotification.created); assertEquals("org_123", eventNotification.getContext().toString()); diff --git a/src/test/java/com/stripe/functional/GeneratedExamples.java b/src/test/java/com/stripe/functional/GeneratedExamples.java index 6792db201148..746ab5e7c68c 100644 --- a/src/test/java/com/stripe/functional/GeneratedExamples.java +++ b/src/test/java/com/stripe/functional/GeneratedExamples.java @@ -32573,6 +32573,41 @@ public void testV2TaxManualRulePost3Services() throws StripeException { null); } + @Test + public void testV2TaxOperationPostServices() throws StripeException { + stubRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + "/v2/tax/operations/resolve_address", + null, + null, + com.stripe.model.v2.tax.OperationsResolveAddressResult.class, + "{\"object\":\"v2.tax.operations_resolve_address_result\",\"address\":{},\"livemode\":true,\"precision\":\"none\",\"precision_details\":{\"issues\":[{\"code\":\"required_for_improved_precision\",\"field\":\"country\"}]}}"); + StripeClient client = new StripeClient(networkSpy); + + com.stripe.param.v2.tax.OperationResolveAddressParams params = + com.stripe.param.v2.tax.OperationResolveAddressParams.builder() + .setAddress( + com.stripe.param.v2.tax.OperationResolveAddressParams.Address.builder() + .setCity("city") + .setCountry("country") + .setLine1("line1") + .setPostalCode("postal_code") + .setState("state") + .build()) + .build(); + + com.stripe.model.v2.tax.OperationsResolveAddressResult operationsResolveAddressResult = + client.v2().tax().operations().resolveAddress(params); + assertNotNull(operationsResolveAddressResult); + verifyRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + "/v2/tax/operations/resolve_address", + params.toMap(), + null); + } + @Test public void testV2TestHelpersFinancialAddressPostServices() throws StripeException { stubRequest( diff --git a/src/test/java/com/stripe/net/CloudProviderEventTest.java b/src/test/java/com/stripe/net/CloudProviderEventTest.java new file mode 100644 index 000000000000..11234e560df9 --- /dev/null +++ b/src/test/java/com/stripe/net/CloudProviderEventTest.java @@ -0,0 +1,236 @@ +package com.stripe.net; + +import static org.junit.jupiter.api.Assertions.*; + +import com.google.gson.JsonObject; +import com.google.gson.JsonSyntaxException; +import com.stripe.BaseStripeTest; +import com.stripe.StripeClient; +import com.stripe.model.Event; +import com.stripe.model.v2.core.EventNotification; +import org.junit.jupiter.api.Test; + +public class CloudProviderEventTest extends BaseStripeTest { + + private static final String EVENTBRIDGE_PAYLOAD = + "{\"version\":\"0\",\"id\":\"17e8dff5-d6cd-3770-ace9-aeac02b6ac3f\"," + + "\"detail-type\":\"customer.created\"," + + "\"source\":\"aws.partner/stripe.com/ed_123\"," + + "\"account\":\"506417113029\"," + + "\"time\":\"2024-03-07T18:27:56Z\"," + + "\"region\":\"us-west-2\"," + + "\"resources\":[]," + + "\"detail\":{" + + "\"id\":\"evt_test_123\"," + + "\"object\":\"event\"," + + "\"api_version\":\"2023-10-16\"," + + "\"created\":1709836076," + + "\"data\":{\"object\":{\"id\":\"cus_123\",\"object\":\"customer\"}}," + + "\"livemode\":true," + + "\"pending_webhooks\":0," + + "\"request\":{\"id\":\"req_123\",\"idempotency_key\":null}," + + "\"type\":\"customer.created\"}}"; + + private static final String EVENTGRID_PAYLOAD = + "{\"specversion\":\"1.0\"," + + "\"type\":\"customer.created\"," + + "\"source\":\"/providers/stripe/ed_test_123\"," + + "\"id\":\"9aeb0fdf-c01e-0131-0922-9eb54906e209\"," + + "\"time\":\"2025-07-11T14:30:00Z\"," + + "\"subject\":null," + + "\"dataContentType\":\"application/cloudevents+json\"," + + "\"data\":{" + + "\"id\":\"evt_test_456\"," + + "\"object\":\"event\"," + + "\"api_version\":\"2023-10-16\"," + + "\"created\":1709836076," + + "\"data\":{\"object\":{\"id\":\"cus_456\",\"object\":\"customer\"}}," + + "\"livemode\":false," + + "\"pending_webhooks\":0," + + "\"request\":{\"id\":\"req_456\",\"idempotency_key\":null}," + + "\"type\":\"customer.created\"}}"; + + private static final String EVENTBRIDGE_NOTIFICATION_PAYLOAD = + "{\"version\":\"0\",\"id\":\"17e8dff5-d6cd-3770-ace9-aeac02b6ac3f\"," + + "\"detail-type\":\"v2.core.event_destination.ping\"," + + "\"source\":\"aws.partner/stripe.com/ed_123\"," + + "\"detail\":{" + + "\"id\":\"evt_test_789\"," + + "\"object\":\"v2.core.event\"," + + "\"type\":\"v2.core.event_destination.ping\"," + + "\"created\":\"2024-03-07T18:27:56.000Z\"," + + "\"livemode\":true}}"; + + private static final String EVENTGRID_NOTIFICATION_PAYLOAD = + "{\"specversion\":\"1.0\"," + + "\"type\":\"v2.core.event_destination.ping\"," + + "\"source\":\"/providers/stripe/ed_test_123\"," + + "\"id\":\"9aeb0fdf-c01e-0131-0922-9eb54906e209\"," + + "\"data\":{" + + "\"id\":\"evt_test_789\"," + + "\"object\":\"v2.core.event\"," + + "\"type\":\"v2.core.event_destination.ping\"," + + "\"created\":\"2024-03-07T18:27:56.000Z\"," + + "\"livemode\":true}}"; + + private static final String RAW_EVENT_PAYLOAD = + "{\"id\":\"evt_test_123\"," + + "\"object\":\"event\"," + + "\"api_version\":\"2023-10-16\"," + + "\"created\":1709836076," + + "\"data\":{\"object\":{\"id\":\"cus_123\",\"object\":\"customer\"}}," + + "\"livemode\":true," + + "\"pending_webhooks\":0," + + "\"request\":{\"id\":\"req_123\",\"idempotency_key\":null}," + + "\"type\":\"customer.created\"}"; + + // constructEventWithoutVerification tests + + @Test + public void testEventBridgeViaClient() { + StripeClient client = new StripeClient("sk_test_fake"); + Event event = client.constructEventWithoutVerification(EVENTBRIDGE_PAYLOAD); + assertNotNull(event); + assertEquals("evt_test_123", event.getId()); + assertEquals("customer.created", event.getType()); + } + + @Test + public void testEventGridViaClient() { + StripeClient client = new StripeClient("sk_test_fake"); + Event event = client.constructEventWithoutVerification(EVENTGRID_PAYLOAD); + assertNotNull(event); + assertEquals("evt_test_456", event.getId()); + assertEquals("customer.created", event.getType()); + } + + @Test + public void testRawEventViaClient() { + StripeClient client = new StripeClient("sk_test_fake"); + Event event = client.constructEventWithoutVerification(RAW_EVENT_PAYLOAD); + assertNotNull(event); + assertEquals("evt_test_123", event.getId()); + assertEquals("customer.created", event.getType()); + } + + @Test + public void testInvalidJsonViaClient() { + StripeClient client = new StripeClient("sk_test_fake"); + assertThrows( + JsonSyntaxException.class, + () -> client.constructEventWithoutVerification("not valid json")); + } + + @Test + public void testUnrecognizedFormatViaClient() { + StripeClient client = new StripeClient("sk_test_fake"); + IllegalArgumentException ex = + assertThrows( + IllegalArgumentException.class, + () -> client.constructEventWithoutVerification("{\"foo\":\"bar\"}")); + assertTrue(ex.getMessage().contains("Unrecognized event format")); + } + + // parseEventNotificationWithoutVerification tests + + @Test + public void testEventBridgeNotificationViaClient() { + StripeClient client = new StripeClient("sk_test_fake"); + EventNotification notification = + client.parseEventNotificationWithoutVerification(EVENTBRIDGE_NOTIFICATION_PAYLOAD); + assertNotNull(notification); + assertEquals("evt_test_789", notification.getId()); + } + + @Test + public void testEventGridNotificationViaClient() { + StripeClient client = new StripeClient("sk_test_fake"); + EventNotification notification = + client.parseEventNotificationWithoutVerification(EVENTGRID_NOTIFICATION_PAYLOAD); + assertNotNull(notification); + assertEquals("evt_test_789", notification.getId()); + } + + @Test + public void testParseNotificationWithV1EventSuggestsConstructEventWithoutVerification() { + StripeClient client = new StripeClient("sk_test_fake"); + assertThrows( + IllegalArgumentException.class, + () -> client.parseEventNotificationWithoutVerification(EVENTBRIDGE_PAYLOAD)); + } + + @Test + public void testParseNotificationInvalidJsonThrows() { + StripeClient client = new StripeClient("sk_test_fake"); + assertThrows( + JsonSyntaxException.class, + () -> client.parseEventNotificationWithoutVerification("not valid json")); + } + + @Test + public void testParseNotificationUnrecognizedFormatThrows() { + StripeClient client = new StripeClient("sk_test_fake"); + IllegalArgumentException ex = + assertThrows( + IllegalArgumentException.class, + () -> client.parseEventNotificationWithoutVerification("{\"foo\":\"bar\"}")); + assertTrue(ex.getMessage().contains("Unrecognized event format")); + } + + @Test + public void testParseNotificationRawV2NotificationPassthrough() { + StripeClient client = new StripeClient("sk_test_fake"); + String rawV2Payload = + "{\"id\":\"evt_234\"," + + "\"object\":\"v2.core.event\"," + + "\"type\":\"v2.core.event_destination.ping\"," + + "\"created\":\"2024-03-07T18:27:56.000Z\"," + + "\"livemode\":true}"; + EventNotification notification = client.parseEventNotificationWithoutVerification(rawV2Payload); + assertNotNull(notification); + assertEquals("evt_234", notification.getId()); + } + + @Test + public void testConstructEventWithoutVerificationRejectsV2ThinEvent() { + StripeClient client = new StripeClient("sk_test_fake"); + String v2Payload = + "{\"id\":\"evt_234\"," + + "\"object\":\"v2.core.event\"," + + "\"type\":\"v2.core.event_destination.ping\"," + + "\"created\":\"2024-03-07T18:27:56.000Z\"," + + "\"livemode\":true}"; + IllegalArgumentException ex = + assertThrows( + IllegalArgumentException.class, + () -> client.constructEventWithoutVerification(v2Payload)); + assertTrue(ex.getMessage().contains("parseEventNotification")); + } + + @Test + public void testAzureEnvelopeMissingDataThrows() { + StripeClient client = new StripeClient("sk_test_fake"); + String payloadMissingData = + "{\"specversion\":\"1.0\"," + + "\"type\":\"customer.created\"," + + "\"source\":\"/providers/stripe/ed_test_123\"," + + "\"id\":\"test-missing-data\"}"; + IllegalArgumentException ex = + assertThrows( + IllegalArgumentException.class, + () -> client.constructEventWithoutVerification(payloadMissingData)); + assertTrue(ex.getMessage().contains("Unrecognized event format")); + } + + @Test + public void testFromJsonUnexpectedObjectTypeThrows() { + StripeClient client = new StripeClient("sk_test_fake"); + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty("object", "customer"); + jsonObject.addProperty("type", "customer.created"); + IllegalArgumentException ex = + assertThrows( + IllegalArgumentException.class, () -> EventNotification.fromJson(jsonObject, client)); + assertTrue(ex.getMessage().contains("Unexpected object type")); + } +} diff --git a/src/test/java/com/stripe/net/WebhookTest.java b/src/test/java/com/stripe/net/WebhookTest.java index 3e1357b6bf39..cf7a7c7d9c70 100644 --- a/src/test/java/com/stripe/net/WebhookTest.java +++ b/src/test/java/com/stripe/net/WebhookTest.java @@ -5,6 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; import com.stripe.BaseStripeTest; import com.stripe.Stripe; @@ -76,7 +77,7 @@ public static String generateSigHeader(Map options) @Test public void testValidJsonAndHeader() throws SignatureVerificationException, NoSuchAlgorithmException, InvalidKeyException { - final String sigHeader = generateSigHeader(); + final String sigHeader = Webhook.Signature.generateSignatureHeader(payload, secret); final Event event = Webhook.constructEvent(payload, sigHeader, secret); @@ -86,10 +87,7 @@ public void testValidJsonAndHeader() @Test public void testValidJsonAndHeaderButOutsideTimeTolerance() throws NoSuchAlgorithmException, InvalidKeyException { - final Map options = new HashMap<>(); - options.put("timestamp", 1L); - - final String sigHeader = generateSigHeader(options); + final String sigHeader = Webhook.Signature.generateSignatureHeader(payload, secret, 1L); final Clock clock = Clock.fixed(Instant.ofEpochMilli(12000), ZoneId.of("UTC")); assertThrows( @@ -109,9 +107,7 @@ public void testValidJsonAndHeaderCanMakeRequestsOnDataObject() + "\"," + "\"object\": \"event\",\"data\": {\"object\": {\"id\": \"acct_123\",\"object\": \"account\"}}}"; - final Map options = new HashMap<>(); - options.put("payload", payload); - final String sigHeader = generateSigHeader(options); + final String sigHeader = Webhook.Signature.generateSignatureHeader(payload, secret); final Event event = Webhook.constructEvent(payload, sigHeader, secret); Account modelViaData = ((Account) event.getData().getObject()); @@ -125,9 +121,7 @@ public void testValidJsonAndHeaderCanMakeRequestsOnDataObject() public void testInvalidJson() throws SignatureVerificationException, NoSuchAlgorithmException, InvalidKeyException { final String payload = "this is not valid JSON"; - final Map options = new HashMap<>(); - options.put("payload", payload); - final String sigHeader = generateSigHeader(options); + final String sigHeader = Webhook.Signature.generateSignatureHeader(payload, secret); assertThrows( JsonSyntaxException.class, @@ -196,9 +190,8 @@ public void testNoValidSignatureForPayload() @Test public void testTimestampOutsideTolerance() throws SignatureVerificationException, NoSuchAlgorithmException, InvalidKeyException { - final Map options = new HashMap<>(); - options.put("timestamp", Webhook.Util.getTimeNow() - 15); - final String sigHeader = generateSigHeader(options); + final String sigHeader = + Webhook.Signature.generateSignatureHeader(payload, secret, Webhook.Util.getTimeNow() - 15); Throwable exception = assertThrows( @@ -212,7 +205,7 @@ public void testTimestampOutsideTolerance() @Test public void testValidHeaderAndSignature() throws SignatureVerificationException, NoSuchAlgorithmException, InvalidKeyException { - final String sigHeader = generateSigHeader(); + final String sigHeader = Webhook.Signature.generateSignatureHeader(payload, secret); assertTrue(Webhook.Signature.verifyHeader(payload, sigHeader, secret, 10, null)); } @@ -220,7 +213,9 @@ public void testValidHeaderAndSignature() @Test public void testHeaderContainsValidSignature() throws SignatureVerificationException, NoSuchAlgorithmException, InvalidKeyException { - final String sigHeader = String.format("%s,v1=bad_signature", generateSigHeader()); + final String sigHeader = + String.format( + "%s,v1=bad_signature", Webhook.Signature.generateSignatureHeader(payload, secret)); assertTrue(Webhook.Signature.verifyHeader(payload, sigHeader, secret, 10, null)); } @@ -228,9 +223,7 @@ public void testHeaderContainsValidSignature() @Test public void testTimestampOffButNoTolerance() throws SignatureVerificationException, NoSuchAlgorithmException, InvalidKeyException { - final Map options = new HashMap<>(); - options.put("timestamp", Long.valueOf(12345L)); - final String sigHeader = generateSigHeader(options); + final String sigHeader = Webhook.Signature.generateSignatureHeader(payload, secret, 12345L); assertTrue(Webhook.Signature.verifyHeader(payload, sigHeader, secret, 0, null)); } @@ -238,11 +231,7 @@ public void testTimestampOffButNoTolerance() @Test public void testTimestampWithClock() throws SignatureVerificationException, NoSuchAlgorithmException, InvalidKeyException { - - final Map options = new HashMap<>(); - options.put("timestamp", 11L); - - final String sigHeader = generateSigHeader(options); + final String sigHeader = Webhook.Signature.generateSignatureHeader(payload, secret, 11L); final Clock clock = Clock.fixed(Instant.ofEpochMilli(1), ZoneId.of("UTC")); assertTrue(Webhook.Signature.verifyHeader(payload, sigHeader, secret, 10, clock)); @@ -251,11 +240,7 @@ public void testTimestampWithClock() @Test public void testTimestampWithClockOutsideTolerance() throws SignatureVerificationException, NoSuchAlgorithmException, InvalidKeyException { - - final Map options = new HashMap<>(); - options.put("timestamp", 11L); - - final String sigHeader = generateSigHeader(options); + final String sigHeader = Webhook.Signature.generateSignatureHeader(payload, secret, 11L); final Clock clock = Clock.fixed(Instant.ofEpochMilli(12), ZoneId.of("UTC")); assertTrue(Webhook.Signature.verifyHeader(payload, sigHeader, secret, 10, clock)); @@ -282,9 +267,7 @@ public void testStripeClientConstructEvent() + "\"," + "\"object\": \"event\",\"data\": {\"object\": {\"id\": \"rdr_123\",\"object\": \"terminal.reader\"}}}"; - final Map options = new HashMap<>(); - options.put("payload", payload); - final String sigHeader = generateSigHeader(options); + final String sigHeader = Webhook.Signature.generateSignatureHeader(payload, secret); final Event event = client.constructEvent(payload, sigHeader, secret); @@ -315,9 +298,7 @@ public void testStripeClientConstructEventWithTolerance() + "\"," + "\"object\": \"event\",\"data\": {\"object\": {\"id\": \"rdr_123\",\"object\": \"terminal.reader\"}}}"; - final Map options = new HashMap<>(); - options.put("payload", payload); - final String sigHeader = generateSigHeader(options); + final String sigHeader = Webhook.Signature.generateSignatureHeader(payload, secret); final Event event = client.constructEvent(payload, sigHeader, secret, 500); @@ -331,19 +312,116 @@ public void testStripeClientConstructEventWithTolerance() public void testConstructEventWithRawJson() throws StripeException, NoSuchAlgorithmException, InvalidKeyException { - final Event event = Webhook.constructEvent(payload, generateSigHeader(), secret); + final Event event = + Webhook.constructEvent( + payload, Webhook.Signature.generateSignatureHeader(payload, secret), secret); assertNotNull(event.getRawJsonObject()); } + @Test + public void testGenerateSignatureHeaderWithTimestamp() + throws NoSuchAlgorithmException, InvalidKeyException, SignatureVerificationException { + final long timestamp = 1609459200L; + final String header = Webhook.Signature.generateSignatureHeader(payload, secret, timestamp); + + assertTrue(Webhook.Signature.verifyHeader(payload, header, secret, 0, null)); + assertTrue(header.startsWith(String.format("t=%d,v1=", timestamp))); + } + + @Test + public void testGenerateSignatureHeaderWithCurrentTimestamp() + throws NoSuchAlgorithmException, InvalidKeyException, SignatureVerificationException { + final String header = Webhook.Signature.generateSignatureHeader(payload, secret); + + assertTrue(Webhook.Signature.verifyHeader(payload, header, secret, 10, null)); + } + + @Test + public void testGenerateSignatureHeaderRoundtrip() + throws NoSuchAlgorithmException, InvalidKeyException, SignatureVerificationException { + String payload = "test_payload"; + String secret = "whsec_test_secret"; + String header = Webhook.Signature.generateSignatureHeader(payload, secret); + // Should not throw: + assertTrue(Webhook.Signature.verifyHeader(payload, header, secret, 300)); + } + + @Test + public void testParseEventNotification() + throws NoSuchAlgorithmException, InvalidKeyException, SignatureVerificationException { + StripeClient client = new StripeClient(new LiveStripeResponseGetter()); + + final String v2Payload = + "{\n" + + " \"id\": \"evt_test_webhook\",\n" + + " \"object\": \"v2.core.event\",\n" + + " \"type\": \"v1.billing.meter.no_meter_found\",\n" + + " \"livemode\": false,\n" + + " \"created\": \"2022-02-15T00:27:45.330Z\"\n" + + "}"; + + final String header = Webhook.Signature.generateSignatureHeader(v2Payload, secret); + + final com.stripe.model.v2.core.EventNotification notification = + client.parseEventNotification(v2Payload, header, secret); + + assertNotNull(notification); + assertEquals("evt_test_webhook", notification.getId()); + } + + @Test + public void testMaybeExtractPassesThroughV1Event() { + final String v1Payload = "{\"id\": \"evt_test_webhook\", \"object\": \"event\"}"; + final JsonObject result = Webhook.maybeExtractFromCloudProviderEnvelope(v1Payload); + assertEquals("event", result.get("object").getAsString()); + } + + @Test + public void testMaybeExtractPassesThroughV2Event() { + final String v2Payload = "{\"id\": \"evt_test_webhook\", \"object\": \"v2.core.event\"}"; + final JsonObject result = Webhook.maybeExtractFromCloudProviderEnvelope(v2Payload); + assertEquals("v2.core.event", result.get("object").getAsString()); + } + + @Test + public void testMaybeExtractThrowsForUnrecognizedFormat() { + final String unknownPayload = "{\"id\": \"evt_test_webhook\", \"object\": \"something_else\"}"; + assertThrows( + IllegalArgumentException.class, + () -> { + Webhook.maybeExtractFromCloudProviderEnvelope(unknownPayload); + }); + } + + @Test + public void testConstructEventWithoutVerification() { + final Event event = Webhook.constructEventWithoutVerification(payload); + + assertNotNull(event); + assertEquals("evt_test_webhook", event.getId()); + } + + @Test + public void testConstructEventWithoutVerificationRejectsV2Payload() { + final String v2Payload = + "{\n \"id\": \"evt_test_webhook\",\n \"object\": \"v2.core.event\"\n}"; + + Throwable exception = + assertThrows( + IllegalArgumentException.class, + () -> { + Webhook.constructEventWithoutVerification(v2Payload); + }); + assertTrue(exception.getMessage().contains("parseEventNotification")); + } + @Test public void testConstructEventRejectsV2Payload() throws NoSuchAlgorithmException, InvalidKeyException { final String v2Payload = "{\n \"id\": \"evt_test_webhook\",\n \"object\": \"v2.core.event\"\n}"; - final Map options = new HashMap<>(); - options.put("payload", v2Payload); - final String sigHeader = generateSigHeader(options); + final String sigHeader = Webhook.Signature.generateSignatureHeader(v2Payload, secret); Throwable exception = assertThrows( @@ -351,7 +429,7 @@ public void testConstructEventRejectsV2Payload() () -> { Webhook.constructEvent(v2Payload, sigHeader, secret); }); - assertTrue(exception.getMessage().contains("StripeClient.parseEventNotification")); + assertTrue(exception.getMessage().contains("parseEventNotification")); } @Test @@ -361,9 +439,7 @@ public void testClientConstructEventRejectsV2Payload() final String v2Payload = "{\n \"id\": \"evt_test_webhook\",\n \"object\": \"v2.core.event\"\n}"; - final Map options = new HashMap<>(); - options.put("payload", v2Payload); - final String sigHeader = generateSigHeader(options); + final String sigHeader = Webhook.Signature.generateSignatureHeader(v2Payload, secret); Throwable exception = assertThrows( @@ -371,6 +447,6 @@ public void testClientConstructEventRejectsV2Payload() () -> { client.constructEvent(v2Payload, sigHeader, secret); }); - assertTrue(exception.getMessage().contains("StripeClient.parseEventNotification")); + assertTrue(exception.getMessage().contains("parseEventNotification")); } }