Skip to content
Open
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: 1 addition & 1 deletion CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
499f00588b1b41670a44a1e00598db81222ce169
61e410d24d6de541c86c48b265b7647c164457ee
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2149
v2151
2 changes: 2 additions & 0 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ def specific_v2_api_error(self, rbody, rcode, resp, rheaders, error_data):
return error.NotCancelableError(**error_args)
elif type == "quota_exceeded":
return error.QuotaExceededError(**error_args)
elif type == "rate_limit":
return error.RateLimitError(**error_args)
elif type == "recipient_not_notifiable":
return error.RecipientNotNotifiableError(**error_args)
elif type == "temporary_session_expired":
Expand Down
16 changes: 16 additions & 0 deletions stripe/_event_notification_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
from stripe.events._v2_core_account_including_defaults_updated_event import (
V2CoreAccountIncludingDefaultsUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_future_requirements_updated_event import (
V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_identity_updated_event import (
V2CoreAccountIncludingIdentityUpdatedEventNotification,
)
Expand Down Expand Up @@ -449,6 +452,19 @@ def on_v2_core_account_including_defaults_updated(
)
return func

def on_v2_core_account_including_future_requirements_updated(
self,
func: "Callable[[V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification, StripeClient], None]",
):
"""
Registers a callback for the `V2CoreAccountIncludingFutureRequirementsUpdatedEvent` (`v2.core.account[future_requirements].updated`) event notification.
"""
self._register(
"v2.core.account[future_requirements].updated",
func,
)
return func

def on_v2_core_account_including_identity_updated(
self,
func: "Callable[[V2CoreAccountIncludingIdentityUpdatedEventNotification, StripeClient], None]",
Expand Down
12 changes: 12 additions & 0 deletions stripe/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
V2CoreAccountIncludingDefaultsUpdatedEvent as V2CoreAccountIncludingDefaultsUpdatedEvent,
V2CoreAccountIncludingDefaultsUpdatedEventNotification as V2CoreAccountIncludingDefaultsUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_future_requirements_updated_event import (
V2CoreAccountIncludingFutureRequirementsUpdatedEvent as V2CoreAccountIncludingFutureRequirementsUpdatedEvent,
V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification as V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_identity_updated_event import (
V2CoreAccountIncludingIdentityUpdatedEvent as V2CoreAccountIncludingIdentityUpdatedEvent,
V2CoreAccountIncludingIdentityUpdatedEventNotification as V2CoreAccountIncludingIdentityUpdatedEventNotification,
Expand Down Expand Up @@ -353,6 +357,14 @@
"stripe.events._v2_core_account_including_defaults_updated_event",
False,
),
"V2CoreAccountIncludingFutureRequirementsUpdatedEvent": (
"stripe.events._v2_core_account_including_future_requirements_updated_event",
False,
),
"V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification": (
"stripe.events._v2_core_account_including_future_requirements_updated_event",
False,
),
"V2CoreAccountIncludingIdentityUpdatedEvent": (
"stripe.events._v2_core_account_including_identity_updated_event",
False,
Expand Down
12 changes: 12 additions & 0 deletions stripe/events/_event_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
from stripe.events._v2_core_account_including_defaults_updated_event import (
V2CoreAccountIncludingDefaultsUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_future_requirements_updated_event import (
V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_identity_updated_event import (
V2CoreAccountIncludingIdentityUpdatedEventNotification,
)
Expand Down Expand Up @@ -236,6 +239,10 @@
"stripe.events._v2_core_account_including_defaults_updated_event",
"V2CoreAccountIncludingDefaultsUpdatedEvent",
),
"v2.core.account[future_requirements].updated": (
"stripe.events._v2_core_account_including_future_requirements_updated_event",
"V2CoreAccountIncludingFutureRequirementsUpdatedEvent",
),
"v2.core.account[identity].updated": (
"stripe.events._v2_core_account_including_identity_updated_event",
"V2CoreAccountIncludingIdentityUpdatedEvent",
Expand Down Expand Up @@ -483,6 +490,10 @@ def get_v2_event_class(type_: str):
"stripe.events._v2_core_account_including_defaults_updated_event",
"V2CoreAccountIncludingDefaultsUpdatedEventNotification",
),
"v2.core.account[future_requirements].updated": (
"stripe.events._v2_core_account_including_future_requirements_updated_event",
"V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification",
),
"v2.core.account[identity].updated": (
"stripe.events._v2_core_account_including_identity_updated_event",
"V2CoreAccountIncludingIdentityUpdatedEventNotification",
Expand Down Expand Up @@ -691,6 +702,7 @@ def get_v2_event_notification_class(type_: str):
"V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventNotification",
"V2CoreAccountIncludingConfigurationStorerUpdatedEventNotification",
"V2CoreAccountIncludingDefaultsUpdatedEventNotification",
"V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification",
"V2CoreAccountIncludingIdentityUpdatedEventNotification",
"V2CoreAccountIncludingRequirementsUpdatedEventNotification",
"V2CoreAccountLinkReturnedEventNotification",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# -*- 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.v2.core._account import Account


class V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification(
EventNotification,
):
LOOKUP_TYPE = "v2.core.account[future_requirements].updated"
type: Literal["v2.core.account[future_requirements].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,
) -> "V2CoreAccountIncludingFutureRequirementsUpdatedEvent":
return cast(
"V2CoreAccountIncludingFutureRequirementsUpdatedEvent",
super().fetch_event(),
)

def fetch_related_object(self) -> "Account":
response = self._client.raw_request(
"get",
self.related_object.url,
stripe_context=self.context,
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,
) -> "V2CoreAccountIncludingFutureRequirementsUpdatedEvent":
return cast(
"V2CoreAccountIncludingFutureRequirementsUpdatedEvent",
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,
usage=["fetch_related_object"],
)
return cast(
"Account",
self._client.deserialize(
response,
api_mode=get_api_mode(self.related_object.url),
),
)


class V2CoreAccountIncludingFutureRequirementsUpdatedEvent(Event):
LOOKUP_TYPE = "v2.core.account[future_requirements].updated"
type: Literal["v2.core.account[future_requirements].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},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class UsBankAccountUpdateParams(TypedDict):
fedwire_routing_number: NotRequired[str]
"""
The bank account's fedwire routing number can be provided for update it was were empty previously.
The bank account's Fedwire routing number can be provided for update if it was empty previously.
"""
routing_number: NotRequired[str]
"""
Expand Down
19 changes: 18 additions & 1 deletion stripe/v2/core/vault/_gb_bank_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ class GbBankAccount(StripeObject):
"v2.core.vault.gb_bank_account"
)

class AlternativeReference(StripeObject):
id: str
"""
The ID of the alternative resource being referenced.
"""
type: Literal["external_account", "payment_method"]
"""
The type of the alternative reference (e.g., external_account for V1 external accounts).
"""

class ConfirmationOfPayee(StripeObject):
class Result(StripeObject):
class Matched(StripeObject):
Expand Down Expand Up @@ -71,6 +81,10 @@ class Provided(StripeObject):
"""
_inner_class_types = {"result": Result}

alternative_reference: Optional[AlternativeReference]
"""
The alternative reference for this payout method, if it's a projected payout method.
"""
archived: bool
"""
Whether this bank account object was archived. Bank account objects can be archived through
Expand Down Expand Up @@ -114,4 +128,7 @@ class Provided(StripeObject):
"""
The Sort Code of the bank account.
"""
_inner_class_types = {"confirmation_of_payee": ConfirmationOfPayee}
_inner_class_types = {
"alternative_reference": AlternativeReference,
"confirmation_of_payee": ConfirmationOfPayee,
}
19 changes: 18 additions & 1 deletion stripe/v2/core/vault/_us_bank_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ class UsBankAccount(StripeObject):
"v2.core.vault.us_bank_account"
)

class AlternativeReference(StripeObject):
id: str
"""
The ID of the alternative resource being referenced.
"""
type: Literal["external_account", "payment_method"]
"""
The type of the alternative reference (e.g., external_account for V1 external accounts).
"""

class Verification(StripeObject):
class MicrodepositVerificationDetails(StripeObject):
expires: str
Expand Down Expand Up @@ -48,6 +58,10 @@ class MicrodepositVerificationDetails(StripeObject):
"microdeposit_verification_details": MicrodepositVerificationDetails,
}

alternative_reference: Optional[AlternativeReference]
"""
The alternative reference for this payout method, if it's a projected payout method.
"""
archived: bool
"""
Whether this USBankAccount object was archived.
Expand Down Expand Up @@ -96,4 +110,7 @@ class MicrodepositVerificationDetails(StripeObject):
"""
The bank account verification details.
"""
_inner_class_types = {"verification": Verification}
_inner_class_types = {
"alternative_reference": AlternativeReference,
"verification": Verification,
}
41 changes: 41 additions & 0 deletions stripe/v2/money_management/_financial_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,44 @@ class SepaBankAccount(StripeObject):
"""

class UsBankAccount(StripeObject):
class AccountHolderAddress(StripeObject):
city: str
"""
The city of the address.
"""
country: str
"""
The country of the address.
"""
line1: str
"""
The first line of the address.
"""
line2: str
"""
The second line of the address.
"""
postal_code: str
"""
The postal / zip code of the address.
"""
state: str
"""
The state of the address.
"""
town: str
"""
The town of the address.
"""

account_holder_address: Optional[AccountHolderAddress]
"""
The address of the account holder.
"""
account_holder_name: Optional[str]
"""
The name of the account holder.
"""
account_number: Optional[str]
"""
The account number of the US Bank Account.
Expand All @@ -83,6 +121,9 @@ class UsBankAccount(StripeObject):
"""
The swift code of the bank or financial institution.
"""
_inner_class_types = {
"account_holder_address": AccountHolderAddress,
}

gb_bank_account: Optional[GbBankAccount]
"""
Expand Down
Loading