Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions stripe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,15 @@ def __getattr__(name):
)
from stripe._error import (
AlreadyCanceledError as AlreadyCanceledError,
AlreadyExistsError as AlreadyExistsError,
BlockedByStripeError as BlockedByStripeError,
ControlledByDashboardError as ControlledByDashboardError,
FeatureNotEnabledError as FeatureNotEnabledError,
FinancialAccountNotOpenError as FinancialAccountNotOpenError,
InsufficientFundsError as InsufficientFundsError,
InvalidPaymentMethodError as InvalidPaymentMethodError,
InvalidPayoutMethodError as InvalidPayoutMethodError,
NonZeroBalanceError as NonZeroBalanceError,
NotCancelableError as NotCancelableError,
QuotaExceededError as QuotaExceededError,
RecipientNotNotifiableError as RecipientNotNotifiableError,
Expand Down
8 changes: 6 additions & 2 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
10 changes: 9 additions & 1 deletion stripe/_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,22 @@ class TemporarySessionExpiredError(StripeError):
pass


class FinancialAccountNotOpenError(StripeError):
class NonZeroBalanceError(StripeError):
pass


class AlreadyExistsError(StripeError):
pass


class FeatureNotEnabledError(StripeError):
pass


class FinancialAccountNotOpenError(StripeError):
pass


class BlockedByStripeError(StripeError):
pass

Expand Down
6 changes: 6 additions & 0 deletions stripe/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
8 changes: 8 additions & 0 deletions stripe/events/_event_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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},
),
)
Original file line number Diff line number Diff line change
@@ -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},
),
)
Loading