diff --git a/CHANGELOG.md b/CHANGELOG.md index 38fb92814..bdd934a98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 15.5.0 - 2026-08-10 +* [#1874](https://github.com/stripe/stripe-python/pull/1874) Add async iteration to v2 list auto-pagination + - Adds `async for` support to v2 `ListObject.auto_paging_iter()`. +* [#1869](https://github.com/stripe/stripe-python/pull/1869) Surface `object` property on `EventNotification` +* [#1867](https://github.com/stripe/stripe-python/pull/1867) Emit Claude Code plugin hint at module load time + - Emits new Claude Code plugin hint when `CLAUDECODE` or `CLAUDE_CODE_CHILD_SESSION` environment variables are detected. +* [#1855](https://github.com/stripe/stripe-python/pull/1855) add/adjust event parsing helpers + + - Added methods that return their respective `Event`/`EventNotification` class instances without verifying authenticity. Use them when you've previously verified an event (e.g. you verified, put the event in a queue, and are now processing). Supports events from [AWS EventBridge](https://docs.stripe.com/event-destinations/eventbridge) and [Azure Event Grid](https://docs.stripe.com/event-destinations/eventgrid) natively. + - `Webhook.construct_event_without_verification(payload)` + - `StripeClient.construct_event_without_verification(payload)` + - `StripeClient.parse_event_notification_without_verification(payload)` + - Added `WebhookSignature.generate_signature_header(payload, secret, timestamp=None)`, which computes a full `Stripe-Signature` header for the given payload. Useful for unit tests! + +* [#1863](https://github.com/stripe/stripe-python/pull/1863) Add `stripe.major_api_version` constant + ## 15.5.0a2 - 2026-08-05 * [#1859](https://github.com/stripe/stripe-python/pull/1859) Update generated code for private-preview * Add support for new resource `billing.FeedbackOptions` diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index 1b3017c05..35b513701 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -85839f80afcaccd622aa30bf53a414cdffbd57bc \ No newline at end of file +2f45a32278692f9e1801089ee4ebc0801e938fa2 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index dea428aab..4f8238b1a 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2369 \ No newline at end of file +v2393 \ No newline at end of file diff --git a/stripe/__init__.py b/stripe/__init__.py index 1b2a62977..1b12d5de9 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -352,6 +352,7 @@ def add_beta_version( FeatureNotEnabledError as FeatureNotEnabledError, FinancialAccountNotOpenError as FinancialAccountNotOpenError, FxQuoteExpiredError as FxQuoteExpiredError, + FxQuoteNeedsRefreshError as FxQuoteNeedsRefreshError, IdempotencyError as IdempotencyError, InsufficientFundsError as InsufficientFundsError, InvalidPaymentMethodError as InvalidPaymentMethodError, @@ -846,6 +847,7 @@ def add_beta_version( "FeatureNotEnabledError": ("stripe._error", False), "FinancialAccountNotOpenError": ("stripe._error", False), "FxQuoteExpiredError": ("stripe._error", False), + "FxQuoteNeedsRefreshError": ("stripe._error", False), "IdempotencyError": ("stripe._error", False), "InsufficientFundsError": ("stripe._error", False), "InvalidPaymentMethodError": ("stripe._error", False), diff --git a/stripe/_account.py b/stripe/_account.py index 0ee92707f..2adf9564b 100644 --- a/stripe/_account.py +++ b/stripe/_account.py @@ -507,7 +507,7 @@ class Capabilities(StripeObject): """ sequra_payments: Optional[Literal["active", "inactive", "pending"]] """ - 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. """ shopeepay_payments: Optional[Literal["active", "inactive", "pending"]] """ @@ -1074,10 +1074,7 @@ class Error(StripeObject): "invalid_url_website_incomplete_under_construction", "invalid_url_website_other", "invalid_value_other", - "partner_disabled_dispute_rate", - "partner_disabled_responsibilities", - "partner_disabled_restricted_business", - "partner_disabled_suspected_fraud", + "partner_disabled", "unsupported_business_type", "verification_data_not_found", "verification_directors_mismatch", @@ -1260,10 +1257,7 @@ class Error(StripeObject): "invalid_url_website_incomplete_under_construction", "invalid_url_website_other", "invalid_value_other", - "partner_disabled_dispute_rate", - "partner_disabled_responsibilities", - "partner_disabled_restricted_business", - "partner_disabled_suspected_fraud", + "partner_disabled", "unsupported_business_type", "verification_data_not_found", "verification_directors_mismatch", diff --git a/stripe/_api_requestor.py b/stripe/_api_requestor.py index 58e09f49a..b7c90f80c 100644 --- a/stripe/_api_requestor.py +++ b/stripe/_api_requestor.py @@ -418,6 +418,8 @@ def specific_v2_api_error(self, rbody, rcode, resp, rheaders, error_data): return error.FinancialAccountNotOpenError(**error_args) elif type == "fx_quote_expired": return error.FxQuoteExpiredError(**error_args) + elif type == "fx_quote_needs_refresh": + return error.FxQuoteNeedsRefreshError(**error_args) elif type == "insufficient_funds": return error.InsufficientFundsError(**error_args) elif type == "invalid_payment_method": diff --git a/stripe/_bank_account.py b/stripe/_bank_account.py index bae2111d3..cd8efac97 100644 --- a/stripe/_bank_account.py +++ b/stripe/_bank_account.py @@ -82,10 +82,7 @@ class Error(StripeObject): "invalid_url_website_incomplete_under_construction", "invalid_url_website_other", "invalid_value_other", - "partner_disabled_dispute_rate", - "partner_disabled_responsibilities", - "partner_disabled_restricted_business", - "partner_disabled_suspected_fraud", + "partner_disabled", "unsupported_business_type", "verification_data_not_found", "verification_directors_mismatch", @@ -218,10 +215,7 @@ class Error(StripeObject): "invalid_url_website_incomplete_under_construction", "invalid_url_website_other", "invalid_value_other", - "partner_disabled_dispute_rate", - "partner_disabled_responsibilities", - "partner_disabled_restricted_business", - "partner_disabled_suspected_fraud", + "partner_disabled", "unsupported_business_type", "verification_data_not_found", "verification_directors_mismatch", diff --git a/stripe/_capability.py b/stripe/_capability.py index c71ce3124..1b955bf09 100644 --- a/stripe/_capability.py +++ b/stripe/_capability.py @@ -74,10 +74,7 @@ class Error(StripeObject): "invalid_url_website_incomplete_under_construction", "invalid_url_website_other", "invalid_value_other", - "partner_disabled_dispute_rate", - "partner_disabled_responsibilities", - "partner_disabled_restricted_business", - "partner_disabled_suspected_fraud", + "partner_disabled", "unsupported_business_type", "verification_data_not_found", "verification_directors_mismatch", @@ -272,10 +269,7 @@ class Error(StripeObject): "invalid_url_website_incomplete_under_construction", "invalid_url_website_other", "invalid_value_other", - "partner_disabled_dispute_rate", - "partner_disabled_responsibilities", - "partner_disabled_restricted_business", - "partner_disabled_suspected_fraud", + "partner_disabled", "unsupported_business_type", "verification_data_not_found", "verification_directors_mismatch", diff --git a/stripe/_charge.py b/stripe/_charge.py index 33c542cab..50e7ccd2d 100644 --- a/stripe/_charge.py +++ b/stripe/_charge.py @@ -1809,9 +1809,9 @@ class Link(StripeObject): Two-letter ISO code representing the funding source country beneath the Link payment. You could use this attribute to get a sense of international fees. """ - pricing_group: Optional[str] + funding_source_group: Optional[str] """ - 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. """ class MbWay(StripeObject): @@ -2132,7 +2132,7 @@ class Pix(StripeObject): """ mandate: Optional[str] """ - ID of the multi use Mandate generated by the PaymentIntent + ID of the multi use Mandate generated by the PaymentIntent or SetupIntent. """ class Promptpay(StripeObject): @@ -2265,7 +2265,7 @@ class SepaDebit(StripeObject): class Sequra(StripeObject): transaction_id: Optional[str] """ - The Sequra transaction ID associated with this payment. + The SeQura transaction ID associated with this payment. """ class Shopeepay(StripeObject): @@ -2351,7 +2351,7 @@ class Tamara(StripeObject): class Twint(StripeObject): mandate: Optional[str] """ - ID of the multi use Mandate generated by the PaymentIntent + ID of the multi use Mandate generated by the PaymentIntent or SetupIntent. """ class Upi(StripeObject): diff --git a/stripe/_customer_session.py b/stripe/_customer_session.py index 5d50b3732..a1e380b0b 100644 --- a/stripe/_customer_session.py +++ b/stripe/_customer_session.py @@ -32,6 +32,12 @@ class BuyButton(StripeObject): Whether the buy button is enabled. """ + class CustomerPortal(StripeObject): + enabled: bool + """ + Whether the customer portal is enabled. + """ + class CustomerSheet(StripeObject): class Features(StripeObject): payment_method_allow_redisplay_filters: Optional[ @@ -204,6 +210,10 @@ class Features(StripeObject): """ This hash contains whether the buy button is enabled. """ + customer_portal: CustomerPortal + """ + This hash contains whether the customer portal is enabled. + """ customer_sheet: CustomerSheet """ This hash contains whether the customer sheet is enabled and the features it supports. @@ -226,6 +236,7 @@ class Features(StripeObject): """ _inner_class_types = { "buy_button": BuyButton, + "customer_portal": CustomerPortal, "customer_sheet": CustomerSheet, "mobile_payment_element": MobilePaymentElement, "payment_element": PaymentElement, diff --git a/stripe/_error.py b/stripe/_error.py index a4b4df88c..c052e2ded 100644 --- a/stripe/_error.py +++ b/stripe/_error.py @@ -242,6 +242,10 @@ class FxQuoteExpiredError(StripeError): pass +class FxQuoteNeedsRefreshError(StripeError): + pass + + class InsufficientFundsError(StripeError): pass diff --git a/stripe/_event_notification_handler.py b/stripe/_event_notification_handler.py index 0dbfb73e7..39816b5d5 100644 --- a/stripe/_event_notification_handler.py +++ b/stripe/_event_notification_handler.py @@ -45,15 +45,39 @@ from stripe.events._v1_balance_available_event import ( V1BalanceAvailableEventNotification, ) + from stripe.events._v1_balance_settings_updated_event import ( + V1BalanceSettingsUpdatedEventNotification, + ) from stripe.events._v1_billing_alert_triggered_event import ( V1BillingAlertTriggeredEventNotification, ) + from stripe.events._v1_billing_credit_balance_transaction_created_event import ( + V1BillingCreditBalanceTransactionCreatedEventNotification, + ) + from stripe.events._v1_billing_credit_grant_created_event import ( + V1BillingCreditGrantCreatedEventNotification, + ) + from stripe.events._v1_billing_credit_grant_updated_event import ( + V1BillingCreditGrantUpdatedEventNotification, + ) + from stripe.events._v1_billing_meter_created_event import ( + V1BillingMeterCreatedEventNotification, + ) + from stripe.events._v1_billing_meter_deactivated_event import ( + V1BillingMeterDeactivatedEventNotification, + ) from stripe.events._v1_billing_meter_error_report_triggered_event import ( V1BillingMeterErrorReportTriggeredEventNotification, ) from stripe.events._v1_billing_meter_no_meter_found_event import ( V1BillingMeterNoMeterFoundEventNotification, ) + from stripe.events._v1_billing_meter_reactivated_event import ( + V1BillingMeterReactivatedEventNotification, + ) + from stripe.events._v1_billing_meter_updated_event import ( + V1BillingMeterUpdatedEventNotification, + ) from stripe.events._v1_billing_portal_configuration_created_event import ( V1BillingPortalConfigurationCreatedEventNotification, ) @@ -210,6 +234,9 @@ from stripe.events._v1_file_created_event import ( V1FileCreatedEventNotification, ) + from stripe.events._v1_financial_connections_account_account_numbers_updated_event import ( + V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification, + ) from stripe.events._v1_financial_connections_account_created_event import ( V1FinancialConnectionsAccountCreatedEventNotification, ) @@ -219,6 +246,9 @@ from stripe.events._v1_financial_connections_account_disconnected_event import ( V1FinancialConnectionsAccountDisconnectedEventNotification, ) + from stripe.events._v1_financial_connections_account_expected_deactivation_date_updated_event import ( + V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification, + ) from stripe.events._v1_financial_connections_account_reactivated_event import ( V1FinancialConnectionsAccountReactivatedEventNotification, ) @@ -231,6 +261,15 @@ from stripe.events._v1_financial_connections_account_refreshed_transactions_event import ( V1FinancialConnectionsAccountRefreshedTransactionsEventNotification, ) + from stripe.events._v1_financial_connections_account_supported_payment_method_types_updated_event import ( + V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification, + ) + from stripe.events._v1_financial_connections_account_upcoming_account_number_expiry_event import ( + V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification, + ) + from stripe.events._v1_financial_connections_account_upcoming_deactivation_event import ( + V1FinancialConnectionsAccountUpcomingDeactivationEventNotification, + ) from stripe.events._v1_identity_verification_session_canceled_event import ( V1IdentityVerificationSessionCanceledEventNotification, ) @@ -282,6 +321,9 @@ from stripe.events._v1_invoice_payment_action_required_event import ( V1InvoicePaymentActionRequiredEventNotification, ) + from stripe.events._v1_invoice_payment_attempt_required_event import ( + V1InvoicePaymentAttemptRequiredEventNotification, + ) from stripe.events._v1_invoice_payment_failed_event import ( V1InvoicePaymentFailedEventNotification, ) @@ -1532,6 +1574,19 @@ def on_v1_balance_available( ) return func + def on_v1_balance_settings_updated( + self, + func: "Callable[[V1BalanceSettingsUpdatedEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1BalanceSettingsUpdatedEvent` (`v1.balance_settings.updated`) event notification. + """ + self._register( + "v1.balance_settings.updated", + func, + ) + return func + def on_v1_billing_alert_triggered( self, func: "Callable[[V1BillingAlertTriggeredEventNotification, StripeClient], None]", @@ -1545,6 +1600,71 @@ def on_v1_billing_alert_triggered( ) return func + def on_v1_billing_credit_balance_transaction_created( + self, + func: "Callable[[V1BillingCreditBalanceTransactionCreatedEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1BillingCreditBalanceTransactionCreatedEvent` (`v1.billing.credit_balance_transaction.created`) event notification. + """ + self._register( + "v1.billing.credit_balance_transaction.created", + func, + ) + return func + + def on_v1_billing_credit_grant_created( + self, + func: "Callable[[V1BillingCreditGrantCreatedEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1BillingCreditGrantCreatedEvent` (`v1.billing.credit_grant.created`) event notification. + """ + self._register( + "v1.billing.credit_grant.created", + func, + ) + return func + + def on_v1_billing_credit_grant_updated( + self, + func: "Callable[[V1BillingCreditGrantUpdatedEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1BillingCreditGrantUpdatedEvent` (`v1.billing.credit_grant.updated`) event notification. + """ + self._register( + "v1.billing.credit_grant.updated", + func, + ) + return func + + def on_v1_billing_meter_created( + self, + func: "Callable[[V1BillingMeterCreatedEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1BillingMeterCreatedEvent` (`v1.billing.meter.created`) event notification. + """ + self._register( + "v1.billing.meter.created", + func, + ) + return func + + def on_v1_billing_meter_deactivated( + self, + func: "Callable[[V1BillingMeterDeactivatedEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1BillingMeterDeactivatedEvent` (`v1.billing.meter.deactivated`) event notification. + """ + self._register( + "v1.billing.meter.deactivated", + func, + ) + return func + def on_v1_billing_meter_error_report_triggered( self, func: "Callable[[V1BillingMeterErrorReportTriggeredEventNotification, StripeClient], None]", @@ -1571,6 +1691,32 @@ def on_v1_billing_meter_no_meter_found( ) return func + def on_v1_billing_meter_reactivated( + self, + func: "Callable[[V1BillingMeterReactivatedEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1BillingMeterReactivatedEvent` (`v1.billing.meter.reactivated`) event notification. + """ + self._register( + "v1.billing.meter.reactivated", + func, + ) + return func + + def on_v1_billing_meter_updated( + self, + func: "Callable[[V1BillingMeterUpdatedEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1BillingMeterUpdatedEvent` (`v1.billing.meter.updated`) event notification. + """ + self._register( + "v1.billing.meter.updated", + func, + ) + return func + def on_v1_billing_portal_configuration_created( self, func: "Callable[[V1BillingPortalConfigurationCreatedEventNotification, StripeClient], None]", @@ -2247,6 +2393,19 @@ def on_v1_file_created( ) return func + def on_v1_financial_connections_account_account_numbers_updated( + self, + func: "Callable[[V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1FinancialConnectionsAccountAccountNumbersUpdatedEvent` (`v1.financial_connections.account.account_numbers_updated`) event notification. + """ + self._register( + "v1.financial_connections.account.account_numbers_updated", + func, + ) + return func + def on_v1_financial_connections_account_created( self, func: "Callable[[V1FinancialConnectionsAccountCreatedEventNotification, StripeClient], None]", @@ -2286,6 +2445,19 @@ def on_v1_financial_connections_account_disconnected( ) return func + def on_v1_financial_connections_account_expected_deactivation_date_updated( + self, + func: "Callable[[V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent` (`v1.financial_connections.account.expected_deactivation_date_updated`) event notification. + """ + self._register( + "v1.financial_connections.account.expected_deactivation_date_updated", + func, + ) + return func + def on_v1_financial_connections_account_reactivated( self, func: "Callable[[V1FinancialConnectionsAccountReactivatedEventNotification, StripeClient], None]", @@ -2338,6 +2510,45 @@ def on_v1_financial_connections_account_refreshed_transactions( ) return func + def on_v1_financial_connections_account_supported_payment_method_types_updated( + self, + func: "Callable[[V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent` (`v1.financial_connections.account.supported_payment_method_types_updated`) event notification. + """ + self._register( + "v1.financial_connections.account.supported_payment_method_types_updated", + func, + ) + return func + + def on_v1_financial_connections_account_upcoming_account_number_expiry( + self, + func: "Callable[[V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent` (`v1.financial_connections.account.upcoming_account_number_expiry`) event notification. + """ + self._register( + "v1.financial_connections.account.upcoming_account_number_expiry", + func, + ) + return func + + def on_v1_financial_connections_account_upcoming_deactivation( + self, + func: "Callable[[V1FinancialConnectionsAccountUpcomingDeactivationEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1FinancialConnectionsAccountUpcomingDeactivationEvent` (`v1.financial_connections.account.upcoming_deactivation`) event notification. + """ + self._register( + "v1.financial_connections.account.upcoming_deactivation", + func, + ) + return func + def on_v1_identity_verification_session_canceled( self, func: "Callable[[V1IdentityVerificationSessionCanceledEventNotification, StripeClient], None]", @@ -2559,6 +2770,19 @@ def on_v1_invoice_payment_action_required( ) return func + def on_v1_invoice_payment_attempt_required( + self, + func: "Callable[[V1InvoicePaymentAttemptRequiredEventNotification, StripeClient], None]", + ): + """ + Registers a callback for the `V1InvoicePaymentAttemptRequiredEvent` (`v1.invoice.payment_attempt_required`) event notification. + """ + self._register( + "v1.invoice.payment_attempt_required", + func, + ) + return func + def on_v1_invoice_payment_failed( self, func: "Callable[[V1InvoicePaymentFailedEventNotification, StripeClient], None]", diff --git a/stripe/_invoice.py b/stripe/_invoice.py index da460620a..b2ea3008e 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -254,6 +254,20 @@ class CustomerAddress(StripeObject): State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). """ + class CustomerBalance(StripeObject): + applied_balance: int + """ + The total amount of customer balance applied to this invoice (automatically + manually). + """ + automatically_applied_balance: int + """ + The amount of customer balance automatically applied during invoice finalization. + """ + manually_applied_balance: int + """ + The total amount of customer balance manually applied after finalization. + """ + class CustomerShipping(StripeObject): class Address(StripeObject): city: Optional[str] @@ -879,6 +893,9 @@ class Bancontact(StripeObject): Preferred language of the Bancontact authorization page that the customer is redirected to. """ + class Billie(StripeObject): + pass + class Bizum(StripeObject): pass @@ -1090,6 +1107,10 @@ class WechatPay(StripeObject): """ If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice's PaymentIntent. """ + billie: Optional[Billie] + """ + If paying by `billie`, this sub-hash contains details about the Billie payment method options to pass to the invoice's PaymentIntent. + """ bizum: Optional[Bizum] """ If paying by `bizum`, this sub-hash contains details about the Bizum payment method options to pass to the invoice's PaymentIntent. @@ -1145,6 +1166,7 @@ class WechatPay(StripeObject): _inner_class_types = { "acss_debit": AcssDebit, "bancontact": Bancontact, + "billie": Billie, "bizum": Bizum, "blik": Blik, "card": Card, @@ -1181,6 +1203,7 @@ class WechatPay(StripeObject): "au_becs_debit", "bacs_debit", "bancontact", + "billie", "bizum", "blik", "boleto", @@ -1212,6 +1235,7 @@ class WechatPay(StripeObject): "payco", "paynow", "paypal", + "paypay", "payto", "pix", "promptpay", @@ -1226,6 +1250,7 @@ class WechatPay(StripeObject): "twint", "upi", "us_bank_account", + "vipps", "wechat_pay", ], str, @@ -1629,6 +1654,10 @@ class TaxRateDetails(StripeObject): """ The customer's address. Until the invoice is finalized, this field will equal `customer.address`. Once the invoice is finalized, this field will no longer be updated. """ + customer_balance: Optional[CustomerBalance] + """ + The customer balance amounts applied to this invoice. + """ customer_email: Optional[str] """ The customer's email. Until the invoice is finalized, this field will equal `customer.email`. Once the invoice is finalized, this field will no longer be updated. @@ -3410,6 +3439,7 @@ async def list_lines_async( "confirmation_secret": ConfirmationSecret, "custom_fields": CustomField, "customer_address": CustomerAddress, + "customer_balance": CustomerBalance, "customer_shipping": CustomerShipping, "customer_tax_ids": CustomerTaxId, "from_invoice": FromInvoice, diff --git a/stripe/_object_classes.py b/stripe/_object_classes.py index 877b90e31..e259e4845 100644 --- a/stripe/_object_classes.py +++ b/stripe/_object_classes.py @@ -788,6 +788,10 @@ "AccountSignal", ), "v2.tax.manual_rule": ("stripe.v2.tax._manual_rule", "ManualRule"), + "v2.tax.operations_resolve_address_result": ( + "stripe.v2.tax._operations_resolve_address_result", + "OperationsResolveAddressResult", + ), # V2 Object classes: The end of the section generated from our OpenAPI spec } diff --git a/stripe/_payment_attempt_record.py b/stripe/_payment_attempt_record.py index 0e7b34a96..4666ec1bb 100644 --- a/stripe/_payment_attempt_record.py +++ b/stripe/_payment_attempt_record.py @@ -1869,7 +1869,7 @@ class Pix(StripeObject): """ mandate: Optional[str] """ - ID of the multi use Mandate generated by the PaymentIntent + ID of the multi use Mandate generated by the PaymentIntent or SetupIntent. """ class Promptpay(StripeObject): @@ -2002,7 +2002,7 @@ class SepaDebit(StripeObject): class Sequra(StripeObject): transaction_id: Optional[str] """ - The Sequra transaction ID associated with this payment. + The SeQura transaction ID associated with this payment. """ class Shopeepay(StripeObject): @@ -2086,7 +2086,7 @@ class Tamara(StripeObject): class Twint(StripeObject): mandate: Optional[str] """ - ID of the multi use Mandate generated by the PaymentIntent + ID of the multi use Mandate generated by the PaymentIntent or SetupIntent. """ class Upi(StripeObject): diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index af12d53f0..4c2cdbefd 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -4870,6 +4870,16 @@ class Sequra(StripeObject): """ Controls when the funds will be captured from the customer's account. """ + setup_future_usage: Optional[Literal["none"]] + """ + 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](https://docs.stripe.com/payments/save-during-payment) 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](https://docs.stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + + If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://docs.stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + + When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://docs.stripe.com/strong-customer-authentication). + """ class Shopeepay(StripeObject): setup_future_usage: Optional[Literal["none"]] diff --git a/stripe/_payment_record.py b/stripe/_payment_record.py index e8ce0c306..d97cf1e71 100644 --- a/stripe/_payment_record.py +++ b/stripe/_payment_record.py @@ -1886,7 +1886,7 @@ class Pix(StripeObject): """ mandate: Optional[str] """ - ID of the multi use Mandate generated by the PaymentIntent + ID of the multi use Mandate generated by the PaymentIntent or SetupIntent. """ class Promptpay(StripeObject): @@ -2019,7 +2019,7 @@ class SepaDebit(StripeObject): class Sequra(StripeObject): transaction_id: Optional[str] """ - The Sequra transaction ID associated with this payment. + The SeQura transaction ID associated with this payment. """ class Shopeepay(StripeObject): @@ -2103,7 +2103,7 @@ class Tamara(StripeObject): class Twint(StripeObject): mandate: Optional[str] """ - ID of the multi use Mandate generated by the PaymentIntent + ID of the multi use Mandate generated by the PaymentIntent or SetupIntent. """ class Upi(StripeObject): diff --git a/stripe/_person.py b/stripe/_person.py index e1c73a017..c163cee48 100644 --- a/stripe/_person.py +++ b/stripe/_person.py @@ -226,10 +226,7 @@ class Error(StripeObject): "invalid_url_website_incomplete_under_construction", "invalid_url_website_other", "invalid_value_other", - "partner_disabled_dispute_rate", - "partner_disabled_responsibilities", - "partner_disabled_restricted_business", - "partner_disabled_suspected_fraud", + "partner_disabled", "unsupported_business_type", "verification_data_not_found", "verification_directors_mismatch", @@ -440,10 +437,7 @@ class Error(StripeObject): "invalid_url_website_incomplete_under_construction", "invalid_url_website_other", "invalid_value_other", - "partner_disabled_dispute_rate", - "partner_disabled_responsibilities", - "partner_disabled_restricted_business", - "partner_disabled_suspected_fraud", + "partner_disabled", "unsupported_business_type", "verification_data_not_found", "verification_directors_mismatch", diff --git a/stripe/_quote_preview_invoice.py b/stripe/_quote_preview_invoice.py index 051ee2752..ba44b1d79 100644 --- a/stripe/_quote_preview_invoice.py +++ b/stripe/_quote_preview_invoice.py @@ -210,6 +210,20 @@ class CustomerAddress(StripeObject): State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). """ + class CustomerBalance(StripeObject): + applied_balance: int + """ + The total amount of customer balance applied to this invoice (automatically + manually). + """ + automatically_applied_balance: int + """ + The amount of customer balance automatically applied during invoice finalization. + """ + manually_applied_balance: int + """ + The total amount of customer balance manually applied after finalization. + """ + class CustomerShipping(StripeObject): class Address(StripeObject): city: Optional[str] @@ -835,6 +849,9 @@ class Bancontact(StripeObject): Preferred language of the Bancontact authorization page that the customer is redirected to. """ + class Billie(StripeObject): + pass + class Bizum(StripeObject): pass @@ -1046,6 +1063,10 @@ class WechatPay(StripeObject): """ If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice's PaymentIntent. """ + billie: Optional[Billie] + """ + If paying by `billie`, this sub-hash contains details about the Billie payment method options to pass to the invoice's PaymentIntent. + """ bizum: Optional[Bizum] """ If paying by `bizum`, this sub-hash contains details about the Bizum payment method options to pass to the invoice's PaymentIntent. @@ -1101,6 +1122,7 @@ class WechatPay(StripeObject): _inner_class_types = { "acss_debit": AcssDebit, "bancontact": Bancontact, + "billie": Billie, "bizum": Bizum, "blik": Blik, "card": Card, @@ -1137,6 +1159,7 @@ class WechatPay(StripeObject): "au_becs_debit", "bacs_debit", "bancontact", + "billie", "bizum", "blik", "boleto", @@ -1168,6 +1191,7 @@ class WechatPay(StripeObject): "payco", "paynow", "paypal", + "paypay", "payto", "pix", "promptpay", @@ -1182,6 +1206,7 @@ class WechatPay(StripeObject): "twint", "upi", "us_bank_account", + "vipps", "wechat_pay", ], str, @@ -1578,6 +1603,10 @@ class TaxRateDetails(StripeObject): """ The customer's address. Until the invoice is finalized, this field will equal `customer.address`. Once the invoice is finalized, this field will no longer be updated. """ + customer_balance: Optional[CustomerBalance] + """ + The customer balance amounts applied to this invoice. + """ customer_email: Optional[str] """ The customer's email. Until the invoice is finalized, this field will equal `customer.email`. Once the invoice is finalized, this field will no longer be updated. @@ -1796,6 +1825,7 @@ class TaxRateDetails(StripeObject): "confirmation_secret": ConfirmationSecret, "custom_fields": CustomField, "customer_address": CustomerAddress, + "customer_balance": CustomerBalance, "customer_shipping": CustomerShipping, "customer_tax_ids": CustomerTaxId, "from_invoice": FromInvoice, diff --git a/stripe/_quote_preview_subscription_schedule.py b/stripe/_quote_preview_subscription_schedule.py index 152dc6c74..c84797bba 100644 --- a/stripe/_quote_preview_subscription_schedule.py +++ b/stripe/_quote_preview_subscription_schedule.py @@ -331,6 +331,24 @@ class UnusedTimeFrom(StripeObject): """ _inner_class_types = {"bill_for": BillFor} + class Status(StripeObject): + class Error(StripeObject): + code: Optional[str] + """ + A machine-readable error code. + """ + message: str + """ + A description of the error. + """ + + error: Optional[Error] + type: Union[Literal["error", "scheduled", "succeeded"], str] + """ + The lifecycle state of the pause operation. + """ + _inner_class_types = {"error": Error} + pause_at: int """ Time at which the subscription pauses. @@ -339,7 +357,8 @@ class UnusedTimeFrom(StripeObject): """ Settings controlling billing behavior during the pause. """ - _inner_class_types = {"settings": Settings} + status: Status + _inner_class_types = {"settings": Settings, "status": Status} class Resume(StripeObject): class Settings(StripeObject): @@ -360,12 +379,40 @@ class Settings(StripeObject): Determines how to handle prorations resulting from the billing_cycle_anchor change on resume. """ + class Status(StripeObject): + class Error(StripeObject): + code: Optional[str] + """ + A machine-readable error code. + """ + message: str + """ + A description of the error. + """ + + error: Optional[Error] + type: Union[ + Literal[ + "error", + "pending", + "requires_action", + "scheduled", + "succeeded", + ], + str, + ] + """ + The lifecycle state of the resume operation. + """ + _inner_class_types = {"error": Error} + resume_at: int """ Time at which the subscription resumes. """ settings: Settings - _inner_class_types = {"settings": Settings} + status: Status + _inner_class_types = {"settings": Settings, "status": Status} key: str """ diff --git a/stripe/_subscription.py b/stripe/_subscription.py index 90ae354a6..7dc4bfe64 100644 --- a/stripe/_subscription.py +++ b/stripe/_subscription.py @@ -371,6 +371,9 @@ class Bancontact(StripeObject): Preferred language of the Bancontact authorization page that the customer is redirected to. """ + class Billie(StripeObject): + pass + class Bizum(StripeObject): class MandateOptions(StripeObject): amount: Optional[int] @@ -657,6 +660,10 @@ class WechatPay(StripeObject): """ This sub-hash contains details about the Bancontact payment method options to pass to invoices created by the subscription. """ + billie: Optional[Billie] + """ + This sub-hash contains details about the Billie payment method options to pass to invoices created by the subscription. + """ bizum: Optional[Bizum] """ This sub-hash contains details about the Bizum payment method options to pass to invoices created by the subscription. @@ -712,6 +719,7 @@ class WechatPay(StripeObject): _inner_class_types = { "acss_debit": AcssDebit, "bancontact": Bancontact, + "billie": Billie, "bizum": Bizum, "blik": Blik, "card": Card, @@ -744,6 +752,7 @@ class WechatPay(StripeObject): "au_becs_debit", "bacs_debit", "bancontact", + "billie", "bizum", "blik", "boleto", @@ -775,6 +784,7 @@ class WechatPay(StripeObject): "payco", "paynow", "paypal", + "paypay", "payto", "pix", "promptpay", @@ -789,6 +799,7 @@ class WechatPay(StripeObject): "twint", "upi", "us_bank_account", + "vipps", "wechat_pay", ], str, diff --git a/stripe/_subscription_schedule.py b/stripe/_subscription_schedule.py index fbbd6b5b7..286b12afc 100644 --- a/stripe/_subscription_schedule.py +++ b/stripe/_subscription_schedule.py @@ -353,6 +353,24 @@ class UnusedTimeFrom(StripeObject): """ _inner_class_types = {"bill_for": BillFor} + class Status(StripeObject): + class Error(StripeObject): + code: Optional[str] + """ + A machine-readable error code. + """ + message: str + """ + A description of the error. + """ + + error: Optional[Error] + type: Union[Literal["error", "scheduled", "succeeded"], str] + """ + The lifecycle state of the pause operation. + """ + _inner_class_types = {"error": Error} + pause_at: int """ Time at which the subscription pauses. @@ -361,7 +379,8 @@ class UnusedTimeFrom(StripeObject): """ Settings controlling billing behavior during the pause. """ - _inner_class_types = {"settings": Settings} + status: Status + _inner_class_types = {"settings": Settings, "status": Status} class Resume(StripeObject): class Settings(StripeObject): @@ -382,12 +401,40 @@ class Settings(StripeObject): Determines how to handle prorations resulting from the billing_cycle_anchor change on resume. """ + class Status(StripeObject): + class Error(StripeObject): + code: Optional[str] + """ + A machine-readable error code. + """ + message: str + """ + A description of the error. + """ + + error: Optional[Error] + type: Union[ + Literal[ + "error", + "pending", + "requires_action", + "scheduled", + "succeeded", + ], + str, + ] + """ + The lifecycle state of the resume operation. + """ + _inner_class_types = {"error": Error} + resume_at: int """ Time at which the subscription resumes. """ settings: Settings - _inner_class_types = {"settings": Settings} + status: Status + _inner_class_types = {"settings": Settings, "status": Status} key: str """ diff --git a/stripe/billing_portal/_session.py b/stripe/billing_portal/_session.py index f2dc44812..57c69dd94 100644 --- a/stripe/billing_portal/_session.py +++ b/stripe/billing_portal/_session.py @@ -69,6 +69,9 @@ class Redirect(StripeObject): "redirect": Redirect, } + class CustomerUpdate(StripeObject): + pass + class SubscriptionCancel(StripeObject): class Retention(StripeObject): class CouponOffer(StripeObject): @@ -143,6 +146,10 @@ class Item(StripeObject): _inner_class_types = {"discounts": Discount, "items": Item} after_completion: AfterCompletion + customer_update: Optional[CustomerUpdate] + """ + Configuration when `flow.type=customer_update`. + """ subscription_cancel: Optional[SubscriptionCancel] """ Configuration when `flow.type=subscription_cancel`. @@ -157,6 +164,7 @@ class Item(StripeObject): """ type: Union[ Literal[ + "customer_update", "payment_method_update", "subscription_cancel", "subscription_update", @@ -169,6 +177,7 @@ class Item(StripeObject): """ _inner_class_types = { "after_completion": AfterCompletion, + "customer_update": CustomerUpdate, "subscription_cancel": SubscriptionCancel, "subscription_update": SubscriptionUpdate, "subscription_update_confirm": SubscriptionUpdateConfirm, diff --git a/stripe/climate/_order.py b/stripe/climate/_order.py index 5f21f6fde..75c5bcc5a 100644 --- a/stripe/climate/_order.py +++ b/stripe/climate/_order.py @@ -139,7 +139,7 @@ class Location(StripeObject): """ expected_delivery_year: int """ - 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. """ id: str """ diff --git a/stripe/climate/_product.py b/stripe/climate/_product.py index b940227a9..211c71dc9 100644 --- a/stripe/climate/_product.py +++ b/stripe/climate/_product.py @@ -49,7 +49,7 @@ class CurrentPricesPerMetricTon(StripeObject): """ delivery_year: Optional[int] """ - 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. """ id: str """ diff --git a/stripe/crypto/_customer_consumer_wallet.py b/stripe/crypto/_customer_consumer_wallet.py index 239c33c8c..4af212ffa 100644 --- a/stripe/crypto/_customer_consumer_wallet.py +++ b/stripe/crypto/_customer_consumer_wallet.py @@ -27,6 +27,7 @@ class CustomerConsumerWallet(StripeObject): "avalanche", "base", "bitcoin", + "celo", "ethereum", "optimism", "polygon", diff --git a/stripe/crypto/_onramp_session.py b/stripe/crypto/_onramp_session.py index ccd78dcad..f34cfb789 100644 --- a/stripe/crypto/_onramp_session.py +++ b/stripe/crypto/_onramp_session.py @@ -72,6 +72,10 @@ class DestinationTags(StripeObject): """ A bitcoin address """ + celo: Optional[str] + """ + A Celo address + """ destination_tags: Optional[DestinationTags] """ The end customer's crypto wallet destination tag (for each network) to use for this transaction. @@ -151,6 +155,7 @@ class DestinationTags(StripeObject): "avalanche", "base", "bitcoin", + "celo", "ethereum", "optimism", "polygon", @@ -173,6 +178,7 @@ class DestinationTags(StripeObject): "avalanche", "base", "bitcoin", + "celo", "ethereum", "optimism", "polygon", diff --git a/stripe/events/__init__.py b/stripe/events/__init__.py index 4773310c2..4b15485b0 100644 --- a/stripe/events/__init__.py +++ b/stripe/events/__init__.py @@ -59,10 +59,34 @@ V1BalanceAvailableEvent as V1BalanceAvailableEvent, V1BalanceAvailableEventNotification as V1BalanceAvailableEventNotification, ) + from stripe.events._v1_balance_settings_updated_event import ( + V1BalanceSettingsUpdatedEvent as V1BalanceSettingsUpdatedEvent, + V1BalanceSettingsUpdatedEventNotification as V1BalanceSettingsUpdatedEventNotification, + ) from stripe.events._v1_billing_alert_triggered_event import ( V1BillingAlertTriggeredEvent as V1BillingAlertTriggeredEvent, V1BillingAlertTriggeredEventNotification as V1BillingAlertTriggeredEventNotification, ) + from stripe.events._v1_billing_credit_balance_transaction_created_event import ( + V1BillingCreditBalanceTransactionCreatedEvent as V1BillingCreditBalanceTransactionCreatedEvent, + V1BillingCreditBalanceTransactionCreatedEventNotification as V1BillingCreditBalanceTransactionCreatedEventNotification, + ) + from stripe.events._v1_billing_credit_grant_created_event import ( + V1BillingCreditGrantCreatedEvent as V1BillingCreditGrantCreatedEvent, + V1BillingCreditGrantCreatedEventNotification as V1BillingCreditGrantCreatedEventNotification, + ) + from stripe.events._v1_billing_credit_grant_updated_event import ( + V1BillingCreditGrantUpdatedEvent as V1BillingCreditGrantUpdatedEvent, + V1BillingCreditGrantUpdatedEventNotification as V1BillingCreditGrantUpdatedEventNotification, + ) + from stripe.events._v1_billing_meter_created_event import ( + V1BillingMeterCreatedEvent as V1BillingMeterCreatedEvent, + V1BillingMeterCreatedEventNotification as V1BillingMeterCreatedEventNotification, + ) + from stripe.events._v1_billing_meter_deactivated_event import ( + V1BillingMeterDeactivatedEvent as V1BillingMeterDeactivatedEvent, + V1BillingMeterDeactivatedEventNotification as V1BillingMeterDeactivatedEventNotification, + ) from stripe.events._v1_billing_meter_error_report_triggered_event import ( V1BillingMeterErrorReportTriggeredEvent as V1BillingMeterErrorReportTriggeredEvent, V1BillingMeterErrorReportTriggeredEventNotification as V1BillingMeterErrorReportTriggeredEventNotification, @@ -71,6 +95,14 @@ V1BillingMeterNoMeterFoundEvent as V1BillingMeterNoMeterFoundEvent, V1BillingMeterNoMeterFoundEventNotification as V1BillingMeterNoMeterFoundEventNotification, ) + from stripe.events._v1_billing_meter_reactivated_event import ( + V1BillingMeterReactivatedEvent as V1BillingMeterReactivatedEvent, + V1BillingMeterReactivatedEventNotification as V1BillingMeterReactivatedEventNotification, + ) + from stripe.events._v1_billing_meter_updated_event import ( + V1BillingMeterUpdatedEvent as V1BillingMeterUpdatedEvent, + V1BillingMeterUpdatedEventNotification as V1BillingMeterUpdatedEventNotification, + ) from stripe.events._v1_billing_portal_configuration_created_event import ( V1BillingPortalConfigurationCreatedEvent as V1BillingPortalConfigurationCreatedEvent, V1BillingPortalConfigurationCreatedEventNotification as V1BillingPortalConfigurationCreatedEventNotification, @@ -279,6 +311,10 @@ V1FileCreatedEvent as V1FileCreatedEvent, V1FileCreatedEventNotification as V1FileCreatedEventNotification, ) + from stripe.events._v1_financial_connections_account_account_numbers_updated_event import ( + V1FinancialConnectionsAccountAccountNumbersUpdatedEvent as V1FinancialConnectionsAccountAccountNumbersUpdatedEvent, + V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification as V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification, + ) from stripe.events._v1_financial_connections_account_created_event import ( V1FinancialConnectionsAccountCreatedEvent as V1FinancialConnectionsAccountCreatedEvent, V1FinancialConnectionsAccountCreatedEventNotification as V1FinancialConnectionsAccountCreatedEventNotification, @@ -291,6 +327,10 @@ V1FinancialConnectionsAccountDisconnectedEvent as V1FinancialConnectionsAccountDisconnectedEvent, V1FinancialConnectionsAccountDisconnectedEventNotification as V1FinancialConnectionsAccountDisconnectedEventNotification, ) + from stripe.events._v1_financial_connections_account_expected_deactivation_date_updated_event import ( + V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent as V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent, + V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification as V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification, + ) from stripe.events._v1_financial_connections_account_reactivated_event import ( V1FinancialConnectionsAccountReactivatedEvent as V1FinancialConnectionsAccountReactivatedEvent, V1FinancialConnectionsAccountReactivatedEventNotification as V1FinancialConnectionsAccountReactivatedEventNotification, @@ -307,6 +347,18 @@ V1FinancialConnectionsAccountRefreshedTransactionsEvent as V1FinancialConnectionsAccountRefreshedTransactionsEvent, V1FinancialConnectionsAccountRefreshedTransactionsEventNotification as V1FinancialConnectionsAccountRefreshedTransactionsEventNotification, ) + from stripe.events._v1_financial_connections_account_supported_payment_method_types_updated_event import ( + V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent as V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent, + V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification as V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification, + ) + from stripe.events._v1_financial_connections_account_upcoming_account_number_expiry_event import ( + V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent as V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent, + V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification as V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification, + ) + from stripe.events._v1_financial_connections_account_upcoming_deactivation_event import ( + V1FinancialConnectionsAccountUpcomingDeactivationEvent as V1FinancialConnectionsAccountUpcomingDeactivationEvent, + V1FinancialConnectionsAccountUpcomingDeactivationEventNotification as V1FinancialConnectionsAccountUpcomingDeactivationEventNotification, + ) from stripe.events._v1_identity_verification_session_canceled_event import ( V1IdentityVerificationSessionCanceledEvent as V1IdentityVerificationSessionCanceledEvent, V1IdentityVerificationSessionCanceledEventNotification as V1IdentityVerificationSessionCanceledEventNotification, @@ -367,6 +419,10 @@ V1InvoicePaymentActionRequiredEvent as V1InvoicePaymentActionRequiredEvent, V1InvoicePaymentActionRequiredEventNotification as V1InvoicePaymentActionRequiredEventNotification, ) + from stripe.events._v1_invoice_payment_attempt_required_event import ( + V1InvoicePaymentAttemptRequiredEvent as V1InvoicePaymentAttemptRequiredEvent, + V1InvoicePaymentAttemptRequiredEventNotification as V1InvoicePaymentAttemptRequiredEventNotification, + ) from stripe.events._v1_invoice_payment_failed_event import ( V1InvoicePaymentFailedEvent as V1InvoicePaymentFailedEvent, V1InvoicePaymentFailedEventNotification as V1InvoicePaymentFailedEventNotification, @@ -1815,6 +1871,14 @@ "stripe.events._v1_balance_available_event", False, ), + "V1BalanceSettingsUpdatedEvent": ( + "stripe.events._v1_balance_settings_updated_event", + False, + ), + "V1BalanceSettingsUpdatedEventNotification": ( + "stripe.events._v1_balance_settings_updated_event", + False, + ), "V1BillingAlertTriggeredEvent": ( "stripe.events._v1_billing_alert_triggered_event", False, @@ -1823,6 +1887,46 @@ "stripe.events._v1_billing_alert_triggered_event", False, ), + "V1BillingCreditBalanceTransactionCreatedEvent": ( + "stripe.events._v1_billing_credit_balance_transaction_created_event", + False, + ), + "V1BillingCreditBalanceTransactionCreatedEventNotification": ( + "stripe.events._v1_billing_credit_balance_transaction_created_event", + False, + ), + "V1BillingCreditGrantCreatedEvent": ( + "stripe.events._v1_billing_credit_grant_created_event", + False, + ), + "V1BillingCreditGrantCreatedEventNotification": ( + "stripe.events._v1_billing_credit_grant_created_event", + False, + ), + "V1BillingCreditGrantUpdatedEvent": ( + "stripe.events._v1_billing_credit_grant_updated_event", + False, + ), + "V1BillingCreditGrantUpdatedEventNotification": ( + "stripe.events._v1_billing_credit_grant_updated_event", + False, + ), + "V1BillingMeterCreatedEvent": ( + "stripe.events._v1_billing_meter_created_event", + False, + ), + "V1BillingMeterCreatedEventNotification": ( + "stripe.events._v1_billing_meter_created_event", + False, + ), + "V1BillingMeterDeactivatedEvent": ( + "stripe.events._v1_billing_meter_deactivated_event", + False, + ), + "V1BillingMeterDeactivatedEventNotification": ( + "stripe.events._v1_billing_meter_deactivated_event", + False, + ), "V1BillingMeterErrorReportTriggeredEvent": ( "stripe.events._v1_billing_meter_error_report_triggered_event", False, @@ -1839,6 +1943,22 @@ "stripe.events._v1_billing_meter_no_meter_found_event", False, ), + "V1BillingMeterReactivatedEvent": ( + "stripe.events._v1_billing_meter_reactivated_event", + False, + ), + "V1BillingMeterReactivatedEventNotification": ( + "stripe.events._v1_billing_meter_reactivated_event", + False, + ), + "V1BillingMeterUpdatedEvent": ( + "stripe.events._v1_billing_meter_updated_event", + False, + ), + "V1BillingMeterUpdatedEventNotification": ( + "stripe.events._v1_billing_meter_updated_event", + False, + ), "V1BillingPortalConfigurationCreatedEvent": ( "stripe.events._v1_billing_portal_configuration_created_event", False, @@ -2231,6 +2351,14 @@ "stripe.events._v1_file_created_event", False, ), + "V1FinancialConnectionsAccountAccountNumbersUpdatedEvent": ( + "stripe.events._v1_financial_connections_account_account_numbers_updated_event", + False, + ), + "V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification": ( + "stripe.events._v1_financial_connections_account_account_numbers_updated_event", + False, + ), "V1FinancialConnectionsAccountCreatedEvent": ( "stripe.events._v1_financial_connections_account_created_event", False, @@ -2255,6 +2383,14 @@ "stripe.events._v1_financial_connections_account_disconnected_event", False, ), + "V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent": ( + "stripe.events._v1_financial_connections_account_expected_deactivation_date_updated_event", + False, + ), + "V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification": ( + "stripe.events._v1_financial_connections_account_expected_deactivation_date_updated_event", + False, + ), "V1FinancialConnectionsAccountReactivatedEvent": ( "stripe.events._v1_financial_connections_account_reactivated_event", False, @@ -2287,6 +2423,30 @@ "stripe.events._v1_financial_connections_account_refreshed_transactions_event", False, ), + "V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent": ( + "stripe.events._v1_financial_connections_account_supported_payment_method_types_updated_event", + False, + ), + "V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification": ( + "stripe.events._v1_financial_connections_account_supported_payment_method_types_updated_event", + False, + ), + "V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent": ( + "stripe.events._v1_financial_connections_account_upcoming_account_number_expiry_event", + False, + ), + "V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification": ( + "stripe.events._v1_financial_connections_account_upcoming_account_number_expiry_event", + False, + ), + "V1FinancialConnectionsAccountUpcomingDeactivationEvent": ( + "stripe.events._v1_financial_connections_account_upcoming_deactivation_event", + False, + ), + "V1FinancialConnectionsAccountUpcomingDeactivationEventNotification": ( + "stripe.events._v1_financial_connections_account_upcoming_deactivation_event", + False, + ), "V1IdentityVerificationSessionCanceledEvent": ( "stripe.events._v1_identity_verification_session_canceled_event", False, @@ -2404,6 +2564,14 @@ "stripe.events._v1_invoice_payment_action_required_event", False, ), + "V1InvoicePaymentAttemptRequiredEvent": ( + "stripe.events._v1_invoice_payment_attempt_required_event", + False, + ), + "V1InvoicePaymentAttemptRequiredEventNotification": ( + "stripe.events._v1_invoice_payment_attempt_required_event", + False, + ), "V1InvoicePaymentFailedEvent": ( "stripe.events._v1_invoice_payment_failed_event", False, diff --git a/stripe/events/_event_classes.py b/stripe/events/_event_classes.py index eaa13a5ef..01c87a4e5 100644 --- a/stripe/events/_event_classes.py +++ b/stripe/events/_event_classes.py @@ -40,15 +40,39 @@ from stripe.events._v1_balance_available_event import ( V1BalanceAvailableEventNotification, ) + from stripe.events._v1_balance_settings_updated_event import ( + V1BalanceSettingsUpdatedEventNotification, + ) from stripe.events._v1_billing_alert_triggered_event import ( V1BillingAlertTriggeredEventNotification, ) + from stripe.events._v1_billing_credit_balance_transaction_created_event import ( + V1BillingCreditBalanceTransactionCreatedEventNotification, + ) + from stripe.events._v1_billing_credit_grant_created_event import ( + V1BillingCreditGrantCreatedEventNotification, + ) + from stripe.events._v1_billing_credit_grant_updated_event import ( + V1BillingCreditGrantUpdatedEventNotification, + ) + from stripe.events._v1_billing_meter_created_event import ( + V1BillingMeterCreatedEventNotification, + ) + from stripe.events._v1_billing_meter_deactivated_event import ( + V1BillingMeterDeactivatedEventNotification, + ) from stripe.events._v1_billing_meter_error_report_triggered_event import ( V1BillingMeterErrorReportTriggeredEventNotification, ) from stripe.events._v1_billing_meter_no_meter_found_event import ( V1BillingMeterNoMeterFoundEventNotification, ) + from stripe.events._v1_billing_meter_reactivated_event import ( + V1BillingMeterReactivatedEventNotification, + ) + from stripe.events._v1_billing_meter_updated_event import ( + V1BillingMeterUpdatedEventNotification, + ) from stripe.events._v1_billing_portal_configuration_created_event import ( V1BillingPortalConfigurationCreatedEventNotification, ) @@ -205,6 +229,9 @@ from stripe.events._v1_file_created_event import ( V1FileCreatedEventNotification, ) + from stripe.events._v1_financial_connections_account_account_numbers_updated_event import ( + V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification, + ) from stripe.events._v1_financial_connections_account_created_event import ( V1FinancialConnectionsAccountCreatedEventNotification, ) @@ -214,6 +241,9 @@ from stripe.events._v1_financial_connections_account_disconnected_event import ( V1FinancialConnectionsAccountDisconnectedEventNotification, ) + from stripe.events._v1_financial_connections_account_expected_deactivation_date_updated_event import ( + V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification, + ) from stripe.events._v1_financial_connections_account_reactivated_event import ( V1FinancialConnectionsAccountReactivatedEventNotification, ) @@ -226,6 +256,15 @@ from stripe.events._v1_financial_connections_account_refreshed_transactions_event import ( V1FinancialConnectionsAccountRefreshedTransactionsEventNotification, ) + from stripe.events._v1_financial_connections_account_supported_payment_method_types_updated_event import ( + V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification, + ) + from stripe.events._v1_financial_connections_account_upcoming_account_number_expiry_event import ( + V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification, + ) + from stripe.events._v1_financial_connections_account_upcoming_deactivation_event import ( + V1FinancialConnectionsAccountUpcomingDeactivationEventNotification, + ) from stripe.events._v1_identity_verification_session_canceled_event import ( V1IdentityVerificationSessionCanceledEventNotification, ) @@ -277,6 +316,9 @@ from stripe.events._v1_invoice_payment_action_required_event import ( V1InvoicePaymentActionRequiredEventNotification, ) + from stripe.events._v1_invoice_payment_attempt_required_event import ( + V1InvoicePaymentAttemptRequiredEventNotification, + ) from stripe.events._v1_invoice_payment_failed_event import ( V1InvoicePaymentFailedEventNotification, ) @@ -1335,10 +1377,34 @@ "stripe.events._v1_balance_available_event", "V1BalanceAvailableEvent", ), + "v1.balance_settings.updated": ( + "stripe.events._v1_balance_settings_updated_event", + "V1BalanceSettingsUpdatedEvent", + ), "v1.billing.alert.triggered": ( "stripe.events._v1_billing_alert_triggered_event", "V1BillingAlertTriggeredEvent", ), + "v1.billing.credit_balance_transaction.created": ( + "stripe.events._v1_billing_credit_balance_transaction_created_event", + "V1BillingCreditBalanceTransactionCreatedEvent", + ), + "v1.billing.credit_grant.created": ( + "stripe.events._v1_billing_credit_grant_created_event", + "V1BillingCreditGrantCreatedEvent", + ), + "v1.billing.credit_grant.updated": ( + "stripe.events._v1_billing_credit_grant_updated_event", + "V1BillingCreditGrantUpdatedEvent", + ), + "v1.billing.meter.created": ( + "stripe.events._v1_billing_meter_created_event", + "V1BillingMeterCreatedEvent", + ), + "v1.billing.meter.deactivated": ( + "stripe.events._v1_billing_meter_deactivated_event", + "V1BillingMeterDeactivatedEvent", + ), "v1.billing.meter.error_report_triggered": ( "stripe.events._v1_billing_meter_error_report_triggered_event", "V1BillingMeterErrorReportTriggeredEvent", @@ -1347,6 +1413,14 @@ "stripe.events._v1_billing_meter_no_meter_found_event", "V1BillingMeterNoMeterFoundEvent", ), + "v1.billing.meter.reactivated": ( + "stripe.events._v1_billing_meter_reactivated_event", + "V1BillingMeterReactivatedEvent", + ), + "v1.billing.meter.updated": ( + "stripe.events._v1_billing_meter_updated_event", + "V1BillingMeterUpdatedEvent", + ), "v1.billing_portal.configuration.created": ( "stripe.events._v1_billing_portal_configuration_created_event", "V1BillingPortalConfigurationCreatedEvent", @@ -1555,6 +1629,10 @@ "stripe.events._v1_file_created_event", "V1FileCreatedEvent", ), + "v1.financial_connections.account.account_numbers_updated": ( + "stripe.events._v1_financial_connections_account_account_numbers_updated_event", + "V1FinancialConnectionsAccountAccountNumbersUpdatedEvent", + ), "v1.financial_connections.account.created": ( "stripe.events._v1_financial_connections_account_created_event", "V1FinancialConnectionsAccountCreatedEvent", @@ -1567,6 +1645,10 @@ "stripe.events._v1_financial_connections_account_disconnected_event", "V1FinancialConnectionsAccountDisconnectedEvent", ), + "v1.financial_connections.account.expected_deactivation_date_updated": ( + "stripe.events._v1_financial_connections_account_expected_deactivation_date_updated_event", + "V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent", + ), "v1.financial_connections.account.reactivated": ( "stripe.events._v1_financial_connections_account_reactivated_event", "V1FinancialConnectionsAccountReactivatedEvent", @@ -1583,6 +1665,18 @@ "stripe.events._v1_financial_connections_account_refreshed_transactions_event", "V1FinancialConnectionsAccountRefreshedTransactionsEvent", ), + "v1.financial_connections.account.supported_payment_method_types_updated": ( + "stripe.events._v1_financial_connections_account_supported_payment_method_types_updated_event", + "V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent", + ), + "v1.financial_connections.account.upcoming_account_number_expiry": ( + "stripe.events._v1_financial_connections_account_upcoming_account_number_expiry_event", + "V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent", + ), + "v1.financial_connections.account.upcoming_deactivation": ( + "stripe.events._v1_financial_connections_account_upcoming_deactivation_event", + "V1FinancialConnectionsAccountUpcomingDeactivationEvent", + ), "v1.identity.verification_session.canceled": ( "stripe.events._v1_identity_verification_session_canceled_event", "V1IdentityVerificationSessionCanceledEvent", @@ -1651,6 +1745,10 @@ "stripe.events._v1_invoice_payment_action_required_event", "V1InvoicePaymentActionRequiredEvent", ), + "v1.invoice.payment_attempt_required": ( + "stripe.events._v1_invoice_payment_attempt_required_event", + "V1InvoicePaymentAttemptRequiredEvent", + ), "v1.invoice.payment_failed": ( "stripe.events._v1_invoice_payment_failed_event", "V1InvoicePaymentFailedEvent", @@ -3058,10 +3156,34 @@ def get_v2_event_class(type_: str): "stripe.events._v1_balance_available_event", "V1BalanceAvailableEventNotification", ), + "v1.balance_settings.updated": ( + "stripe.events._v1_balance_settings_updated_event", + "V1BalanceSettingsUpdatedEventNotification", + ), "v1.billing.alert.triggered": ( "stripe.events._v1_billing_alert_triggered_event", "V1BillingAlertTriggeredEventNotification", ), + "v1.billing.credit_balance_transaction.created": ( + "stripe.events._v1_billing_credit_balance_transaction_created_event", + "V1BillingCreditBalanceTransactionCreatedEventNotification", + ), + "v1.billing.credit_grant.created": ( + "stripe.events._v1_billing_credit_grant_created_event", + "V1BillingCreditGrantCreatedEventNotification", + ), + "v1.billing.credit_grant.updated": ( + "stripe.events._v1_billing_credit_grant_updated_event", + "V1BillingCreditGrantUpdatedEventNotification", + ), + "v1.billing.meter.created": ( + "stripe.events._v1_billing_meter_created_event", + "V1BillingMeterCreatedEventNotification", + ), + "v1.billing.meter.deactivated": ( + "stripe.events._v1_billing_meter_deactivated_event", + "V1BillingMeterDeactivatedEventNotification", + ), "v1.billing.meter.error_report_triggered": ( "stripe.events._v1_billing_meter_error_report_triggered_event", "V1BillingMeterErrorReportTriggeredEventNotification", @@ -3070,6 +3192,14 @@ def get_v2_event_class(type_: str): "stripe.events._v1_billing_meter_no_meter_found_event", "V1BillingMeterNoMeterFoundEventNotification", ), + "v1.billing.meter.reactivated": ( + "stripe.events._v1_billing_meter_reactivated_event", + "V1BillingMeterReactivatedEventNotification", + ), + "v1.billing.meter.updated": ( + "stripe.events._v1_billing_meter_updated_event", + "V1BillingMeterUpdatedEventNotification", + ), "v1.billing_portal.configuration.created": ( "stripe.events._v1_billing_portal_configuration_created_event", "V1BillingPortalConfigurationCreatedEventNotification", @@ -3278,6 +3408,10 @@ def get_v2_event_class(type_: str): "stripe.events._v1_file_created_event", "V1FileCreatedEventNotification", ), + "v1.financial_connections.account.account_numbers_updated": ( + "stripe.events._v1_financial_connections_account_account_numbers_updated_event", + "V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification", + ), "v1.financial_connections.account.created": ( "stripe.events._v1_financial_connections_account_created_event", "V1FinancialConnectionsAccountCreatedEventNotification", @@ -3290,6 +3424,10 @@ def get_v2_event_class(type_: str): "stripe.events._v1_financial_connections_account_disconnected_event", "V1FinancialConnectionsAccountDisconnectedEventNotification", ), + "v1.financial_connections.account.expected_deactivation_date_updated": ( + "stripe.events._v1_financial_connections_account_expected_deactivation_date_updated_event", + "V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification", + ), "v1.financial_connections.account.reactivated": ( "stripe.events._v1_financial_connections_account_reactivated_event", "V1FinancialConnectionsAccountReactivatedEventNotification", @@ -3306,6 +3444,18 @@ def get_v2_event_class(type_: str): "stripe.events._v1_financial_connections_account_refreshed_transactions_event", "V1FinancialConnectionsAccountRefreshedTransactionsEventNotification", ), + "v1.financial_connections.account.supported_payment_method_types_updated": ( + "stripe.events._v1_financial_connections_account_supported_payment_method_types_updated_event", + "V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification", + ), + "v1.financial_connections.account.upcoming_account_number_expiry": ( + "stripe.events._v1_financial_connections_account_upcoming_account_number_expiry_event", + "V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification", + ), + "v1.financial_connections.account.upcoming_deactivation": ( + "stripe.events._v1_financial_connections_account_upcoming_deactivation_event", + "V1FinancialConnectionsAccountUpcomingDeactivationEventNotification", + ), "v1.identity.verification_session.canceled": ( "stripe.events._v1_identity_verification_session_canceled_event", "V1IdentityVerificationSessionCanceledEventNotification", @@ -3374,6 +3524,10 @@ def get_v2_event_class(type_: str): "stripe.events._v1_invoice_payment_action_required_event", "V1InvoicePaymentActionRequiredEventNotification", ), + "v1.invoice.payment_attempt_required": ( + "stripe.events._v1_invoice_payment_attempt_required_event", + "V1InvoicePaymentAttemptRequiredEventNotification", + ), "v1.invoice.payment_failed": ( "stripe.events._v1_invoice_payment_failed_event", "V1InvoicePaymentFailedEventNotification", @@ -4748,9 +4902,17 @@ def get_v2_event_notification_class(type_: str): "V1ApplicationFeeRefundedEventNotification", "V1ApplicationFeeRefundUpdatedEventNotification", "V1BalanceAvailableEventNotification", + "V1BalanceSettingsUpdatedEventNotification", "V1BillingAlertTriggeredEventNotification", + "V1BillingCreditBalanceTransactionCreatedEventNotification", + "V1BillingCreditGrantCreatedEventNotification", + "V1BillingCreditGrantUpdatedEventNotification", + "V1BillingMeterCreatedEventNotification", + "V1BillingMeterDeactivatedEventNotification", "V1BillingMeterErrorReportTriggeredEventNotification", "V1BillingMeterNoMeterFoundEventNotification", + "V1BillingMeterReactivatedEventNotification", + "V1BillingMeterUpdatedEventNotification", "V1BillingPortalConfigurationCreatedEventNotification", "V1BillingPortalConfigurationUpdatedEventNotification", "V1BillingPortalSessionCreatedEventNotification", @@ -4803,13 +4965,18 @@ def get_v2_event_notification_class(type_: str): "V1CustomerUpdatedEventNotification", "V1EntitlementsActiveEntitlementSummaryUpdatedEventNotification", "V1FileCreatedEventNotification", + "V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification", "V1FinancialConnectionsAccountCreatedEventNotification", "V1FinancialConnectionsAccountDeactivatedEventNotification", "V1FinancialConnectionsAccountDisconnectedEventNotification", + "V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification", "V1FinancialConnectionsAccountReactivatedEventNotification", "V1FinancialConnectionsAccountRefreshedBalanceEventNotification", "V1FinancialConnectionsAccountRefreshedOwnershipEventNotification", "V1FinancialConnectionsAccountRefreshedTransactionsEventNotification", + "V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification", + "V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification", + "V1FinancialConnectionsAccountUpcomingDeactivationEventNotification", "V1IdentityVerificationSessionCanceledEventNotification", "V1IdentityVerificationSessionCreatedEventNotification", "V1IdentityVerificationSessionProcessingEventNotification", @@ -4827,6 +4994,7 @@ def get_v2_event_notification_class(type_: str): "V1InvoiceOverpaidEventNotification", "V1InvoicePaidEventNotification", "V1InvoicePaymentActionRequiredEventNotification", + "V1InvoicePaymentAttemptRequiredEventNotification", "V1InvoicePaymentFailedEventNotification", "V1InvoicePaymentPaidEventNotification", "V1InvoicePaymentSucceededEventNotification", diff --git a/stripe/events/_v1_balance_settings_updated_event.py b/stripe/events/_v1_balance_settings_updated_event.py new file mode 100644 index 000000000..07e601a90 --- /dev/null +++ b/stripe/events/_v1_balance_settings_updated_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._balance_settings import BalanceSettings + from stripe._stripe_client import StripeClient + + +class V1BalanceSettingsUpdatedEventNotification(EventNotification): + LOOKUP_TYPE = "v1.balance_settings.updated" + type: Literal["v1.balance_settings.updated"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V1BalanceSettingsUpdatedEvent": + return cast( + "V1BalanceSettingsUpdatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "BalanceSettings": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BalanceSettings", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V1BalanceSettingsUpdatedEvent": + return cast( + "V1BalanceSettingsUpdatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "BalanceSettings": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BalanceSettings", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1BalanceSettingsUpdatedEvent(Event): + LOOKUP_TYPE = "v1.balance_settings.updated" + type: Literal["v1.balance_settings.updated"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "BalanceSettings": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "BalanceSettings", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_billing_credit_balance_transaction_created_event.py b/stripe/events/_v1_billing_credit_balance_transaction_created_event.py new file mode 100644 index 000000000..7ad8227e4 --- /dev/null +++ b/stripe/events/_v1_billing_credit_balance_transaction_created_event.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.billing._credit_balance_transaction import ( + CreditBalanceTransaction, + ) + + +class V1BillingCreditBalanceTransactionCreatedEventNotification( + EventNotification, +): + LOOKUP_TYPE = "v1.billing.credit_balance_transaction.created" + type: Literal["v1.billing.credit_balance_transaction.created"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V1BillingCreditBalanceTransactionCreatedEvent": + return cast( + "V1BillingCreditBalanceTransactionCreatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "CreditBalanceTransaction": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "CreditBalanceTransaction", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async( + self, + ) -> "V1BillingCreditBalanceTransactionCreatedEvent": + return cast( + "V1BillingCreditBalanceTransactionCreatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "CreditBalanceTransaction": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "CreditBalanceTransaction", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1BillingCreditBalanceTransactionCreatedEvent(Event): + LOOKUP_TYPE = "v1.billing.credit_balance_transaction.created" + type: Literal["v1.billing.credit_balance_transaction.created"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "CreditBalanceTransaction": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "CreditBalanceTransaction", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_billing_credit_grant_created_event.py b/stripe/events/_v1_billing_credit_grant_created_event.py new file mode 100644 index 000000000..26c0a675a --- /dev/null +++ b/stripe/events/_v1_billing_credit_grant_created_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.billing._credit_grant import CreditGrant + + +class V1BillingCreditGrantCreatedEventNotification(EventNotification): + LOOKUP_TYPE = "v1.billing.credit_grant.created" + type: Literal["v1.billing.credit_grant.created"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V1BillingCreditGrantCreatedEvent": + return cast( + "V1BillingCreditGrantCreatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "CreditGrant": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "CreditGrant", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V1BillingCreditGrantCreatedEvent": + return cast( + "V1BillingCreditGrantCreatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "CreditGrant": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "CreditGrant", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1BillingCreditGrantCreatedEvent(Event): + LOOKUP_TYPE = "v1.billing.credit_grant.created" + type: Literal["v1.billing.credit_grant.created"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "CreditGrant": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "CreditGrant", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_billing_credit_grant_updated_event.py b/stripe/events/_v1_billing_credit_grant_updated_event.py new file mode 100644 index 000000000..c90e4a904 --- /dev/null +++ b/stripe/events/_v1_billing_credit_grant_updated_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.billing._credit_grant import CreditGrant + + +class V1BillingCreditGrantUpdatedEventNotification(EventNotification): + LOOKUP_TYPE = "v1.billing.credit_grant.updated" + type: Literal["v1.billing.credit_grant.updated"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V1BillingCreditGrantUpdatedEvent": + return cast( + "V1BillingCreditGrantUpdatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "CreditGrant": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "CreditGrant", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V1BillingCreditGrantUpdatedEvent": + return cast( + "V1BillingCreditGrantUpdatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "CreditGrant": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "CreditGrant", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1BillingCreditGrantUpdatedEvent(Event): + LOOKUP_TYPE = "v1.billing.credit_grant.updated" + type: Literal["v1.billing.credit_grant.updated"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "CreditGrant": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "CreditGrant", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_billing_meter_created_event.py b/stripe/events/_v1_billing_meter_created_event.py new file mode 100644 index 000000000..0dd217593 --- /dev/null +++ b/stripe/events/_v1_billing_meter_created_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.billing._meter import Meter + + +class V1BillingMeterCreatedEventNotification(EventNotification): + LOOKUP_TYPE = "v1.billing.meter.created" + type: Literal["v1.billing.meter.created"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V1BillingMeterCreatedEvent": + return cast( + "V1BillingMeterCreatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "Meter": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Meter", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V1BillingMeterCreatedEvent": + return cast( + "V1BillingMeterCreatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "Meter": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Meter", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1BillingMeterCreatedEvent(Event): + LOOKUP_TYPE = "v1.billing.meter.created" + type: Literal["v1.billing.meter.created"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "Meter": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "Meter", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_billing_meter_deactivated_event.py b/stripe/events/_v1_billing_meter_deactivated_event.py new file mode 100644 index 000000000..0f0a6e590 --- /dev/null +++ b/stripe/events/_v1_billing_meter_deactivated_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.billing._meter import Meter + + +class V1BillingMeterDeactivatedEventNotification(EventNotification): + LOOKUP_TYPE = "v1.billing.meter.deactivated" + type: Literal["v1.billing.meter.deactivated"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V1BillingMeterDeactivatedEvent": + return cast( + "V1BillingMeterDeactivatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "Meter": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Meter", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V1BillingMeterDeactivatedEvent": + return cast( + "V1BillingMeterDeactivatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "Meter": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Meter", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1BillingMeterDeactivatedEvent(Event): + LOOKUP_TYPE = "v1.billing.meter.deactivated" + type: Literal["v1.billing.meter.deactivated"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "Meter": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "Meter", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_billing_meter_reactivated_event.py b/stripe/events/_v1_billing_meter_reactivated_event.py new file mode 100644 index 000000000..918ea484b --- /dev/null +++ b/stripe/events/_v1_billing_meter_reactivated_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.billing._meter import Meter + + +class V1BillingMeterReactivatedEventNotification(EventNotification): + LOOKUP_TYPE = "v1.billing.meter.reactivated" + type: Literal["v1.billing.meter.reactivated"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V1BillingMeterReactivatedEvent": + return cast( + "V1BillingMeterReactivatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "Meter": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Meter", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V1BillingMeterReactivatedEvent": + return cast( + "V1BillingMeterReactivatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "Meter": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Meter", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1BillingMeterReactivatedEvent(Event): + LOOKUP_TYPE = "v1.billing.meter.reactivated" + type: Literal["v1.billing.meter.reactivated"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "Meter": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "Meter", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_billing_meter_updated_event.py b/stripe/events/_v1_billing_meter_updated_event.py new file mode 100644 index 000000000..f37b84db0 --- /dev/null +++ b/stripe/events/_v1_billing_meter_updated_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.billing._meter import Meter + + +class V1BillingMeterUpdatedEventNotification(EventNotification): + LOOKUP_TYPE = "v1.billing.meter.updated" + type: Literal["v1.billing.meter.updated"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V1BillingMeterUpdatedEvent": + return cast( + "V1BillingMeterUpdatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "Meter": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Meter", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V1BillingMeterUpdatedEvent": + return cast( + "V1BillingMeterUpdatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "Meter": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Meter", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1BillingMeterUpdatedEvent(Event): + LOOKUP_TYPE = "v1.billing.meter.updated" + type: Literal["v1.billing.meter.updated"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "Meter": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "Meter", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_financial_connections_account_account_numbers_updated_event.py b/stripe/events/_v1_financial_connections_account_account_numbers_updated_event.py new file mode 100644 index 000000000..2765518bc --- /dev/null +++ b/stripe/events/_v1_financial_connections_account_account_numbers_updated_event.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.financial_connections._account import Account + + +class V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification( + EventNotification, +): + LOOKUP_TYPE = "v1.financial_connections.account.account_numbers_updated" + type: Literal["v1.financial_connections.account.account_numbers_updated"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event( + self, + ) -> "V1FinancialConnectionsAccountAccountNumbersUpdatedEvent": + return cast( + "V1FinancialConnectionsAccountAccountNumbersUpdatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "Account": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Account", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async( + self, + ) -> "V1FinancialConnectionsAccountAccountNumbersUpdatedEvent": + return cast( + "V1FinancialConnectionsAccountAccountNumbersUpdatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "Account": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Account", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1FinancialConnectionsAccountAccountNumbersUpdatedEvent(Event): + LOOKUP_TYPE = "v1.financial_connections.account.account_numbers_updated" + type: Literal["v1.financial_connections.account.account_numbers_updated"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "Account": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "Account", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_financial_connections_account_expected_deactivation_date_updated_event.py b/stripe/events/_v1_financial_connections_account_expected_deactivation_date_updated_event.py new file mode 100644 index 000000000..fc69cd5fe --- /dev/null +++ b/stripe/events/_v1_financial_connections_account_expected_deactivation_date_updated_event.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.financial_connections._account import Account + + +class V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification( + EventNotification, +): + LOOKUP_TYPE = ( + "v1.financial_connections.account.expected_deactivation_date_updated" + ) + type: Literal[ + "v1.financial_connections.account.expected_deactivation_date_updated" + ] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event( + self, + ) -> "V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent": + return cast( + "V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "Account": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Account", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async( + self, + ) -> "V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent": + return cast( + "V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "Account": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Account", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent(Event): + LOOKUP_TYPE = ( + "v1.financial_connections.account.expected_deactivation_date_updated" + ) + type: Literal[ + "v1.financial_connections.account.expected_deactivation_date_updated" + ] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "Account": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "Account", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_financial_connections_account_supported_payment_method_types_updated_event.py b/stripe/events/_v1_financial_connections_account_supported_payment_method_types_updated_event.py new file mode 100644 index 000000000..295af4d97 --- /dev/null +++ b/stripe/events/_v1_financial_connections_account_supported_payment_method_types_updated_event.py @@ -0,0 +1,129 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.financial_connections._account import Account + + +class V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification( + EventNotification, +): + LOOKUP_TYPE = "v1.financial_connections.account.supported_payment_method_types_updated" + type: Literal[ + "v1.financial_connections.account.supported_payment_method_types_updated" + ] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event( + self, + ) -> ( + "V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent" + ): + return cast( + "V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "Account": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Account", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async( + self, + ) -> ( + "V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent" + ): + return cast( + "V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "Account": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Account", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent( + Event, +): + LOOKUP_TYPE = "v1.financial_connections.account.supported_payment_method_types_updated" + type: Literal[ + "v1.financial_connections.account.supported_payment_method_types_updated" + ] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "Account": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "Account", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_financial_connections_account_upcoming_account_number_expiry_event.py b/stripe/events/_v1_financial_connections_account_upcoming_account_number_expiry_event.py new file mode 100644 index 000000000..da2aa15c8 --- /dev/null +++ b/stripe/events/_v1_financial_connections_account_upcoming_account_number_expiry_event.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.financial_connections._account import Account + + +class V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification( + EventNotification, +): + LOOKUP_TYPE = ( + "v1.financial_connections.account.upcoming_account_number_expiry" + ) + type: Literal[ + "v1.financial_connections.account.upcoming_account_number_expiry" + ] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event( + self, + ) -> "V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent": + return cast( + "V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "Account": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Account", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async( + self, + ) -> "V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent": + return cast( + "V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "Account": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Account", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent(Event): + LOOKUP_TYPE = ( + "v1.financial_connections.account.upcoming_account_number_expiry" + ) + type: Literal[ + "v1.financial_connections.account.upcoming_account_number_expiry" + ] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "Account": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "Account", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_financial_connections_account_upcoming_deactivation_event.py b/stripe/events/_v1_financial_connections_account_upcoming_deactivation_event.py new file mode 100644 index 000000000..3d7b4daa0 --- /dev/null +++ b/stripe/events/_v1_financial_connections_account_upcoming_deactivation_event.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.financial_connections._account import Account + + +class V1FinancialConnectionsAccountUpcomingDeactivationEventNotification( + EventNotification, +): + LOOKUP_TYPE = "v1.financial_connections.account.upcoming_deactivation" + type: Literal["v1.financial_connections.account.upcoming_deactivation"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event( + self, + ) -> "V1FinancialConnectionsAccountUpcomingDeactivationEvent": + return cast( + "V1FinancialConnectionsAccountUpcomingDeactivationEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "Account": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Account", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async( + self, + ) -> "V1FinancialConnectionsAccountUpcomingDeactivationEvent": + return cast( + "V1FinancialConnectionsAccountUpcomingDeactivationEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "Account": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Account", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1FinancialConnectionsAccountUpcomingDeactivationEvent(Event): + LOOKUP_TYPE = "v1.financial_connections.account.upcoming_deactivation" + type: Literal["v1.financial_connections.account.upcoming_deactivation"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "Account": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "Account", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v1_invoice_payment_attempt_required_event.py b/stripe/events/_v1_invoice_payment_attempt_required_event.py new file mode 100644 index 000000000..239b2bad6 --- /dev/null +++ b/stripe/events/_v1_invoice_payment_attempt_required_event.py @@ -0,0 +1,115 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._invoice import Invoice + from stripe._stripe_client import StripeClient + + +class V1InvoicePaymentAttemptRequiredEventNotification(EventNotification): + LOOKUP_TYPE = "v1.invoice.payment_attempt_required" + type: Literal["v1.invoice.payment_attempt_required"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V1InvoicePaymentAttemptRequiredEvent": + return cast( + "V1InvoicePaymentAttemptRequiredEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "Invoice": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Invoice", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async( + self, + ) -> "V1InvoicePaymentAttemptRequiredEvent": + return cast( + "V1InvoicePaymentAttemptRequiredEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "Invoice": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "Invoice", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V1InvoicePaymentAttemptRequiredEvent(Event): + LOOKUP_TYPE = "v1.invoice.payment_attempt_required" + type: Literal["v1.invoice.payment_attempt_required"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "Invoice": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "Invoice", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_core_health_authorization_rate_drop_firing_event.py b/stripe/events/_v2_core_health_authorization_rate_drop_firing_event.py index a79ceae54..78e2868ce 100644 --- a/stripe/events/_v2_core_health_authorization_rate_drop_firing_event.py +++ b/stripe/events/_v2_core_health_authorization_rate_drop_firing_event.py @@ -42,11 +42,15 @@ class V2CoreHealthAuthorizationRateDropFiringEvent(Event): class V2CoreHealthAuthorizationRateDropFiringEventData(StripeObject): class Impact(StripeObject): class Dimension(StripeObject): + acquirer: Optional[str] + """ + The acquirer dimension. + """ issuer: Optional[str] """ The issuer dimension. """ - type: Literal["issuer"] + type: Union[Literal["acquirer", "issuer"], str] """ The type of the dimension. """ diff --git a/stripe/events/_v2_core_health_authorization_rate_drop_resolved_event.py b/stripe/events/_v2_core_health_authorization_rate_drop_resolved_event.py index 6f08b3481..dee4f510b 100644 --- a/stripe/events/_v2_core_health_authorization_rate_drop_resolved_event.py +++ b/stripe/events/_v2_core_health_authorization_rate_drop_resolved_event.py @@ -42,11 +42,15 @@ class V2CoreHealthAuthorizationRateDropResolvedEvent(Event): class V2CoreHealthAuthorizationRateDropResolvedEventData(StripeObject): class Impact(StripeObject): class Dimension(StripeObject): + acquirer: Optional[str] + """ + The acquirer dimension. + """ issuer: Optional[str] """ The issuer dimension. """ - type: Literal["issuer"] + type: Union[Literal["acquirer", "issuer"], str] """ The type of the dimension. """ diff --git a/stripe/financial_connections/_account.py b/stripe/financial_connections/_account.py index 45c918e46..40b2a022d 100644 --- a/stripe/financial_connections/_account.py +++ b/stripe/financial_connections/_account.py @@ -146,6 +146,25 @@ class BalanceRefresh(StripeObject): The status of the last refresh attempt. """ + class ClassificationState(StripeObject): + status: Optional[Union[Literal["completed", "pending"], str]] + """ + The taxonomy classification status for this account. One of 'pending' or 'completed'. + """ + + class EnrichmentState(StripeObject): + class Merchant(StripeObject): + status: Optional[Union[Literal["completed", "pending"], str]] + """ + The merchant enrichment status for this account. One of 'pending' or 'completed'. + """ + + merchant: Optional[Merchant] + """ + The enrichment status for merchant name normalization. + """ + _inner_class_types = {"merchant": Merchant} + class InferredBalancesRefresh(StripeObject): last_attempted_at: int """ @@ -260,6 +279,10 @@ class TransactionRefresh(StripeObject): """ The type of the account. Account category is further divided in `subcategory`. """ + classification_state: Optional[UntypedStripeObject[ClassificationState]] + """ + Per-taxonomy processing state for this account. One entry per subscribed taxonomy. + """ created: int """ Time at which the object was created. Measured in seconds since the Unix epoch. @@ -268,6 +291,10 @@ class TransactionRefresh(StripeObject): """ A human-readable name that has been assigned to this account, either by the account holder or by the institution. """ + enrichment_state: Optional[EnrichmentState] + """ + The state of merchant name enrichment for this account. + """ id: str """ Unique identifier for the object. @@ -1025,6 +1052,8 @@ async def list_inferred_balances_async( "account_numbers": AccountNumber, "balance": Balance, "balance_refresh": BalanceRefresh, + "classification_state": ClassificationState, + "enrichment_state": EnrichmentState, "inferred_balances_refresh": InferredBalancesRefresh, "ownership_refresh": OwnershipRefresh, "status_details": StatusDetails, diff --git a/stripe/financial_connections/_session.py b/stripe/financial_connections/_session.py index a4bc50183..1e979a20f 100644 --- a/stripe/financial_connections/_session.py +++ b/stripe/financial_connections/_session.py @@ -68,6 +68,10 @@ class Filters(StripeObject): """ List of countries from which to filter accounts. """ + country: Optional[str] + """ + Country from which to filter accounts. + """ institution: Optional[str] """ Stripe ID of the institution with which the customer should be directed to log in. diff --git a/stripe/financial_connections/_transaction.py b/stripe/financial_connections/_transaction.py index a288c187b..de40ca3bc 100644 --- a/stripe/financial_connections/_transaction.py +++ b/stripe/financial_connections/_transaction.py @@ -3,7 +3,7 @@ from stripe._list_object import ListObject from stripe._listable_api_resource import ListableAPIResource from stripe._stripe_object import StripeObject -from typing import ClassVar, Optional, Union +from typing import ClassVar, List, Optional, Union from typing_extensions import Literal, Unpack, TYPE_CHECKING if TYPE_CHECKING: @@ -24,6 +24,72 @@ class Transaction(ListableAPIResource["Transaction"]): "financial_connections.transaction" ) + class Classification(StripeObject): + class MoneyMovement(StripeObject): + confidence_level: Optional[ + Literal["high", "low", "medium", "very_high"] + ] + """ + Stripe's confidence in this classification. + """ + detailed_label: Optional[str] + """ + The detailed category label for this transaction. + """ + primary_label: Optional[str] + """ + The primary category label for this transaction. + """ + + class PersonalFinance(StripeObject): + confidence_level: Optional[ + Literal["high", "low", "medium", "very_high"] + ] + """ + Stripe's confidence in this classification. + """ + detailed_label: Optional[str] + """ + The detailed category label for this transaction. + """ + primary_label: Optional[str] + """ + The primary category label for this transaction. + """ + + money_movement: Optional[MoneyMovement] + """ + Money movement classification labels for this transaction. + """ + personal_finance: Optional[PersonalFinance] + """ + Personal finance classification labels for this transaction. + """ + type: str + """ + The taxonomy type for this classification entry. + """ + _inner_class_types = { + "money_movement": MoneyMovement, + "personal_finance": PersonalFinance, + } + + class Enrichments(StripeObject): + class Merchant(StripeObject): + confidence_level: Optional[ + Literal["high", "low", "medium", "very_high"] + ] + """ + Stripe's confidence in the enriched merchant name. + """ + name: Optional[str] + """ + The normalized merchant name for this transaction. + """ + + merchant: Merchant + _inner_class_types = {"merchant": Merchant} + class StatusTransitions(StripeObject): posted_at: Optional[int] """ @@ -42,6 +108,10 @@ class StatusTransitions(StripeObject): """ The amount of this transaction, in cents (or local equivalent). """ + classifications: Optional[List[Classification]] + """ + Classification labels for this transaction, one entry per subscribed use case. + """ currency: str """ Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). @@ -50,6 +120,10 @@ class StatusTransitions(StripeObject): """ The description of this transaction. """ + enrichments: Optional[Enrichments] + """ + Enriched merchant information for this transaction. + """ id: str """ Unique identifier for the object. @@ -142,4 +216,8 @@ async def retrieve_async( await instance.refresh_async() return instance - _inner_class_types = {"status_transitions": StatusTransitions} + _inner_class_types = { + "classifications": Classification, + "enrichments": Enrichments, + "status_transitions": StatusTransitions, + } diff --git a/stripe/issuing/_authorization.py b/stripe/issuing/_authorization.py index 949820c91..4eda9f6ad 100644 --- a/stripe/issuing/_authorization.py +++ b/stripe/issuing/_authorization.py @@ -987,6 +987,44 @@ class AmountDetails(StripeObject): The amount of cash requested by the cardholder. """ + class HoldAmount(StripeObject): + currency: str + """ + Three-letter ISO currency code. + """ + value: int + """ + The amount in the smallest currency unit. + """ + + class HoldAmountDetails(StripeObject): + class Network(StripeObject): + currency: str + """ + Three-letter ISO currency code. + """ + value: int + """ + The amount in the smallest currency unit. + """ + + class Reserve(StripeObject): + currency: str + """ + Three-letter ISO currency code. + """ + value: int + """ + The amount in the smallest currency unit. + """ + + network: Network + reserve: Optional[Reserve] + """ + The reserve amount held for this authorization. Present for certain MCCs that may have overcaptures. + """ + _inner_class_types = {"network": Network, "reserve": Reserve} + amount: int """ The additional amount Stripe will hold if the authorization is approved, in the card's [currency](https://docs.stripe.com/api#issuing_authorization_object-pending-request-currency) and in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal). @@ -999,6 +1037,14 @@ class AmountDetails(StripeObject): """ Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). """ + hold_amount: Optional[HoldAmount] + """ + The total amount to be held for this authorization request. + """ + hold_amount_details: Optional[HoldAmountDetails] + """ + Breakdown of the amounts contributing to hold_amount. + """ is_amount_controllable: bool """ If set `true`, you may provide [amount](https://docs.stripe.com/api/issuing/authorizations/approve#approve_issuing_authorization-amount) to control how much to hold for the authorization. @@ -1015,7 +1061,11 @@ class AmountDetails(StripeObject): """ The card network's estimate of the likelihood that an authorization is fraudulent. Takes on values between 1 and 99. """ - _inner_class_types = {"amount_details": AmountDetails} + _inner_class_types = { + "amount_details": AmountDetails, + "hold_amount": HoldAmount, + "hold_amount_details": HoldAmountDetails, + } class Redaction(StripeObject): status: Union[Literal["processing", "redacted", "validated"], str] @@ -1034,6 +1084,44 @@ class AmountDetails(StripeObject): The amount of cash requested by the cardholder. """ + class HoldAmount(StripeObject): + currency: str + """ + Three-letter ISO currency code. + """ + value: int + """ + The amount in the smallest currency unit. + """ + + class HoldAmountDetails(StripeObject): + class Network(StripeObject): + currency: str + """ + Three-letter ISO currency code. + """ + value: int + """ + The amount in the smallest currency unit. + """ + + class Reserve(StripeObject): + currency: str + """ + Three-letter ISO currency code. + """ + value: int + """ + The amount in the smallest currency unit. + """ + + network: Network + reserve: Optional[Reserve] + """ + The reserve amount held for this authorization. Present for certain MCCs that may have overcaptures. + """ + _inner_class_types = {"network": Network, "reserve": Reserve} + class NetworkData(StripeObject): class TraceId(StripeObject): banknet_reference_number: Optional[str] @@ -1079,6 +1167,14 @@ class TraceId(StripeObject): """ Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). """ + hold_amount: Optional[HoldAmount] + """ + The total amount that was held for this authorization request. + """ + hold_amount_details: Optional[HoldAmountDetails] + """ + Breakdown of the amounts contributing to hold_amount. + """ merchant_amount: int """ The `pending_request.merchant_amount` at the time of the request, presented in the `merchant_currency` and in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal). @@ -1134,6 +1230,8 @@ class TraceId(StripeObject): """ _inner_class_types = { "amount_details": AmountDetails, + "hold_amount": HoldAmount, + "hold_amount_details": HoldAmountDetails, "network_data": NetworkData, } diff --git a/stripe/issuing/_cardholder.py b/stripe/issuing/_cardholder.py index acd915e26..d71368a9c 100644 --- a/stripe/issuing/_cardholder.py +++ b/stripe/issuing/_cardholder.py @@ -1203,11 +1203,16 @@ class SpendingLimit(StripeObject): """ preferred_locales: Optional[ List[ - Union[Literal["da", "de", "en", "es", "fr", "it", "pl", "sv"], str] + Union[ + Literal[ + "da", "de", "en", "es", "fr", "hu", "it", "pl", "ro", "sv" + ], + str, + ] ] ] """ - The cardholder's preferred locales (languages), ordered by preference. Locales can be `da`, `de`, `en`, `es`, `fr`, `it`, `pl`, or `sv`. + The cardholder's preferred locales (languages), ordered by preference. Locales can be `de`, `en`, `es`, `fr`, or `it`. This changes the language of the [3D Secure flow](https://docs.stripe.com/issuing/3d-secure) and one-time password messages sent to the cardholder. """ redaction: Optional[Redaction] diff --git a/stripe/params/__init__.py b/stripe/params/__init__.py index 147de54a0..ba69b51cc 100644 --- a/stripe/params/__init__.py +++ b/stripe/params/__init__.py @@ -1177,6 +1177,7 @@ ) from stripe.params._customer_balance_transaction_create_params import ( CustomerBalanceTransactionCreateParams as CustomerBalanceTransactionCreateParams, + CustomerBalanceTransactionCreateParamsAppliedToInvoice as CustomerBalanceTransactionCreateParamsAppliedToInvoice, ) from stripe.params._customer_balance_transaction_list_params import ( CustomerBalanceTransactionListParams as CustomerBalanceTransactionListParams, @@ -1203,6 +1204,7 @@ ) from stripe.params._customer_create_balance_transaction_params import ( CustomerCreateBalanceTransactionParams as CustomerCreateBalanceTransactionParams, + CustomerCreateBalanceTransactionParamsAppliedToInvoice as CustomerCreateBalanceTransactionParamsAppliedToInvoice, ) from stripe.params._customer_create_funding_instructions_params import ( CustomerCreateFundingInstructionsParams as CustomerCreateFundingInstructionsParams, @@ -10176,6 +10178,10 @@ "stripe.params._customer_balance_transaction_create_params", False, ), + "CustomerBalanceTransactionCreateParamsAppliedToInvoice": ( + "stripe.params._customer_balance_transaction_create_params", + False, + ), "CustomerBalanceTransactionListParams": ( "stripe.params._customer_balance_transaction_list_params", False, @@ -10216,6 +10222,10 @@ "stripe.params._customer_create_balance_transaction_params", False, ), + "CustomerCreateBalanceTransactionParamsAppliedToInvoice": ( + "stripe.params._customer_create_balance_transaction_params", + False, + ), "CustomerCreateFundingInstructionsParams": ( "stripe.params._customer_create_funding_instructions_params", False, diff --git a/stripe/params/_customer_balance_transaction_create_params.py b/stripe/params/_customer_balance_transaction_create_params.py index 80acdcf8f..c39ba6453 100644 --- a/stripe/params/_customer_balance_transaction_create_params.py +++ b/stripe/params/_customer_balance_transaction_create_params.py @@ -10,6 +10,12 @@ class CustomerBalanceTransactionCreateParams(TypedDict): """ The integer amount in **cents (or local equivalent)** to apply to the customer's credit balance. """ + applied_to_invoice: NotRequired[ + "CustomerBalanceTransactionCreateParamsAppliedToInvoice" + ] + """ + Required when `type` is `applied_to_invoice`. Identifies the open invoice to apply the customer's balance credit to. + """ currency: str """ Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Specifies the [`invoice_credit_balance`](https://docs.stripe.com/api/customers/object#customer_object-invoice_credit_balance) that this transaction will apply to. If the customer's `currency` is not set, it will be updated to this value. @@ -28,3 +34,14 @@ class CustomerBalanceTransactionCreateParams(TypedDict): """ Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. """ + type: NotRequired["Literal['adjustment', 'applied_to_invoice']|str"] + """ + The type of customer balance transaction. Defaults to `adjustment`, which updates the customer's credit balance directly. Set to `applied_to_invoice` to apply the customer's existing credit balance to a specific open invoice. + """ + + +class CustomerBalanceTransactionCreateParamsAppliedToInvoice(TypedDict): + invoice: str + """ + The ID of the open invoice to apply the customer's balance credit to. + """ diff --git a/stripe/params/_customer_create_balance_transaction_params.py b/stripe/params/_customer_create_balance_transaction_params.py index b2b17c6df..4107c1e82 100644 --- a/stripe/params/_customer_create_balance_transaction_params.py +++ b/stripe/params/_customer_create_balance_transaction_params.py @@ -3,7 +3,7 @@ from stripe._request_options import RequestOptions from stripe._stripe_object import UntypedStripeObject from typing import Dict, List -from typing_extensions import Literal, NotRequired +from typing_extensions import Literal, NotRequired, TypedDict class CustomerCreateBalanceTransactionParams(RequestOptions): @@ -11,6 +11,12 @@ class CustomerCreateBalanceTransactionParams(RequestOptions): """ The integer amount in **cents (or local equivalent)** to apply to the customer's credit balance. """ + applied_to_invoice: NotRequired[ + "CustomerCreateBalanceTransactionParamsAppliedToInvoice" + ] + """ + Required when `type` is `applied_to_invoice`. Identifies the open invoice to apply the customer's balance credit to. + """ currency: str """ Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Specifies the [`invoice_credit_balance`](https://docs.stripe.com/api/customers/object#customer_object-invoice_credit_balance) that this transaction will apply to. If the customer's `currency` is not set, it will be updated to this value. @@ -29,3 +35,14 @@ class CustomerCreateBalanceTransactionParams(RequestOptions): """ Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. """ + type: NotRequired["Literal['adjustment', 'applied_to_invoice']|str"] + """ + The type of customer balance transaction. Defaults to `adjustment`, which updates the customer's credit balance directly. Set to `applied_to_invoice` to apply the customer's existing credit balance to a specific open invoice. + """ + + +class CustomerCreateBalanceTransactionParamsAppliedToInvoice(TypedDict): + invoice: str + """ + The ID of the open invoice to apply the customer's balance credit to. + """ diff --git a/stripe/params/_invoice_create_params.py b/stripe/params/_invoice_create_params.py index ecc43a8dd..454e466ac 100644 --- a/stripe/params/_invoice_create_params.py +++ b/stripe/params/_invoice_create_params.py @@ -288,7 +288,7 @@ class InvoiceCreateParamsPaymentSettings(TypedDict): Payment-method-specific configuration to provide to the invoice's PaymentIntent. """ payment_method_types: NotRequired[ - "Literal['']|List[Union[Literal['ach_credit_transfer', 'ach_debit', 'acss_debit', 'affirm', 'alipay', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'check_scan', 'crypto', 'custom', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'id_bank_transfer', 'ideal', 'jp_credit_transfer', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'momo', 'multibanco', 'naver_pay', 'nz_bank_account', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'payto', 'pix', 'promptpay', 'revolut_pay', 'satispay', 'sepa_credit_transfer', 'sepa_debit', 'sequra', 'sofort', 'stripe_balance', 'swish', 'twint', 'upi', 'us_bank_account', 'wechat_pay'], str]]" + "Literal['']|List[Union[Literal['ach_credit_transfer', 'ach_debit', 'acss_debit', 'affirm', 'alipay', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'billie', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'check_scan', 'crypto', 'custom', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'id_bank_transfer', 'ideal', 'jp_credit_transfer', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'momo', 'multibanco', 'naver_pay', 'nz_bank_account', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'paypay', 'payto', 'pix', 'promptpay', 'revolut_pay', 'satispay', 'sepa_credit_transfer', 'sepa_debit', 'sequra', 'sofort', 'stripe_balance', 'swish', 'twint', 'upi', 'us_bank_account', 'vipps', 'wechat_pay'], str]]" ] """ The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). diff --git a/stripe/params/_invoice_modify_params.py b/stripe/params/_invoice_modify_params.py index f00e4eaf1..0c06875f0 100644 --- a/stripe/params/_invoice_modify_params.py +++ b/stripe/params/_invoice_modify_params.py @@ -253,7 +253,7 @@ class InvoiceModifyParamsPaymentSettings(TypedDict): Payment-method-specific configuration to provide to the invoice's PaymentIntent. """ payment_method_types: NotRequired[ - "Literal['']|List[Union[Literal['ach_credit_transfer', 'ach_debit', 'acss_debit', 'affirm', 'alipay', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'check_scan', 'crypto', 'custom', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'id_bank_transfer', 'ideal', 'jp_credit_transfer', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'momo', 'multibanco', 'naver_pay', 'nz_bank_account', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'payto', 'pix', 'promptpay', 'revolut_pay', 'satispay', 'sepa_credit_transfer', 'sepa_debit', 'sequra', 'sofort', 'stripe_balance', 'swish', 'twint', 'upi', 'us_bank_account', 'wechat_pay'], str]]" + "Literal['']|List[Union[Literal['ach_credit_transfer', 'ach_debit', 'acss_debit', 'affirm', 'alipay', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'billie', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'check_scan', 'crypto', 'custom', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'id_bank_transfer', 'ideal', 'jp_credit_transfer', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'momo', 'multibanco', 'naver_pay', 'nz_bank_account', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'paypay', 'payto', 'pix', 'promptpay', 'revolut_pay', 'satispay', 'sepa_credit_transfer', 'sepa_debit', 'sequra', 'sofort', 'stripe_balance', 'swish', 'twint', 'upi', 'us_bank_account', 'vipps', 'wechat_pay'], str]]" ] """ The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). diff --git a/stripe/params/_invoice_update_params.py b/stripe/params/_invoice_update_params.py index 28d6e1161..d9cb7c150 100644 --- a/stripe/params/_invoice_update_params.py +++ b/stripe/params/_invoice_update_params.py @@ -252,7 +252,7 @@ class InvoiceUpdateParamsPaymentSettings(TypedDict): Payment-method-specific configuration to provide to the invoice's PaymentIntent. """ payment_method_types: NotRequired[ - "Literal['']|List[Union[Literal['ach_credit_transfer', 'ach_debit', 'acss_debit', 'affirm', 'alipay', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'check_scan', 'crypto', 'custom', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'id_bank_transfer', 'ideal', 'jp_credit_transfer', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'momo', 'multibanco', 'naver_pay', 'nz_bank_account', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'payto', 'pix', 'promptpay', 'revolut_pay', 'satispay', 'sepa_credit_transfer', 'sepa_debit', 'sequra', 'sofort', 'stripe_balance', 'swish', 'twint', 'upi', 'us_bank_account', 'wechat_pay'], str]]" + "Literal['']|List[Union[Literal['ach_credit_transfer', 'ach_debit', 'acss_debit', 'affirm', 'alipay', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'billie', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'check_scan', 'crypto', 'custom', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'id_bank_transfer', 'ideal', 'jp_credit_transfer', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'momo', 'multibanco', 'naver_pay', 'nz_bank_account', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'paypay', 'payto', 'pix', 'promptpay', 'revolut_pay', 'satispay', 'sepa_credit_transfer', 'sepa_debit', 'sequra', 'sofort', 'stripe_balance', 'swish', 'twint', 'upi', 'us_bank_account', 'vipps', 'wechat_pay'], str]]" ] """ The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). diff --git a/stripe/params/_payment_attempt_record_report_failed_params.py b/stripe/params/_payment_attempt_record_report_failed_params.py index 94a0aef5d..cf5fab39a 100644 --- a/stripe/params/_payment_attempt_record_report_failed_params.py +++ b/stripe/params/_payment_attempt_record_report_failed_params.py @@ -16,10 +16,10 @@ class PaymentAttemptRecordReportFailedParams(RequestOptions): When the reported payment failed. Measured in seconds since the Unix epoch. """ failure_code: NotRequired[ - "Literal['payment_method_customer_decline', 'payment_method_provider_unknown_outcome']|str" + "Literal['authentication_failure', 'expired_payment_method', 'incorrect_cvc', 'incorrect_number', 'incorrect_postal_code', 'insufficient_funds', 'payment_method_customer_decline', 'payment_method_provider_unknown_outcome', 'payment_method_restricted', 'processing_error']|str" ] """ - The failure code for this payment attempt. Must be one of `payment_method_customer_decline` or `payment_method_provider_unknown_outcome`. + The failure code for this payment attempt. Must be one of `payment_method_customer_decline`, `payment_method_provider_unknown_outcome`, `authentication_failure`, `expired_payment_method`, `incorrect_cvc`, `incorrect_number`, `incorrect_postal_code`, `insufficient_funds`, `processing_error`, or `payment_method_restricted`. """ metadata: NotRequired[ "Literal['']|Dict[str, str]|UntypedStripeObject[str]" @@ -67,6 +67,10 @@ class PaymentAttemptRecordReportFailedParamsPaymentMethodDetailsCard( """ Verification checks performed on the card. """ + network_decline_code: NotRequired[str] + """ + Decline code from the card network for the failed payment. + """ class PaymentAttemptRecordReportFailedParamsPaymentMethodDetailsCardChecks( diff --git a/stripe/params/_payment_record_report_payment_attempt_failed_params.py b/stripe/params/_payment_record_report_payment_attempt_failed_params.py index 1816b3abb..21ffb42b3 100644 --- a/stripe/params/_payment_record_report_payment_attempt_failed_params.py +++ b/stripe/params/_payment_record_report_payment_attempt_failed_params.py @@ -16,10 +16,10 @@ class PaymentRecordReportPaymentAttemptFailedParams(RequestOptions): When the reported payment failed. Measured in seconds since the Unix epoch. """ failure_code: NotRequired[ - "Literal['payment_method_customer_decline', 'payment_method_provider_unknown_outcome']|str" + "Literal['authentication_failure', 'expired_payment_method', 'incorrect_cvc', 'incorrect_number', 'incorrect_postal_code', 'insufficient_funds', 'payment_method_customer_decline', 'payment_method_provider_unknown_outcome', 'payment_method_restricted', 'processing_error']|str" ] """ - The failure code for this payment attempt. Must be one of `payment_method_customer_decline` or `payment_method_provider_unknown_outcome`. + The failure code for this payment attempt. Must be one of `payment_method_customer_decline`, `payment_method_provider_unknown_outcome`, `authentication_failure`, `expired_payment_method`, `incorrect_cvc`, `incorrect_number`, `incorrect_postal_code`, `insufficient_funds`, `processing_error`, or `payment_method_restricted`. """ metadata: NotRequired[ "Literal['']|Dict[str, str]|UntypedStripeObject[str]" @@ -69,6 +69,10 @@ class PaymentRecordReportPaymentAttemptFailedParamsPaymentMethodDetailsCard( """ Verification checks performed on the card. """ + network_decline_code: NotRequired[str] + """ + Decline code from the card network for the failed payment. + """ class PaymentRecordReportPaymentAttemptFailedParamsPaymentMethodDetailsCardChecks( diff --git a/stripe/params/_payment_record_report_payment_attempt_params.py b/stripe/params/_payment_record_report_payment_attempt_params.py index 8a99b9e6c..f3989fc14 100644 --- a/stripe/params/_payment_record_report_payment_attempt_params.py +++ b/stripe/params/_payment_record_report_payment_attempt_params.py @@ -59,10 +59,10 @@ class PaymentRecordReportPaymentAttemptParamsFailed(TypedDict): When the reported payment failed. Measured in seconds since the Unix epoch. """ failure_code: NotRequired[ - "Literal['payment_method_customer_decline', 'payment_method_provider_unknown_outcome']|str" + "Literal['authentication_failure', 'expired_payment_method', 'incorrect_cvc', 'incorrect_number', 'incorrect_postal_code', 'insufficient_funds', 'payment_method_customer_decline', 'payment_method_provider_unknown_outcome', 'payment_method_restricted', 'processing_error']|str" ] """ - The failure code for this payment attempt. Must be one of `payment_method_customer_decline` or `payment_method_provider_unknown_outcome`. + The failure code for this payment attempt. Must be one of `payment_method_customer_decline`, `payment_method_provider_unknown_outcome`, `authentication_failure`, `expired_payment_method`, `incorrect_cvc`, `incorrect_number`, `incorrect_postal_code`, `insufficient_funds`, `processing_error`, or `payment_method_restricted`. """ payment_evaluations: NotRequired[List[str]] """ diff --git a/stripe/params/_payment_record_report_payment_params.py b/stripe/params/_payment_record_report_payment_params.py index 17da4e179..f398228c5 100644 --- a/stripe/params/_payment_record_report_payment_params.py +++ b/stripe/params/_payment_record_report_payment_params.py @@ -107,10 +107,10 @@ class PaymentRecordReportPaymentParamsFailed(TypedDict): When the reported payment failed. Measured in seconds since the Unix epoch. """ failure_code: NotRequired[ - "Literal['payment_method_customer_decline', 'payment_method_provider_unknown_outcome']|str" + "Literal['authentication_failure', 'expired_payment_method', 'incorrect_cvc', 'incorrect_number', 'incorrect_postal_code', 'insufficient_funds', 'payment_method_customer_decline', 'payment_method_provider_unknown_outcome', 'payment_method_restricted', 'processing_error']|str" ] """ - The failure code for this payment attempt. Must be one of `payment_method_customer_decline` or `payment_method_provider_unknown_outcome`. + The failure code for this payment attempt. Must be one of `payment_method_customer_decline`, `payment_method_provider_unknown_outcome`, `authentication_failure`, `expired_payment_method`, `incorrect_cvc`, `incorrect_number`, `incorrect_postal_code`, `insufficient_funds`, `processing_error`, or `payment_method_restricted`. """ payment_evaluations: NotRequired[List[str]] """ diff --git a/stripe/params/_subscription_create_params.py b/stripe/params/_subscription_create_params.py index 0674dc6d0..22d13b212 100644 --- a/stripe/params/_subscription_create_params.py +++ b/stripe/params/_subscription_create_params.py @@ -850,7 +850,7 @@ class SubscriptionCreateParamsPaymentSettings(TypedDict): Payment-method-specific configuration to provide to invoices created by the subscription. """ payment_method_types: NotRequired[ - "Literal['']|List[Union[Literal['ach_credit_transfer', 'ach_debit', 'acss_debit', 'affirm', 'alipay', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'check_scan', 'crypto', 'custom', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'id_bank_transfer', 'ideal', 'jp_credit_transfer', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'momo', 'multibanco', 'naver_pay', 'nz_bank_account', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'payto', 'pix', 'promptpay', 'revolut_pay', 'satispay', 'sepa_credit_transfer', 'sepa_debit', 'sequra', 'sofort', 'stripe_balance', 'swish', 'twint', 'upi', 'us_bank_account', 'wechat_pay'], str]]" + "Literal['']|List[Union[Literal['ach_credit_transfer', 'ach_debit', 'acss_debit', 'affirm', 'alipay', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'billie', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'check_scan', 'crypto', 'custom', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'id_bank_transfer', 'ideal', 'jp_credit_transfer', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'momo', 'multibanco', 'naver_pay', 'nz_bank_account', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'paypay', 'payto', 'pix', 'promptpay', 'revolut_pay', 'satispay', 'sepa_credit_transfer', 'sepa_debit', 'sequra', 'sofort', 'stripe_balance', 'swish', 'twint', 'upi', 'us_bank_account', 'vipps', 'wechat_pay'], str]]" ] """ The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). Should not be specified with payment_method_configuration diff --git a/stripe/params/_subscription_modify_params.py b/stripe/params/_subscription_modify_params.py index ba9ef4553..82abee5b5 100644 --- a/stripe/params/_subscription_modify_params.py +++ b/stripe/params/_subscription_modify_params.py @@ -820,7 +820,7 @@ class SubscriptionModifyParamsPaymentSettings(TypedDict): Payment-method-specific configuration to provide to invoices created by the subscription. """ payment_method_types: NotRequired[ - "Literal['']|List[Union[Literal['ach_credit_transfer', 'ach_debit', 'acss_debit', 'affirm', 'alipay', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'check_scan', 'crypto', 'custom', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'id_bank_transfer', 'ideal', 'jp_credit_transfer', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'momo', 'multibanco', 'naver_pay', 'nz_bank_account', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'payto', 'pix', 'promptpay', 'revolut_pay', 'satispay', 'sepa_credit_transfer', 'sepa_debit', 'sequra', 'sofort', 'stripe_balance', 'swish', 'twint', 'upi', 'us_bank_account', 'wechat_pay'], str]]" + "Literal['']|List[Union[Literal['ach_credit_transfer', 'ach_debit', 'acss_debit', 'affirm', 'alipay', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'billie', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'check_scan', 'crypto', 'custom', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'id_bank_transfer', 'ideal', 'jp_credit_transfer', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'momo', 'multibanco', 'naver_pay', 'nz_bank_account', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'paypay', 'payto', 'pix', 'promptpay', 'revolut_pay', 'satispay', 'sepa_credit_transfer', 'sepa_debit', 'sequra', 'sofort', 'stripe_balance', 'swish', 'twint', 'upi', 'us_bank_account', 'vipps', 'wechat_pay'], str]]" ] """ The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). Should not be specified with payment_method_configuration diff --git a/stripe/params/_subscription_schedule_create_params.py b/stripe/params/_subscription_schedule_create_params.py index 12610523d..a6347040c 100644 --- a/stripe/params/_subscription_schedule_create_params.py +++ b/stripe/params/_subscription_schedule_create_params.py @@ -62,7 +62,7 @@ class SubscriptionScheduleCreateParams(RequestOptions): List["SubscriptionScheduleCreateParamsPauseSchedule"] ] """ - 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. """ phases: NotRequired[List["SubscriptionScheduleCreateParamsPhase"]] """ @@ -320,7 +320,7 @@ class SubscriptionScheduleCreateParamsPauseSchedule(TypedDict): """ A unique identifier for this pause schedule entry. """ - pause: "SubscriptionScheduleCreateParamsPauseSchedulePause" + pause: NotRequired["SubscriptionScheduleCreateParamsPauseSchedulePause"] """ Configuration for when and how the subscription pauses. """ @@ -460,7 +460,7 @@ class SubscriptionScheduleCreateParamsPauseScheduleResumeSettings(TypedDict): Literal["resume_on_payment_attempt", "resume_on_payment_success"] ] """ - Controls whether Stripe attempts payment on the resumption invoice and how payment affects the subscription's status. The default is `resume_on_payment_attempt`. + Controls whether Stripe attempts payment on the resumption invoice and how payment affects the subscription's status. The default is `resume_on_payment_success`. """ proration_behavior: NotRequired[ "Literal['always_invoice', 'create_prorations', 'none']|str" diff --git a/stripe/params/_subscription_schedule_modify_params.py b/stripe/params/_subscription_schedule_modify_params.py index 3d75a29ad..0e8683dde 100644 --- a/stripe/params/_subscription_schedule_modify_params.py +++ b/stripe/params/_subscription_schedule_modify_params.py @@ -46,7 +46,7 @@ class SubscriptionScheduleModifyParams(RequestOptions): "Literal['']|List[SubscriptionScheduleModifyParamsPauseSchedule]" ] """ - Sets the pause schedules for the subscription schedule. Include a `key` to update an existing entry or omit it to add a new one. Pass `""` to clear all entries or `[]` 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. """ phases: NotRequired[List["SubscriptionScheduleModifyParamsPhase"]] """ @@ -292,7 +292,9 @@ class SubscriptionScheduleModifyParamsPauseSchedule(TypedDict): """ Configuration for when and how the subscription pauses. """ - resume: NotRequired["SubscriptionScheduleModifyParamsPauseScheduleResume"] + resume: NotRequired[ + "Literal['']|SubscriptionScheduleModifyParamsPauseScheduleResume" + ] """ Configuration for when and how the subscription resumes. """ @@ -432,7 +434,7 @@ class SubscriptionScheduleModifyParamsPauseScheduleResumeSettings(TypedDict): Literal["resume_on_payment_attempt", "resume_on_payment_success"] ] """ - Controls whether Stripe attempts payment on the resumption invoice and how payment affects the subscription's status. The default is `resume_on_payment_attempt`. + Controls whether Stripe attempts payment on the resumption invoice and how payment affects the subscription's status. The default is `resume_on_payment_success`. """ proration_behavior: NotRequired[ "Literal['always_invoice', 'create_prorations', 'none']|str" diff --git a/stripe/params/_subscription_schedule_update_params.py b/stripe/params/_subscription_schedule_update_params.py index 8e2e2d2d4..283e4de81 100644 --- a/stripe/params/_subscription_schedule_update_params.py +++ b/stripe/params/_subscription_schedule_update_params.py @@ -45,7 +45,7 @@ class SubscriptionScheduleUpdateParams(TypedDict): "Literal['']|List[SubscriptionScheduleUpdateParamsPauseSchedule]" ] """ - Sets the pause schedules for the subscription schedule. Include a `key` to update an existing entry or omit it to add a new one. Pass `""` to clear all entries or `[]` 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. """ phases: NotRequired[List["SubscriptionScheduleUpdateParamsPhase"]] """ @@ -291,7 +291,9 @@ class SubscriptionScheduleUpdateParamsPauseSchedule(TypedDict): """ Configuration for when and how the subscription pauses. """ - resume: NotRequired["SubscriptionScheduleUpdateParamsPauseScheduleResume"] + resume: NotRequired[ + "Literal['']|SubscriptionScheduleUpdateParamsPauseScheduleResume" + ] """ Configuration for when and how the subscription resumes. """ @@ -431,7 +433,7 @@ class SubscriptionScheduleUpdateParamsPauseScheduleResumeSettings(TypedDict): Literal["resume_on_payment_attempt", "resume_on_payment_success"] ] """ - Controls whether Stripe attempts payment on the resumption invoice and how payment affects the subscription's status. The default is `resume_on_payment_attempt`. + Controls whether Stripe attempts payment on the resumption invoice and how payment affects the subscription's status. The default is `resume_on_payment_success`. """ proration_behavior: NotRequired[ "Literal['always_invoice', 'create_prorations', 'none']|str" diff --git a/stripe/params/_subscription_update_params.py b/stripe/params/_subscription_update_params.py index 2440a1594..bbe09b244 100644 --- a/stripe/params/_subscription_update_params.py +++ b/stripe/params/_subscription_update_params.py @@ -819,7 +819,7 @@ class SubscriptionUpdateParamsPaymentSettings(TypedDict): Payment-method-specific configuration to provide to invoices created by the subscription. """ payment_method_types: NotRequired[ - "Literal['']|List[Union[Literal['ach_credit_transfer', 'ach_debit', 'acss_debit', 'affirm', 'alipay', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'check_scan', 'crypto', 'custom', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'id_bank_transfer', 'ideal', 'jp_credit_transfer', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'momo', 'multibanco', 'naver_pay', 'nz_bank_account', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'payto', 'pix', 'promptpay', 'revolut_pay', 'satispay', 'sepa_credit_transfer', 'sepa_debit', 'sequra', 'sofort', 'stripe_balance', 'swish', 'twint', 'upi', 'us_bank_account', 'wechat_pay'], str]]" + "Literal['']|List[Union[Literal['ach_credit_transfer', 'ach_debit', 'acss_debit', 'affirm', 'alipay', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'billie', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'check_scan', 'crypto', 'custom', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'id_bank_transfer', 'ideal', 'jp_credit_transfer', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'momo', 'multibanco', 'naver_pay', 'nz_bank_account', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'paypay', 'payto', 'pix', 'promptpay', 'revolut_pay', 'satispay', 'sepa_credit_transfer', 'sepa_debit', 'sequra', 'sofort', 'stripe_balance', 'swish', 'twint', 'upi', 'us_bank_account', 'vipps', 'wechat_pay'], str]]" ] """ The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). Should not be specified with payment_method_configuration diff --git a/stripe/params/crypto/_onramp_session_create_params.py b/stripe/params/crypto/_onramp_session_create_params.py index 8b5eff8a4..e22019465 100644 --- a/stripe/params/crypto/_onramp_session_create_params.py +++ b/stripe/params/crypto/_onramp_session_create_params.py @@ -48,7 +48,7 @@ class OnrampSessionCreateParams(RequestOptions): * When set, if `destination_currencies` is also set, the value of `destination_currency` must be present in that array. To lock a `destination_currency`, specify that value as the single value for `destination_currencies`. Users can select a different cryptocurrency in the onramp UI subject to `destination_currencies` if set. """ destination_network: NotRequired[ - "Literal['avalanche', 'base', 'bitcoin', 'ethereum', 'optimism', 'polygon', 'solana', 'stellar', 'sui', 'tempo', 'worldchain']|str" + "Literal['avalanche', 'base', 'bitcoin', 'celo', 'ethereum', 'optimism', 'polygon', 'solana', 'stellar', 'sui', 'tempo', 'worldchain']|str" ] """ The default destination crypto network. @@ -63,6 +63,7 @@ class OnrampSessionCreateParams(RequestOptions): "avalanche", "base", "bitcoin", + "celo", "ethereum", "optimism", "polygon", diff --git a/stripe/params/crypto/_onramp_session_list_params.py b/stripe/params/crypto/_onramp_session_list_params.py index fab1dbd90..db1e1314c 100644 --- a/stripe/params/crypto/_onramp_session_list_params.py +++ b/stripe/params/crypto/_onramp_session_list_params.py @@ -17,7 +17,7 @@ class OnrampSessionListParams(RequestOptions): The destination cryptocurrency to filter by. """ destination_network: NotRequired[ - "Literal['avalanche', 'base', 'bitcoin', 'ethereum', 'optimism', 'polygon', 'solana', 'stellar', 'sui', 'tempo', 'worldchain']|str" + "Literal['avalanche', 'base', 'bitcoin', 'celo', 'ethereum', 'optimism', 'polygon', 'solana', 'stellar', 'sui', 'tempo', 'worldchain']|str" ] """ The destination blockchain network to filter by. diff --git a/stripe/params/crypto/_onramp_transaction_limits_retrieve_params.py b/stripe/params/crypto/_onramp_transaction_limits_retrieve_params.py index aa91da517..041141249 100644 --- a/stripe/params/crypto/_onramp_transaction_limits_retrieve_params.py +++ b/stripe/params/crypto/_onramp_transaction_limits_retrieve_params.py @@ -11,7 +11,7 @@ class OnrampTransactionLimitsRetrieveParams(RequestOptions): The IP address of the customer requesting transaction limits. We support IPv4 and IPv6 addresses. """ destination_network: NotRequired[ - "Literal['avalanche', 'base', 'bitcoin', 'ethereum', 'optimism', 'polygon', 'solana', 'stellar', 'sui', 'tempo', 'worldchain']|str" + "Literal['avalanche', 'base', 'bitcoin', 'celo', 'ethereum', 'optimism', 'polygon', 'solana', 'stellar', 'sui', 'tempo', 'worldchain']|str" ] """ The destination blockchain network to use for limit calculations. diff --git a/stripe/params/issuing/_cardholder_create_params.py b/stripe/params/issuing/_cardholder_create_params.py index 0c6b969f6..bddd00510 100644 --- a/stripe/params/issuing/_cardholder_create_params.py +++ b/stripe/params/issuing/_cardholder_create_params.py @@ -42,11 +42,16 @@ class CardholderCreateParams(RequestOptions): """ preferred_locales: NotRequired[ List[ - Union[Literal["da", "de", "en", "es", "fr", "it", "pl", "sv"], str] + Union[ + Literal[ + "da", "de", "en", "es", "fr", "hu", "it", "pl", "ro", "sv" + ], + str, + ] ] ] """ - The cardholder's preferred locales (languages), ordered by preference. Locales can be `da`, `de`, `en`, `es`, `fr`, `it`, `pl`, or `sv`. + The cardholder's preferred locales (languages), ordered by preference. Locales can be `de`, `en`, `es`, `fr`, or `it`. This changes the language of the [3D Secure flow](https://docs.stripe.com/issuing/3d-secure) and one-time password messages sent to the cardholder. """ spending_controls: NotRequired["CardholderCreateParamsSpendingControls"] diff --git a/stripe/params/issuing/_cardholder_modify_params.py b/stripe/params/issuing/_cardholder_modify_params.py index 925b4bd1e..edfa5efa2 100644 --- a/stripe/params/issuing/_cardholder_modify_params.py +++ b/stripe/params/issuing/_cardholder_modify_params.py @@ -41,11 +41,16 @@ class CardholderModifyParams(RequestOptions): """ preferred_locales: NotRequired[ List[ - Union[Literal["da", "de", "en", "es", "fr", "it", "pl", "sv"], str] + Union[ + Literal[ + "da", "de", "en", "es", "fr", "hu", "it", "pl", "ro", "sv" + ], + str, + ] ] ] """ - The cardholder's preferred locales (languages), ordered by preference. Locales can be `da`, `de`, `en`, `es`, `fr`, `it`, `pl`, or `sv`. + The cardholder's preferred locales (languages), ordered by preference. Locales can be `de`, `en`, `es`, `fr`, or `it`. This changes the language of the [3D Secure flow](https://docs.stripe.com/issuing/3d-secure) and one-time password messages sent to the cardholder. """ spending_controls: NotRequired["CardholderModifyParamsSpendingControls"] diff --git a/stripe/params/issuing/_cardholder_update_params.py b/stripe/params/issuing/_cardholder_update_params.py index f2370ead3..8e637b039 100644 --- a/stripe/params/issuing/_cardholder_update_params.py +++ b/stripe/params/issuing/_cardholder_update_params.py @@ -40,11 +40,16 @@ class CardholderUpdateParams(TypedDict): """ preferred_locales: NotRequired[ List[ - Union[Literal["da", "de", "en", "es", "fr", "it", "pl", "sv"], str] + Union[ + Literal[ + "da", "de", "en", "es", "fr", "hu", "it", "pl", "ro", "sv" + ], + str, + ] ] ] """ - The cardholder's preferred locales (languages), ordered by preference. Locales can be `da`, `de`, `en`, `es`, `fr`, `it`, `pl`, or `sv`. + The cardholder's preferred locales (languages), ordered by preference. Locales can be `de`, `en`, `es`, `fr`, or `it`. This changes the language of the [3D Secure flow](https://docs.stripe.com/issuing/3d-secure) and one-time password messages sent to the cardholder. """ spending_controls: NotRequired["CardholderUpdateParamsSpendingControls"] diff --git a/stripe/params/v2/billing/_contract_activate_params.py b/stripe/params/v2/billing/_contract_activate_params.py index dc2a57b49..8f848452d 100644 --- a/stripe/params/v2/billing/_contract_activate_params.py +++ b/stripe/params/v2/billing/_contract_activate_params.py @@ -9,7 +9,10 @@ class ContractActivateParams(TypedDict): List[ Union[ Literal[ - "billing_settings", "pricing_lines", "pricing_overrides" + "billing_settings", + "one_time_fees", + "pricing_lines", + "pricing_overrides", ], str, ] diff --git a/stripe/params/v2/billing/_contract_cancel_params.py b/stripe/params/v2/billing/_contract_cancel_params.py index d51325af0..616e28965 100644 --- a/stripe/params/v2/billing/_contract_cancel_params.py +++ b/stripe/params/v2/billing/_contract_cancel_params.py @@ -16,7 +16,10 @@ class ContractCancelParams(TypedDict): List[ Union[ Literal[ - "billing_settings", "pricing_lines", "pricing_overrides" + "billing_settings", + "one_time_fees", + "pricing_lines", + "pricing_overrides", ], str, ] diff --git a/stripe/params/v2/billing/_contract_create_params.py b/stripe/params/v2/billing/_contract_create_params.py index 25ebaead9..1da87d4c9 100644 --- a/stripe/params/v2/billing/_contract_create_params.py +++ b/stripe/params/v2/billing/_contract_create_params.py @@ -28,7 +28,10 @@ class ContractCreateParams(TypedDict): List[ Union[ Literal[ - "billing_settings", "pricing_lines", "pricing_overrides" + "billing_settings", + "one_time_fees", + "pricing_lines", + "pricing_overrides", ], str, ] diff --git a/stripe/params/v2/billing/_contract_list_params.py b/stripe/params/v2/billing/_contract_list_params.py index 10f4b2ee1..5a4e3ba25 100644 --- a/stripe/params/v2/billing/_contract_list_params.py +++ b/stripe/params/v2/billing/_contract_list_params.py @@ -13,7 +13,10 @@ class ContractListParams(TypedDict): List[ Union[ Literal[ - "billing_settings", "pricing_lines", "pricing_overrides" + "billing_settings", + "one_time_fees", + "pricing_lines", + "pricing_overrides", ], str, ] diff --git a/stripe/params/v2/billing/_contract_retrieve_params.py b/stripe/params/v2/billing/_contract_retrieve_params.py index 2e8feadea..ebff00258 100644 --- a/stripe/params/v2/billing/_contract_retrieve_params.py +++ b/stripe/params/v2/billing/_contract_retrieve_params.py @@ -9,7 +9,10 @@ class ContractRetrieveParams(TypedDict): List[ Union[ Literal[ - "billing_settings", "pricing_lines", "pricing_overrides" + "billing_settings", + "one_time_fees", + "pricing_lines", + "pricing_overrides", ], str, ] diff --git a/stripe/params/v2/billing/_contract_update_params.py b/stripe/params/v2/billing/_contract_update_params.py index 7ec277606..5616d8fe9 100644 --- a/stripe/params/v2/billing/_contract_update_params.py +++ b/stripe/params/v2/billing/_contract_update_params.py @@ -11,7 +11,10 @@ class ContractUpdateParams(TypedDict): List[ Union[ Literal[ - "billing_settings", "pricing_lines", "pricing_overrides" + "billing_settings", + "one_time_fees", + "pricing_lines", + "pricing_overrides", ], str, ] diff --git a/stripe/params/v2/core/_account_create_params.py b/stripe/params/v2/core/_account_create_params.py index f660bc274..459b31bcf 100644 --- a/stripe/params/v2/core/_account_create_params.py +++ b/stripe/params/v2/core/_account_create_params.py @@ -785,7 +785,7 @@ class AccountCreateParamsConfigurationCustomer(TypedDict): class AccountCreateParamsConfigurationCustomerAutomaticIndirectTax(TypedDict): exempt: NotRequired[Literal["exempt", "none", "reverse"]] """ - Describes the customer's tax exemption status, which is `none`, `exempt`, or `reverse`. When set to reverse, invoice and receipt PDFs include the following text: “Reverse charge”. + Describes the customer's tax exemption status, which is `none`, `exempt`, or `reverse`. When set to reverse, invoice and receipt PDFs include the following text: "Reverse charge". """ ip_address: NotRequired[str] """ diff --git a/stripe/params/v2/money_management/__init__.py b/stripe/params/v2/money_management/__init__.py index 3141fded4..9fee11568 100644 --- a/stripe/params/v2/money_management/__init__.py +++ b/stripe/params/v2/money_management/__init__.py @@ -147,6 +147,9 @@ from stripe.params.v2.money_management._payout_intent_cancel_params import ( PayoutIntentCancelParams as PayoutIntentCancelParams, ) + from stripe.params.v2.money_management._payout_intent_confirm_params import ( + PayoutIntentConfirmParams as PayoutIntentConfirmParams, + ) from stripe.params.v2.money_management._payout_intent_create_params import ( PayoutIntentCreateParams as PayoutIntentCreateParams, PayoutIntentCreateParamsFrom as PayoutIntentCreateParamsFrom, @@ -158,6 +161,9 @@ PayoutIntentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptions as PayoutIntentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptions, PayoutIntentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptionsAch as PayoutIntentCreateParamsToPayoutMethodOptionsBankAccountPreferredNetworkOptionsAch, ) + from stripe.params.v2.money_management._payout_intent_fx_quote_params import ( + PayoutIntentFxQuoteParams as PayoutIntentFxQuoteParams, + ) from stripe.params.v2.money_management._payout_intent_list_params import ( PayoutIntentListParams as PayoutIntentListParams, ) @@ -517,6 +523,10 @@ "stripe.params.v2.money_management._payout_intent_cancel_params", False, ), + "PayoutIntentConfirmParams": ( + "stripe.params.v2.money_management._payout_intent_confirm_params", + False, + ), "PayoutIntentCreateParams": ( "stripe.params.v2.money_management._payout_intent_create_params", False, @@ -553,6 +563,10 @@ "stripe.params.v2.money_management._payout_intent_create_params", False, ), + "PayoutIntentFxQuoteParams": ( + "stripe.params.v2.money_management._payout_intent_fx_quote_params", + False, + ), "PayoutIntentListParams": ( "stripe.params.v2.money_management._payout_intent_list_params", False, diff --git a/stripe/params/v2/money_management/_payout_intent_confirm_params.py b/stripe/params/v2/money_management/_payout_intent_confirm_params.py new file mode 100644 index 000000000..44c0b9e9b --- /dev/null +++ b/stripe/params/v2/money_management/_payout_intent_confirm_params.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TypedDict + + +class PayoutIntentConfirmParams(TypedDict): + pass diff --git a/stripe/params/v2/money_management/_payout_intent_create_params.py b/stripe/params/v2/money_management/_payout_intent_create_params.py index bb68c9490..520a6c4e7 100644 --- a/stripe/params/v2/money_management/_payout_intent_create_params.py +++ b/stripe/params/v2/money_management/_payout_intent_create_params.py @@ -16,6 +16,10 @@ class PayoutIntentCreateParams(_PayoutIntentCreateParamsBase): """ The monetary amount to be sent. """ + confirmation_method: NotRequired["Literal['automatic', 'manual']|str"] + """ + Controls whether the intent requires explicit confirmation before transitioning to pending. Defaults to automatic. + """ description: NotRequired[str] """ An arbitrary string attached to the PayoutIntent. Often useful for displaying to users. diff --git a/stripe/params/v2/money_management/_payout_intent_fx_quote_params.py b/stripe/params/v2/money_management/_payout_intent_fx_quote_params.py new file mode 100644 index 000000000..8abf8275d --- /dev/null +++ b/stripe/params/v2/money_management/_payout_intent_fx_quote_params.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TypedDict + + +class PayoutIntentFxQuoteParams(TypedDict): + pass diff --git a/stripe/params/v2/payments/_off_session_payment_create_params.py b/stripe/params/v2/payments/_off_session_payment_create_params.py index 483048ce8..c293d94df 100644 --- a/stripe/params/v2/payments/_off_session_payment_create_params.py +++ b/stripe/params/v2/payments/_off_session_payment_create_params.py @@ -9,7 +9,7 @@ class OffSessionPaymentCreateParams(TypedDict): amount: AmountParam """ - The “presentment amount” to be collected from the customer. + The "presentment amount" to be collected from the customer. """ amount_details: NotRequired["OffSessionPaymentCreateParamsAmountDetails"] """ diff --git a/stripe/params/v2/tax/__init__.py b/stripe/params/v2/tax/__init__.py index b50e5714b..e131a6e88 100644 --- a/stripe/params/v2/tax/__init__.py +++ b/stripe/params/v2/tax/__init__.py @@ -27,6 +27,10 @@ ManualRuleUpdateParamsScheduledTaxRate as ManualRuleUpdateParamsScheduledTaxRate, ManualRuleUpdateParamsScheduledTaxRateRate as ManualRuleUpdateParamsScheduledTaxRateRate, ) + from stripe.params.v2.tax._operation_resolve_address_params import ( + OperationResolveAddressParams as OperationResolveAddressParams, + OperationResolveAddressParamsAddress as OperationResolveAddressParamsAddress, + ) # name -> (import_target, is_submodule) _import_map = { @@ -82,6 +86,14 @@ "stripe.params.v2.tax._manual_rule_update_params", False, ), + "OperationResolveAddressParams": ( + "stripe.params.v2.tax._operation_resolve_address_params", + False, + ), + "OperationResolveAddressParamsAddress": ( + "stripe.params.v2.tax._operation_resolve_address_params", + False, + ), } if not TYPE_CHECKING: diff --git a/stripe/params/v2/tax/_operation_resolve_address_params.py b/stripe/params/v2/tax/_operation_resolve_address_params.py new file mode 100644 index 000000000..9cd42b265 --- /dev/null +++ b/stripe/params/v2/tax/_operation_resolve_address_params.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import NotRequired, TypedDict + + +class OperationResolveAddressParams(TypedDict): + address: "OperationResolveAddressParamsAddress" + """ + The address to resolve. + """ + + +class OperationResolveAddressParamsAddress(TypedDict): + city: NotRequired[str] + """ + The city. + """ + country: str + """ + The two-letter country code. + """ + line1: NotRequired[str] + """ + The first line of the street address. + """ + postal_code: NotRequired[str] + """ + The postal code. + """ + state: NotRequired[str] + """ + The state or province. + """ diff --git a/stripe/v2/_list_object.py b/stripe/v2/_list_object.py index 8e301edce..08fcbd016 100644 --- a/stripe/v2/_list_object.py +++ b/stripe/v2/_list_object.py @@ -1,5 +1,6 @@ +from stripe._any_iterator import AnyIterator from stripe._stripe_object import StripeObject -from typing import List, Optional, TypeVar, Generic +from typing import AsyncIterator, Iterator, List, Optional, TypeVar, Generic T = TypeVar("T", bound=StripeObject) @@ -40,7 +41,13 @@ def __len__(self): def __reversed__(self): return getattr(self, "data", []).__reversed__() - def auto_paging_iter(self): + def auto_paging_iter(self) -> AnyIterator[T]: + return AnyIterator( + self._auto_paging_iter(), + self._auto_paging_iter_async(), + ) + + def _auto_paging_iter(self) -> Iterator[T]: page = self.data next_page_url = self.next_page_url while True: @@ -57,3 +64,21 @@ def auto_paging_iter(self): assert isinstance(result, ListObject) page = result.data next_page_url = result.next_page_url + + async def _auto_paging_iter_async(self) -> AsyncIterator[T]: + page = self.data + next_page_url = self.next_page_url + while True: + for item in page: + yield item + if next_page_url is None: + break + + result = await self._request_async( + "get", + next_page_url, + base_address="api", + ) + assert isinstance(result, ListObject) + page = result.data + next_page_url = result.next_page_url diff --git a/stripe/v2/_tax_service.py b/stripe/v2/_tax_service.py index c010a06a6..9cb9c93b1 100644 --- a/stripe/v2/_tax_service.py +++ b/stripe/v2/_tax_service.py @@ -6,17 +6,20 @@ if TYPE_CHECKING: from stripe.v2.tax._manual_rule_service import ManualRuleService + from stripe.v2.tax._operation_service import OperationService _subservices = { "manual_rules": [ "stripe.v2.tax._manual_rule_service", "ManualRuleService", ], + "operations": ["stripe.v2.tax._operation_service", "OperationService"], } class TaxService(StripeService): manual_rules: "ManualRuleService" + operations: "OperationService" def __init__(self, requestor): super().__init__(requestor) diff --git a/stripe/v2/core/_account.py b/stripe/v2/core/_account.py index 935d4f7c7..ed06586b7 100644 --- a/stripe/v2/core/_account.py +++ b/stripe/v2/core/_account.py @@ -12097,7 +12097,7 @@ class Kanji(StripeObject): """ legal_gender: Optional[Union[Literal["female", "male"], str]] """ - The individual's gender (International regulations require either "male” or "female"). + The individual's gender (International regulations require either "male" or "female"). """ metadata: Optional[UntypedStripeObject[str]] """ diff --git a/stripe/v2/core/_event.py b/stripe/v2/core/_event.py index 12b1c6993..34d74aa8c 100644 --- a/stripe/v2/core/_event.py +++ b/stripe/v2/core/_event.py @@ -268,7 +268,7 @@ def from_json( def __repr__(self) -> str: return f"" - def fetch_event(self) -> "Event": + def fetch_event(self) -> Event: response = self._client.raw_request( "get", f"/v2/core/events/{self.id}", @@ -276,9 +276,9 @@ def fetch_event(self) -> "Event": headers={"Stripe-Request-Trigger": f"event={self.id}"}, usage=["pushed_event_pull"], ) - return cast("Event", self._client.deserialize(response, api_mode="V2")) + return cast(Event, self._client.deserialize(response, api_mode="V2")) - async def fetch_event_async(self) -> "Event": + async def fetch_event_async(self) -> Event: response = await self._client.raw_request_async( "get", f"/v2/core/events/{self.id}", @@ -286,7 +286,7 @@ async def fetch_event_async(self) -> "Event": headers={"Stripe-Request-Trigger": f"event={self.id}"}, usage=["pushed_event_pull", "pushed_event_pull_async"], ) - return cast("Event", self._client.deserialize(response, api_mode="V2")) + return cast(Event, self._client.deserialize(response, api_mode="V2")) class UnknownEventNotification(EventNotification): diff --git a/stripe/v2/core/health/_alert.py b/stripe/v2/core/health/_alert.py index 074b9065f..89a4f2d11 100644 --- a/stripe/v2/core/health/_alert.py +++ b/stripe/v2/core/health/_alert.py @@ -112,13 +112,17 @@ class TopImpactedAccount(StripeObject): class AuthorizationRateDrop(StripeObject): class Dimension(StripeObject): + acquirer: Optional[str] + """ + Populated when type is acquirer. + """ issuer: Optional[str] """ Populated when type is issuer. """ - type: Literal["issuer"] + type: Union[Literal["acquirer", "issuer"], str] """ - The type of the dimension. Determines which field in dimension_details is populated. + The type of the dimension. Determines which field is populated. """ charge_type: Union[Literal["money_moving", "validation"], str] diff --git a/stripe/v2/core/health/_alert_history_entry.py b/stripe/v2/core/health/_alert_history_entry.py index 0648f86a2..e16b5b703 100644 --- a/stripe/v2/core/health/_alert_history_entry.py +++ b/stripe/v2/core/health/_alert_history_entry.py @@ -112,13 +112,17 @@ class TopImpactedAccount(StripeObject): class AuthorizationRateDrop(StripeObject): class Dimension(StripeObject): + acquirer: Optional[str] + """ + Populated when type is acquirer. + """ issuer: Optional[str] """ Populated when type is issuer. """ - type: Literal["issuer"] + type: Union[Literal["acquirer", "issuer"], str] """ - The type of the dimension. Determines which field in dimension_details is populated. + The type of the dimension. Determines which field is populated. """ charge_type: Union[Literal["money_moving", "validation"], str] diff --git a/stripe/v2/money_management/_payout_intent.py b/stripe/v2/money_management/_payout_intent.py index 89667f888..6ce85e87d 100644 --- a/stripe/v2/money_management/_payout_intent.py +++ b/stripe/v2/money_management/_payout_intent.py @@ -15,16 +15,89 @@ class PayoutIntent(StripeObject): "v2.money_management.payout_intent" ) + class EstimatedFee(StripeObject): + class TaxAmount(StripeObject): + currency: str + """ + Currency code. + """ + value_decimal: str + """ + Tax amount value represented as a decimal string in major units. + """ + + amount: Amount + """ + The fee amount. + """ + tax_amount: Optional[TaxAmount] + """ + Tax charged for this fee, if applicable. Value expressed as a decimal string in major units. + """ + type: Union[ + Literal[ + "cross_border_fee", + "foreign_exchange_fee", + "instant_card_payout_fee", + "next_day_payout_fee", + "real_time_payout_fee", + "stablecoin_payout_fee", + "stablecoin_routing_fee", + "standard_payout_fee", + "wire_payout_fee", + ], + str, + ] + """ + Open Enum. The type of fee. + """ + _inner_class_types = {"tax_amount": TaxAmount} + class From(StripeObject): currency: str """ The currency of the financial account. """ + debited: Optional[Amount] + """ + Estimated amount to be debited from the financial account. + """ financial_account: str """ The FinancialAccount that funds are pulled from. """ + class FxQuote(StripeObject): + class Rates(StripeObject): + exchange_rate: str + """ + The exchange rate going from_currency -> to_currency, represented as a decimal string + (e.g., "1.1520") to preserve the full precision of the rate. + """ + + lock_duration: Union[Literal["five_minutes", "none"], str] + """ + Open Enum. Duration of the FX rate lock. + """ + lock_expires_at: Optional[str] + """ + Timestamp when the rate lock expires. Null when rate locking is not supported. + """ + lock_status: Union[Literal["active", "expired", "none"], str] + """ + Open Enum. Lock status of the FX rate. + """ + rates: UntypedStripeObject[Rates] + """ + Key: source currency. Value: exchange rate from source currency to to_currency. + """ + to_currency: str + """ + The destination currency. + """ + _inner_class_types = {"rates": Rates} + _inner_class_dicts = ["rates"] + class LatestPayout(StripeObject): outbound_payment: Optional[str] """ @@ -40,6 +113,14 @@ class LatestPayout(StripeObject): """ class NextAction(StripeObject): + class Confirm(StripeObject): + reason: Union[ + Literal["automatically_required", "manually_requested"], str + ] + """ + Open Enum. The reason the PayoutIntent requires confirmation. + """ + class HandleFailure(StripeObject): failure_reason: Union[ Literal[ @@ -75,15 +156,22 @@ class HandleFailure(StripeObject): Open Enum. The reason for the failure. """ + confirm: Optional[Confirm] + """ + Details about a confirmation required. Populated when type is confirm. + """ handle_failure: Optional[HandleFailure] """ Details about a failure that requires user action. Populated when type is handle_failure. """ - type: Literal["handle_failure"] + type: Union[Literal["confirm", "handle_failure"], str] """ Open Enum. The type of next action required. """ - _inner_class_types = {"handle_failure": HandleFailure} + _inner_class_types = { + "confirm": Confirm, + "handle_failure": HandleFailure, + } class RecipientNotification(StripeObject): setting: Literal["configured", "none"] @@ -176,6 +264,10 @@ class Ach(StripeObject): """ _inner_class_types = {"bank_account": BankAccount} + credited: Optional[Amount] + """ + Estimated amount to be credited to the recipient in the destination currency. + """ currency: Optional[str] """ The currency to send to the recipient. @@ -198,6 +290,10 @@ class Ach(StripeObject): """ The monetary amount to be sent. """ + confirmation_method: Union[Literal["automatic", "manual"], str] + """ + Controls whether the intent requires explicit confirmation before transitioning to pending. + """ created: str """ Time at which the PayoutIntent was created. @@ -207,10 +303,18 @@ class Ach(StripeObject): """ An arbitrary string attached to the PayoutIntent. Often useful for displaying to users. """ + estimated_fees: Optional[List[EstimatedFee]] + """ + Estimated fees and taxes. + """ from_: From """ The FinancialAccount that funds are pulled from. """ + fx_quote: Optional[FxQuote] + """ + FX rate information for fee transparency. + """ id: str """ Unique identifier for the PayoutIntent. @@ -265,7 +369,9 @@ class Ach(StripeObject): To which payout method the payout is sent. """ _inner_class_types = { + "estimated_fees": EstimatedFee, "from": From, + "fx_quote": FxQuote, "latest_payout": LatestPayout, "next_action": NextAction, "recipient_notification": RecipientNotification, diff --git a/stripe/v2/money_management/_payout_intent_service.py b/stripe/v2/money_management/_payout_intent_service.py index 94079b010..16a61ca59 100644 --- a/stripe/v2/money_management/_payout_intent_service.py +++ b/stripe/v2/money_management/_payout_intent_service.py @@ -10,9 +10,15 @@ from stripe.params.v2.money_management._payout_intent_cancel_params import ( PayoutIntentCancelParams, ) + from stripe.params.v2.money_management._payout_intent_confirm_params import ( + PayoutIntentConfirmParams, + ) from stripe.params.v2.money_management._payout_intent_create_params import ( PayoutIntentCreateParams, ) + from stripe.params.v2.money_management._payout_intent_fx_quote_params import ( + PayoutIntentFxQuoteParams, + ) from stripe.params.v2.money_management._payout_intent_list_params import ( PayoutIntentListParams, ) @@ -198,7 +204,7 @@ def cancel( options: Optional["RequestOptions"] = None, ) -> "PayoutIntent": """ - Cancels a PayoutIntent. Only pending PayoutIntents or processing PayoutIntents with cancelable OutboundPayment/Transfer can be canceled. + Cancels a PayoutIntent. Only pending PayoutIntents, processing PayoutIntents with cancelable OutboundPayment/Transfer, or requires_action PayoutIntents can be canceled. """ return cast( "PayoutIntent", @@ -220,7 +226,7 @@ async def cancel_async( options: Optional["RequestOptions"] = None, ) -> "PayoutIntent": """ - Cancels a PayoutIntent. Only pending PayoutIntents or processing PayoutIntents with cancelable OutboundPayment/Transfer can be canceled. + Cancels a PayoutIntent. Only pending PayoutIntents, processing PayoutIntents with cancelable OutboundPayment/Transfer, or requires_action PayoutIntents can be canceled. """ return cast( "PayoutIntent", @@ -234,3 +240,91 @@ async def cancel_async( options=options, ), ) + + def confirm( + self, + id: str, + params: Optional["PayoutIntentConfirmParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "PayoutIntent": + """ + Confirms a PayoutIntent that is in the requires_action state, transitioning it to pending. + """ + return cast( + "PayoutIntent", + self._request( + "post", + "/v2/money_management/payout_intents/{id}/confirm".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def confirm_async( + self, + id: str, + params: Optional["PayoutIntentConfirmParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "PayoutIntent": + """ + Confirms a PayoutIntent that is in the requires_action state, transitioning it to pending. + """ + return cast( + "PayoutIntent", + await self._request_async( + "post", + "/v2/money_management/payout_intents/{id}/confirm".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + def fx_quote( + self, + id: str, + params: Optional["PayoutIntentFxQuoteParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "PayoutIntent": + """ + Refreshes FX quote for a PayoutIntent. + """ + return cast( + "PayoutIntent", + self._request( + "post", + "/v2/money_management/payout_intents/{id}/fx_quote".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def fx_quote_async( + self, + id: str, + params: Optional["PayoutIntentFxQuoteParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "PayoutIntent": + """ + Refreshes FX quote for a PayoutIntent. + """ + return cast( + "PayoutIntent", + await self._request_async( + "post", + "/v2/money_management/payout_intents/{id}/fx_quote".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/v2/payments/_off_session_payment.py b/stripe/v2/payments/_off_session_payment.py index 3ab6cd496..edf6e235b 100644 --- a/stripe/v2/payments/_off_session_payment.py +++ b/stripe/v2/payments/_off_session_payment.py @@ -198,7 +198,7 @@ class TransferData(StripeObject): """ amount_requested: Amount """ - The “presentment amount” to be collected from the customer. + The "presentment amount" to be collected from the customer. """ application: Optional[str] """ diff --git a/stripe/v2/tax/__init__.py b/stripe/v2/tax/__init__.py index ae79b79ed..4b2c2104d 100644 --- a/stripe/v2/tax/__init__.py +++ b/stripe/v2/tax/__init__.py @@ -8,11 +8,22 @@ from stripe.v2.tax._manual_rule_service import ( ManualRuleService as ManualRuleService, ) + from stripe.v2.tax._operation_service import ( + OperationService as OperationService, + ) + from stripe.v2.tax._operations_resolve_address_result import ( + OperationsResolveAddressResult as OperationsResolveAddressResult, + ) # name -> (import_target, is_submodule) _import_map = { "ManualRule": ("stripe.v2.tax._manual_rule", False), "ManualRuleService": ("stripe.v2.tax._manual_rule_service", False), + "OperationService": ("stripe.v2.tax._operation_service", False), + "OperationsResolveAddressResult": ( + "stripe.v2.tax._operations_resolve_address_result", + False, + ), } if not TYPE_CHECKING: diff --git a/stripe/v2/tax/_operation_service.py b/stripe/v2/tax/_operation_service.py new file mode 100644 index 000000000..db5ddd066 --- /dev/null +++ b/stripe/v2/tax/_operation_service.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_service import StripeService +from typing import Optional, cast +from typing_extensions import TYPE_CHECKING + +if TYPE_CHECKING: + from stripe._request_options import RequestOptions + from stripe.params.v2.tax._operation_resolve_address_params import ( + OperationResolveAddressParams, + ) + from stripe.v2.tax._operations_resolve_address_result import ( + OperationsResolveAddressResult, + ) + + +class OperationService(StripeService): + def resolve_address( + self, + params: "OperationResolveAddressParams", + options: Optional["RequestOptions"] = None, + ) -> "OperationsResolveAddressResult": + """ + Resolves an address to its tax precision level. + """ + return cast( + "OperationsResolveAddressResult", + self._request( + "post", + "/v2/tax/operations/resolve_address", + base_address="api", + params=params, + options=options, + ), + ) + + async def resolve_address_async( + self, + params: "OperationResolveAddressParams", + options: Optional["RequestOptions"] = None, + ) -> "OperationsResolveAddressResult": + """ + Resolves an address to its tax precision level. + """ + return cast( + "OperationsResolveAddressResult", + await self._request_async( + "post", + "/v2/tax/operations/resolve_address", + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/v2/tax/_operations_resolve_address_result.py b/stripe/v2/tax/_operations_resolve_address_result.py new file mode 100644 index 000000000..b5ca9745b --- /dev/null +++ b/stripe/v2/tax/_operations_resolve_address_result.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from typing import ClassVar, List, Optional +from typing_extensions import Literal + + +class OperationsResolveAddressResult(StripeObject): + """ + The result of resolving an address to its tax precision level. + """ + + OBJECT_NAME: ClassVar[ + Literal["v2.tax.operations_resolve_address_result"] + ] = "v2.tax.operations_resolve_address_result" + + class Address(StripeObject): + city: Optional[str] + """ + The city. + """ + country: Optional[str] + """ + The two-letter country code. + """ + line1: Optional[str] + """ + The first line of the street address. + """ + postal_code: Optional[str] + """ + The postal code. + """ + state: Optional[str] + """ + The state or province. + """ + + class PrecisionDetails(StripeObject): + class Issue(StripeObject): + code: Literal["required_for_improved_precision"] + """ + A code describing the issue. + """ + field: Literal["city", "country", "line1", "postal_code", "state"] + """ + The address field with the issue. + """ + + issues: List[Issue] + """ + Issues preventing higher precision. + """ + _inner_class_types = {"issues": Issue} + + address: Address + """ + The normalized form of the input address. + """ + livemode: bool + """ + Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + """ + object: Literal["v2.tax.operations_resolve_address_result"] + """ + String representing the object's type. Objects of the same type share the same value of the object field. + """ + precision: Literal[ + "none", "address", "city", "country", "postal_code", "state", "street" + ] + """ + The precision level of the resolved address. + """ + precision_details: PrecisionDetails + """ + Details about the precision, including any issues. + """ + _inner_class_types = { + "address": Address, + "precision_details": PrecisionDetails, + } diff --git a/tests/api_resources/test_list_object_v2.py b/tests/api_resources/test_list_object_v2.py index 7767b6a36..84759e873 100644 --- a/tests/api_resources/test_list_object_v2.py +++ b/tests/api_resources/test_list_object_v2.py @@ -146,3 +146,129 @@ def test_iter_forwards_api_key(self, http_client_mock: HTTPClientMock): query_string=query_string_2, api_key="sk_test_iter_forwards_options", ) + + +class TestAutoPagingAsync: + @staticmethod + def pageable_model_response(ids, next_page_url): + return { + "data": [{"id": id, "object": "pageablemodel"} for id in ids], + "next_page_url": next_page_url, + } + + @pytest.mark.anyio + async def test_iter_one_page(self, http_client_mock): + lo = ListObject.construct_from( + self.pageable_model_response(["pm_123", "pm_124"], None), "mykey" + ) + + http_client_mock.assert_no_request() + + seen = [item["id"] async for item in lo.auto_paging_iter()] + + assert seen == ["pm_123", "pm_124"] + + @pytest.mark.anyio + async def test_iter_two_pages(self, http_client_mock): + method = "get" + path = "/v2/pageablemodels" + + lo = ListObject.construct_from( + self.pageable_model_response( + ["pm_123", "pm_124"], + "/v2/pageablemodels?foo=bar&page=page_2", + ), + None, + ) + + http_client_mock.stub_request( + method, + path=path, + query_string="foo=bar&page=page_3", + rbody=json.dumps( + self.pageable_model_response(["pm_127", "pm_128"], None) + ), + ) + + http_client_mock.stub_request( + method, + path=path, + query_string="foo=bar&page=page_2", + rbody=json.dumps( + self.pageable_model_response( + ["pm_125", "pm_126"], + "/v2/pageablemodels?foo=bar&page=page_3", + ) + ), + ) + + seen = [item["id"] async for item in lo.auto_paging_iter()] + + http_client_mock.assert_requested( + method, path=path, query_string="foo=bar&page=page_2" + ) + http_client_mock.assert_requested( + method, path=path, query_string="foo=bar&page=page_3" + ) + + assert seen == [ + "pm_123", + "pm_124", + "pm_125", + "pm_126", + "pm_127", + "pm_128", + ] + + @pytest.mark.anyio + async def test_iter_forwards_api_key( + self, http_client_mock: HTTPClientMock + ): + client = stripe.StripeClient( + http_client=http_client_mock.get_mock_http_client(), + api_key="sk_test_xyz", + ) + + method = "get" + query_string_1 = "object_id=obj_123" + query_string_2 = "object_id=obj_123&page=page_2" + path = "/v2/core/events" + + http_client_mock.stub_request( + method, + path=path, + query_string=query_string_1, + rbody='{"data": [{"id": "x"}], "next_page_url": "/v2/core/events?object_id=obj_123&page=page_2"}', + rcode=200, + rheaders={}, + ) + + http_client_mock.stub_request( + method, + path=path, + query_string=query_string_2, + rbody='{"data": [{"id": "y"}, {"id": "z"}], "next_page_url": null}', + rcode=200, + rheaders={}, + ) + + lo = await client.v2.core.events.list_async( + params={"object_id": "obj_123"}, + options={"api_key": "sk_test_iter_forwards_options"}, + ) + + seen = [item["id"] async for item in lo.auto_paging_iter()] + + assert seen == ["x", "y", "z"] + http_client_mock.assert_requested( + method, + path=path, + query_string=query_string_1, + api_key="sk_test_iter_forwards_options", + ) + http_client_mock.assert_requested( + method, + path=path, + query_string=query_string_2, + api_key="sk_test_iter_forwards_options", + ) diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index 7a068ef8d..b1ca55a7e 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -48748,6 +48748,50 @@ def test_v2_money_management_payout_intent_post_3_service( is_json=True, ) + def test_v2_money_management_payout_intent_post_4_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/money_management/payout_intents/id_123/confirm", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.money_management.payout_intents.confirm("id_123") + http_client_mock.assert_requested( + "post", + path="/v2/money_management/payout_intents/id_123/confirm", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", + is_json=True, + ) + + def test_v2_money_management_payout_intent_post_5_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/money_management/payout_intents/id_123/fx_quote", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.money_management.payout_intents.fx_quote("id_123") + http_client_mock.assert_requested( + "post", + path="/v2/money_management/payout_intents/id_123/fx_quote", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", + is_json=True, + ) + def test_v2_money_management_payout_method_get_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -50167,6 +50211,38 @@ def test_v2_tax_manual_rule_post_3_service( is_json=True, ) + def test_v2_tax_operation_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/tax/operations/resolve_address", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.tax.operations.resolve_address( + { + "address": { + "city": "city", + "country": "country", + "line1": "line1", + "postal_code": "postal_code", + "state": "state", + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v2/tax/operations/resolve_address", + query_string="", + api_base="https://api.stripe.com", + post_data='{"address":{"city":"city","country":"country","line1":"line1","postal_code":"postal_code","state":"state"}}', + is_json=True, + ) + def test_v2_test_helpers_financial_address_post_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -50512,6 +50588,33 @@ def test_fx_quote_expired_error_service( is_json=True, ) + def test_fx_quote_needs_refresh_error_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/money_management/payout_intents/id_123/confirm", + rbody='{"error":{"type":"fx_quote_needs_refresh","code":"payout_intent_fx_quote_expired"}}', + rcode=400, + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + try: + client.v2.money_management.payout_intents.confirm("id_123") + except _error.FxQuoteNeedsRefreshError: + pass + http_client_mock.assert_requested( + "post", + path="/v2/money_management/payout_intents/id_123/confirm", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", + is_json=True, + ) + def test_insufficient_funds_error_service( self, http_client_mock: HTTPClientMock ) -> None: