diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index fc0689d97..c7a4fc4f7 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -5abe0e44caedb3474ee672265284096ec89e0fa3 +4b8685a69ee5061fca67cc7e3fd69c8e6890b24e \ No newline at end of file diff --git a/stripe/events/__init__.py b/stripe/events/__init__.py index d4476e562..ef5969efd 100644 --- a/stripe/events/__init__.py +++ b/stripe/events/__init__.py @@ -221,6 +221,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, @@ -1045,6 +1049,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, diff --git a/stripe/events/_event_classes.py b/stripe/events/_event_classes.py index 08f535ac9..b7e6fa233 100644 --- a/stripe/events/_event_classes.py +++ b/stripe/events/_event_classes.py @@ -163,6 +163,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, ) @@ -677,6 +680,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", @@ -1304,6 +1311,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", @@ -1775,6 +1786,7 @@ def get_v2_event_notification_class(type_: str): "V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventNotification", "V2CoreAccountIncludingConfigurationStorerUpdatedEventNotification", "V2CoreAccountIncludingDefaultsUpdatedEventNotification", + "V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification", "V2CoreAccountIncludingIdentityUpdatedEventNotification", "V2CoreAccountIncludingRequirementsUpdatedEventNotification", "V2CoreAccountLinkReturnedEventNotification", diff --git a/stripe/events/_v2_core_account_including_future_requirements_updated_event.py b/stripe/events/_v2_core_account_including_future_requirements_updated_event.py new file mode 100644 index 000000000..0e471082b --- /dev/null +++ b/stripe/events/_v2_core_account_including_future_requirements_updated_event.py @@ -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}, + ), + ) diff --git a/stripe/params/v2/money_management/__init__.py b/stripe/params/v2/money_management/__init__.py index 4a493c619..5f1a99f3f 100644 --- a/stripe/params/v2/money_management/__init__.py +++ b/stripe/params/v2/money_management/__init__.py @@ -69,6 +69,7 @@ OutboundPaymentCreateParams as OutboundPaymentCreateParams, OutboundPaymentCreateParamsAmount as OutboundPaymentCreateParamsAmount, OutboundPaymentCreateParamsDeliveryOptions as OutboundPaymentCreateParamsDeliveryOptions, + OutboundPaymentCreateParamsDeliveryOptionsPaperCheck as OutboundPaymentCreateParamsDeliveryOptionsPaperCheck, OutboundPaymentCreateParamsFrom as OutboundPaymentCreateParamsFrom, OutboundPaymentCreateParamsRecipientNotification as OutboundPaymentCreateParamsRecipientNotification, OutboundPaymentCreateParamsTo as OutboundPaymentCreateParamsTo, @@ -299,6 +300,10 @@ "stripe.params.v2.money_management._outbound_payment_create_params", False, ), + "OutboundPaymentCreateParamsDeliveryOptionsPaperCheck": ( + "stripe.params.v2.money_management._outbound_payment_create_params", + False, + ), "OutboundPaymentCreateParamsFrom": ( "stripe.params.v2.money_management._outbound_payment_create_params", False, diff --git a/stripe/params/v2/money_management/_outbound_payment_create_params.py b/stripe/params/v2/money_management/_outbound_payment_create_params.py index 8e962c435..638920632 100644 --- a/stripe/params/v2/money_management/_outbound_payment_create_params.py +++ b/stripe/params/v2/money_management/_outbound_payment_create_params.py @@ -58,13 +58,34 @@ class OutboundPaymentCreateParamsAmount(TypedDict): class OutboundPaymentCreateParamsDeliveryOptions(TypedDict): + speed: NotRequired[Literal["instant", "next_business_day", "standard"]] + """ + Open Enum. Speed of the payout. + """ bank_account: NotRequired[Literal["automatic", "local", "wire"]] """ Open Enum. Method for bank account. """ - speed: NotRequired[Literal["instant", "next_business_day", "standard"]] + paper_check: NotRequired[ + "OutboundPaymentCreateParamsDeliveryOptionsPaperCheck" + ] """ - Open Enum. Speed of the payout. + Delivery options for paper check. + """ + + +class OutboundPaymentCreateParamsDeliveryOptionsPaperCheck(TypedDict): + memo: NotRequired[str] + """ + Memo printed on the memo field of the check. + """ + shipping_speed: NotRequired[Literal["priority", "standard"]] + """ + Open Enum. Shipping speed of the paper check. Defaults to standard. + """ + signature: str + """ + Signature for the paper check. """ diff --git a/stripe/params/v2/money_management/_outbound_payment_quote_create_params.py b/stripe/params/v2/money_management/_outbound_payment_quote_create_params.py index cf1fc4115..84a6f1c0a 100644 --- a/stripe/params/v2/money_management/_outbound_payment_quote_create_params.py +++ b/stripe/params/v2/money_management/_outbound_payment_quote_create_params.py @@ -37,14 +37,14 @@ class OutboundPaymentQuoteCreateParamsAmount(TypedDict): class OutboundPaymentQuoteCreateParamsDeliveryOptions(TypedDict): - bank_account: NotRequired[Literal["automatic", "local", "wire"]] - """ - Open Enum. Method for bank account. - """ speed: NotRequired[Literal["instant", "next_business_day", "standard"]] """ Open Enum. Speed of the payout. """ + bank_account: NotRequired[Literal["automatic", "local", "wire"]] + """ + Open Enum. Method for bank account. + """ class OutboundPaymentQuoteCreateParamsFrom(TypedDict): diff --git a/stripe/v2/iam/_api_key_service.py b/stripe/v2/iam/_api_key_service.py index 1969eb46c..02f1c4729 100644 --- a/stripe/v2/iam/_api_key_service.py +++ b/stripe/v2/iam/_api_key_service.py @@ -64,7 +64,7 @@ def create( options: Optional["RequestOptions"] = None, ) -> "ApiKey": """ - Create an API key. + Create an API key. To create a secret key in livemode, a public key for encryption must be provided. """ return cast( "ApiKey", @@ -83,7 +83,7 @@ async def create_async( options: Optional["RequestOptions"] = None, ) -> "ApiKey": """ - Create an API key. + Create an API key. To create a secret key in livemode, a public key for encryption must be provided. """ return cast( "ApiKey", @@ -103,7 +103,7 @@ def retrieve( options: Optional["RequestOptions"] = None, ) -> "ApiKey": """ - Retrieve an API key. + Retrieve an API key. For livemode secret keys, secret tokens are only returned on creation, and never returned here. """ return cast( "ApiKey", @@ -123,7 +123,7 @@ async def retrieve_async( options: Optional["RequestOptions"] = None, ) -> "ApiKey": """ - Retrieve an API key. + Retrieve an API key. For livemode secret keys, secret tokens are only returned on creation, and never returned here. """ return cast( "ApiKey", @@ -143,7 +143,7 @@ def update( options: Optional["RequestOptions"] = None, ) -> "ApiKey": """ - Update an API key. + Update an API key. Only parameters that are specified in the request will be updated. """ return cast( "ApiKey", @@ -163,7 +163,7 @@ async def update_async( options: Optional["RequestOptions"] = None, ) -> "ApiKey": """ - Update an API key. + Update an API key. Only parameters that are specified in the request will be updated. """ return cast( "ApiKey", @@ -183,7 +183,7 @@ def expire( options: Optional["RequestOptions"] = None, ) -> "ApiKey": """ - Expire an API key. + Expire an API key. The specified key becomes invalid immediately. """ return cast( "ApiKey", @@ -203,7 +203,7 @@ async def expire_async( options: Optional["RequestOptions"] = None, ) -> "ApiKey": """ - Expire an API key. + Expire an API key. The specified key becomes invalid immediately. """ return cast( "ApiKey", @@ -223,7 +223,7 @@ def rotate( options: Optional["RequestOptions"] = None, ) -> "ApiKey": """ - Rotate an API key. + Rotate an API key. A new key with the same properties is created and returned. The existing key is expired immediately, unless an expiry time is specified. """ return cast( "ApiKey", @@ -243,7 +243,7 @@ async def rotate_async( options: Optional["RequestOptions"] = None, ) -> "ApiKey": """ - Rotate an API key. + Rotate an API key. A new key with the same properties is created and returned. The existing key is expired immediately, unless an expiry time is specified. """ return cast( "ApiKey", diff --git a/stripe/v2/money_management/_outbound_payment.py b/stripe/v2/money_management/_outbound_payment.py index f9aebf1ea..8dc110909 100644 --- a/stripe/v2/money_management/_outbound_payment.py +++ b/stripe/v2/money_management/_outbound_payment.py @@ -25,14 +25,33 @@ class Amount(StripeObject): """ class DeliveryOptions(StripeObject): + class PaperCheck(StripeObject): + memo: Optional[str] + """ + Memo printed on the memo field of the check. + """ + shipping_speed: Literal["priority", "standard"] + """ + Open Enum. Shipping speed of the paper check. + """ + signature: str + """ + Signature for the paper check. + """ + bank_account: Optional[Literal["automatic", "local", "wire"]] """ Open Enum. Method for bank account. """ + paper_check: Optional[PaperCheck] + """ + Delivery options for paper check. + """ speed: Optional[Literal["instant", "next_business_day", "standard"]] """ Open Enum. Speed of the payout. """ + _inner_class_types = {"paper_check": PaperCheck} class From(StripeObject): class Debited(StripeObject): @@ -164,6 +183,74 @@ class TraceId(StripeObject): The trace ID value if `trace_id.status` is `supported`, otherwise empty. """ + class TrackingDetails(StripeObject): + class PaperCheck(StripeObject): + class MailingAddress(StripeObject): + city: Optional[str] + """ + City, district, suburb, town, or village. + """ + country: Optional[str] + """ + Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + """ + line1: Optional[str] + """ + Address line 1 (e.g., street, PO Box, or company name). + """ + line2: Optional[str] + """ + Address line 2 (e.g., apartment, suite, unit, or building). + """ + postal_code: Optional[str] + """ + ZIP or postal code. + """ + state: Optional[str] + """ + State, county, province, or region. + """ + town: Optional[str] + """ + Town or district. + """ + + carrier: Literal["fedex", "usps"] + """ + Open Enum. Carrier of the paper check. + """ + check_number: str + """ + Check number. + """ + current_postal_code: str + """ + Postal code of the latest tracking update. + """ + mailing_address: MailingAddress + """ + Mailing address of the paper check. + """ + tracking_number: str + """ + Tracking number for the check. + """ + tracking_status: Literal["delivered", "in_transit", "mailed"] + """ + Open Enum. Tracking status of the paper check. + """ + updated_at: str + """ + When the tracking details were last updated. + """ + _inner_class_types = {"mailing_address": MailingAddress} + + paper_check: Optional[PaperCheck] + """ + Paper check tracking details. + """ + _inner_class_types = {"paper_check": PaperCheck} + amount: Amount """ The "presentment amount" for the OutboundPayment. @@ -253,6 +340,10 @@ class TraceId(StripeObject): """ A unique identifier that can be used to track this OutboundPayment with recipient bank. Banks might call this a “reference number” or something similar. """ + tracking_details: Optional[TrackingDetails] + """ + Information to track this OutboundPayment with the recipient bank. + """ _inner_class_types = { "amount": Amount, "delivery_options": DeliveryOptions, @@ -262,5 +353,6 @@ class TraceId(StripeObject): "status_transitions": StatusTransitions, "to": To, "trace_id": TraceId, + "tracking_details": TrackingDetails, } _field_remappings = {"from_": "from"} diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index 5bc4905c3..366f2a2c9 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -48623,9 +48623,9 @@ def test_rate_limit_error_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( - "post", - "/v2/reporting/report_runs", - rbody='{"error":{"type":"rate_limit","code":"report_run_rate_limit_exceeded"}}', + "get", + "/v2/core/accounts", + rbody='{"error":{"type":"rate_limit","code":"account_rate_limit_exceeded"}}', rcode=400, ) client = StripeClient( @@ -48634,31 +48634,14 @@ def test_rate_limit_error_service( ) try: - client.v2.reporting.report_runs.create( - { - "report": "report", - "report_parameters": { - "int_key": 123, - "string_key": "value", - "boolean_key": True, - "object_key": { - "object_int_key": 123, - "object_string_key": "value", - "object_boolean_key": True, - }, - "array_key": [1, 2, 3], - }, - } - ) + client.v2.core.accounts.list() except _error.RateLimitError: pass http_client_mock.assert_requested( - "post", - path="/v2/reporting/report_runs", + "get", + path="/v2/core/accounts", query_string="", api_base="https://api.stripe.com", - post_data='{"report":"report","report_parameters":{"int_key":123,"string_key":"value","boolean_key":true,"object_key":{"object_int_key":123,"object_string_key":"value","object_boolean_key":true},"array_key":[1,2,3]}}', - is_json=True, ) def test_recipient_not_notifiable_error_service(