From 3649036ffcc81527f08f122c29ada182563f027c Mon Sep 17 00:00:00 2001 From: Helen Ye Date: Wed, 9 Jul 2025 11:56:20 -0400 Subject: [PATCH] Update for June release --- stripe/__init__.py | 2 + stripe/_api_requestor.py | 8 +- stripe/_error.py | 10 +- stripe/events/__init__.py | 6 + stripe/events/_event_classes.py | 8 + ..._storer_capability_status_updated_event.py | 104 +++++ ...ding_configuration_storer_updated_event.py | 45 ++ stripe/v2/core/_account.py | 423 +++++++++++++++++- stripe/v2/core/_account_service.py | 357 ++++++++++++++- .../v2/money_management/_financial_account.py | 21 + .../_financial_account_service.py | 311 ++++++++++++- tests/test_generated_examples.py | 127 +++++- 12 files changed, 1403 insertions(+), 19 deletions(-) create mode 100644 stripe/events/_v2_core_account_including_configuration_storer_capability_status_updated_event.py create mode 100644 stripe/events/_v2_core_account_including_configuration_storer_updated_event.py diff --git a/stripe/__init__.py b/stripe/__init__.py index c6e405ae5..5d7f54f74 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -445,6 +445,7 @@ def __getattr__(name): ) from stripe._error import ( AlreadyCanceledError as AlreadyCanceledError, + AlreadyExistsError as AlreadyExistsError, BlockedByStripeError as BlockedByStripeError, ControlledByDashboardError as ControlledByDashboardError, FeatureNotEnabledError as FeatureNotEnabledError, @@ -452,6 +453,7 @@ def __getattr__(name): InsufficientFundsError as InsufficientFundsError, InvalidPaymentMethodError as InvalidPaymentMethodError, InvalidPayoutMethodError as InvalidPayoutMethodError, + NonZeroBalanceError as NonZeroBalanceError, NotCancelableError as NotCancelableError, QuotaExceededError as QuotaExceededError, RecipientNotNotifiableError as RecipientNotNotifiableError, diff --git a/stripe/_api_requestor.py b/stripe/_api_requestor.py index 2a01dd214..3cab29a9d 100644 --- a/stripe/_api_requestor.py +++ b/stripe/_api_requestor.py @@ -371,10 +371,14 @@ def specific_v2_api_error(self, rbody, rcode, resp, rheaders, error_data): # switchCases: The beginning of the section generated from our OpenAPI spec elif type == "temporary_session_expired": return error.TemporarySessionExpiredError(**error_args) - elif type == "financial_account_not_open": - return error.FinancialAccountNotOpenError(**error_args) + elif type == "non_zero_balance": + return error.NonZeroBalanceError(**error_args) + elif type == "already_exists": + return error.AlreadyExistsError(**error_args) elif type == "feature_not_enabled": return error.FeatureNotEnabledError(**error_args) + elif type == "financial_account_not_open": + return error.FinancialAccountNotOpenError(**error_args) elif type == "blocked_by_stripe": return error.BlockedByStripeError(**error_args) elif type == "already_canceled": diff --git a/stripe/_error.py b/stripe/_error.py index 5e5e47c44..80b1955b1 100644 --- a/stripe/_error.py +++ b/stripe/_error.py @@ -192,7 +192,11 @@ class TemporarySessionExpiredError(StripeError): pass -class FinancialAccountNotOpenError(StripeError): +class NonZeroBalanceError(StripeError): + pass + + +class AlreadyExistsError(StripeError): pass @@ -200,6 +204,10 @@ class FeatureNotEnabledError(StripeError): pass +class FinancialAccountNotOpenError(StripeError): + pass + + class BlockedByStripeError(StripeError): pass diff --git a/stripe/events/__init__.py b/stripe/events/__init__.py index 705304e6f..da1f837c8 100644 --- a/stripe/events/__init__.py +++ b/stripe/events/__init__.py @@ -30,6 +30,12 @@ from stripe.events._v2_core_account_including_configuration_recipient_updated_event import ( V2CoreAccountIncludingConfigurationRecipientUpdatedEvent as V2CoreAccountIncludingConfigurationRecipientUpdatedEvent, ) +from stripe.events._v2_core_account_including_configuration_storer_capability_status_updated_event import ( + V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent as V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent, +) +from stripe.events._v2_core_account_including_configuration_storer_updated_event import ( + V2CoreAccountIncludingConfigurationStorerUpdatedEvent as V2CoreAccountIncludingConfigurationStorerUpdatedEvent, +) from stripe.events._v2_core_account_including_defaults_updated_event import ( V2CoreAccountIncludingDefaultsUpdatedEvent as V2CoreAccountIncludingDefaultsUpdatedEvent, ) diff --git a/stripe/events/_event_classes.py b/stripe/events/_event_classes.py index 79adae13c..8b7d4858c 100644 --- a/stripe/events/_event_classes.py +++ b/stripe/events/_event_classes.py @@ -48,6 +48,12 @@ from stripe.events._v2_core_account_including_configuration_recipient_updated_event import ( V2CoreAccountIncludingConfigurationRecipientUpdatedEvent, ) +from stripe.events._v2_core_account_including_configuration_storer_capability_status_updated_event import ( + V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent, +) +from stripe.events._v2_core_account_including_configuration_storer_updated_event import ( + V2CoreAccountIncludingConfigurationStorerUpdatedEvent, +) from stripe.events._v2_money_management_adjustment_created_event import ( V2MoneyManagementAdjustmentCreatedEvent, ) @@ -193,6 +199,8 @@ V2CoreAccountIncludingConfigurationMerchantUpdatedEvent.LOOKUP_TYPE: V2CoreAccountIncludingConfigurationMerchantUpdatedEvent, V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEvent.LOOKUP_TYPE: V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEvent, V2CoreAccountIncludingConfigurationRecipientUpdatedEvent.LOOKUP_TYPE: V2CoreAccountIncludingConfigurationRecipientUpdatedEvent, + V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent.LOOKUP_TYPE: V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent, + V2CoreAccountIncludingConfigurationStorerUpdatedEvent.LOOKUP_TYPE: V2CoreAccountIncludingConfigurationStorerUpdatedEvent, V2CoreAccountIncludingDefaultsUpdatedEvent.LOOKUP_TYPE: V2CoreAccountIncludingDefaultsUpdatedEvent, V2CoreAccountIncludingIdentityUpdatedEvent.LOOKUP_TYPE: V2CoreAccountIncludingIdentityUpdatedEvent, V2CoreAccountIncludingRequirementsUpdatedEvent.LOOKUP_TYPE: V2CoreAccountIncludingRequirementsUpdatedEvent, diff --git a/stripe/events/_v2_core_account_including_configuration_storer_capability_status_updated_event.py b/stripe/events/_v2_core_account_including_configuration_storer_capability_status_updated_event.py new file mode 100644 index 000000000..3ddf8e417 --- /dev/null +++ b/stripe/events/_v2_core_account_including_configuration_storer_capability_status_updated_event.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._api_mode import ApiMode +from stripe._api_requestor import _APIRequestor +from stripe._stripe_object import StripeObject +from stripe._stripe_response import StripeResponse +from stripe.v2._event import Event +from stripe.v2.core._account import Account +from typing import Any, Dict, Optional, cast +from typing_extensions import Literal + + +class V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent( + Event, +): + LOOKUP_TYPE = ( + "v2.core.account[configuration.storer].capability_status_updated" + ) + type: Literal[ + "v2.core.account[configuration.storer].capability_status_updated" + ] + + class V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventData( + StripeObject, + ): + updated_capability: Literal[ + "financial_addressses.bank_accounts", + "holds_currencies.eur", + "holds_currencies.gbp", + "holds_currencies.usd", + "inbound_transfers.bank_accounts", + "outbound_payments.bank_accounts", + "outbound_payments.cards", + "outbound_payments.financial_accounts", + "outbound_transfers.bank_accounts", + "outbound_transfers.financial_accounts", + ] + """ + Open Enum. The capability which had its status updated. + """ + + data: V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventData + """ + Data for the v2.core.account[configuration.storer].capability_status_updated event + """ + + @classmethod + def _construct_from( + cls, + *, + values: Dict[str, Any], + last_response: Optional[StripeResponse] = None, + requestor: "_APIRequestor", + api_mode: ApiMode, + ) -> ( + "V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent" + ): + evt = super()._construct_from( + values=values, + last_response=last_response, + requestor=requestor, + api_mode=api_mode, + ) + if hasattr(evt, "data"): + evt.data = V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEvent.V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventData._construct_from( + values=evt.data, + last_response=last_response, + requestor=requestor, + api_mode=api_mode, + ) + return evt + + 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_account": self.context}, + ), + ) diff --git a/stripe/events/_v2_core_account_including_configuration_storer_updated_event.py b/stripe/events/_v2_core_account_including_configuration_storer_updated_event.py new file mode 100644 index 000000000..42d1bd8c6 --- /dev/null +++ b/stripe/events/_v2_core_account_including_configuration_storer_updated_event.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe.v2._event import Event +from stripe.v2.core._account import Account +from typing import cast +from typing_extensions import Literal + + +class V2CoreAccountIncludingConfigurationStorerUpdatedEvent(Event): + LOOKUP_TYPE = "v2.core.account[configuration.storer].updated" + type: Literal["v2.core.account[configuration.storer].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_account": self.context}, + ), + ) diff --git a/stripe/v2/core/_account.py b/stripe/v2/core/_account.py index 6bd7e116e..a74cdb386 100644 --- a/stripe/v2/core/_account.py +++ b/stripe/v2/core/_account.py @@ -3361,6 +3361,408 @@ class DefaultOutboundDestination(StripeObject): "default_outbound_destination": DefaultOutboundDestination, } + class Storer(StripeObject): + class Capabilities(StripeObject): + class FinancialAddresses(StripeObject): + class BankAccounts(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "determining_status", + "requirements_past_due", + "requirements_pending_verification", + "restricted_other", + "unsupported_business", + "unsupported_country", + "unsupported_entity_type", + ] + """ + Machine-readable code explaining the reason for the Capability to be in its current status. + """ + resolution: Literal[ + "contact_stripe", + "no_resolution", + "provide_info", + ] + """ + Machine-readable code explaining how to make the Capability active. + """ + + requested: bool + """ + Whether the Capability has been requested. + """ + status: Literal[ + "active", "pending", "restricted", "unsupported" + ] + """ + The status of the Capability. + """ + status_details: List[StatusDetail] + """ + Additional details regarding the status of the Capability. `status_details` will be empty if the Capability's status is `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + bank_accounts: Optional[BankAccounts] + """ + Can provision a bank-account like financial address (VBAN) to credit/debit a FinancialAccount. + """ + _inner_class_types = {"bank_accounts": BankAccounts} + + class HoldsCurrencies(StripeObject): + class Gbp(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "determining_status", + "requirements_past_due", + "requirements_pending_verification", + "restricted_other", + "unsupported_business", + "unsupported_country", + "unsupported_entity_type", + ] + """ + Machine-readable code explaining the reason for the Capability to be in its current status. + """ + resolution: Literal[ + "contact_stripe", + "no_resolution", + "provide_info", + ] + """ + Machine-readable code explaining how to make the Capability active. + """ + + requested: bool + """ + Whether the Capability has been requested. + """ + status: Literal[ + "active", "pending", "restricted", "unsupported" + ] + """ + The status of the Capability. + """ + status_details: List[StatusDetail] + """ + Additional details regarding the status of the Capability. `status_details` will be empty if the Capability's status is `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + gbp: Optional[Gbp] + """ + Can hold storage-type funds on Stripe in GBP. + """ + _inner_class_types = {"gbp": Gbp} + + class InboundTransfers(StripeObject): + class BankAccounts(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "determining_status", + "requirements_past_due", + "requirements_pending_verification", + "restricted_other", + "unsupported_business", + "unsupported_country", + "unsupported_entity_type", + ] + """ + Machine-readable code explaining the reason for the Capability to be in its current status. + """ + resolution: Literal[ + "contact_stripe", + "no_resolution", + "provide_info", + ] + """ + Machine-readable code explaining how to make the Capability active. + """ + + requested: bool + """ + Whether the Capability has been requested. + """ + status: Literal[ + "active", "pending", "restricted", "unsupported" + ] + """ + The status of the Capability. + """ + status_details: List[StatusDetail] + """ + Additional details regarding the status of the Capability. `status_details` will be empty if the Capability's status is `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + bank_accounts: Optional[BankAccounts] + """ + Can pull funds from an external bank account, owned by yourself, to a FinancialAccount. + """ + _inner_class_types = {"bank_accounts": BankAccounts} + + class OutboundPayments(StripeObject): + class BankAccounts(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "determining_status", + "requirements_past_due", + "requirements_pending_verification", + "restricted_other", + "unsupported_business", + "unsupported_country", + "unsupported_entity_type", + ] + """ + Machine-readable code explaining the reason for the Capability to be in its current status. + """ + resolution: Literal[ + "contact_stripe", + "no_resolution", + "provide_info", + ] + """ + Machine-readable code explaining how to make the Capability active. + """ + + requested: bool + """ + Whether the Capability has been requested. + """ + status: Literal[ + "active", "pending", "restricted", "unsupported" + ] + """ + The status of the Capability. + """ + status_details: List[StatusDetail] + """ + Additional details regarding the status of the Capability. `status_details` will be empty if the Capability's status is `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + class Cards(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "determining_status", + "requirements_past_due", + "requirements_pending_verification", + "restricted_other", + "unsupported_business", + "unsupported_country", + "unsupported_entity_type", + ] + """ + Machine-readable code explaining the reason for the Capability to be in its current status. + """ + resolution: Literal[ + "contact_stripe", + "no_resolution", + "provide_info", + ] + """ + Machine-readable code explaining how to make the Capability active. + """ + + requested: bool + """ + Whether the Capability has been requested. + """ + status: Literal[ + "active", "pending", "restricted", "unsupported" + ] + """ + The status of the Capability. + """ + status_details: List[StatusDetail] + """ + Additional details regarding the status of the Capability. `status_details` will be empty if the Capability's status is `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + class FinancialAccounts(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "determining_status", + "requirements_past_due", + "requirements_pending_verification", + "restricted_other", + "unsupported_business", + "unsupported_country", + "unsupported_entity_type", + ] + """ + Machine-readable code explaining the reason for the Capability to be in its current status. + """ + resolution: Literal[ + "contact_stripe", + "no_resolution", + "provide_info", + ] + """ + Machine-readable code explaining how to make the Capability active. + """ + + requested: bool + """ + Whether the Capability has been requested. + """ + status: Literal[ + "active", "pending", "restricted", "unsupported" + ] + """ + The status of the Capability. + """ + status_details: List[StatusDetail] + """ + Additional details regarding the status of the Capability. `status_details` will be empty if the Capability's status is `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + bank_accounts: Optional[BankAccounts] + """ + Can send funds from a FinancialAccount to a bank account, owned by someone else. + """ + cards: Optional[Cards] + """ + Can send funds from a FinancialAccount to a debit card, owned by someone else. + """ + financial_accounts: Optional[FinancialAccounts] + """ + Can send funds from a FinancialAccount to another FinancialAccount, owned by someone else. + """ + _inner_class_types = { + "bank_accounts": BankAccounts, + "cards": Cards, + "financial_accounts": FinancialAccounts, + } + + class OutboundTransfers(StripeObject): + class BankAccounts(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "determining_status", + "requirements_past_due", + "requirements_pending_verification", + "restricted_other", + "unsupported_business", + "unsupported_country", + "unsupported_entity_type", + ] + """ + Machine-readable code explaining the reason for the Capability to be in its current status. + """ + resolution: Literal[ + "contact_stripe", + "no_resolution", + "provide_info", + ] + """ + Machine-readable code explaining how to make the Capability active. + """ + + requested: bool + """ + Whether the Capability has been requested. + """ + status: Literal[ + "active", "pending", "restricted", "unsupported" + ] + """ + The status of the Capability. + """ + status_details: List[StatusDetail] + """ + Additional details regarding the status of the Capability. `status_details` will be empty if the Capability's status is `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + class FinancialAccounts(StripeObject): + class StatusDetail(StripeObject): + code: Literal[ + "determining_status", + "requirements_past_due", + "requirements_pending_verification", + "restricted_other", + "unsupported_business", + "unsupported_country", + "unsupported_entity_type", + ] + """ + Machine-readable code explaining the reason for the Capability to be in its current status. + """ + resolution: Literal[ + "contact_stripe", + "no_resolution", + "provide_info", + ] + """ + Machine-readable code explaining how to make the Capability active. + """ + + requested: bool + """ + Whether the Capability has been requested. + """ + status: Literal[ + "active", "pending", "restricted", "unsupported" + ] + """ + The status of the Capability. + """ + status_details: List[StatusDetail] + """ + Additional details regarding the status of the Capability. `status_details` will be empty if the Capability's status is `active`. + """ + _inner_class_types = {"status_details": StatusDetail} + + bank_accounts: Optional[BankAccounts] + """ + Can send funds from a FinancialAccount, to a bank account, owned by yourself. + """ + financial_accounts: Optional[FinancialAccounts] + """ + Can send funds from a FinancialAccount to another FinancialAccount, owned by yourself. + """ + _inner_class_types = { + "bank_accounts": BankAccounts, + "financial_accounts": FinancialAccounts, + } + + financial_addresses: Optional[FinancialAddresses] + """ + Can provision a financial address to credit/debit a FinancialAccount. + """ + holds_currencies: Optional[HoldsCurrencies] + """ + Can hold storage-type funds on Stripe. + """ + inbound_transfers: Optional[InboundTransfers] + """ + Can pull funds from an external source, owned by yourself, to a FinancialAccount. + """ + outbound_payments: Optional[OutboundPayments] + """ + Can send funds from a FinancialAccount to a destination owned by someone else. + """ + outbound_transfers: Optional[OutboundTransfers] + """ + Can send funds from a FinancialAccount to a destination owned by yourself. + """ + _inner_class_types = { + "financial_addresses": FinancialAddresses, + "holds_currencies": HoldsCurrencies, + "inbound_transfers": InboundTransfers, + "outbound_payments": OutboundPayments, + "outbound_transfers": OutboundTransfers, + } + + capabilities: Optional[Capabilities] + """ + Capabilities that have been requested on the Storer Configuration. + """ + _inner_class_types = {"capabilities": Capabilities} + customer: Optional[Customer] """ The Customer Configuration allows the Account to be used in inbound payment flows. @@ -3373,10 +3775,15 @@ class DefaultOutboundDestination(StripeObject): """ The Recipient Configuration allows the Account to receive funds. """ + storer: Optional[Storer] + """ + The Storer Configuration allows the Account to store and move funds using stored-value FinancialAccounts. + """ _inner_class_types = { "customer": Customer, "merchant": Merchant, "recipient": Recipient, + "storer": Storer, } class Defaults(StripeObject): @@ -7190,10 +7597,13 @@ class Deadline(StripeObject): "cartes_bancaires_payments", "cashapp_payments", "eps_payments", + "financial_addresses.bank_accounts", "fpx_payments", "gb_bank_transfer_payments", "grabpay_payments", + "holds_currencies.gbp", "ideal_payments", + "inbound_transfers.financial_accounts", "jcb_payments", "jp_bank_transfer_payments", "kakao_pay_payments", @@ -7205,6 +7615,11 @@ class Deadline(StripeObject): "multibanco_payments", "mx_bank_transfer_payments", "naver_pay_payments", + "outbound_payments.bank_accounts", + "outbound_payments.cards", + "outbound_payments.financial_accounts", + "outbound_transfers.bank_accounts", + "outbound_transfers.financial_accounts", "oxxo_payments", "p24_payments", "payco_payments", @@ -7225,7 +7640,9 @@ class Deadline(StripeObject): """ The name of the Capability which will be restricted. """ - configuration: Literal["customer", "merchant", "recipient"] + configuration: Literal[ + "customer", "merchant", "recipient", "storer" + ] """ The configuration which specifies the Capability which will be restricted. """ @@ -7340,7 +7757,9 @@ class MinimumDeadline(StripeObject): """ _inner_class_types = {"entries": Entry, "summary": Summary} - applied_configurations: List[Literal["customer", "merchant", "recipient"]] + applied_configurations: List[ + Literal["customer", "merchant", "recipient", "storer"] + ] """ Filter only accounts that have all of the configurations specified. If omitted, returns all accounts regardless of which configurations they have. """ diff --git a/stripe/v2/core/_account_service.py b/stripe/v2/core/_account_service.py index 1714580c8..c911a331b 100644 --- a/stripe/v2/core/_account_service.py +++ b/stripe/v2/core/_account_service.py @@ -18,7 +18,7 @@ def __init__(self, requestor): class CloseParams(TypedDict): applied_configurations: NotRequired[ - List[Literal["customer", "merchant", "recipient"]] + List[Literal["customer", "merchant", "recipient", "storer"]] ] """ Configurations on the Account to be closed. All configurations on the Account must be passed in for this request to succeed. @@ -55,6 +55,7 @@ class CreateParams(TypedDict): "configuration.customer", "configuration.merchant", "configuration.recipient", + "configuration.storer", "defaults", "identity", "requirements", @@ -88,6 +89,10 @@ class CreateParamsConfiguration(TypedDict): """ The Recipient Configuration allows the Account to receive funds. """ + storer: NotRequired["AccountService.CreateParamsConfigurationStorer"] + """ + The Storer Configuration allows the Account to store and move funds using stored-value FinancialAccounts. + """ class CreateParamsConfigurationCustomer(TypedDict): automatic_indirect_tax: NotRequired[ @@ -1585,6 +1590,178 @@ class CreateParamsConfigurationRecipientCapabilitiesStripeBalanceStripeTransfers To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. """ + class CreateParamsConfigurationStorer(TypedDict): + capabilities: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilities" + ] + """ + Capabilities to request on the Storer Configuration. + """ + + class CreateParamsConfigurationStorerCapabilities(TypedDict): + financial_addresses: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesFinancialAddresses" + ] + """ + Can provision a financial address to credit/debit a FinancialAccount. + """ + holds_currencies: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesHoldsCurrencies" + ] + """ + Can hold storage-type funds on Stripe. + """ + inbound_transfers: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesInboundTransfers" + ] + """ + Can pull funds from an external source, owned by yourself, to a FinancialAccount. + """ + outbound_payments: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesOutboundPayments" + ] + """ + Can send funds from a FinancialAccount to a destination owned by someone else. + """ + outbound_transfers: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesOutboundTransfers" + ] + """ + Can send funds from a FinancialAccount to a destination owned by yourself. + """ + + class CreateParamsConfigurationStorerCapabilitiesFinancialAddresses( + TypedDict, + ): + bank_accounts: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesFinancialAddressesBankAccounts" + ] + """ + Can provision a bank-account-like financial address (VBAN) to credit/debit a FinancialAccount. + """ + + class CreateParamsConfigurationStorerCapabilitiesFinancialAddressesBankAccounts( + TypedDict, + ): + requested: bool + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class CreateParamsConfigurationStorerCapabilitiesHoldsCurrencies( + TypedDict + ): + gbp: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesHoldsCurrenciesGbp" + ] + """ + Can hold storage-type funds on Stripe in GBP. + """ + + class CreateParamsConfigurationStorerCapabilitiesHoldsCurrenciesGbp( + TypedDict, + ): + requested: bool + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class CreateParamsConfigurationStorerCapabilitiesInboundTransfers( + TypedDict, + ): + bank_accounts: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesInboundTransfersBankAccounts" + ] + """ + Can pull funds from an external bank account owned by yourself to a FinancialAccount. + """ + + class CreateParamsConfigurationStorerCapabilitiesInboundTransfersBankAccounts( + TypedDict, + ): + requested: bool + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class CreateParamsConfigurationStorerCapabilitiesOutboundPayments( + TypedDict, + ): + bank_accounts: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesOutboundPaymentsBankAccounts" + ] + """ + Can send funds from a FinancialAccount to a bank account owned by someone else. + """ + cards: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesOutboundPaymentsCards" + ] + """ + Can send funds from a FinancialAccount to a debit card owned by someone else. + """ + financial_accounts: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesOutboundPaymentsFinancialAccounts" + ] + """ + Can send funds from a FinancialAccount to another FinancialAccount owned by someone else. + """ + + class CreateParamsConfigurationStorerCapabilitiesOutboundPaymentsBankAccounts( + TypedDict, + ): + requested: bool + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class CreateParamsConfigurationStorerCapabilitiesOutboundPaymentsCards( + TypedDict, + ): + requested: bool + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class CreateParamsConfigurationStorerCapabilitiesOutboundPaymentsFinancialAccounts( + TypedDict, + ): + requested: bool + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class CreateParamsConfigurationStorerCapabilitiesOutboundTransfers( + TypedDict, + ): + bank_accounts: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesOutboundTransfersBankAccounts" + ] + """ + Can send funds from a FinancialAccount to a bank account owned by yourself. + """ + financial_accounts: NotRequired[ + "AccountService.CreateParamsConfigurationStorerCapabilitiesOutboundTransfersFinancialAccounts" + ] + """ + Can send funds from a FinancialAccount to another FinancialAccount owned by yourself. + """ + + class CreateParamsConfigurationStorerCapabilitiesOutboundTransfersBankAccounts( + TypedDict, + ): + requested: bool + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class CreateParamsConfigurationStorerCapabilitiesOutboundTransfersFinancialAccounts( + TypedDict, + ): + requested: bool + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + class CreateParamsDefaults(TypedDict): currency: NotRequired[ Literal[ @@ -5275,6 +5452,7 @@ class RetrieveParams(TypedDict): "configuration.customer", "configuration.merchant", "configuration.recipient", + "configuration.storer", "defaults", "identity", "requirements", @@ -5316,6 +5494,7 @@ class UpdateParams(TypedDict): "configuration.customer", "configuration.merchant", "configuration.recipient", + "configuration.storer", "defaults", "identity", "requirements", @@ -5349,6 +5528,10 @@ class UpdateParamsConfiguration(TypedDict): """ The Recipient Configuration allows the Account to receive funds. """ + storer: NotRequired["AccountService.UpdateParamsConfigurationStorer"] + """ + The Storer Configuration allows the Account to store and move funds using stored-value FinancialAccounts. + """ class UpdateParamsConfigurationCustomer(TypedDict): automatic_indirect_tax: NotRequired[ @@ -6864,6 +7047,178 @@ class UpdateParamsConfigurationRecipientCapabilitiesStripeBalanceStripeTransfers To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. """ + class UpdateParamsConfigurationStorer(TypedDict): + capabilities: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilities" + ] + """ + Capabilities to request on the Storer Configuration. + """ + + class UpdateParamsConfigurationStorerCapabilities(TypedDict): + financial_addresses: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesFinancialAddresses" + ] + """ + Can provision a financial address to credit/debit a FinancialAccount. + """ + holds_currencies: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesHoldsCurrencies" + ] + """ + Can hold storage-type funds on Stripe. + """ + inbound_transfers: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesInboundTransfers" + ] + """ + Can pull funds from an external source, owned by yourself, to a FinancialAccount. + """ + outbound_payments: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesOutboundPayments" + ] + """ + Can send funds from a FinancialAccount to a destination owned by someone else. + """ + outbound_transfers: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesOutboundTransfers" + ] + """ + Can send funds from a FinancialAccount to a destination owned by yourself. + """ + + class UpdateParamsConfigurationStorerCapabilitiesFinancialAddresses( + TypedDict, + ): + bank_accounts: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesFinancialAddressesBankAccounts" + ] + """ + Can provision a bank-account-like financial address (VBAN) to credit/debit a FinancialAccount. + """ + + class UpdateParamsConfigurationStorerCapabilitiesFinancialAddressesBankAccounts( + TypedDict, + ): + requested: NotRequired[bool] + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class UpdateParamsConfigurationStorerCapabilitiesHoldsCurrencies( + TypedDict + ): + gbp: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesHoldsCurrenciesGbp" + ] + """ + Can hold storage-type funds on Stripe in GBP. + """ + + class UpdateParamsConfigurationStorerCapabilitiesHoldsCurrenciesGbp( + TypedDict, + ): + requested: NotRequired[bool] + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class UpdateParamsConfigurationStorerCapabilitiesInboundTransfers( + TypedDict, + ): + bank_accounts: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesInboundTransfersBankAccounts" + ] + """ + Can pull funds from an external bank account owned by yourself to a FinancialAccount. + """ + + class UpdateParamsConfigurationStorerCapabilitiesInboundTransfersBankAccounts( + TypedDict, + ): + requested: NotRequired[bool] + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class UpdateParamsConfigurationStorerCapabilitiesOutboundPayments( + TypedDict, + ): + bank_accounts: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesOutboundPaymentsBankAccounts" + ] + """ + Can send funds from a FinancialAccount to a bank account owned by someone else. + """ + cards: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesOutboundPaymentsCards" + ] + """ + Can send funds from a FinancialAccount to a debit card owned by someone else. + """ + financial_accounts: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesOutboundPaymentsFinancialAccounts" + ] + """ + Can send funds from a FinancialAccount to another FinancialAccount owned by someone else. + """ + + class UpdateParamsConfigurationStorerCapabilitiesOutboundPaymentsBankAccounts( + TypedDict, + ): + requested: NotRequired[bool] + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class UpdateParamsConfigurationStorerCapabilitiesOutboundPaymentsCards( + TypedDict, + ): + requested: NotRequired[bool] + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class UpdateParamsConfigurationStorerCapabilitiesOutboundPaymentsFinancialAccounts( + TypedDict, + ): + requested: NotRequired[bool] + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class UpdateParamsConfigurationStorerCapabilitiesOutboundTransfers( + TypedDict, + ): + bank_accounts: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesOutboundTransfersBankAccounts" + ] + """ + Can send funds from a FinancialAccount to a bank account owned by yourself. + """ + financial_accounts: NotRequired[ + "AccountService.UpdateParamsConfigurationStorerCapabilitiesOutboundTransfersFinancialAccounts" + ] + """ + Can send funds from a FinancialAccount to another FinancialAccount owned by yourself. + """ + + class UpdateParamsConfigurationStorerCapabilitiesOutboundTransfersBankAccounts( + TypedDict, + ): + requested: NotRequired[bool] + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + + class UpdateParamsConfigurationStorerCapabilitiesOutboundTransfersFinancialAccounts( + TypedDict, + ): + requested: NotRequired[bool] + """ + To request a new Capability for an account, pass true. There can be a delay before the requested Capability becomes active. + """ + class UpdateParamsDefaults(TypedDict): currency: NotRequired[ Literal[ diff --git a/stripe/v2/money_management/_financial_account.py b/stripe/v2/money_management/_financial_account.py index ed14d34e4..68b666b95 100644 --- a/stripe/v2/money_management/_financial_account.py +++ b/stripe/v2/money_management/_financial_account.py @@ -35,6 +35,25 @@ class Other(StripeObject): The type of the FinancialAccount, represented as a string. Upgrade your API version to see the type reflected in `financial_account.type`. """ + class StatusDetails(StripeObject): + class Closed(StripeObject): + class ForwardingSettings(StripeObject): + payment_method: Optional[str] + """ + The address to send forwarded payments to. + """ + payout_method: Optional[str] + """ + The address to send forwarded payouts to. + """ + + forwarding_settings: Optional[ForwardingSettings] + reason: Literal["account_closed", "closed_by_platform", "other"] + _inner_class_types = {"forwarding_settings": ForwardingSettings} + + closed: Optional[Closed] + _inner_class_types = {"closed": Closed} + class Storage(StripeObject): holds_currencies: List[ Literal[ @@ -512,6 +531,7 @@ class Storage(StripeObject): """ Closed Enum. An enum representing the status of the FinancialAccount. This indicates whether or not the FinancialAccount can be used for any money movement flows. """ + status_details: Optional[StatusDetails] storage: Optional[Storage] """ If this is a `storage` FinancialAccount, this hash includes details specific to `storage` FinancialAccounts. @@ -524,5 +544,6 @@ class Storage(StripeObject): _inner_class_types = { "balance": Balance, "other": Other, + "status_details": StatusDetails, "storage": Storage, } diff --git a/stripe/v2/money_management/_financial_account_service.py b/stripe/v2/money_management/_financial_account_service.py index 01175db66..c9757cff3 100644 --- a/stripe/v2/money_management/_financial_account_service.py +++ b/stripe/v2/money_management/_financial_account_service.py @@ -5,16 +5,241 @@ from stripe._util import sanitize_id from stripe.v2._list_object import ListObject from stripe.v2.money_management._financial_account import FinancialAccount -from typing import cast -from typing_extensions import NotRequired, TypedDict +from typing import Dict, List, cast +from typing_extensions import Literal, NotRequired, TypedDict class FinancialAccountService(StripeService): + class CloseParams(TypedDict): + forwarding_settings: NotRequired[ + "FinancialAccountService.CloseParamsForwardingSettings" + ] + """ + The addresses to forward any incoming transactions to. + """ + + class CloseParamsForwardingSettings(TypedDict): + payment_method: NotRequired[str] + """ + The address to send forwarded payments to. + """ + payout_method: NotRequired[str] + """ + The address to send forwarded payouts to. + """ + + class CreateParams(TypedDict): + metadata: NotRequired[Dict[str, str]] + """ + Metadata associated with the FinancialAccount. + """ + storage: NotRequired["FinancialAccountService.CreateParamsStorage"] + """ + Parameters specific to creating `storage` type FinancialAccounts. + """ + type: Literal["storage"] + """ + The type of FinancialAccount to create. + """ + + class CreateParamsStorage(TypedDict): + holds_currencies: List[ + Literal[ + "aed", + "afn", + "all", + "amd", + "ang", + "aoa", + "ars", + "aud", + "awg", + "azn", + "bam", + "bbd", + "bdt", + "bgn", + "bhd", + "bif", + "bmd", + "bnd", + "bob", + "bov", + "brl", + "bsd", + "btn", + "bwp", + "byn", + "byr", + "bzd", + "cad", + "cdf", + "che", + "chf", + "chw", + "clf", + "clp", + "cny", + "cop", + "cou", + "crc", + "cuc", + "cup", + "cve", + "czk", + "djf", + "dkk", + "dop", + "dzd", + "eek", + "egp", + "ern", + "etb", + "eur", + "fjd", + "fkp", + "gbp", + "gel", + "ghc", + "ghs", + "gip", + "gmd", + "gnf", + "gtq", + "gyd", + "hkd", + "hnl", + "hrk", + "htg", + "huf", + "idr", + "ils", + "inr", + "iqd", + "irr", + "isk", + "jmd", + "jod", + "jpy", + "kes", + "kgs", + "khr", + "kmf", + "kpw", + "krw", + "kwd", + "kyd", + "kzt", + "lak", + "lbp", + "lkr", + "lrd", + "lsl", + "ltl", + "lvl", + "lyd", + "mad", + "mdl", + "mga", + "mkd", + "mmk", + "mnt", + "mop", + "mro", + "mru", + "mur", + "mvr", + "mwk", + "mxn", + "mxv", + "myr", + "mzn", + "nad", + "ngn", + "nio", + "nok", + "npr", + "nzd", + "omr", + "pab", + "pen", + "pgk", + "php", + "pkr", + "pln", + "pyg", + "qar", + "ron", + "rsd", + "rub", + "rwf", + "sar", + "sbd", + "scr", + "sdg", + "sek", + "sgd", + "shp", + "sle", + "sll", + "sos", + "srd", + "ssp", + "std", + "stn", + "svc", + "syp", + "szl", + "thb", + "tjs", + "tmt", + "tnd", + "top", + "try", + "ttd", + "twd", + "tzs", + "uah", + "ugx", + "usd", + "usdb", + "usdc", + "usn", + "uyi", + "uyu", + "uzs", + "vef", + "ves", + "vnd", + "vuv", + "wst", + "xaf", + "xcd", + "xcg", + "xof", + "xpf", + "yer", + "zar", + "zmk", + "zmw", + "zwd", + "zwg", + "zwl", + ] + ] + """ + The currencies that this FinancialAccount can hold. + """ + class ListParams(TypedDict): limit: NotRequired[int] """ The page limit. """ + status: NotRequired[Literal["closed", "open", "pending"]] + """ + The status of the FinancialAccount to filter by. By default, closed FinancialAccounts are not returned. + """ class RetrieveParams(TypedDict): pass @@ -57,6 +282,44 @@ async def list_async( ), ) + def create( + self, + params: "FinancialAccountService.CreateParams", + options: RequestOptions = {}, + ) -> FinancialAccount: + """ + Creates a new FinancialAccount. + """ + return cast( + FinancialAccount, + self._request( + "post", + "/v2/money_management/financial_accounts", + base_address="api", + params=params, + options=options, + ), + ) + + async def create_async( + self, + params: "FinancialAccountService.CreateParams", + options: RequestOptions = {}, + ) -> FinancialAccount: + """ + Creates a new FinancialAccount. + """ + return cast( + FinancialAccount, + await self._request_async( + "post", + "/v2/money_management/financial_accounts", + base_address="api", + params=params, + options=options, + ), + ) + def retrieve( self, id: str, @@ -100,3 +363,47 @@ async def retrieve_async( options=options, ), ) + + def close( + self, + id: str, + params: "FinancialAccountService.CloseParams" = {}, + options: RequestOptions = {}, + ) -> FinancialAccount: + """ + Closes a FinancialAccount with or without forwarding settings. + """ + return cast( + FinancialAccount, + self._request( + "post", + "/v2/money_management/financial_accounts/{id}/close".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def close_async( + self, + id: str, + params: "FinancialAccountService.CloseParams" = {}, + options: RequestOptions = {}, + ) -> FinancialAccount: + """ + Closes a FinancialAccount with or without forwarding settings. + """ + return cast( + FinancialAccount, + await self._request_async( + "post", + "/v2/money_management/financial_accounts/{id}/close".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index 3dab67657..0f29cc9f8 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -33977,6 +33977,32 @@ def test_v2_money_management_financial_account_get_service( api_base="https://api.stripe.com", ) + def test_v2_money_management_financial_account_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/money_management/financial_accounts", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.money_management.financial_accounts.create( + { + "type": "storage", + } + ) + http_client_mock.assert_requested( + "post", + path="/v2/money_management/financial_accounts", + query_string="", + api_base="https://api.stripe.com", + post_data='{"type":"storage"}', + is_json=True, + ) + def test_v2_money_management_financial_account_get_2_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -33997,6 +34023,28 @@ def test_v2_money_management_financial_account_get_2_service( api_base="https://api.stripe.com", ) + def test_v2_money_management_financial_account_post_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/money_management/financial_accounts/id_123/close", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.money_management.financial_accounts.close("id_123") + http_client_mock.assert_requested( + "post", + path="/v2/money_management/financial_accounts/id_123/close", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", + is_json=True, + ) + def test_v2_money_management_financial_address_get_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -34930,13 +34978,13 @@ def test_temporary_session_expired_error_service( is_json=True, ) - def test_financial_account_not_open_error_service( + def test_non_zero_balance_error_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "post", - "/v2/money_management/financial_addresses", - rbody='{"error":{"type":"financial_account_not_open","code":"financial_account_not_in_open_status"}}', + "/v2/money_management/financial_accounts/id_123/close", + rbody='{"error":{"type":"non_zero_balance","code":"closing_financial_account_with_non_zero_balances"}}', rcode=400, ) client = StripeClient( @@ -34945,20 +34993,46 @@ def test_financial_account_not_open_error_service( ) try: - client.v2.money_management.financial_addresses.create( + client.v2.money_management.financial_accounts.close("id_123") + except _error.NonZeroBalanceError: + pass + http_client_mock.assert_requested( + "post", + path="/v2/money_management/financial_accounts/id_123/close", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", + is_json=True, + ) + + def test_already_exists_error_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/money_management/financial_accounts", + rbody='{"error":{"type":"already_exists","code":"already_exists"}}', + rcode=400, + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + try: + client.v2.money_management.financial_accounts.create( { - "currency": "stn", - "financial_account": "financial_account", + "type": "storage", } ) - except _error.FinancialAccountNotOpenError: + except _error.AlreadyExistsError: pass http_client_mock.assert_requested( "post", - path="/v2/money_management/financial_addresses", + path="/v2/money_management/financial_accounts", query_string="", api_base="https://api.stripe.com", - post_data='{"currency":"stn","financial_account":"financial_account"}', + post_data='{"type":"storage"}', is_json=True, ) @@ -34967,7 +35041,7 @@ def test_feature_not_enabled_error_service( ) -> None: http_client_mock.stub_request( "post", - "/v2/money_management/financial_addresses", + "/v2/money_management/financial_accounts", rbody='{"error":{"type":"feature_not_enabled","code":"storer_capability_missing"}}', rcode=400, ) @@ -34976,6 +35050,37 @@ def test_feature_not_enabled_error_service( http_client=http_client_mock.get_mock_http_client(), ) + try: + client.v2.money_management.financial_accounts.create( + { + "type": "storage", + } + ) + except _error.FeatureNotEnabledError: + pass + http_client_mock.assert_requested( + "post", + path="/v2/money_management/financial_accounts", + query_string="", + api_base="https://api.stripe.com", + post_data='{"type":"storage"}', + is_json=True, + ) + + def test_financial_account_not_open_error_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/money_management/financial_addresses", + rbody='{"error":{"type":"financial_account_not_open","code":"financial_account_not_in_open_status"}}', + rcode=400, + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + try: client.v2.money_management.financial_addresses.create( { @@ -34983,7 +35088,7 @@ def test_feature_not_enabled_error_service( "financial_account": "financial_account", } ) - except _error.FeatureNotEnabledError: + except _error.FinancialAccountNotOpenError: pass http_client_mock.assert_requested( "post",