From 13b58a71b45877d8fd97e7fc6a58a6186da8bc23 Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 30 Jul 2025 09:21:42 -0700 Subject: [PATCH 01/31] Update generated code for v1868 and 2025-07-30.basil (#1541) Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- API_VERSION | 2 +- OPENAPI_VERSION | 2 +- stripe/_account.py | 20 +- stripe/_account_link.py | 4 +- stripe/_account_link_service.py | 4 +- stripe/_account_service.py | 8 +- stripe/_account_session.py | 56 ++ stripe/_account_session_service.py | 32 + stripe/_api_version.py | 2 +- stripe/_capability.py | 2 +- stripe/_charge.py | 14 +- stripe/_confirmation_token.py | 6 +- stripe/_customer.py | 2 +- stripe/_dispute.py | 2 +- stripe/_event.py | 40 +- stripe/_invoice.py | 38 +- stripe/_invoice_item.py | 2 +- stripe/_invoice_item_service.py | 2 +- stripe/_invoice_service.py | 38 +- stripe/_payment_intent.py | 48 +- stripe/_payment_intent_service.py | 16 +- stripe/_payment_link.py | 90 ++- stripe/_payment_link_service.py | 88 ++- stripe/_payment_method.py | 10 +- stripe/_payment_method_service.py | 4 +- stripe/_quote.py | 3 + stripe/_quote_service.py | 3 + stripe/_refund.py | 2 +- stripe/_review.py | 4 +- stripe/_setup_attempt.py | 2 +- stripe/_subscription.py | 13 +- stripe/_subscription_item.py | 4 +- stripe/_subscription_item_service.py | 4 +- stripe/_subscription_schedule.py | 35 +- stripe/_subscription_schedule_service.py | 39 +- stripe/_subscription_service.py | 13 +- stripe/_webhook_endpoint.py | 1 + stripe/_webhook_endpoint_service.py | 1 + stripe/billing/_credit_grant.py | 2 +- stripe/billing/_credit_grant_service.py | 2 +- stripe/billing_portal/_configuration.py | 62 ++ .../billing_portal/_configuration_service.py | 44 ++ stripe/checkout/_session.py | 42 +- stripe/checkout/_session_service.py | 22 + stripe/identity/_verification_session.py | 4 +- stripe/radar/_value_list.py | 4 +- stripe/radar/_value_list_service.py | 2 +- stripe/reporting/_report_run.py | 1 + stripe/reporting/_report_run_service.py | 1 + stripe/tax/_registration.py | 700 ++++++++++++++++-- stripe/tax/_registration_service.py | 528 ++++++++++++- stripe/terminal/_configuration.py | 208 ++++++ stripe/terminal/_configuration_service.py | 144 ++++ 53 files changed, 2223 insertions(+), 199 deletions(-) diff --git a/API_VERSION b/API_VERSION index 1116f63c2..40f35337b 100644 --- a/API_VERSION +++ b/API_VERSION @@ -1 +1 @@ -2025-06-30.basil \ No newline at end of file +2025-07-30.basil \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index d8931ef8a..7b0334ddc 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1819 \ No newline at end of file +v1868 \ No newline at end of file diff --git a/stripe/_account.py b/stripe/_account.py index 0ef74b02c..3f89f06bd 100644 --- a/stripe/_account.py +++ b/stripe/_account.py @@ -132,7 +132,7 @@ class SupportAddress(StripeObject): ] ] """ - Whether the business is a minority-owned, women-owned, and/or LGBTQI+-owned business. + Whether the business is a minority-owned, women-owned, and/or LGBTQI+ -owned business. """ monthly_estimated_revenue: Optional[MonthlyEstimatedRevenue] name: Optional[str] @@ -1561,7 +1561,7 @@ class CreateParamsBusinessProfile(TypedDict): ] ] """ - Whether the business is a minority-owned, women-owned, and/or LGBTQI+-owned business. + Whether the business is a minority-owned, women-owned, and/or LGBTQI+ -owned business. """ monthly_estimated_revenue: NotRequired[ "Account.CreateParamsBusinessProfileMonthlyEstimatedRevenue" @@ -4628,7 +4628,7 @@ def _cls_delete( Test-mode accounts can be deleted at any time. - Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. + Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. """ @@ -4652,7 +4652,7 @@ def delete( Test-mode accounts can be deleted at any time. - Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. + Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. """ @@ -4665,7 +4665,7 @@ def delete(self, **params: Unpack["Account.DeleteParams"]) -> "Account": Test-mode accounts can be deleted at any time. - Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. + Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. """ @@ -4680,7 +4680,7 @@ def delete( # pyright: ignore[reportGeneralTypeIssues] Test-mode accounts can be deleted at any time. - Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. + Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. """ @@ -4699,7 +4699,7 @@ async def _cls_delete_async( Test-mode accounts can be deleted at any time. - Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. + Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. """ @@ -4723,7 +4723,7 @@ async def delete_async( Test-mode accounts can be deleted at any time. - Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. + Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. """ @@ -4738,7 +4738,7 @@ async def delete_async( Test-mode accounts can be deleted at any time. - Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. + Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. """ @@ -4753,7 +4753,7 @@ async def delete_async( # pyright: ignore[reportGeneralTypeIssues] Test-mode accounts can be deleted at any time. - Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. + Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. """ diff --git a/stripe/_account_link.py b/stripe/_account_link.py index dce24a0c6..8af6f1bb7 100644 --- a/stripe/_account_link.py +++ b/stripe/_account_link.py @@ -45,7 +45,9 @@ class CreateParams(RequestOptions): """ type: Literal["account_onboarding", "account_update"] """ - The type of account link the user is requesting. Possible values are `account_onboarding` or `account_update`. + The type of account link the user is requesting. + + You can create Account Links of type `account_update` only for connected accounts where your platform is responsible for collecting requirements, including Custom accounts. You can't create them for accounts that have access to a Stripe-hosted Dashboard. If you use [Connect embedded components](https://docs.stripe.com/connect/get-started-connect-embedded-components), you can include components that allow your connected accounts to update their own information. For an account without Stripe-hosted Dashboard access where Stripe is liable for negative balances, you must use embedded components. """ class CreateParamsCollectionOptions(TypedDict): diff --git a/stripe/_account_link_service.py b/stripe/_account_link_service.py index 793610084..44106ab2d 100644 --- a/stripe/_account_link_service.py +++ b/stripe/_account_link_service.py @@ -37,7 +37,9 @@ class CreateParams(TypedDict): """ type: Literal["account_onboarding", "account_update"] """ - The type of account link the user is requesting. Possible values are `account_onboarding` or `account_update`. + The type of account link the user is requesting. + + You can create Account Links of type `account_update` only for connected accounts where your platform is responsible for collecting requirements, including Custom accounts. You can't create them for accounts that have access to a Stripe-hosted Dashboard. If you use [Connect embedded components](https://docs.stripe.com/connect/get-started-connect-embedded-components), you can include components that allow your connected accounts to update their own information. For an account without Stripe-hosted Dashboard access where Stripe is liable for negative balances, you must use embedded components. """ class CreateParamsCollectionOptions(TypedDict): diff --git a/stripe/_account_service.py b/stripe/_account_service.py index 55c3b7daa..09d2c6f44 100644 --- a/stripe/_account_service.py +++ b/stripe/_account_service.py @@ -166,7 +166,7 @@ class CreateParamsBusinessProfile(TypedDict): ] ] """ - Whether the business is a minority-owned, women-owned, and/or LGBTQI+-owned business. + Whether the business is a minority-owned, women-owned, and/or LGBTQI+ -owned business. """ monthly_estimated_revenue: NotRequired[ "AccountService.CreateParamsBusinessProfileMonthlyEstimatedRevenue" @@ -2122,7 +2122,7 @@ class UpdateParamsBusinessProfile(TypedDict): ] ] """ - Whether the business is a minority-owned, women-owned, and/or LGBTQI+-owned business. + Whether the business is a minority-owned, women-owned, and/or LGBTQI+ -owned business. """ monthly_estimated_revenue: NotRequired[ "AccountService.UpdateParamsBusinessProfileMonthlyEstimatedRevenue" @@ -3856,7 +3856,7 @@ def delete( Test-mode accounts can be deleted at any time. - Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. + Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. """ @@ -3882,7 +3882,7 @@ async def delete_async( Test-mode accounts can be deleted at any time. - Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. + Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero. If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. """ diff --git a/stripe/_account_session.py b/stripe/_account_session.py index c542ddaa9..b4acb660f 100644 --- a/stripe/_account_session.py +++ b/stripe/_account_session.py @@ -164,6 +164,28 @@ class Features(StripeObject): features: Features _inner_class_types = {"features": Features} + class InstantPayoutsPromotion(StripeObject): + class Features(StripeObject): + disable_stripe_user_authentication: bool + """ + Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`. + """ + external_account_collection: bool + """ + Whether external account collection is enabled. This feature can only be `false` for accounts where you're responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`. + """ + instant_payouts: bool + """ + Whether to allow creation of instant payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`. + """ + + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: Features + _inner_class_types = {"features": Features} + class IssuingCard(StripeObject): class Features(StripeObject): card_management: bool @@ -382,6 +404,7 @@ class Features(StripeObject): documents: Documents financial_account: FinancialAccount financial_account_transactions: FinancialAccountTransactions + instant_payouts_promotion: InstantPayoutsPromotion issuing_card: IssuingCard issuing_cards_list: IssuingCardsList notification_banner: NotificationBanner @@ -400,6 +423,7 @@ class Features(StripeObject): "documents": Documents, "financial_account": FinancialAccount, "financial_account_transactions": FinancialAccountTransactions, + "instant_payouts_promotion": InstantPayoutsPromotion, "issuing_card": IssuingCard, "issuing_cards_list": IssuingCardsList, "notification_banner": NotificationBanner, @@ -467,6 +491,12 @@ class CreateParamsComponents(TypedDict): """ Configuration for the [financial account transactions](https://docs.stripe.com/connect/supported-embedded-components/financial-account-transactions/) embedded component. """ + instant_payouts_promotion: NotRequired[ + "AccountSession.CreateParamsComponentsInstantPayoutsPromotion" + ] + """ + Configuration for the [instant payouts promotion](https://docs.stripe.com/connect/supported-embedded-components/instant-payouts-promotion/) embedded component. + """ issuing_card: NotRequired[ "AccountSession.CreateParamsComponentsIssuingCard" ] @@ -697,6 +727,32 @@ class CreateParamsComponentsFinancialAccountTransactionsFeatures( Whether to allow card spend dispute management features. """ + class CreateParamsComponentsInstantPayoutsPromotion(TypedDict): + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: NotRequired[ + "AccountSession.CreateParamsComponentsInstantPayoutsPromotionFeatures" + ] + """ + The list of features enabled in the embedded component. + """ + + class CreateParamsComponentsInstantPayoutsPromotionFeatures(TypedDict): + disable_stripe_user_authentication: NotRequired[bool] + """ + Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`. + """ + external_account_collection: NotRequired[bool] + """ + Whether external account collection is enabled. This feature can only be `false` for accounts where you're responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`. + """ + instant_payouts: NotRequired[bool] + """ + Whether to allow creation of instant payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`. + """ + class CreateParamsComponentsIssuingCard(TypedDict): enabled: bool """ diff --git a/stripe/_account_session_service.py b/stripe/_account_session_service.py index 85d557c9b..9c519f844 100644 --- a/stripe/_account_session_service.py +++ b/stripe/_account_session_service.py @@ -65,6 +65,12 @@ class CreateParamsComponents(TypedDict): """ Configuration for the [financial account transactions](https://docs.stripe.com/connect/supported-embedded-components/financial-account-transactions/) embedded component. """ + instant_payouts_promotion: NotRequired[ + "AccountSessionService.CreateParamsComponentsInstantPayoutsPromotion" + ] + """ + Configuration for the [instant payouts promotion](https://docs.stripe.com/connect/supported-embedded-components/instant-payouts-promotion/) embedded component. + """ issuing_card: NotRequired[ "AccountSessionService.CreateParamsComponentsIssuingCard" ] @@ -299,6 +305,32 @@ class CreateParamsComponentsFinancialAccountTransactionsFeatures( Whether to allow card spend dispute management features. """ + class CreateParamsComponentsInstantPayoutsPromotion(TypedDict): + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: NotRequired[ + "AccountSessionService.CreateParamsComponentsInstantPayoutsPromotionFeatures" + ] + """ + The list of features enabled in the embedded component. + """ + + class CreateParamsComponentsInstantPayoutsPromotionFeatures(TypedDict): + disable_stripe_user_authentication: NotRequired[bool] + """ + Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`. + """ + external_account_collection: NotRequired[bool] + """ + Whether external account collection is enabled. This feature can only be `false` for accounts where you're responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`. + """ + instant_payouts: NotRequired[bool] + """ + Whether to allow creation of instant payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`. + """ + class CreateParamsComponentsIssuingCard(TypedDict): enabled: bool """ diff --git a/stripe/_api_version.py b/stripe/_api_version.py index 6f3730c3b..d40c6d5e5 100644 --- a/stripe/_api_version.py +++ b/stripe/_api_version.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec class _ApiVersion: - CURRENT = "2025-06-30.basil" + CURRENT = "2025-07-30.basil" CURRENT_MAJOR = "basil" diff --git a/stripe/_capability.py b/stripe/_capability.py index 77a887b45..98e0b5bc9 100644 --- a/stripe/_capability.py +++ b/stripe/_capability.py @@ -376,7 +376,7 @@ class Error(StripeObject): Time at which the capability was requested. Measured in seconds since the Unix epoch. """ requirements: Optional[Requirements] - status: Literal["active", "disabled", "inactive", "pending", "unrequested"] + status: Literal["active", "inactive", "pending", "unrequested"] """ The status of the capability. """ diff --git a/stripe/_charge.py b/stripe/_charge.py index ad26d58d9..93cd4f794 100644 --- a/stripe/_charge.py +++ b/stripe/_charge.py @@ -315,7 +315,7 @@ class Funding(StripeObject): class Card(StripeObject): brand: Optional[str] """ - Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ country: Optional[str] """ @@ -775,7 +775,7 @@ class ShippingAddress(StripeObject): """ brand: Optional[str] """ - Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ capture_before: Optional[int] """ @@ -942,7 +942,7 @@ class Wallet(StripeObject): """ brand: Optional[str] """ - Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ brand_product: Optional[str] """ @@ -1058,6 +1058,10 @@ class Cashapp(StripeObject): """ A public identifier for buyers using Cash App. """ + transaction_id: Optional[str] + """ + A unique and immutable identifier of payments assigned by Cash App + """ class Crypto(StripeObject): buyer_address: Optional[str] @@ -1673,7 +1677,7 @@ class Funding(StripeObject): class Card(StripeObject): brand: Optional[str] """ - Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ country: Optional[str] """ @@ -1997,7 +2001,7 @@ class Zip(StripeObject): class PresentmentDetails(StripeObject): presentment_amount: int """ - Amount intended to be collected by this payment, denominated in presentment_currency. + Amount intended to be collected by this payment, denominated in `presentment_currency`. """ presentment_currency: str """ diff --git a/stripe/_confirmation_token.py b/stripe/_confirmation_token.py index 82f2b890c..ff2e6ccce 100644 --- a/stripe/_confirmation_token.py +++ b/stripe/_confirmation_token.py @@ -316,7 +316,7 @@ class Wallet(StripeObject): """ brand: Optional[str] """ - Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ brand_product: Optional[str] """ @@ -661,7 +661,7 @@ class ShippingAddress(StripeObject): brand: str """ - Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ checks: Optional[Checks] """ @@ -768,7 +768,7 @@ class Wallet(StripeObject): brand: Optional[str] """ - Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ brand_product: Optional[str] """ diff --git a/stripe/_customer.py b/stripe/_customer.py index 3fc4cf423..0c59964b3 100644 --- a/stripe/_customer.py +++ b/stripe/_customer.py @@ -1414,7 +1414,7 @@ class SearchParams(RequestOptions): """ balance: Optional[int] """ - The current balance, if any, that's stored on the customer. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that's added to their next invoice. The balance only considers amounts that Stripe hasn't successfully applied to any invoice. It doesn't reflect unpaid invoices. This balance is only taken into account after invoices finalize. + The current balance, if any, that's stored on the customer in their default currency. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that's added to their next invoice. The balance only considers amounts that Stripe hasn't successfully applied to any invoice. It doesn't reflect unpaid invoices. This balance is only taken into account after invoices finalize. For multi-currency balances, see [invoice_credit_balance](https://stripe.com/docs/api/customers/object#customer_object-invoice_credit_balance). """ cash_balance: Optional["CashBalance"] """ diff --git a/stripe/_dispute.py b/stripe/_dispute.py index 2584022a1..8237ab6e0 100644 --- a/stripe/_dispute.py +++ b/stripe/_dispute.py @@ -366,7 +366,7 @@ class AmazonPay(StripeObject): class Card(StripeObject): brand: str """ - Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ case_type: Literal["chargeback", "compliance", "inquiry"] """ diff --git a/stripe/_event.py b/stripe/_event.py index cd4748f4e..c2b3273ae 100644 --- a/stripe/_event.py +++ b/stripe/_event.py @@ -10,35 +10,23 @@ class Event(ListableAPIResource["Event"]): """ - Events are our way of letting you know when something interesting happens in - your account. When an interesting event occurs, we create a new `Event` - object. For example, when a charge succeeds, we create a `charge.succeeded` - event, and when an invoice payment attempt fails, we create an - `invoice.payment_failed` event. Certain API requests might create multiple - events. For example, if you create a new subscription for a - customer, you receive both a `customer.subscription.created` event and a - `charge.succeeded` event. + Snapshot events allow you to track and react to activity in your Stripe integration. When + the state of another API resource changes, Stripe creates an `Event` object that contains + all the relevant information associated with that action, including the affected API + resource. For example, a successful payment triggers a `charge.succeeded` event, which + contains the `Charge` in the event's data property. Some actions trigger multiple events. + For example, if you create a new subscription for a customer, it triggers both a + `customer.subscription.created` event and a `charge.succeeded` event. - Events occur when the state of another API resource changes. The event's data - field embeds the resource's state at the time of the change. For - example, a `charge.succeeded` event contains a charge, and an - `invoice.payment_failed` event contains an invoice. + Configure an event destination in your account to listen for events that represent actions + your integration needs to respond to. Additionally, you can retrieve an individual event or + a list of events from the API. - As with other API resources, you can use endpoints to retrieve an - [individual event](https://stripe.com/docs/api#retrieve_event) or a [list of events](https://stripe.com/docs/api#list_events) - from the API. We also have a separate - [webhooks](http://en.wikipedia.org/wiki/Webhook) system for sending the - `Event` objects directly to an endpoint on your server. You can manage - webhooks in your - [account settings](https://dashboard.stripe.com/account/webhooks). Learn how - to [listen for events](https://docs.stripe.com/webhooks) - so that your integration can automatically trigger reactions. + [Connect](https://docs.stripe.com/connect) platforms can also receive event notifications + that occur in their connected accounts. These events include an account attribute that + identifies the relevant connected account. - When using [Connect](https://docs.stripe.com/connect), you can also receive event notifications - that occur in connected accounts. For these events, there's an - additional `account` attribute in the received `Event` object. - - We only guarantee access to events through the [Retrieve Event API](https://stripe.com/docs/api#retrieve_event) + You can access events through the [Retrieve Event API](https://docs.stripe.com/api/events#retrieve_event) for 30 days. """ diff --git a/stripe/_invoice.py b/stripe/_invoice.py index b4e9fa5e3..1e09248d3 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -1418,7 +1418,7 @@ class CreateParams(RequestOptions): """ auto_advance: NotRequired[bool] """ - Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action. + Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action. Defaults to false. """ automatic_tax: NotRequired["Invoice.CreateParamsAutomaticTax"] """ @@ -1426,7 +1426,7 @@ class CreateParams(RequestOptions): """ automatically_finalizes_at: NotRequired[int] """ - The time when this invoice should be scheduled to finalize. The invoice will be finalized at this time if it is still in draft state. + The time when this invoice should be scheduled to finalize (up to 5 years in the future). The invoice is finalized at this time if it's still in draft state. """ collection_method: NotRequired[ Literal["charge_automatically", "send_invoice"] @@ -1704,7 +1704,7 @@ class CreateParamsPaymentSettingsPaymentMethodOptionsCard(TypedDict): "Invoice.CreateParamsPaymentSettingsPaymentMethodOptionsCardInstallments" ] """ - Installment configuration for payments attempted on this invoice (Mexico Only). + Installment configuration for payments attempted on this invoice. For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). """ @@ -2521,6 +2521,9 @@ class CreatePreviewParamsScheduleDetails(TypedDict): class CreatePreviewParamsScheduleDetailsBillingMode(TypedDict): type: Literal["classic", "flexible"] + """ + Controls the calculation and orchestration of prorations and invoices for subscriptions. + """ class CreatePreviewParamsScheduleDetailsPhase(TypedDict): add_invoice_items: NotRequired[ @@ -2579,6 +2582,12 @@ class CreatePreviewParamsScheduleDetailsPhase(TypedDict): """ The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts. """ + duration: NotRequired[ + "Invoice.CreatePreviewParamsScheduleDetailsPhaseDuration" + ] + """ + The number of intervals the phase should last. If set, `end_date` must not be set. + """ end_date: NotRequired["int|Literal['now']"] """ The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set. @@ -2595,7 +2604,7 @@ class CreatePreviewParamsScheduleDetailsPhase(TypedDict): """ iterations: NotRequired[int] """ - Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. + Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. This parameter is deprecated and will be removed in a future version. Use `duration` instead. """ metadata: NotRequired[Dict[str, str]] """ @@ -2748,6 +2757,16 @@ class CreatePreviewParamsScheduleDetailsPhaseDiscount(TypedDict): ID of the promotion code to create a new discount for. """ + class CreatePreviewParamsScheduleDetailsPhaseDuration(TypedDict): + interval: Literal["day", "month", "week", "year"] + """ + Specifies phase duration. Either `day`, `week`, `month` or `year`. + """ + interval_count: NotRequired[int] + """ + The multiplier applied to the interval. + """ + class CreatePreviewParamsScheduleDetailsPhaseInvoiceSettings(TypedDict): account_tax_ids: NotRequired["Literal['']|List[str]"] """ @@ -2899,7 +2918,9 @@ class CreatePreviewParamsSubscriptionDetails(TypedDict): """ Controls how prorations and invoices for subscriptions are calculated and orchestrated. """ - cancel_at: NotRequired["Literal['']|int"] + cancel_at: NotRequired[ + "Literal['']|int|Literal['max_period_end', 'min_period_end']" + ] """ A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period. """ @@ -2946,6 +2967,9 @@ class CreatePreviewParamsSubscriptionDetails(TypedDict): class CreatePreviewParamsSubscriptionDetailsBillingMode(TypedDict): type: Literal["classic", "flexible"] + """ + Controls the calculation and orchestration of prorations and invoices for subscriptions. + """ class CreatePreviewParamsSubscriptionDetailsItem(TypedDict): billing_thresholds: NotRequired[ @@ -3196,7 +3220,7 @@ class ModifyParams(RequestOptions): """ automatically_finalizes_at: NotRequired[int] """ - The time when this invoice should be scheduled to finalize. The invoice will be finalized at this time if it is still in draft state. To turn off automatic finalization, set `auto_advance` to false. + The time when this invoice should be scheduled to finalize (up to 5 years in the future). The invoice is finalized at this time if it's still in draft state. To turn off automatic finalization, set `auto_advance` to false. """ collection_method: NotRequired[ Literal["charge_automatically", "send_invoice"] @@ -3448,7 +3472,7 @@ class ModifyParamsPaymentSettingsPaymentMethodOptionsCard(TypedDict): "Invoice.ModifyParamsPaymentSettingsPaymentMethodOptionsCardInstallments" ] """ - Installment configuration for payments attempted on this invoice (Mexico Only). + Installment configuration for payments attempted on this invoice. For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). """ diff --git a/stripe/_invoice_item.py b/stripe/_invoice_item.py index 2755a1cf7..1d927d3fe 100644 --- a/stripe/_invoice_item.py +++ b/stripe/_invoice_item.py @@ -131,7 +131,7 @@ class CreateParams(RequestOptions): """ invoice: NotRequired[str] """ - The ID of an existing invoice to add this invoice item to. When left blank, the invoice item will be added to the next upcoming scheduled invoice. This is useful when adding invoice items in response to an invoice.created webhook. You can only add invoice items to draft invoices and there is a maximum of 250 items per invoice. + The ID of an existing invoice to add this invoice item to. For subscription invoices, when left blank, the invoice item will be added to the next upcoming scheduled invoice. For standalone invoices, the invoice item won't be automatically added unless you pass `pending_invoice_item_behavior: 'include'` when creating the invoice. This is useful when adding invoice items in response to an invoice.created webhook. You can only add invoice items to draft invoices and there is a maximum of 250 items per invoice. """ metadata: NotRequired["Literal['']|Dict[str, str]"] """ diff --git a/stripe/_invoice_item_service.py b/stripe/_invoice_item_service.py index cfe596084..6469b3b8b 100644 --- a/stripe/_invoice_item_service.py +++ b/stripe/_invoice_item_service.py @@ -43,7 +43,7 @@ class CreateParams(TypedDict): """ invoice: NotRequired[str] """ - The ID of an existing invoice to add this invoice item to. When left blank, the invoice item will be added to the next upcoming scheduled invoice. This is useful when adding invoice items in response to an invoice.created webhook. You can only add invoice items to draft invoices and there is a maximum of 250 items per invoice. + The ID of an existing invoice to add this invoice item to. For subscription invoices, when left blank, the invoice item will be added to the next upcoming scheduled invoice. For standalone invoices, the invoice item won't be automatically added unless you pass `pending_invoice_item_behavior: 'include'` when creating the invoice. This is useful when adding invoice items in response to an invoice.created webhook. You can only add invoice items to draft invoices and there is a maximum of 250 items per invoice. """ metadata: NotRequired["Literal['']|Dict[str, str]"] """ diff --git a/stripe/_invoice_service.py b/stripe/_invoice_service.py index 3763484e5..9c842b140 100644 --- a/stripe/_invoice_service.py +++ b/stripe/_invoice_service.py @@ -284,7 +284,7 @@ class CreateParams(TypedDict): """ auto_advance: NotRequired[bool] """ - Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action. + Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action. Defaults to false. """ automatic_tax: NotRequired["InvoiceService.CreateParamsAutomaticTax"] """ @@ -292,7 +292,7 @@ class CreateParams(TypedDict): """ automatically_finalizes_at: NotRequired[int] """ - The time when this invoice should be scheduled to finalize. The invoice will be finalized at this time if it is still in draft state. + The time when this invoice should be scheduled to finalize (up to 5 years in the future). The invoice is finalized at this time if it's still in draft state. """ collection_method: NotRequired[ Literal["charge_automatically", "send_invoice"] @@ -576,7 +576,7 @@ class CreateParamsPaymentSettingsPaymentMethodOptionsCard(TypedDict): "InvoiceService.CreateParamsPaymentSettingsPaymentMethodOptionsCardInstallments" ] """ - Installment configuration for payments attempted on this invoice (Mexico Only). + Installment configuration for payments attempted on this invoice. For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). """ @@ -1401,6 +1401,9 @@ class CreatePreviewParamsScheduleDetails(TypedDict): class CreatePreviewParamsScheduleDetailsBillingMode(TypedDict): type: Literal["classic", "flexible"] + """ + Controls the calculation and orchestration of prorations and invoices for subscriptions. + """ class CreatePreviewParamsScheduleDetailsPhase(TypedDict): add_invoice_items: NotRequired[ @@ -1459,6 +1462,12 @@ class CreatePreviewParamsScheduleDetailsPhase(TypedDict): """ The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts. """ + duration: NotRequired[ + "InvoiceService.CreatePreviewParamsScheduleDetailsPhaseDuration" + ] + """ + The number of intervals the phase should last. If set, `end_date` must not be set. + """ end_date: NotRequired["int|Literal['now']"] """ The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set. @@ -1477,7 +1486,7 @@ class CreatePreviewParamsScheduleDetailsPhase(TypedDict): """ iterations: NotRequired[int] """ - Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. + Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. This parameter is deprecated and will be removed in a future version. Use `duration` instead. """ metadata: NotRequired[Dict[str, str]] """ @@ -1630,6 +1639,16 @@ class CreatePreviewParamsScheduleDetailsPhaseDiscount(TypedDict): ID of the promotion code to create a new discount for. """ + class CreatePreviewParamsScheduleDetailsPhaseDuration(TypedDict): + interval: Literal["day", "month", "week", "year"] + """ + Specifies phase duration. Either `day`, `week`, `month` or `year`. + """ + interval_count: NotRequired[int] + """ + The multiplier applied to the interval. + """ + class CreatePreviewParamsScheduleDetailsPhaseInvoiceSettings(TypedDict): account_tax_ids: NotRequired["Literal['']|List[str]"] """ @@ -1781,7 +1800,9 @@ class CreatePreviewParamsSubscriptionDetails(TypedDict): """ Controls how prorations and invoices for subscriptions are calculated and orchestrated. """ - cancel_at: NotRequired["Literal['']|int"] + cancel_at: NotRequired[ + "Literal['']|int|Literal['max_period_end', 'min_period_end']" + ] """ A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period. """ @@ -1828,6 +1849,9 @@ class CreatePreviewParamsSubscriptionDetails(TypedDict): class CreatePreviewParamsSubscriptionDetailsBillingMode(TypedDict): type: Literal["classic", "flexible"] + """ + Controls the calculation and orchestration of prorations and invoices for subscriptions. + """ class CreatePreviewParamsSubscriptionDetailsItem(TypedDict): billing_thresholds: NotRequired[ @@ -2397,7 +2421,7 @@ class UpdateParams(TypedDict): """ automatically_finalizes_at: NotRequired[int] """ - The time when this invoice should be scheduled to finalize. The invoice will be finalized at this time if it is still in draft state. To turn off automatic finalization, set `auto_advance` to false. + The time when this invoice should be scheduled to finalize (up to 5 years in the future). The invoice is finalized at this time if it's still in draft state. To turn off automatic finalization, set `auto_advance` to false. """ collection_method: NotRequired[ Literal["charge_automatically", "send_invoice"] @@ -2653,7 +2677,7 @@ class UpdateParamsPaymentSettingsPaymentMethodOptionsCard(TypedDict): "InvoiceService.UpdateParamsPaymentSettingsPaymentMethodOptionsCardInstallments" ] """ - Installment configuration for payments attempted on this invoice (Mexico Only). + Installment configuration for payments attempted on this invoice. For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). """ diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index 0a55a5eda..f97be8cd2 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -2491,7 +2491,7 @@ class Zip(StripeObject): class PresentmentDetails(StripeObject): presentment_amount: int """ - Amount intended to be collected by this payment, denominated in presentment_currency. + Amount intended to be collected by this payment, denominated in `presentment_currency`. """ presentment_currency: str """ @@ -4138,7 +4138,7 @@ class ConfirmParamsPaymentMethodOptionsCard(TypedDict): "PaymentIntent.ConfirmParamsPaymentMethodOptionsCardInstallments" ] """ - Installment configuration for payments attempted on this PaymentIntent (Mexico Only). + Installment configuration for payments attempted on this PaymentIntent. For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). """ @@ -6953,7 +6953,7 @@ class CreateParamsPaymentMethodOptionsCard(TypedDict): "PaymentIntent.CreateParamsPaymentMethodOptionsCardInstallments" ] """ - Installment configuration for payments attempted on this PaymentIntent (Mexico Only). + Installment configuration for payments attempted on this PaymentIntent. For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). """ @@ -9760,7 +9760,7 @@ class ModifyParamsPaymentMethodOptionsCard(TypedDict): "PaymentIntent.ModifyParamsPaymentMethodOptionsCardInstallments" ] """ - Installment configuration for payments attempted on this PaymentIntent (Mexico Only). + Installment configuration for payments attempted on this PaymentIntent. For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). """ @@ -11659,6 +11659,7 @@ def _cls_confirm( Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. + If the selected payment method requires additional authentication steps, the PaymentIntent will transition to the requires_action status and suggest additional actions via next_action. If payment fails, @@ -11666,18 +11667,22 @@ def _cls_confirm( canceled status if the confirmation limit is reached. If payment succeeds, the PaymentIntent will transition to the succeeded status (or requires_capture, if capture_method is set to manual). + If the confirmation_method is automatic, payment may be attempted using our [client SDKs](https://docs.stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) and the PaymentIntent's [client_secret](https://docs.stripe.com/api#payment_intent_object-client_secret). After next_actions are handled by the client, no additional confirmation is required to complete the payment. + If the confirmation_method is manual, all payment attempts must be initiated using a secret key. + If any actions are required for the payment, the PaymentIntent will return to the requires_confirmation state after those actions are completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment attempt. + There is a variable upper limit on how many times a PaymentIntent can be confirmed. After this limit is reached, any further calls to this endpoint will transition the PaymentIntent to the canceled state. @@ -11702,6 +11707,7 @@ def confirm( Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. + If the selected payment method requires additional authentication steps, the PaymentIntent will transition to the requires_action status and suggest additional actions via next_action. If payment fails, @@ -11709,18 +11715,22 @@ def confirm( canceled status if the confirmation limit is reached. If payment succeeds, the PaymentIntent will transition to the succeeded status (or requires_capture, if capture_method is set to manual). + If the confirmation_method is automatic, payment may be attempted using our [client SDKs](https://docs.stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) and the PaymentIntent's [client_secret](https://docs.stripe.com/api#payment_intent_object-client_secret). After next_actions are handled by the client, no additional confirmation is required to complete the payment. + If the confirmation_method is manual, all payment attempts must be initiated using a secret key. + If any actions are required for the payment, the PaymentIntent will return to the requires_confirmation state after those actions are completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment attempt. + There is a variable upper limit on how many times a PaymentIntent can be confirmed. After this limit is reached, any further calls to this endpoint will transition the PaymentIntent to the canceled state. @@ -11735,6 +11745,7 @@ def confirm( Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. + If the selected payment method requires additional authentication steps, the PaymentIntent will transition to the requires_action status and suggest additional actions via next_action. If payment fails, @@ -11742,18 +11753,22 @@ def confirm( canceled status if the confirmation limit is reached. If payment succeeds, the PaymentIntent will transition to the succeeded status (or requires_capture, if capture_method is set to manual). + If the confirmation_method is automatic, payment may be attempted using our [client SDKs](https://docs.stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) and the PaymentIntent's [client_secret](https://docs.stripe.com/api#payment_intent_object-client_secret). After next_actions are handled by the client, no additional confirmation is required to complete the payment. + If the confirmation_method is manual, all payment attempts must be initiated using a secret key. + If any actions are required for the payment, the PaymentIntent will return to the requires_confirmation state after those actions are completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment attempt. + There is a variable upper limit on how many times a PaymentIntent can be confirmed. After this limit is reached, any further calls to this endpoint will transition the PaymentIntent to the canceled state. @@ -11768,6 +11783,7 @@ def confirm( # pyright: ignore[reportGeneralTypeIssues] Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. + If the selected payment method requires additional authentication steps, the PaymentIntent will transition to the requires_action status and suggest additional actions via next_action. If payment fails, @@ -11775,18 +11791,22 @@ def confirm( # pyright: ignore[reportGeneralTypeIssues] canceled status if the confirmation limit is reached. If payment succeeds, the PaymentIntent will transition to the succeeded status (or requires_capture, if capture_method is set to manual). + If the confirmation_method is automatic, payment may be attempted using our [client SDKs](https://docs.stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) and the PaymentIntent's [client_secret](https://docs.stripe.com/api#payment_intent_object-client_secret). After next_actions are handled by the client, no additional confirmation is required to complete the payment. + If the confirmation_method is manual, all payment attempts must be initiated using a secret key. + If any actions are required for the payment, the PaymentIntent will return to the requires_confirmation state after those actions are completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment attempt. + There is a variable upper limit on how many times a PaymentIntent can be confirmed. After this limit is reached, any further calls to this endpoint will transition the PaymentIntent to the canceled state. @@ -11810,6 +11830,7 @@ async def _cls_confirm_async( Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. + If the selected payment method requires additional authentication steps, the PaymentIntent will transition to the requires_action status and suggest additional actions via next_action. If payment fails, @@ -11817,18 +11838,22 @@ async def _cls_confirm_async( canceled status if the confirmation limit is reached. If payment succeeds, the PaymentIntent will transition to the succeeded status (or requires_capture, if capture_method is set to manual). + If the confirmation_method is automatic, payment may be attempted using our [client SDKs](https://docs.stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) and the PaymentIntent's [client_secret](https://docs.stripe.com/api#payment_intent_object-client_secret). After next_actions are handled by the client, no additional confirmation is required to complete the payment. + If the confirmation_method is manual, all payment attempts must be initiated using a secret key. + If any actions are required for the payment, the PaymentIntent will return to the requires_confirmation state after those actions are completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment attempt. + There is a variable upper limit on how many times a PaymentIntent can be confirmed. After this limit is reached, any further calls to this endpoint will transition the PaymentIntent to the canceled state. @@ -11853,6 +11878,7 @@ async def confirm_async( Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. + If the selected payment method requires additional authentication steps, the PaymentIntent will transition to the requires_action status and suggest additional actions via next_action. If payment fails, @@ -11860,18 +11886,22 @@ async def confirm_async( canceled status if the confirmation limit is reached. If payment succeeds, the PaymentIntent will transition to the succeeded status (or requires_capture, if capture_method is set to manual). + If the confirmation_method is automatic, payment may be attempted using our [client SDKs](https://docs.stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) and the PaymentIntent's [client_secret](https://docs.stripe.com/api#payment_intent_object-client_secret). After next_actions are handled by the client, no additional confirmation is required to complete the payment. + If the confirmation_method is manual, all payment attempts must be initiated using a secret key. + If any actions are required for the payment, the PaymentIntent will return to the requires_confirmation state after those actions are completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment attempt. + There is a variable upper limit on how many times a PaymentIntent can be confirmed. After this limit is reached, any further calls to this endpoint will transition the PaymentIntent to the canceled state. @@ -11886,6 +11916,7 @@ async def confirm_async( Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. + If the selected payment method requires additional authentication steps, the PaymentIntent will transition to the requires_action status and suggest additional actions via next_action. If payment fails, @@ -11893,18 +11924,22 @@ async def confirm_async( canceled status if the confirmation limit is reached. If payment succeeds, the PaymentIntent will transition to the succeeded status (or requires_capture, if capture_method is set to manual). + If the confirmation_method is automatic, payment may be attempted using our [client SDKs](https://docs.stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) and the PaymentIntent's [client_secret](https://docs.stripe.com/api#payment_intent_object-client_secret). After next_actions are handled by the client, no additional confirmation is required to complete the payment. + If the confirmation_method is manual, all payment attempts must be initiated using a secret key. + If any actions are required for the payment, the PaymentIntent will return to the requires_confirmation state after those actions are completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment attempt. + There is a variable upper limit on how many times a PaymentIntent can be confirmed. After this limit is reached, any further calls to this endpoint will transition the PaymentIntent to the canceled state. @@ -11919,6 +11954,7 @@ async def confirm_async( # pyright: ignore[reportGeneralTypeIssues] Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. + If the selected payment method requires additional authentication steps, the PaymentIntent will transition to the requires_action status and suggest additional actions via next_action. If payment fails, @@ -11926,18 +11962,22 @@ async def confirm_async( # pyright: ignore[reportGeneralTypeIssues] canceled status if the confirmation limit is reached. If payment succeeds, the PaymentIntent will transition to the succeeded status (or requires_capture, if capture_method is set to manual). + If the confirmation_method is automatic, payment may be attempted using our [client SDKs](https://docs.stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) and the PaymentIntent's [client_secret](https://docs.stripe.com/api#payment_intent_object-client_secret). After next_actions are handled by the client, no additional confirmation is required to complete the payment. + If the confirmation_method is manual, all payment attempts must be initiated using a secret key. + If any actions are required for the payment, the PaymentIntent will return to the requires_confirmation state after those actions are completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment attempt. + There is a variable upper limit on how many times a PaymentIntent can be confirmed. After this limit is reached, any further calls to this endpoint will transition the PaymentIntent to the canceled state. diff --git a/stripe/_payment_intent_service.py b/stripe/_payment_intent_service.py index c6329d987..dca493f5d 100644 --- a/stripe/_payment_intent_service.py +++ b/stripe/_payment_intent_service.py @@ -1599,7 +1599,7 @@ class ConfirmParamsPaymentMethodOptionsCard(TypedDict): "PaymentIntentService.ConfirmParamsPaymentMethodOptionsCardInstallments" ] """ - Installment configuration for payments attempted on this PaymentIntent (Mexico Only). + Installment configuration for payments attempted on this PaymentIntent. For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). """ @@ -4444,7 +4444,7 @@ class CreateParamsPaymentMethodOptionsCard(TypedDict): "PaymentIntentService.CreateParamsPaymentMethodOptionsCardInstallments" ] """ - Installment configuration for payments attempted on this PaymentIntent (Mexico Only). + Installment configuration for payments attempted on this PaymentIntent. For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). """ @@ -7309,7 +7309,7 @@ class UpdateParamsPaymentMethodOptionsCard(TypedDict): "PaymentIntentService.UpdateParamsPaymentMethodOptionsCardInstallments" ] """ - Installment configuration for payments attempted on this PaymentIntent (Mexico Only). + Installment configuration for payments attempted on this PaymentIntent. For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments). """ @@ -8980,6 +8980,7 @@ def confirm( Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. + If the selected payment method requires additional authentication steps, the PaymentIntent will transition to the requires_action status and suggest additional actions via next_action. If payment fails, @@ -8987,18 +8988,22 @@ def confirm( canceled status if the confirmation limit is reached. If payment succeeds, the PaymentIntent will transition to the succeeded status (or requires_capture, if capture_method is set to manual). + If the confirmation_method is automatic, payment may be attempted using our [client SDKs](https://docs.stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) and the PaymentIntent's [client_secret](https://docs.stripe.com/api#payment_intent_object-client_secret). After next_actions are handled by the client, no additional confirmation is required to complete the payment. + If the confirmation_method is manual, all payment attempts must be initiated using a secret key. + If any actions are required for the payment, the PaymentIntent will return to the requires_confirmation state after those actions are completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment attempt. + There is a variable upper limit on how many times a PaymentIntent can be confirmed. After this limit is reached, any further calls to this endpoint will transition the PaymentIntent to the canceled state. @@ -9026,6 +9031,7 @@ async def confirm_async( Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. + If the selected payment method requires additional authentication steps, the PaymentIntent will transition to the requires_action status and suggest additional actions via next_action. If payment fails, @@ -9033,18 +9039,22 @@ async def confirm_async( canceled status if the confirmation limit is reached. If payment succeeds, the PaymentIntent will transition to the succeeded status (or requires_capture, if capture_method is set to manual). + If the confirmation_method is automatic, payment may be attempted using our [client SDKs](https://docs.stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) and the PaymentIntent's [client_secret](https://docs.stripe.com/api#payment_intent_object-client_secret). After next_actions are handled by the client, no additional confirmation is required to complete the payment. + If the confirmation_method is manual, all payment attempts must be initiated using a secret key. + If any actions are required for the payment, the PaymentIntent will return to the requires_confirmation state after those actions are completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment attempt. + There is a variable upper limit on how many times a PaymentIntent can be confirmed. After this limit is reached, any further calls to this endpoint will transition the PaymentIntent to the canceled state. diff --git a/stripe/_payment_link.py b/stripe/_payment_link.py index 53c60c42a..90f9d2871 100644 --- a/stripe/_payment_link.py +++ b/stripe/_payment_link.py @@ -268,6 +268,10 @@ class RenderingOptions(StripeObject): """ How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. """ + template: Optional[str] + """ + ID of the invoice rendering template to be used for the generated invoice. + """ account_tax_ids: Optional[List[ExpandableField["TaxId"]]] """ @@ -1194,6 +1198,10 @@ class CreateParamsInvoiceCreationInvoiceDataRenderingOptions(TypedDict): """ How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for this invoice. + """ class CreateParamsLineItem(TypedDict): adjustable_quantity: NotRequired[ @@ -1202,10 +1210,14 @@ class CreateParamsLineItem(TypedDict): """ When set, provides configuration for this item's quantity to be adjusted by the customer during checkout. """ - price: str + price: NotRequired[str] """ The ID of the [Price](https://stripe.com/docs/api/prices) or [Plan](https://stripe.com/docs/api/plans) object. """ + price_data: NotRequired["PaymentLink.CreateParamsLineItemPriceData"] + """ + Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required. + """ quantity: int """ The quantity of the line item being purchased. @@ -1218,13 +1230,81 @@ class CreateParamsLineItemAdjustableQuantity(TypedDict): """ maximum: NotRequired[int] """ - The maximum quantity the customer can purchase. By default this value is 99. You can specify a value up to 999. + The maximum quantity the customer can purchase. By default this value is 99. You can specify a value up to 999999. """ minimum: NotRequired[int] """ The minimum quantity the customer can purchase. By default this value is 0. If there is only one item in the cart then that item's quantity cannot go down to 0. """ + class CreateParamsLineItemPriceData(TypedDict): + 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). + """ + product: NotRequired[str] + """ + The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to. One of `product` or `product_data` is required. + """ + product_data: NotRequired[ + "PaymentLink.CreateParamsLineItemPriceDataProductData" + ] + """ + Data used to generate a new [Product](https://docs.stripe.com/api/products) object inline. One of `product` or `product_data` is required. + """ + recurring: NotRequired[ + "PaymentLink.CreateParamsLineItemPriceDataRecurring" + ] + """ + The recurring components of a price such as `interval` and `interval_count`. + """ + tax_behavior: NotRequired[ + Literal["exclusive", "inclusive", "unspecified"] + ] + """ + Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed. + """ + unit_amount: NotRequired[int] + """ + A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. + """ + unit_amount_decimal: NotRequired[str] + """ + Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. + """ + + class CreateParamsLineItemPriceDataProductData(TypedDict): + description: NotRequired[str] + """ + The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. + """ + images: NotRequired[List[str]] + """ + A list of up to 8 URLs of images for this product, meant to be displayable to the customer. + """ + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ + name: str + """ + The product's name, meant to be displayable to the customer. + """ + tax_code: NotRequired[str] + """ + A [tax code](https://stripe.com/docs/tax/tax-categories) ID. + """ + + class CreateParamsLineItemPriceDataRecurring(TypedDict): + interval: Literal["day", "month", "week", "year"] + """ + Specifies billing frequency. Either `day`, `week`, `month` or `year`. + """ + interval_count: NotRequired[int] + """ + The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + """ + class CreateParamsOptionalItem(TypedDict): adjustable_quantity: NotRequired[ "PaymentLink.CreateParamsOptionalItemAdjustableQuantity" @@ -2079,6 +2159,10 @@ class ModifyParamsInvoiceCreationInvoiceDataRenderingOptions(TypedDict): """ How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for this invoice. + """ class ModifyParamsLineItem(TypedDict): adjustable_quantity: NotRequired[ @@ -2103,7 +2187,7 @@ class ModifyParamsLineItemAdjustableQuantity(TypedDict): """ maximum: NotRequired[int] """ - The maximum quantity the customer can purchase. By default this value is 99. You can specify a value up to 999. + The maximum quantity the customer can purchase. By default this value is 99. You can specify a value up to 999999. """ minimum: NotRequired[int] """ diff --git a/stripe/_payment_link_service.py b/stripe/_payment_link_service.py index 628f4d055..f24885288 100644 --- a/stripe/_payment_link_service.py +++ b/stripe/_payment_link_service.py @@ -514,6 +514,10 @@ class CreateParamsInvoiceCreationInvoiceDataRenderingOptions(TypedDict): """ How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for this invoice. + """ class CreateParamsLineItem(TypedDict): adjustable_quantity: NotRequired[ @@ -522,10 +526,16 @@ class CreateParamsLineItem(TypedDict): """ When set, provides configuration for this item's quantity to be adjusted by the customer during checkout. """ - price: str + price: NotRequired[str] """ The ID of the [Price](https://stripe.com/docs/api/prices) or [Plan](https://stripe.com/docs/api/plans) object. """ + price_data: NotRequired[ + "PaymentLinkService.CreateParamsLineItemPriceData" + ] + """ + Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required. + """ quantity: int """ The quantity of the line item being purchased. @@ -538,13 +548,81 @@ class CreateParamsLineItemAdjustableQuantity(TypedDict): """ maximum: NotRequired[int] """ - The maximum quantity the customer can purchase. By default this value is 99. You can specify a value up to 999. + The maximum quantity the customer can purchase. By default this value is 99. You can specify a value up to 999999. """ minimum: NotRequired[int] """ The minimum quantity the customer can purchase. By default this value is 0. If there is only one item in the cart then that item's quantity cannot go down to 0. """ + class CreateParamsLineItemPriceData(TypedDict): + 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). + """ + product: NotRequired[str] + """ + The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to. One of `product` or `product_data` is required. + """ + product_data: NotRequired[ + "PaymentLinkService.CreateParamsLineItemPriceDataProductData" + ] + """ + Data used to generate a new [Product](https://docs.stripe.com/api/products) object inline. One of `product` or `product_data` is required. + """ + recurring: NotRequired[ + "PaymentLinkService.CreateParamsLineItemPriceDataRecurring" + ] + """ + The recurring components of a price such as `interval` and `interval_count`. + """ + tax_behavior: NotRequired[ + Literal["exclusive", "inclusive", "unspecified"] + ] + """ + Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed. + """ + unit_amount: NotRequired[int] + """ + A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. + """ + unit_amount_decimal: NotRequired[str] + """ + Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. + """ + + class CreateParamsLineItemPriceDataProductData(TypedDict): + description: NotRequired[str] + """ + The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. + """ + images: NotRequired[List[str]] + """ + A list of up to 8 URLs of images for this product, meant to be displayable to the customer. + """ + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ + name: str + """ + The product's name, meant to be displayable to the customer. + """ + tax_code: NotRequired[str] + """ + A [tax code](https://stripe.com/docs/tax/tax-categories) ID. + """ + + class CreateParamsLineItemPriceDataRecurring(TypedDict): + interval: Literal["day", "month", "week", "year"] + """ + Specifies billing frequency. Either `day`, `week`, `month` or `year`. + """ + interval_count: NotRequired[int] + """ + The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). + """ + class CreateParamsOptionalItem(TypedDict): adjustable_quantity: NotRequired[ "PaymentLinkService.CreateParamsOptionalItemAdjustableQuantity" @@ -1397,6 +1475,10 @@ class UpdateParamsInvoiceCreationInvoiceDataRenderingOptions(TypedDict): """ How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for this invoice. + """ class UpdateParamsLineItem(TypedDict): adjustable_quantity: NotRequired[ @@ -1421,7 +1503,7 @@ class UpdateParamsLineItemAdjustableQuantity(TypedDict): """ maximum: NotRequired[int] """ - The maximum quantity the customer can purchase. By default this value is 99. You can specify a value up to 999. + The maximum quantity the customer can purchase. By default this value is 99. You can specify a value up to 999999. """ minimum: NotRequired[int] """ diff --git a/stripe/_payment_method.py b/stripe/_payment_method.py index 8064bf039..1b5b5ea6a 100644 --- a/stripe/_payment_method.py +++ b/stripe/_payment_method.py @@ -249,7 +249,7 @@ class Wallet(StripeObject): """ brand: Optional[str] """ - Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ brand_product: Optional[str] """ @@ -594,7 +594,7 @@ class ShippingAddress(StripeObject): brand: str """ - Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ checks: Optional[Checks] """ @@ -699,7 +699,7 @@ class Wallet(StripeObject): brand: Optional[str] """ - Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ brand_product: Optional[str] """ @@ -2848,7 +2848,7 @@ def modify( cls, id: str, **params: Unpack["PaymentMethod.ModifyParams"] ) -> "PaymentMethod": """ - Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. + Updates a PaymentMethod object. A PaymentMethod must be attached to a customer to be updated. """ url = "%s/%s" % (cls.class_url(), sanitize_id(id)) return cast( @@ -2865,7 +2865,7 @@ async def modify_async( cls, id: str, **params: Unpack["PaymentMethod.ModifyParams"] ) -> "PaymentMethod": """ - Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. + Updates a PaymentMethod object. A PaymentMethod must be attached to a customer to be updated. """ url = "%s/%s" % (cls.class_url(), sanitize_id(id)) return cast( diff --git a/stripe/_payment_method_service.py b/stripe/_payment_method_service.py index 313a0d9fd..19cd571c7 100644 --- a/stripe/_payment_method_service.py +++ b/stripe/_payment_method_service.py @@ -1113,7 +1113,7 @@ def update( options: RequestOptions = {}, ) -> PaymentMethod: """ - Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. + Updates a PaymentMethod object. A PaymentMethod must be attached to a customer to be updated. """ return cast( PaymentMethod, @@ -1135,7 +1135,7 @@ async def update_async( options: RequestOptions = {}, ) -> PaymentMethod: """ - Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated. + Updates a PaymentMethod object. A PaymentMethod must be attached to a customer to be updated. """ return cast( PaymentMethod, diff --git a/stripe/_quote.py b/stripe/_quote.py index 075384c54..cbe4dea85 100644 --- a/stripe/_quote.py +++ b/stripe/_quote.py @@ -702,6 +702,9 @@ class CreateParamsSubscriptionData(TypedDict): class CreateParamsSubscriptionDataBillingMode(TypedDict): type: Literal["classic", "flexible"] + """ + Controls the calculation and orchestration of prorations and invoices for subscriptions. + """ class CreateParamsTransferData(TypedDict): amount: NotRequired[int] diff --git a/stripe/_quote_service.py b/stripe/_quote_service.py index 7b5a9dde6..6342cd6a6 100644 --- a/stripe/_quote_service.py +++ b/stripe/_quote_service.py @@ -299,6 +299,9 @@ class CreateParamsSubscriptionData(TypedDict): class CreateParamsSubscriptionDataBillingMode(TypedDict): type: Literal["classic", "flexible"] + """ + Controls the calculation and orchestration of prorations and invoices for subscriptions. + """ class CreateParamsTransferData(TypedDict): amount: NotRequired[int] diff --git a/stripe/_refund.py b/stripe/_refund.py index 37044b0be..5d48f86be 100644 --- a/stripe/_refund.py +++ b/stripe/_refund.py @@ -341,7 +341,7 @@ class EmailSent(StripeObject): class PresentmentDetails(StripeObject): presentment_amount: int """ - Amount intended to be collected by this payment, denominated in presentment_currency. + Amount intended to be collected by this payment, denominated in `presentment_currency`. """ presentment_currency: str """ diff --git a/stripe/_review.py b/stripe/_review.py index d8681862d..be9436a7b 100644 --- a/stripe/_review.py +++ b/stripe/_review.py @@ -141,7 +141,7 @@ class RetrieveParams(RequestOptions): ] ] """ - The reason the review was closed, or null if it has not yet been closed. One of `approved`, `refunded`, `refunded_as_fraud`, `disputed`, `redacted`, or `canceled`. + The reason the review was closed, or null if it has not yet been closed. One of `approved`, `refunded`, `refunded_as_fraud`, `disputed`, `redacted`, `canceled`, `payment_never_settled`, or `acknowledged`. """ created: int """ @@ -181,7 +181,7 @@ class RetrieveParams(RequestOptions): """ reason: str """ - The reason the review is currently open or closed. One of `rule`, `manual`, `approved`, `refunded`, `refunded_as_fraud`, `disputed`, `redacted`, or `canceled`. + The reason the review is currently open or closed. One of `rule`, `manual`, `approved`, `refunded`, `refunded_as_fraud`, `disputed`, `redacted`, `canceled`, `payment_never_settled`, or `acknowledged`. """ session: Optional[Session] """ diff --git a/stripe/_setup_attempt.py b/stripe/_setup_attempt.py index acc072dff..5ca0a0135 100644 --- a/stripe/_setup_attempt.py +++ b/stripe/_setup_attempt.py @@ -177,7 +177,7 @@ class GooglePay(StripeObject): brand: Optional[str] """ - Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ checks: Optional[Checks] """ diff --git a/stripe/_subscription.py b/stripe/_subscription.py index 44605b5ba..b8522bdee 100644 --- a/stripe/_subscription.py +++ b/stripe/_subscription.py @@ -552,7 +552,9 @@ class CreateParams(RequestOptions): """ Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. """ - cancel_at: NotRequired[int] + cancel_at: NotRequired[ + "int|Literal['max_period_end', 'min_period_end']" + ] """ A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period. """ @@ -796,6 +798,9 @@ class CreateParamsBillingCycleAnchorConfig(TypedDict): class CreateParamsBillingMode(TypedDict): type: Literal["classic", "flexible"] + """ + Controls the calculation and orchestration of prorations and invoices for subscriptions. + """ class CreateParamsBillingThresholds(TypedDict): amount_gte: NotRequired[int] @@ -1383,7 +1388,9 @@ class ModifyParams(RequestOptions): """ Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. """ - cancel_at: NotRequired["Literal['']|int"] + cancel_at: NotRequired[ + "Literal['']|int|Literal['max_period_end', 'min_period_end']" + ] """ A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period. """ @@ -1476,7 +1483,7 @@ class ModifyParams(RequestOptions): Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes). - Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. + Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://docs.stripe.com/changelog/2019-03-14) to learn more. """ payment_settings: NotRequired[ "Subscription.ModifyParamsPaymentSettings" diff --git a/stripe/_subscription_item.py b/stripe/_subscription_item.py index 944ad0495..a8c821bee 100644 --- a/stripe/_subscription_item.py +++ b/stripe/_subscription_item.py @@ -80,7 +80,7 @@ class CreateParams(RequestOptions): Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes). - Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. + Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://docs.stripe.com/changelog/2019-03-14) to learn more. """ plan: NotRequired[str] """ @@ -253,7 +253,7 @@ class ModifyParams(RequestOptions): Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes). - Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. + Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://docs.stripe.com/changelog/2019-03-14) to learn more. """ plan: NotRequired[str] """ diff --git a/stripe/_subscription_item_service.py b/stripe/_subscription_item_service.py index 1823cfc68..4a79829b3 100644 --- a/stripe/_subscription_item_service.py +++ b/stripe/_subscription_item_service.py @@ -46,7 +46,7 @@ class CreateParams(TypedDict): Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes). - Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. + Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://docs.stripe.com/changelog/2019-03-14) to learn more. """ plan: NotRequired[str] """ @@ -227,7 +227,7 @@ class UpdateParams(TypedDict): Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes). - Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. + Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://docs.stripe.com/changelog/2019-03-14) to learn more. """ plan: NotRequired[str] """ diff --git a/stripe/_subscription_schedule.py b/stripe/_subscription_schedule.py index 77f92b2e4..c121a249f 100644 --- a/stripe/_subscription_schedule.py +++ b/stripe/_subscription_schedule.py @@ -502,6 +502,9 @@ class CreateParams(RequestOptions): class CreateParamsBillingMode(TypedDict): type: Literal["classic", "flexible"] + """ + Controls the calculation and orchestration of prorations and invoices for subscriptions. + """ class CreateParamsDefaultSettings(TypedDict): application_fee_percent: NotRequired[float] @@ -678,6 +681,10 @@ class CreateParamsPhase(TypedDict): """ The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts. """ + duration: NotRequired["SubscriptionSchedule.CreateParamsPhaseDuration"] + """ + The number of intervals the phase should last. If set, `end_date` must not be set. + """ end_date: NotRequired[int] """ The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set. @@ -694,7 +701,7 @@ class CreateParamsPhase(TypedDict): """ iterations: NotRequired[int] """ - Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. + Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. This parameter is deprecated and will be removed in a future version. Use `duration` instead. """ metadata: NotRequired[Dict[str, str]] """ @@ -837,6 +844,16 @@ class CreateParamsPhaseDiscount(TypedDict): ID of the promotion code to create a new discount for. """ + class CreateParamsPhaseDuration(TypedDict): + interval: Literal["day", "month", "week", "year"] + """ + Specifies phase duration. Either `day`, `week`, `month` or `year`. + """ + interval_count: NotRequired[int] + """ + The multiplier applied to the interval. + """ + class CreateParamsPhaseInvoiceSettings(TypedDict): account_tax_ids: NotRequired["Literal['']|List[str]"] """ @@ -1300,6 +1317,10 @@ class ModifyParamsPhase(TypedDict): """ The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts. """ + duration: NotRequired["SubscriptionSchedule.ModifyParamsPhaseDuration"] + """ + The number of intervals the phase should last. If set, `end_date` must not be set. + """ end_date: NotRequired["int|Literal['now']"] """ The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set. @@ -1316,7 +1337,7 @@ class ModifyParamsPhase(TypedDict): """ iterations: NotRequired[int] """ - Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. + Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. This parameter is deprecated and will be removed in a future version. Use `duration` instead. """ metadata: NotRequired[Dict[str, str]] """ @@ -1463,6 +1484,16 @@ class ModifyParamsPhaseDiscount(TypedDict): ID of the promotion code to create a new discount for. """ + class ModifyParamsPhaseDuration(TypedDict): + interval: Literal["day", "month", "week", "year"] + """ + Specifies phase duration. Either `day`, `week`, `month` or `year`. + """ + interval_count: NotRequired[int] + """ + The multiplier applied to the interval. + """ + class ModifyParamsPhaseInvoiceSettings(TypedDict): account_tax_ids: NotRequired["Literal['']|List[str]"] """ diff --git a/stripe/_subscription_schedule_service.py b/stripe/_subscription_schedule_service.py index 1e7363509..9dc620bdd 100644 --- a/stripe/_subscription_schedule_service.py +++ b/stripe/_subscription_schedule_service.py @@ -72,6 +72,9 @@ class CreateParams(TypedDict): class CreateParamsBillingMode(TypedDict): type: Literal["classic", "flexible"] + """ + Controls the calculation and orchestration of prorations and invoices for subscriptions. + """ class CreateParamsDefaultSettings(TypedDict): application_fee_percent: NotRequired[float] @@ -248,6 +251,12 @@ class CreateParamsPhase(TypedDict): """ The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts. """ + duration: NotRequired[ + "SubscriptionScheduleService.CreateParamsPhaseDuration" + ] + """ + The number of intervals the phase should last. If set, `end_date` must not be set. + """ end_date: NotRequired[int] """ The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set. @@ -264,7 +273,7 @@ class CreateParamsPhase(TypedDict): """ iterations: NotRequired[int] """ - Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. + Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. This parameter is deprecated and will be removed in a future version. Use `duration` instead. """ metadata: NotRequired[Dict[str, str]] """ @@ -407,6 +416,16 @@ class CreateParamsPhaseDiscount(TypedDict): ID of the promotion code to create a new discount for. """ + class CreateParamsPhaseDuration(TypedDict): + interval: Literal["day", "month", "week", "year"] + """ + Specifies phase duration. Either `day`, `week`, `month` or `year`. + """ + interval_count: NotRequired[int] + """ + The multiplier applied to the interval. + """ + class CreateParamsPhaseInvoiceSettings(TypedDict): account_tax_ids: NotRequired["Literal['']|List[str]"] """ @@ -888,6 +907,12 @@ class UpdateParamsPhase(TypedDict): """ The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts. """ + duration: NotRequired[ + "SubscriptionScheduleService.UpdateParamsPhaseDuration" + ] + """ + The number of intervals the phase should last. If set, `end_date` must not be set. + """ end_date: NotRequired["int|Literal['now']"] """ The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set. @@ -904,7 +929,7 @@ class UpdateParamsPhase(TypedDict): """ iterations: NotRequired[int] """ - Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. + Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set. This parameter is deprecated and will be removed in a future version. Use `duration` instead. """ metadata: NotRequired[Dict[str, str]] """ @@ -1051,6 +1076,16 @@ class UpdateParamsPhaseDiscount(TypedDict): ID of the promotion code to create a new discount for. """ + class UpdateParamsPhaseDuration(TypedDict): + interval: Literal["day", "month", "week", "year"] + """ + Specifies phase duration. Either `day`, `week`, `month` or `year`. + """ + interval_count: NotRequired[int] + """ + The multiplier applied to the interval. + """ + class UpdateParamsPhaseInvoiceSettings(TypedDict): account_tax_ids: NotRequired["Literal['']|List[str]"] """ diff --git a/stripe/_subscription_service.py b/stripe/_subscription_service.py index 93197671a..18d8a4fe5 100644 --- a/stripe/_subscription_service.py +++ b/stripe/_subscription_service.py @@ -87,7 +87,9 @@ class CreateParams(TypedDict): """ Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. """ - cancel_at: NotRequired[int] + cancel_at: NotRequired[ + "int|Literal['max_period_end', 'min_period_end']" + ] """ A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period. """ @@ -335,6 +337,9 @@ class CreateParamsBillingCycleAnchorConfig(TypedDict): class CreateParamsBillingMode(TypedDict): type: Literal["classic", "flexible"] + """ + Controls the calculation and orchestration of prorations and invoices for subscriptions. + """ class CreateParamsBillingThresholds(TypedDict): amount_gte: NotRequired[int] @@ -976,7 +981,9 @@ class UpdateParams(TypedDict): """ Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. """ - cancel_at: NotRequired["Literal['']|int"] + cancel_at: NotRequired[ + "Literal['']|int|Literal['max_period_end', 'min_period_end']" + ] """ A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period. """ @@ -1069,7 +1076,7 @@ class UpdateParams(TypedDict): Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes). - Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. + Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://docs.stripe.com/changelog/2019-03-14) to learn more. """ payment_settings: NotRequired[ "SubscriptionService.UpdateParamsPaymentSettings" diff --git a/stripe/_webhook_endpoint.py b/stripe/_webhook_endpoint.py index 695757c4e..297457e96 100644 --- a/stripe/_webhook_endpoint.py +++ b/stripe/_webhook_endpoint.py @@ -145,6 +145,7 @@ class CreateParams(RequestOptions): "2025-04-30.basil", "2025-05-28.basil", "2025-06-30.basil", + "2025-07-30.basil", ] ] """ diff --git a/stripe/_webhook_endpoint_service.py b/stripe/_webhook_endpoint_service.py index db8117339..42b305a1c 100644 --- a/stripe/_webhook_endpoint_service.py +++ b/stripe/_webhook_endpoint_service.py @@ -126,6 +126,7 @@ class CreateParams(TypedDict): "2025-04-30.basil", "2025-05-28.basil", "2025-06-30.basil", + "2025-07-30.basil", ] ] """ diff --git a/stripe/billing/_credit_grant.py b/stripe/billing/_credit_grant.py index 2d2f52c92..c8fbabf2a 100644 --- a/stripe/billing/_credit_grant.py +++ b/stripe/billing/_credit_grant.py @@ -128,7 +128,7 @@ class CreateParamsAmount(TypedDict): """ type: Literal["monetary"] """ - Specify the type of this amount. We currently only support `monetary` billing credits. + The type of this amount. We currently only support `monetary` billing credits. """ class CreateParamsAmountMonetary(TypedDict): diff --git a/stripe/billing/_credit_grant_service.py b/stripe/billing/_credit_grant_service.py index 4ebbe19e9..af32fb54b 100644 --- a/stripe/billing/_credit_grant_service.py +++ b/stripe/billing/_credit_grant_service.py @@ -61,7 +61,7 @@ class CreateParamsAmount(TypedDict): """ type: Literal["monetary"] """ - Specify the type of this amount. We currently only support `monetary` billing credits. + The type of this amount. We currently only support `monetary` billing credits. """ class CreateParamsAmountMonetary(TypedDict): diff --git a/stripe/billing_portal/_configuration.py b/stripe/billing_portal/_configuration.py index 42beb6605..ccd8f9f87 100644 --- a/stripe/billing_portal/_configuration.py +++ b/stripe/billing_portal/_configuration.py @@ -116,6 +116,21 @@ class CancellationReason(StripeObject): class SubscriptionUpdate(StripeObject): class Product(StripeObject): + class AdjustableQuantity(StripeObject): + enabled: bool + """ + If true, the quantity can be adjusted to any non-negative integer. + """ + maximum: Optional[int] + """ + The maximum quantity that can be set for the product. + """ + minimum: int + """ + The minimum quantity that can be set for the product. + """ + + adjustable_quantity: AdjustableQuantity prices: List[str] """ The list of price IDs which, when subscribed to, a subscription can be updated. @@ -124,6 +139,9 @@ class Product(StripeObject): """ The product ID. """ + _inner_class_types = { + "adjustable_quantity": AdjustableQuantity + } class ScheduleAtPeriodEnd(StripeObject): class Condition(StripeObject): @@ -366,6 +384,12 @@ class CreateParamsFeaturesSubscriptionUpdate(TypedDict): """ class CreateParamsFeaturesSubscriptionUpdateProduct(TypedDict): + adjustable_quantity: NotRequired[ + "Configuration.CreateParamsFeaturesSubscriptionUpdateProductAdjustableQuantity" + ] + """ + Control whether the quantity of the product can be adjusted. + """ prices: List[str] """ The list of price IDs for the product that a subscription can be updated to. @@ -375,6 +399,22 @@ class CreateParamsFeaturesSubscriptionUpdateProduct(TypedDict): The product id. """ + class CreateParamsFeaturesSubscriptionUpdateProductAdjustableQuantity( + TypedDict, + ): + enabled: bool + """ + Set to true if the quantity can be adjusted to any non-negative integer. + """ + maximum: NotRequired[int] + """ + The maximum quantity that can be set for the product. + """ + minimum: NotRequired[int] + """ + The minimum quantity that can be set for the product. + """ + class CreateParamsFeaturesSubscriptionUpdateScheduleAtPeriodEnd(TypedDict): conditions: NotRequired[ List[ @@ -592,6 +632,12 @@ class ModifyParamsFeaturesSubscriptionUpdate(TypedDict): """ class ModifyParamsFeaturesSubscriptionUpdateProduct(TypedDict): + adjustable_quantity: NotRequired[ + "Configuration.ModifyParamsFeaturesSubscriptionUpdateProductAdjustableQuantity" + ] + """ + Control whether the quantity of the product can be adjusted. + """ prices: List[str] """ The list of price IDs for the product that a subscription can be updated to. @@ -601,6 +647,22 @@ class ModifyParamsFeaturesSubscriptionUpdateProduct(TypedDict): The product id. """ + class ModifyParamsFeaturesSubscriptionUpdateProductAdjustableQuantity( + TypedDict, + ): + enabled: bool + """ + Set to true if the quantity can be adjusted to any non-negative integer. + """ + maximum: NotRequired[int] + """ + The maximum quantity that can be set for the product. + """ + minimum: NotRequired[int] + """ + The minimum quantity that can be set for the product. + """ + class ModifyParamsFeaturesSubscriptionUpdateScheduleAtPeriodEnd(TypedDict): conditions: NotRequired[ "Literal['']|List[Configuration.ModifyParamsFeaturesSubscriptionUpdateScheduleAtPeriodEndCondition]" diff --git a/stripe/billing_portal/_configuration_service.py b/stripe/billing_portal/_configuration_service.py index 2bf54fa64..c89bad718 100644 --- a/stripe/billing_portal/_configuration_service.py +++ b/stripe/billing_portal/_configuration_service.py @@ -185,6 +185,12 @@ class CreateParamsFeaturesSubscriptionUpdate(TypedDict): """ class CreateParamsFeaturesSubscriptionUpdateProduct(TypedDict): + adjustable_quantity: NotRequired[ + "ConfigurationService.CreateParamsFeaturesSubscriptionUpdateProductAdjustableQuantity" + ] + """ + Control whether the quantity of the product can be adjusted. + """ prices: List[str] """ The list of price IDs for the product that a subscription can be updated to. @@ -194,6 +200,22 @@ class CreateParamsFeaturesSubscriptionUpdateProduct(TypedDict): The product id. """ + class CreateParamsFeaturesSubscriptionUpdateProductAdjustableQuantity( + TypedDict, + ): + enabled: bool + """ + Set to true if the quantity can be adjusted to any non-negative integer. + """ + maximum: NotRequired[int] + """ + The maximum quantity that can be set for the product. + """ + minimum: NotRequired[int] + """ + The minimum quantity that can be set for the product. + """ + class CreateParamsFeaturesSubscriptionUpdateScheduleAtPeriodEnd(TypedDict): conditions: NotRequired[ List[ @@ -417,6 +439,12 @@ class UpdateParamsFeaturesSubscriptionUpdate(TypedDict): """ class UpdateParamsFeaturesSubscriptionUpdateProduct(TypedDict): + adjustable_quantity: NotRequired[ + "ConfigurationService.UpdateParamsFeaturesSubscriptionUpdateProductAdjustableQuantity" + ] + """ + Control whether the quantity of the product can be adjusted. + """ prices: List[str] """ The list of price IDs for the product that a subscription can be updated to. @@ -426,6 +454,22 @@ class UpdateParamsFeaturesSubscriptionUpdateProduct(TypedDict): The product id. """ + class UpdateParamsFeaturesSubscriptionUpdateProductAdjustableQuantity( + TypedDict, + ): + enabled: bool + """ + Set to true if the quantity can be adjusted to any non-negative integer. + """ + maximum: NotRequired[int] + """ + The maximum quantity that can be set for the product. + """ + minimum: NotRequired[int] + """ + The minimum quantity that can be set for the product. + """ + class UpdateParamsFeaturesSubscriptionUpdateScheduleAtPeriodEnd(TypedDict): conditions: NotRequired[ "Literal['']|List[ConfigurationService.UpdateParamsFeaturesSubscriptionUpdateScheduleAtPeriodEndCondition]" diff --git a/stripe/checkout/_session.py b/stripe/checkout/_session.py index 0d1c8d317..a95513f57 100644 --- a/stripe/checkout/_session.py +++ b/stripe/checkout/_session.py @@ -575,6 +575,10 @@ class RenderingOptions(StripeObject): """ How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. """ + template: Optional[str] + """ + ID of the invoice rendering template to be used for the generated invoice. + """ account_tax_ids: Optional[List[ExpandableField["TaxIdResource"]]] """ @@ -1214,6 +1218,16 @@ class Pix(StripeObject): """ The number of seconds after which Pix payment will expire. """ + 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 RevolutPay(StripeObject): setup_future_usage: Optional[Literal["none", "off_session"]] @@ -1436,7 +1450,7 @@ class PhoneNumberCollection(StripeObject): class PresentmentDetails(StripeObject): presentment_amount: int """ - Amount intended to be collected by this payment, denominated in presentment_currency. + Amount intended to be collected by this payment, denominated in `presentment_currency`. """ presentment_currency: str """ @@ -2053,6 +2067,10 @@ class CreateParams(RequestOptions): For `subscription` mode, there is a maximum of 20 line items and optional items with recurring Prices and 20 line items and optional items with one-time Prices. """ + origin_context: NotRequired[Literal["mobile_app", "web"]] + """ + Where the user is coming from. This informs the optimizations that are applied to the session. For example, a session originating from a mobile app may behave more like a native app, depending on the platform. This parameter is currently not allowed if `ui_mode` is `custom`. + """ payment_intent_data: NotRequired[ "Session.CreateParamsPaymentIntentData" ] @@ -2118,6 +2136,7 @@ class CreateParams(RequestOptions): "mobilepay", "multibanco", "naver_pay", + "nz_bank_account", "oxxo", "p24", "pay_by_bank", @@ -2544,6 +2563,10 @@ class CreateParamsInvoiceCreationInvoiceDataRenderingOptions(TypedDict): """ How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for this invoice. + """ class CreateParamsLineItem(TypedDict): adjustable_quantity: NotRequired[ @@ -3696,6 +3719,16 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. """ + setup_future_usage: NotRequired[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 CreateParamsPaymentMethodOptionsRevolutPay(TypedDict): setup_future_usage: NotRequired[Literal["none", "off_session"]] @@ -4318,6 +4351,9 @@ class CreateParamsSubscriptionData(TypedDict): class CreateParamsSubscriptionDataBillingMode(TypedDict): type: Literal["classic", "flexible"] + """ + Controls the calculation and orchestration of prorations and invoices for subscriptions. + """ class CreateParamsSubscriptionDataInvoiceSettings(TypedDict): issuer: NotRequired[ @@ -4857,6 +4893,10 @@ class RetrieveParams(RequestOptions): """ The optional items presented to the customer at checkout. """ + origin_context: Optional[Literal["mobile_app", "web"]] + """ + Where the user is coming from. This informs the optimizations that are applied to the session. + """ payment_intent: Optional[ExpandableField["PaymentIntent"]] """ The ID of the PaymentIntent for Checkout Sessions in `payment` mode. You can't confirm or cancel the PaymentIntent for a Checkout Session. To cancel, [expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead. diff --git a/stripe/checkout/_session_service.py b/stripe/checkout/_session_service.py index 2552a1e95..2f1bdc5e4 100644 --- a/stripe/checkout/_session_service.py +++ b/stripe/checkout/_session_service.py @@ -204,6 +204,10 @@ class CreateParams(TypedDict): For `subscription` mode, there is a maximum of 20 line items and optional items with recurring Prices and 20 line items and optional items with one-time Prices. """ + origin_context: NotRequired[Literal["mobile_app", "web"]] + """ + Where the user is coming from. This informs the optimizations that are applied to the session. For example, a session originating from a mobile app may behave more like a native app, depending on the platform. This parameter is currently not allowed if `ui_mode` is `custom`. + """ payment_intent_data: NotRequired[ "SessionService.CreateParamsPaymentIntentData" ] @@ -269,6 +273,7 @@ class CreateParams(TypedDict): "mobilepay", "multibanco", "naver_pay", + "nz_bank_account", "oxxo", "p24", "pay_by_bank", @@ -707,6 +712,10 @@ class CreateParamsInvoiceCreationInvoiceDataRenderingOptions(TypedDict): """ How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for this invoice. + """ class CreateParamsLineItem(TypedDict): adjustable_quantity: NotRequired[ @@ -1897,6 +1906,16 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. """ + setup_future_usage: NotRequired[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 CreateParamsPaymentMethodOptionsRevolutPay(TypedDict): setup_future_usage: NotRequired[Literal["none", "off_session"]] @@ -2519,6 +2538,9 @@ class CreateParamsSubscriptionData(TypedDict): class CreateParamsSubscriptionDataBillingMode(TypedDict): type: Literal["classic", "flexible"] + """ + Controls the calculation and orchestration of prorations and invoices for subscriptions. + """ class CreateParamsSubscriptionDataInvoiceSettings(TypedDict): issuer: NotRequired[ diff --git a/stripe/identity/_verification_session.py b/stripe/identity/_verification_session.py index c473ffc47..909092f60 100644 --- a/stripe/identity/_verification_session.py +++ b/stripe/identity/_verification_session.py @@ -152,11 +152,11 @@ class Redaction(StripeObject): """ class RelatedPerson(StripeObject): - account: Optional[str] + account: str """ Token referencing the associated Account of the related Person resource. """ - person: Optional[str] + person: str """ Token referencing the related Person resource. """ diff --git a/stripe/radar/_value_list.py b/stripe/radar/_value_list.py index 5fd7a3b34..66176699b 100644 --- a/stripe/radar/_value_list.py +++ b/stripe/radar/_value_list.py @@ -58,7 +58,7 @@ class CreateParams(RequestOptions): ] ] """ - Type of the items in the value list. One of `card_fingerprint`, `us_bank_account_fingerprint`, `sepa_debit_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, or `customer_id`. Use `string` if the item type is unknown or mixed. + Type of the items in the value list. One of `card_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, `customer_id`, `sepa_debit_fingerprint`, or `us_bank_account_fingerprint`. Use `string` if the item type is unknown or mixed. """ metadata: NotRequired[Dict[str, str]] """ @@ -177,7 +177,7 @@ class RetrieveParams(RequestOptions): "us_bank_account_fingerprint", ] """ - The type of items in the value list. One of `card_fingerprint`, `us_bank_account_fingerprint`, `sepa_debit_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, or `customer_id`. + The type of items in the value list. One of `card_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, `customer_id`, `sepa_debit_fingerprint`, or `us_bank_account_fingerprint`. """ list_items: ListObject["ValueListItem"] """ diff --git a/stripe/radar/_value_list_service.py b/stripe/radar/_value_list_service.py index ed270a34f..ca779ddeb 100644 --- a/stripe/radar/_value_list_service.py +++ b/stripe/radar/_value_list_service.py @@ -34,7 +34,7 @@ class CreateParams(TypedDict): ] ] """ - Type of the items in the value list. One of `card_fingerprint`, `us_bank_account_fingerprint`, `sepa_debit_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, or `customer_id`. Use `string` if the item type is unknown or mixed. + Type of the items in the value list. One of `card_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, `customer_id`, `sepa_debit_fingerprint`, or `us_bank_account_fingerprint`. Use `string` if the item type is unknown or mixed. """ metadata: NotRequired[Dict[str, str]] """ diff --git a/stripe/reporting/_report_run.py b/stripe/reporting/_report_run.py index 3a610d51b..49495e3c3 100644 --- a/stripe/reporting/_report_run.py +++ b/stripe/reporting/_report_run.py @@ -255,6 +255,7 @@ class CreateParamsParameters(TypedDict): "America/Coral_Harbour", "America/Cordoba", "America/Costa_Rica", + "America/Coyhaique", "America/Creston", "America/Cuiaba", "America/Curacao", diff --git a/stripe/reporting/_report_run_service.py b/stripe/reporting/_report_run_service.py index cc4505382..bd7f286c6 100644 --- a/stripe/reporting/_report_run_service.py +++ b/stripe/reporting/_report_run_service.py @@ -194,6 +194,7 @@ class CreateParamsParameters(TypedDict): "America/Coral_Harbour", "America/Cordoba", "America/Costa_Rica", + "America/Coyhaique", "America/Creston", "America/Cuiaba", "America/Curacao", diff --git a/stripe/tax/_registration.py b/stripe/tax/_registration.py index 747ca293b..5d57edf20 100644 --- a/stripe/tax/_registration.py +++ b/stripe/tax/_registration.py @@ -28,10 +28,18 @@ class Registration( class CountryOptions(StripeObject): class Ae(StripeObject): + class Standard(StripeObject): + place_of_supply_scheme: Literal["inbound_goods", "standard"] + """ + Place of supply scheme used in an Default standard registration. + """ + + standard: Optional[Standard] type: Literal["standard"] """ Type of registration in `country`. """ + _inner_class_types = {"standard": Standard} class Al(StripeObject): type: Literal["standard"] @@ -53,7 +61,9 @@ class Ao(StripeObject): class At(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -66,10 +76,18 @@ class Standard(StripeObject): _inner_class_types = {"standard": Standard} class Au(StripeObject): + class Standard(StripeObject): + place_of_supply_scheme: Literal["inbound_goods", "standard"] + """ + Place of supply scheme used in an Default standard registration. + """ + + standard: Optional[Standard] type: Literal["standard"] """ Type of registration in `country`. """ + _inner_class_types = {"standard": Standard} class Aw(StripeObject): type: Literal["standard"] @@ -103,7 +121,9 @@ class Bd(StripeObject): class Be(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -123,7 +143,9 @@ class Bf(StripeObject): class Bg(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -180,10 +202,18 @@ class Cd(StripeObject): """ class Ch(StripeObject): + class Standard(StripeObject): + place_of_supply_scheme: Literal["inbound_goods", "standard"] + """ + Place of supply scheme used in an Default standard registration. + """ + + standard: Optional[Standard] type: Literal["standard"] """ Type of registration in `country`. """ + _inner_class_types = {"standard": Standard} class Cl(StripeObject): type: Literal["simplified"] @@ -217,7 +247,9 @@ class Cv(StripeObject): class Cy(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -231,7 +263,9 @@ class Standard(StripeObject): class Cz(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -245,7 +279,9 @@ class Standard(StripeObject): class De(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -259,7 +295,9 @@ class Standard(StripeObject): class Dk(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -279,7 +317,9 @@ class Ec(StripeObject): class Ee(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -299,7 +339,9 @@ class Eg(StripeObject): class Es(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -319,7 +361,9 @@ class Et(StripeObject): class Fi(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -333,7 +377,9 @@ class Standard(StripeObject): class Fr(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -346,10 +392,18 @@ class Standard(StripeObject): _inner_class_types = {"standard": Standard} class Gb(StripeObject): + class Standard(StripeObject): + place_of_supply_scheme: Literal["inbound_goods", "standard"] + """ + Place of supply scheme used in an Default standard registration. + """ + + standard: Optional[Standard] type: Literal["standard"] """ Type of registration in `country`. """ + _inner_class_types = {"standard": Standard} class Ge(StripeObject): type: Literal["simplified"] @@ -365,7 +419,9 @@ class Gn(StripeObject): class Gr(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -379,7 +435,9 @@ class Standard(StripeObject): class Hr(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -393,7 +451,9 @@ class Standard(StripeObject): class Hu(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -413,7 +473,9 @@ class Id(StripeObject): class Ie(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -439,7 +501,9 @@ class Is(StripeObject): class It(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -452,10 +516,18 @@ class Standard(StripeObject): _inner_class_types = {"standard": Standard} class Jp(StripeObject): + class Standard(StripeObject): + place_of_supply_scheme: Literal["inbound_goods", "standard"] + """ + Place of supply scheme used in an Default standard registration. + """ + + standard: Optional[Standard] type: Literal["standard"] """ Type of registration in `country`. """ + _inner_class_types = {"standard": Standard} class Ke(StripeObject): type: Literal["simplified"] @@ -495,7 +567,9 @@ class La(StripeObject): class Lt(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -509,7 +583,9 @@ class Standard(StripeObject): class Lu(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -523,7 +599,9 @@ class Standard(StripeObject): class Lv(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -567,7 +645,9 @@ class Mr(StripeObject): class Mt(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -599,7 +679,9 @@ class Ng(StripeObject): class Nl(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -612,10 +694,18 @@ class Standard(StripeObject): _inner_class_types = {"standard": Standard} class No(StripeObject): + class Standard(StripeObject): + place_of_supply_scheme: Literal["inbound_goods", "standard"] + """ + Place of supply scheme used in an Default standard registration. + """ + + standard: Optional[Standard] type: Literal["standard"] """ Type of registration in `country`. """ + _inner_class_types = {"standard": Standard} class Np(StripeObject): type: Literal["simplified"] @@ -624,10 +714,18 @@ class Np(StripeObject): """ class Nz(StripeObject): + class Standard(StripeObject): + place_of_supply_scheme: Literal["inbound_goods", "standard"] + """ + Place of supply scheme used in an Default standard registration. + """ + + standard: Optional[Standard] type: Literal["standard"] """ Type of registration in `country`. """ + _inner_class_types = {"standard": Standard} class Om(StripeObject): type: Literal["standard"] @@ -649,7 +747,9 @@ class Ph(StripeObject): class Pl(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -663,7 +763,9 @@ class Standard(StripeObject): class Pt(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -677,7 +779,9 @@ class Standard(StripeObject): class Ro(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -709,7 +813,9 @@ class Sa(StripeObject): class Se(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -722,14 +828,24 @@ class Standard(StripeObject): _inner_class_types = {"standard": Standard} class Sg(StripeObject): + class Standard(StripeObject): + place_of_supply_scheme: Literal["inbound_goods", "standard"] + """ + Place of supply scheme used in an Default standard registration. + """ + + standard: Optional[Standard] type: Literal["standard"] """ Type of registration in `country`. """ + _inner_class_types = {"standard": Standard} class Si(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -743,7 +859,9 @@ class Standard(StripeObject): class Sk(StripeObject): class Standard(StripeObject): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1519,17 +1637,45 @@ class CreateParamsCountryOptions(_CreateParamsCountryOptionsBase): """ class CreateParamsCountryOptionsAe(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsAeStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsAeStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsAl(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsAlStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsAlStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsAm(TypedDict): type: Literal["simplified"] """ @@ -1537,11 +1683,25 @@ class CreateParamsCountryOptionsAm(TypedDict): """ class CreateParamsCountryOptionsAo(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsAoStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsAoStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsAt(TypedDict): standard: NotRequired[ "Registration.CreateParamsCountryOptionsAtStandard" @@ -1555,23 +1715,53 @@ class CreateParamsCountryOptionsAt(TypedDict): """ class CreateParamsCountryOptionsAtStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsAu(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsAuStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsAuStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsAw(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsAwStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsAwStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsAz(TypedDict): type: Literal["simplified"] """ @@ -1579,23 +1769,65 @@ class CreateParamsCountryOptionsAz(TypedDict): """ class CreateParamsCountryOptionsBa(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsBaStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsBaStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsBb(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsBbStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsBbStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsBd(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsBdStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsBdStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsBe(TypedDict): standard: NotRequired[ "Registration.CreateParamsCountryOptionsBeStandard" @@ -1609,17 +1841,33 @@ class CreateParamsCountryOptionsBe(TypedDict): """ class CreateParamsCountryOptionsBeStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsBf(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsBfStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsBfStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsBg(TypedDict): standard: NotRequired[ "Registration.CreateParamsCountryOptionsBgStandard" @@ -1633,17 +1881,33 @@ class CreateParamsCountryOptionsBg(TypedDict): """ class CreateParamsCountryOptionsBgStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsBh(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsBhStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsBhStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsBj(TypedDict): type: Literal["simplified"] """ @@ -1651,11 +1915,25 @@ class CreateParamsCountryOptionsBj(TypedDict): """ class CreateParamsCountryOptionsBs(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsBsStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsBsStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsBy(TypedDict): type: Literal["simplified"] """ @@ -1681,17 +1959,45 @@ class CreateParamsCountryOptionsCaProvinceStandard(TypedDict): """ class CreateParamsCountryOptionsCd(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsCdStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsCdStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsCh(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsChStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsChStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsCl(TypedDict): type: Literal["simplified"] """ @@ -1735,7 +2041,9 @@ class CreateParamsCountryOptionsCy(TypedDict): """ class CreateParamsCountryOptionsCyStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1753,7 +2061,9 @@ class CreateParamsCountryOptionsCz(TypedDict): """ class CreateParamsCountryOptionsCzStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1771,7 +2081,9 @@ class CreateParamsCountryOptionsDe(TypedDict): """ class CreateParamsCountryOptionsDeStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1789,7 +2101,9 @@ class CreateParamsCountryOptionsDk(TypedDict): """ class CreateParamsCountryOptionsDkStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1813,7 +2127,9 @@ class CreateParamsCountryOptionsEe(TypedDict): """ class CreateParamsCountryOptionsEeStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1837,17 +2153,33 @@ class CreateParamsCountryOptionsEs(TypedDict): """ class CreateParamsCountryOptionsEsStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsEt(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsEtStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsEtStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsFi(TypedDict): standard: NotRequired[ "Registration.CreateParamsCountryOptionsFiStandard" @@ -1861,7 +2193,9 @@ class CreateParamsCountryOptionsFi(TypedDict): """ class CreateParamsCountryOptionsFiStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1879,17 +2213,33 @@ class CreateParamsCountryOptionsFr(TypedDict): """ class CreateParamsCountryOptionsFrStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsGb(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsGbStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsGbStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsGe(TypedDict): type: Literal["simplified"] """ @@ -1897,11 +2247,25 @@ class CreateParamsCountryOptionsGe(TypedDict): """ class CreateParamsCountryOptionsGn(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsGnStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsGnStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsGr(TypedDict): standard: NotRequired[ "Registration.CreateParamsCountryOptionsGrStandard" @@ -1915,7 +2279,9 @@ class CreateParamsCountryOptionsGr(TypedDict): """ class CreateParamsCountryOptionsGrStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1933,7 +2299,9 @@ class CreateParamsCountryOptionsHr(TypedDict): """ class CreateParamsCountryOptionsHrStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1951,7 +2319,9 @@ class CreateParamsCountryOptionsHu(TypedDict): """ class CreateParamsCountryOptionsHuStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1975,7 +2345,9 @@ class CreateParamsCountryOptionsIe(TypedDict): """ class CreateParamsCountryOptionsIeStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1987,11 +2359,25 @@ class CreateParamsCountryOptionsIn(TypedDict): """ class CreateParamsCountryOptionsIs(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsIsStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsIsStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsIt(TypedDict): standard: NotRequired[ "Registration.CreateParamsCountryOptionsItStandard" @@ -2005,17 +2391,33 @@ class CreateParamsCountryOptionsIt(TypedDict): """ class CreateParamsCountryOptionsItStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsJp(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsJpStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsJpStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsKe(TypedDict): type: Literal["simplified"] """ @@ -2065,7 +2467,9 @@ class CreateParamsCountryOptionsLt(TypedDict): """ class CreateParamsCountryOptionsLtStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -2083,7 +2487,9 @@ class CreateParamsCountryOptionsLu(TypedDict): """ class CreateParamsCountryOptionsLuStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -2101,7 +2507,9 @@ class CreateParamsCountryOptionsLv(TypedDict): """ class CreateParamsCountryOptionsLvStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -2119,23 +2527,65 @@ class CreateParamsCountryOptionsMd(TypedDict): """ class CreateParamsCountryOptionsMe(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsMeStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsMeStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsMk(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsMkStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsMkStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsMr(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsMrStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsMrStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsMt(TypedDict): standard: NotRequired[ "Registration.CreateParamsCountryOptionsMtStandard" @@ -2149,7 +2599,9 @@ class CreateParamsCountryOptionsMt(TypedDict): """ class CreateParamsCountryOptionsMtStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -2185,17 +2637,33 @@ class CreateParamsCountryOptionsNl(TypedDict): """ class CreateParamsCountryOptionsNlStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsNo(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsNoStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsNoStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsNp(TypedDict): type: Literal["simplified"] """ @@ -2203,17 +2671,45 @@ class CreateParamsCountryOptionsNp(TypedDict): """ class CreateParamsCountryOptionsNz(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsNzStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsNzStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsOm(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsOmStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsOmStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsPe(TypedDict): type: Literal["simplified"] """ @@ -2239,7 +2735,9 @@ class CreateParamsCountryOptionsPl(TypedDict): """ class CreateParamsCountryOptionsPlStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -2257,7 +2755,9 @@ class CreateParamsCountryOptionsPt(TypedDict): """ class CreateParamsCountryOptionsPtStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -2275,17 +2775,33 @@ class CreateParamsCountryOptionsRo(TypedDict): """ class CreateParamsCountryOptionsRoStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsRs(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsRsStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsRsStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsRu(TypedDict): type: Literal["simplified"] """ @@ -2311,17 +2827,33 @@ class CreateParamsCountryOptionsSe(TypedDict): """ class CreateParamsCountryOptionsSeStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsSg(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsSgStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsSgStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsSi(TypedDict): standard: NotRequired[ "Registration.CreateParamsCountryOptionsSiStandard" @@ -2335,7 +2867,9 @@ class CreateParamsCountryOptionsSi(TypedDict): """ class CreateParamsCountryOptionsSiStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -2353,7 +2887,9 @@ class CreateParamsCountryOptionsSk(TypedDict): """ class CreateParamsCountryOptionsSkStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -2365,11 +2901,25 @@ class CreateParamsCountryOptionsSn(TypedDict): """ class CreateParamsCountryOptionsSr(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsSrStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsSrStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsTh(TypedDict): type: Literal["simplified"] """ @@ -2475,11 +3025,25 @@ class CreateParamsCountryOptionsUsStateSalesTaxElection(TypedDict): """ class CreateParamsCountryOptionsUy(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsUyStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsUyStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsUz(TypedDict): type: Literal["simplified"] """ @@ -2493,11 +3057,25 @@ class CreateParamsCountryOptionsVn(TypedDict): """ class CreateParamsCountryOptionsZa(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsZaStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsZaStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsZm(TypedDict): type: Literal["simplified"] """ @@ -2505,11 +3083,25 @@ class CreateParamsCountryOptionsZm(TypedDict): """ class CreateParamsCountryOptionsZw(TypedDict): + standard: NotRequired[ + "Registration.CreateParamsCountryOptionsZwStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsZwStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class ListParams(RequestOptions): ending_before: NotRequired[str] """ diff --git a/stripe/tax/_registration_service.py b/stripe/tax/_registration_service.py index f8abadea1..f1e8ae849 100644 --- a/stripe/tax/_registration_service.py +++ b/stripe/tax/_registration_service.py @@ -435,17 +435,45 @@ class CreateParamsCountryOptions(_CreateParamsCountryOptionsBase): """ class CreateParamsCountryOptionsAe(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsAeStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsAeStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsAl(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsAlStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsAlStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsAm(TypedDict): type: Literal["simplified"] """ @@ -453,11 +481,25 @@ class CreateParamsCountryOptionsAm(TypedDict): """ class CreateParamsCountryOptionsAo(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsAoStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsAoStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsAt(TypedDict): standard: NotRequired[ "RegistrationService.CreateParamsCountryOptionsAtStandard" @@ -471,23 +513,53 @@ class CreateParamsCountryOptionsAt(TypedDict): """ class CreateParamsCountryOptionsAtStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsAu(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsAuStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsAuStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsAw(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsAwStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsAwStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsAz(TypedDict): type: Literal["simplified"] """ @@ -495,23 +567,65 @@ class CreateParamsCountryOptionsAz(TypedDict): """ class CreateParamsCountryOptionsBa(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsBaStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsBaStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsBb(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsBbStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsBbStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsBd(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsBdStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsBdStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsBe(TypedDict): standard: NotRequired[ "RegistrationService.CreateParamsCountryOptionsBeStandard" @@ -525,17 +639,33 @@ class CreateParamsCountryOptionsBe(TypedDict): """ class CreateParamsCountryOptionsBeStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsBf(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsBfStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsBfStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsBg(TypedDict): standard: NotRequired[ "RegistrationService.CreateParamsCountryOptionsBgStandard" @@ -549,17 +679,33 @@ class CreateParamsCountryOptionsBg(TypedDict): """ class CreateParamsCountryOptionsBgStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsBh(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsBhStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsBhStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsBj(TypedDict): type: Literal["simplified"] """ @@ -567,11 +713,25 @@ class CreateParamsCountryOptionsBj(TypedDict): """ class CreateParamsCountryOptionsBs(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsBsStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsBsStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsBy(TypedDict): type: Literal["simplified"] """ @@ -597,17 +757,45 @@ class CreateParamsCountryOptionsCaProvinceStandard(TypedDict): """ class CreateParamsCountryOptionsCd(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsCdStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsCdStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsCh(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsChStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsChStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsCl(TypedDict): type: Literal["simplified"] """ @@ -651,7 +839,9 @@ class CreateParamsCountryOptionsCy(TypedDict): """ class CreateParamsCountryOptionsCyStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -669,7 +859,9 @@ class CreateParamsCountryOptionsCz(TypedDict): """ class CreateParamsCountryOptionsCzStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -687,7 +879,9 @@ class CreateParamsCountryOptionsDe(TypedDict): """ class CreateParamsCountryOptionsDeStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -705,7 +899,9 @@ class CreateParamsCountryOptionsDk(TypedDict): """ class CreateParamsCountryOptionsDkStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -729,7 +925,9 @@ class CreateParamsCountryOptionsEe(TypedDict): """ class CreateParamsCountryOptionsEeStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -753,17 +951,33 @@ class CreateParamsCountryOptionsEs(TypedDict): """ class CreateParamsCountryOptionsEsStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsEt(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsEtStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsEtStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsFi(TypedDict): standard: NotRequired[ "RegistrationService.CreateParamsCountryOptionsFiStandard" @@ -777,7 +991,9 @@ class CreateParamsCountryOptionsFi(TypedDict): """ class CreateParamsCountryOptionsFiStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -795,17 +1011,33 @@ class CreateParamsCountryOptionsFr(TypedDict): """ class CreateParamsCountryOptionsFrStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsGb(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsGbStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsGbStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsGe(TypedDict): type: Literal["simplified"] """ @@ -813,11 +1045,25 @@ class CreateParamsCountryOptionsGe(TypedDict): """ class CreateParamsCountryOptionsGn(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsGnStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsGnStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsGr(TypedDict): standard: NotRequired[ "RegistrationService.CreateParamsCountryOptionsGrStandard" @@ -831,7 +1077,9 @@ class CreateParamsCountryOptionsGr(TypedDict): """ class CreateParamsCountryOptionsGrStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -849,7 +1097,9 @@ class CreateParamsCountryOptionsHr(TypedDict): """ class CreateParamsCountryOptionsHrStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -867,7 +1117,9 @@ class CreateParamsCountryOptionsHu(TypedDict): """ class CreateParamsCountryOptionsHuStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -891,7 +1143,9 @@ class CreateParamsCountryOptionsIe(TypedDict): """ class CreateParamsCountryOptionsIeStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -903,11 +1157,25 @@ class CreateParamsCountryOptionsIn(TypedDict): """ class CreateParamsCountryOptionsIs(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsIsStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsIsStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsIt(TypedDict): standard: NotRequired[ "RegistrationService.CreateParamsCountryOptionsItStandard" @@ -921,17 +1189,33 @@ class CreateParamsCountryOptionsIt(TypedDict): """ class CreateParamsCountryOptionsItStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsJp(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsJpStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsJpStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsKe(TypedDict): type: Literal["simplified"] """ @@ -981,7 +1265,9 @@ class CreateParamsCountryOptionsLt(TypedDict): """ class CreateParamsCountryOptionsLtStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -999,7 +1285,9 @@ class CreateParamsCountryOptionsLu(TypedDict): """ class CreateParamsCountryOptionsLuStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1017,7 +1305,9 @@ class CreateParamsCountryOptionsLv(TypedDict): """ class CreateParamsCountryOptionsLvStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1035,23 +1325,65 @@ class CreateParamsCountryOptionsMd(TypedDict): """ class CreateParamsCountryOptionsMe(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsMeStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsMeStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsMk(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsMkStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsMkStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsMr(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsMrStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsMrStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsMt(TypedDict): standard: NotRequired[ "RegistrationService.CreateParamsCountryOptionsMtStandard" @@ -1065,7 +1397,9 @@ class CreateParamsCountryOptionsMt(TypedDict): """ class CreateParamsCountryOptionsMtStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1101,17 +1435,33 @@ class CreateParamsCountryOptionsNl(TypedDict): """ class CreateParamsCountryOptionsNlStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsNo(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsNoStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsNoStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsNp(TypedDict): type: Literal["simplified"] """ @@ -1119,17 +1469,45 @@ class CreateParamsCountryOptionsNp(TypedDict): """ class CreateParamsCountryOptionsNz(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsNzStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsNzStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsOm(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsOmStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsOmStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsPe(TypedDict): type: Literal["simplified"] """ @@ -1155,7 +1533,9 @@ class CreateParamsCountryOptionsPl(TypedDict): """ class CreateParamsCountryOptionsPlStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1173,7 +1553,9 @@ class CreateParamsCountryOptionsPt(TypedDict): """ class CreateParamsCountryOptionsPtStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1191,17 +1573,33 @@ class CreateParamsCountryOptionsRo(TypedDict): """ class CreateParamsCountryOptionsRoStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsRs(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsRsStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsRsStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsRu(TypedDict): type: Literal["simplified"] """ @@ -1227,17 +1625,33 @@ class CreateParamsCountryOptionsSe(TypedDict): """ class CreateParamsCountryOptionsSeStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ class CreateParamsCountryOptionsSg(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsSgStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsSgStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsSi(TypedDict): standard: NotRequired[ "RegistrationService.CreateParamsCountryOptionsSiStandard" @@ -1251,7 +1665,9 @@ class CreateParamsCountryOptionsSi(TypedDict): """ class CreateParamsCountryOptionsSiStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1269,7 +1685,9 @@ class CreateParamsCountryOptionsSk(TypedDict): """ class CreateParamsCountryOptionsSkStandard(TypedDict): - place_of_supply_scheme: Literal["small_seller", "standard"] + place_of_supply_scheme: Literal[ + "inbound_goods", "small_seller", "standard" + ] """ Place of supply scheme used in an EU standard registration. """ @@ -1281,11 +1699,25 @@ class CreateParamsCountryOptionsSn(TypedDict): """ class CreateParamsCountryOptionsSr(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsSrStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsSrStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsTh(TypedDict): type: Literal["simplified"] """ @@ -1391,11 +1823,25 @@ class CreateParamsCountryOptionsUsStateSalesTaxElection(TypedDict): """ class CreateParamsCountryOptionsUy(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsUyStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsUyStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsUz(TypedDict): type: Literal["simplified"] """ @@ -1409,11 +1855,25 @@ class CreateParamsCountryOptionsVn(TypedDict): """ class CreateParamsCountryOptionsZa(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsZaStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsZaStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class CreateParamsCountryOptionsZm(TypedDict): type: Literal["simplified"] """ @@ -1421,11 +1881,25 @@ class CreateParamsCountryOptionsZm(TypedDict): """ class CreateParamsCountryOptionsZw(TypedDict): + standard: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsZwStandard" + ] + """ + Options for the standard registration. + """ type: Literal["standard"] """ Type of registration to be created in `country`. """ + class CreateParamsCountryOptionsZwStandard(TypedDict): + place_of_supply_scheme: NotRequired[ + Literal["inbound_goods", "standard"] + ] + """ + Place of supply scheme used in an standard registration. + """ + class ListParams(TypedDict): ending_before: NotRequired[str] """ diff --git a/stripe/terminal/_configuration.py b/stripe/terminal/_configuration.py index 058a261ce..e63dd14e1 100644 --- a/stripe/terminal/_configuration.py +++ b/stripe/terminal/_configuration.py @@ -66,6 +66,20 @@ class StripeS700(StripeObject): """ class Tipping(StripeObject): + class Aed(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class Aud(StripeObject): fixed_amounts: Optional[List[int]] """ @@ -80,6 +94,20 @@ class Aud(StripeObject): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class Bgn(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class Cad(StripeObject): fixed_amounts: Optional[List[int]] """ @@ -178,6 +206,20 @@ class Hkd(StripeObject): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class Huf(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class Jpy(StripeObject): fixed_amounts: Optional[List[int]] """ @@ -248,6 +290,20 @@ class Pln(StripeObject): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class Ron(StripeObject): + fixed_amounts: Optional[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: Optional[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: Optional[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class Sek(StripeObject): fixed_amounts: Optional[List[int]] """ @@ -290,7 +346,9 @@ class Usd(StripeObject): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + aed: Optional[Aed] aud: Optional[Aud] + bgn: Optional[Bgn] cad: Optional[Cad] chf: Optional[Chf] czk: Optional[Czk] @@ -298,16 +356,20 @@ class Usd(StripeObject): eur: Optional[Eur] gbp: Optional[Gbp] hkd: Optional[Hkd] + huf: Optional[Huf] jpy: Optional[Jpy] myr: Optional[Myr] nok: Optional[Nok] nzd: Optional[Nzd] pln: Optional[Pln] + ron: Optional[Ron] sek: Optional[Sek] sgd: Optional[Sgd] usd: Optional[Usd] _inner_class_types = { + "aed": Aed, "aud": Aud, + "bgn": Bgn, "cad": Cad, "chf": Chf, "czk": Czk, @@ -315,11 +377,13 @@ class Usd(StripeObject): "eur": Eur, "gbp": Gbp, "hkd": Hkd, + "huf": Huf, "jpy": Jpy, "myr": Myr, "nok": Nok, "nzd": Nzd, "pln": Pln, + "ron": Ron, "sek": Sek, "sgd": Sgd, "usd": Usd, @@ -464,10 +528,18 @@ class CreateParamsStripeS700(TypedDict): """ class CreateParamsTipping(TypedDict): + aed: NotRequired["Configuration.CreateParamsTippingAed"] + """ + Tipping configuration for AED + """ aud: NotRequired["Configuration.CreateParamsTippingAud"] """ Tipping configuration for AUD """ + bgn: NotRequired["Configuration.CreateParamsTippingBgn"] + """ + Tipping configuration for BGN + """ cad: NotRequired["Configuration.CreateParamsTippingCad"] """ Tipping configuration for CAD @@ -496,6 +568,10 @@ class CreateParamsTipping(TypedDict): """ Tipping configuration for HKD """ + huf: NotRequired["Configuration.CreateParamsTippingHuf"] + """ + Tipping configuration for HUF + """ jpy: NotRequired["Configuration.CreateParamsTippingJpy"] """ Tipping configuration for JPY @@ -516,6 +592,10 @@ class CreateParamsTipping(TypedDict): """ Tipping configuration for PLN """ + ron: NotRequired["Configuration.CreateParamsTippingRon"] + """ + Tipping configuration for RON + """ sek: NotRequired["Configuration.CreateParamsTippingSek"] """ Tipping configuration for SEK @@ -529,6 +609,20 @@ class CreateParamsTipping(TypedDict): Tipping configuration for USD """ + class CreateParamsTippingAed(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class CreateParamsTippingAud(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -543,6 +637,20 @@ class CreateParamsTippingAud(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class CreateParamsTippingBgn(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class CreateParamsTippingCad(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -641,6 +749,20 @@ class CreateParamsTippingHkd(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class CreateParamsTippingHuf(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class CreateParamsTippingJpy(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -711,6 +833,20 @@ class CreateParamsTippingPln(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class CreateParamsTippingRon(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class CreateParamsTippingSek(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -933,10 +1069,18 @@ class ModifyParamsStripeS700(TypedDict): """ class ModifyParamsTipping(TypedDict): + aed: NotRequired["Configuration.ModifyParamsTippingAed"] + """ + Tipping configuration for AED + """ aud: NotRequired["Configuration.ModifyParamsTippingAud"] """ Tipping configuration for AUD """ + bgn: NotRequired["Configuration.ModifyParamsTippingBgn"] + """ + Tipping configuration for BGN + """ cad: NotRequired["Configuration.ModifyParamsTippingCad"] """ Tipping configuration for CAD @@ -965,6 +1109,10 @@ class ModifyParamsTipping(TypedDict): """ Tipping configuration for HKD """ + huf: NotRequired["Configuration.ModifyParamsTippingHuf"] + """ + Tipping configuration for HUF + """ jpy: NotRequired["Configuration.ModifyParamsTippingJpy"] """ Tipping configuration for JPY @@ -985,6 +1133,10 @@ class ModifyParamsTipping(TypedDict): """ Tipping configuration for PLN """ + ron: NotRequired["Configuration.ModifyParamsTippingRon"] + """ + Tipping configuration for RON + """ sek: NotRequired["Configuration.ModifyParamsTippingSek"] """ Tipping configuration for SEK @@ -998,6 +1150,20 @@ class ModifyParamsTipping(TypedDict): Tipping configuration for USD """ + class ModifyParamsTippingAed(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class ModifyParamsTippingAud(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -1012,6 +1178,20 @@ class ModifyParamsTippingAud(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class ModifyParamsTippingBgn(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class ModifyParamsTippingCad(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -1110,6 +1290,20 @@ class ModifyParamsTippingHkd(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class ModifyParamsTippingHuf(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class ModifyParamsTippingJpy(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -1180,6 +1374,20 @@ class ModifyParamsTippingPln(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class ModifyParamsTippingRon(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class ModifyParamsTippingSek(TypedDict): fixed_amounts: NotRequired[List[int]] """ diff --git a/stripe/terminal/_configuration_service.py b/stripe/terminal/_configuration_service.py index 08664f686..25f494129 100644 --- a/stripe/terminal/_configuration_service.py +++ b/stripe/terminal/_configuration_service.py @@ -87,10 +87,18 @@ class CreateParamsStripeS700(TypedDict): """ class CreateParamsTipping(TypedDict): + aed: NotRequired["ConfigurationService.CreateParamsTippingAed"] + """ + Tipping configuration for AED + """ aud: NotRequired["ConfigurationService.CreateParamsTippingAud"] """ Tipping configuration for AUD """ + bgn: NotRequired["ConfigurationService.CreateParamsTippingBgn"] + """ + Tipping configuration for BGN + """ cad: NotRequired["ConfigurationService.CreateParamsTippingCad"] """ Tipping configuration for CAD @@ -119,6 +127,10 @@ class CreateParamsTipping(TypedDict): """ Tipping configuration for HKD """ + huf: NotRequired["ConfigurationService.CreateParamsTippingHuf"] + """ + Tipping configuration for HUF + """ jpy: NotRequired["ConfigurationService.CreateParamsTippingJpy"] """ Tipping configuration for JPY @@ -139,6 +151,10 @@ class CreateParamsTipping(TypedDict): """ Tipping configuration for PLN """ + ron: NotRequired["ConfigurationService.CreateParamsTippingRon"] + """ + Tipping configuration for RON + """ sek: NotRequired["ConfigurationService.CreateParamsTippingSek"] """ Tipping configuration for SEK @@ -152,6 +168,20 @@ class CreateParamsTipping(TypedDict): Tipping configuration for USD """ + class CreateParamsTippingAed(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class CreateParamsTippingAud(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -166,6 +196,20 @@ class CreateParamsTippingAud(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class CreateParamsTippingBgn(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class CreateParamsTippingCad(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -264,6 +308,20 @@ class CreateParamsTippingHkd(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class CreateParamsTippingHuf(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class CreateParamsTippingJpy(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -334,6 +392,20 @@ class CreateParamsTippingPln(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class CreateParamsTippingRon(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class CreateParamsTippingSek(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -568,10 +640,18 @@ class UpdateParamsStripeS700(TypedDict): """ class UpdateParamsTipping(TypedDict): + aed: NotRequired["ConfigurationService.UpdateParamsTippingAed"] + """ + Tipping configuration for AED + """ aud: NotRequired["ConfigurationService.UpdateParamsTippingAud"] """ Tipping configuration for AUD """ + bgn: NotRequired["ConfigurationService.UpdateParamsTippingBgn"] + """ + Tipping configuration for BGN + """ cad: NotRequired["ConfigurationService.UpdateParamsTippingCad"] """ Tipping configuration for CAD @@ -600,6 +680,10 @@ class UpdateParamsTipping(TypedDict): """ Tipping configuration for HKD """ + huf: NotRequired["ConfigurationService.UpdateParamsTippingHuf"] + """ + Tipping configuration for HUF + """ jpy: NotRequired["ConfigurationService.UpdateParamsTippingJpy"] """ Tipping configuration for JPY @@ -620,6 +704,10 @@ class UpdateParamsTipping(TypedDict): """ Tipping configuration for PLN """ + ron: NotRequired["ConfigurationService.UpdateParamsTippingRon"] + """ + Tipping configuration for RON + """ sek: NotRequired["ConfigurationService.UpdateParamsTippingSek"] """ Tipping configuration for SEK @@ -633,6 +721,20 @@ class UpdateParamsTipping(TypedDict): Tipping configuration for USD """ + class UpdateParamsTippingAed(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class UpdateParamsTippingAud(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -647,6 +749,20 @@ class UpdateParamsTippingAud(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class UpdateParamsTippingBgn(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class UpdateParamsTippingCad(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -745,6 +861,20 @@ class UpdateParamsTippingHkd(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class UpdateParamsTippingHuf(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class UpdateParamsTippingJpy(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -815,6 +945,20 @@ class UpdateParamsTippingPln(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class UpdateParamsTippingRon(TypedDict): + fixed_amounts: NotRequired[List[int]] + """ + Fixed amounts displayed when collecting a tip + """ + percentages: NotRequired[List[int]] + """ + Percentages displayed when collecting a tip + """ + smart_tip_threshold: NotRequired[int] + """ + Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + """ + class UpdateParamsTippingSek(TypedDict): fixed_amounts: NotRequired[List[int]] """ From 68adcec4f2ed8bdc1d9a0676722a63884ed80df3 Mon Sep 17 00:00:00 2001 From: Ramya Rao Date: Wed, 30 Jul 2025 10:20:42 -0700 Subject: [PATCH 02/31] Bump version to 12.4.0 --- CHANGELOG.md | 30 +++++++++++++++++++++++++++--- VERSION | 2 +- stripe/_version.py | 2 +- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb21e1279..98850c473 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,31 @@ +## 12.4.0 - 2025-07-30 +This release changes the pinned API version to `2025-07-30.basil`. + +* [#1541](https://github.com/stripe/stripe-python/pull/1541) Update generated code + * Add support for `instant_payouts_promotion` on `AccountSession.Component` and `AccountSession.CreateParamsComponent` + * Add support for `adjustable_quantity` on `BillingPortal.Configuration.Feature.SubscriptionUpdate.Product`, `billing_portal.Configuration.CreateParamsFeatureSubscriptionUpdateProduct`, and `billing_portal.Configuration.ModifyParamsFeatureSubscriptionUpdateProduct` + * Remove support for value `disabled` from enum `Capability.status` + * Add support for `transaction_id` on `Charge.PaymentMethodDetail.Cashapp` + * Add support for `origin_context` on `Checkout.Session` and `checkout.Session.CreateParams` + * Add support for `template` on `Checkout.Session.InvoiceCreation.InvoiceDatum.RenderingOption`, `PaymentLink.CreateParamsInvoiceCreationInvoiceDatumRenderingOption`, `PaymentLink.InvoiceCreation.InvoiceDatum.RenderingOption`, `PaymentLink.ModifyParamsInvoiceCreationInvoiceDatumRenderingOption`, and `checkout.Session.CreateParamsInvoiceCreationInvoiceDatumRenderingOption` + * Add support for `setup_future_usage` on `Checkout.Session.PaymentMethodOption.Pix` and `checkout.Session.CreateParamsPaymentMethodOptionPix` + * Add support for new value `nz_bank_account` on enum `checkout.Session.CreateParams.payment_method_types` + * Change `Identity.VerificationSession.RelatedPerson.account` to be required + * Change `Identity.VerificationSession.RelatedPerson.person` to be required + * Add support for `duration` on `Invoice.CreatePreviewParamsScheduleDetailPhase`, `SubscriptionSchedule.CreateParamsPhase`, and `SubscriptionSchedule.ModifyParamsPhase` + * Change type of `Invoice.CreatePreviewParamsSubscriptionDetail.cancel_at`, `Subscription.CreateParams.cancel_at`, and `Subscription.ModifyParams.cancel_at` from `DateTime` to `DateTime | enum('max_period_end'|'min_period_end')` + * Add support for `price_data` on `PaymentLink.CreateParamsLineItem` + * Change `PaymentLink.CreateParamsLineItem.price` to be optional + * Add support for new value `America/Coyhaique` on enum `reporting.ReportRun.CreateParamsParameter.timezone` + * Add support for `standard` on `Tax.Registration.CountryOption.Ae`, `Tax.Registration.CountryOption.Au`, `Tax.Registration.CountryOption.Ch`, `Tax.Registration.CountryOption.Gb`, `Tax.Registration.CountryOption.Jp`, `Tax.Registration.CountryOption.No`, `Tax.Registration.CountryOption.Nz`, `Tax.Registration.CountryOption.Sg`, `tax.Registration.CreateParamsCountryOptionAe`, `tax.Registration.CreateParamsCountryOptionAl`, `tax.Registration.CreateParamsCountryOptionAo`, `tax.Registration.CreateParamsCountryOptionAu`, `tax.Registration.CreateParamsCountryOptionAw`, `tax.Registration.CreateParamsCountryOptionB`, `tax.Registration.CreateParamsCountryOptionBa`, `tax.Registration.CreateParamsCountryOptionBb`, `tax.Registration.CreateParamsCountryOptionBd`, `tax.Registration.CreateParamsCountryOptionBf`, `tax.Registration.CreateParamsCountryOptionBh`, `tax.Registration.CreateParamsCountryOptionCd`, `tax.Registration.CreateParamsCountryOptionCh`, `tax.Registration.CreateParamsCountryOptionEt`, `tax.Registration.CreateParamsCountryOptionGb`, `tax.Registration.CreateParamsCountryOptionGn`, `tax.Registration.CreateParamsCountryOptionIs`, `tax.Registration.CreateParamsCountryOptionJp`, `tax.Registration.CreateParamsCountryOptionMe`, `tax.Registration.CreateParamsCountryOptionMk`, `tax.Registration.CreateParamsCountryOptionMr`, `tax.Registration.CreateParamsCountryOptionNo`, `tax.Registration.CreateParamsCountryOptionNz`, `tax.Registration.CreateParamsCountryOptionOm`, `tax.Registration.CreateParamsCountryOptionR`, `tax.Registration.CreateParamsCountryOptionSg`, `tax.Registration.CreateParamsCountryOptionSr`, `tax.Registration.CreateParamsCountryOptionUy`, `tax.Registration.CreateParamsCountryOptionZa`, and `tax.Registration.CreateParamsCountryOptionZw` + * Add support for new value `inbound_goods` on enums `Tax.Registration.CountryOption.At.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Be.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Bg.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Cy.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Cz.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.De.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Dk.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.E.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Ee.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Fi.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Fr.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Gr.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Hr.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Hu.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Ie.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.It.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Lt.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Lu.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Lv.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Mt.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Nl.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Pl.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Pt.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Ro.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Se.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Si.Standard.place_of_supply_scheme`, `Tax.Registration.CountryOption.Sk.Standard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionAtStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionBeStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionBgStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionCyStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionCzStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionDeStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionDkStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionEStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionEeStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionFiStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionFrStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionGrStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionHrStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionHuStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionIeStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionItStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionLtStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionLuStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionLvStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionMtStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionNlStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionPlStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionPtStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionRoStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionSeStandard.place_of_supply_scheme`, `tax.Registration.CreateParamsCountryOptionSiStandard.place_of_supply_scheme`, and `tax.Registration.CreateParamsCountryOptionSkStandard.place_of_supply_scheme` + * Add support for `aed`, `bgn`, `huf`, and `ron` on `Terminal.Configuration.Tipping`, `terminal.Configuration.CreateParamsTipping`, and `terminal.Configuration.ModifyParamsTipping` + * Add support for new value `2025-07-30.basil` on enum `WebhookEndpoint.CreateParams.api_version` +* [#1537](https://github.com/stripe/stripe-python/pull/1537) Fix timeout type hint in RequestsClient + ## 12.3.0 - 2025-07-01 +This release changes the pinned API version to `2025-06-30.basil`. + * [#1526](https://github.com/stripe/stripe-python/pull/1526) Update generated code * Add support for `migrate` method on resource `Subscription` * Add support for `collect_payment_method` and `confirm_payment_intent` methods on resource `terminal.Reader` @@ -34,9 +61,6 @@ * Add support for new value `2025-06-30.basil` on enum `WebhookEndpoint.CreateParams.api_version` * Add support for snapshot event `terminal.reader.action_updated` with resource `terminal.Reader` * [#1534](https://github.com/stripe/stripe-python/pull/1534) Fix the link to releases page from readme -* [#1532](https://github.com/stripe/stripe-python/pull/1532) Added lint ignore instruction for deprecated import -* [#1524](https://github.com/stripe/stripe-python/pull/1524) Added import for the new deprecated services in stripe_client -* [#1522](https://github.com/stripe/stripe-python/pull/1522) Add a new deprecated v1 services section ## 12.2.0 - 2025-05-29 This release changes the pinned API version to `2025-05-28.basil`. diff --git a/VERSION b/VERSION index 4d23cb8e0..f8c17e780 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -12.3.0 +12.4.0 diff --git a/stripe/_version.py b/stripe/_version.py index a48d177fb..7c16e69ef 100644 --- a/stripe/_version.py +++ b/stripe/_version.py @@ -1 +1 @@ -VERSION = "12.3.0" +VERSION = "12.4.0" From ad7548f444c78a4b60921fcec07d7a88e671bce6 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 8 Aug 2025 23:22:00 +0000 Subject: [PATCH 03/31] Update generated code for v1895 and 2025-07-30.preview --- OPENAPI_VERSION | 2 +- stripe/_customer_session.py | 170 ++++++++++++++++++++++++++++ stripe/_customer_session_service.py | 86 ++++++++++++++ 3 files changed, 257 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 7e3c17467..6d92aa4f4 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1892 \ No newline at end of file +v1895 \ No newline at end of file diff --git a/stripe/_customer_session.py b/stripe/_customer_session.py index d0b4b6c4a..72d0d67a1 100644 --- a/stripe/_customer_session.py +++ b/stripe/_customer_session.py @@ -36,6 +36,80 @@ class BuyButton(StripeObject): Whether the buy button is enabled. """ + class CustomerSheet(StripeObject): + class Features(StripeObject): + payment_method_allow_redisplay_filters: Optional[ + List[Literal["always", "limited", "unspecified"]] + ] + """ + A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the customer sheet displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. + + If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. + """ + payment_method_remove: Optional[Literal["disabled", "enabled"]] + """ + Controls whether the customer sheet displays the option to remove a saved payment method." + + Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the [`customer` object](https://docs.stripe.com/api/payment_methods/object#payment_method_object-customer) from that [PaymentMethod](https://docs.stripe.com/api/payment_methods). + """ + + enabled: bool + """ + Whether the customer sheet is enabled. + """ + features: Optional[Features] + """ + This hash defines whether the customer sheet supports certain features. + """ + _inner_class_types = {"features": Features} + + class MobilePaymentElement(StripeObject): + class Features(StripeObject): + payment_method_allow_redisplay_filters: Optional[ + List[Literal["always", "limited", "unspecified"]] + ] + """ + A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the mobile payment element displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. + + If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. + """ + payment_method_redisplay: Optional[ + Literal["disabled", "enabled"] + ] + """ + Controls whether or not the mobile payment element shows saved payment methods. + """ + payment_method_remove: Optional[Literal["disabled", "enabled"]] + """ + Controls whether the mobile payment element displays the option to remove a saved payment method." + + Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the [`customer` object](https://docs.stripe.com/api/payment_methods/object#payment_method_object-customer) from that [PaymentMethod](https://docs.stripe.com/api/payment_methods). + """ + payment_method_save: Optional[Literal["disabled", "enabled"]] + """ + Controls whether the mobile payment element displays a checkbox offering to save a new payment method. + + If a customer checks the box, the [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) value on the PaymentMethod is set to `'always'` at confirmation time. For PaymentIntents, the [`setup_future_usage`](https://docs.stripe.com/api/payment_intents/object#payment_intent_object-setup_future_usage) value is also set to the value defined in `payment_method_save_usage`. + """ + payment_method_save_allow_redisplay_override: Optional[ + Literal["always", "limited", "unspecified"] + ] + """ + Allows overriding the value of allow_override when saving a new payment method when payment_method_save is set to disabled. Use values: "always", "limited", or "unspecified". + + If not specified, defaults to `nil` (no override value). + """ + + enabled: bool + """ + Whether the mobile payment element is enabled. + """ + features: Optional[Features] + """ + This hash defines whether the mobile payment element supports certain features. + """ + _inner_class_types = {"features": Features} + class PaymentElement(StripeObject): class Features(StripeObject): payment_method_allow_redisplay_filters: List[ @@ -95,6 +169,14 @@ class PricingTable(StripeObject): """ This hash contains whether the buy button is enabled. """ + customer_sheet: Optional[CustomerSheet] + """ + This hash contains whether the customer sheet is enabled and the features it supports. + """ + mobile_payment_element: Optional[MobilePaymentElement] + """ + This hash contains whether the mobile payment element is enabled and the features it supports. + """ payment_element: PaymentElement """ This hash contains whether the Payment Element is enabled and the features it supports. @@ -105,6 +187,8 @@ class PricingTable(StripeObject): """ _inner_class_types = { "buy_button": BuyButton, + "customer_sheet": CustomerSheet, + "mobile_payment_element": MobilePaymentElement, "payment_element": PaymentElement, "pricing_table": PricingTable, } @@ -134,6 +218,18 @@ class CreateParamsComponents(TypedDict): """ Configuration for buy button. """ + customer_sheet: NotRequired[ + "CustomerSession.CreateParamsComponentsCustomerSheet" + ] + """ + Configuration for the customer sheet. + """ + mobile_payment_element: NotRequired[ + "CustomerSession.CreateParamsComponentsMobilePaymentElement" + ] + """ + Configuration for the mobile payment element. + """ payment_element: NotRequired[ "CustomerSession.CreateParamsComponentsPaymentElement" ] @@ -153,6 +249,80 @@ class CreateParamsComponentsBuyButton(TypedDict): Whether the buy button is enabled. """ + class CreateParamsComponentsCustomerSheet(TypedDict): + enabled: bool + """ + Whether the customer sheet is enabled. + """ + features: NotRequired[ + "CustomerSession.CreateParamsComponentsCustomerSheetFeatures" + ] + """ + This hash defines whether the customer sheet supports certain features. + """ + + class CreateParamsComponentsCustomerSheetFeatures(TypedDict): + payment_method_allow_redisplay_filters: NotRequired[ + List[Literal["always", "limited", "unspecified"]] + ] + """ + A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the customer sheet displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. + + If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. + """ + payment_method_remove: NotRequired[Literal["disabled", "enabled"]] + """ + Controls whether the customer sheet displays the option to remove a saved payment method." + + Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the [`customer` object](https://docs.stripe.com/api/payment_methods/object#payment_method_object-customer) from that [PaymentMethod](https://docs.stripe.com/api/payment_methods). + """ + + class CreateParamsComponentsMobilePaymentElement(TypedDict): + enabled: bool + """ + Whether the mobile payment element is enabled. + """ + features: NotRequired[ + "CustomerSession.CreateParamsComponentsMobilePaymentElementFeatures" + ] + """ + This hash defines whether the mobile payment element supports certain features. + """ + + class CreateParamsComponentsMobilePaymentElementFeatures(TypedDict): + payment_method_allow_redisplay_filters: NotRequired[ + List[Literal["always", "limited", "unspecified"]] + ] + """ + A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the mobile payment element displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. + + If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. + """ + payment_method_redisplay: NotRequired[Literal["disabled", "enabled"]] + """ + Controls whether or not the mobile payment element shows saved payment methods. + """ + payment_method_remove: NotRequired[Literal["disabled", "enabled"]] + """ + Controls whether the mobile payment element displays the option to remove a saved payment method." + + Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the [`customer` object](https://docs.stripe.com/api/payment_methods/object#payment_method_object-customer) from that [PaymentMethod](https://docs.stripe.com/api/payment_methods). + """ + payment_method_save: NotRequired[Literal["disabled", "enabled"]] + """ + Controls whether the mobile payment element displays a checkbox offering to save a new payment method. + + If a customer checks the box, the [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) value on the PaymentMethod is set to `'always'` at confirmation time. For PaymentIntents, the [`setup_future_usage`](https://docs.stripe.com/api/payment_intents/object#payment_intent_object-setup_future_usage) value is also set to the value defined in `payment_method_save_usage`. + """ + payment_method_save_allow_redisplay_override: NotRequired[ + Literal["always", "limited", "unspecified"] + ] + """ + Allows overriding the value of allow_override when saving a new payment method when payment_method_save is set to disabled. Use values: "always", "limited", or "unspecified". + + If not specified, defaults to `nil` (no override value). + """ + class CreateParamsComponentsPaymentElement(TypedDict): enabled: bool """ diff --git a/stripe/_customer_session_service.py b/stripe/_customer_session_service.py index 45cb77aed..0fc841fa2 100644 --- a/stripe/_customer_session_service.py +++ b/stripe/_customer_session_service.py @@ -33,6 +33,18 @@ class CreateParamsComponents(TypedDict): """ Configuration for buy button. """ + customer_sheet: NotRequired[ + "CustomerSessionService.CreateParamsComponentsCustomerSheet" + ] + """ + Configuration for the customer sheet. + """ + mobile_payment_element: NotRequired[ + "CustomerSessionService.CreateParamsComponentsMobilePaymentElement" + ] + """ + Configuration for the mobile payment element. + """ payment_element: NotRequired[ "CustomerSessionService.CreateParamsComponentsPaymentElement" ] @@ -52,6 +64,80 @@ class CreateParamsComponentsBuyButton(TypedDict): Whether the buy button is enabled. """ + class CreateParamsComponentsCustomerSheet(TypedDict): + enabled: bool + """ + Whether the customer sheet is enabled. + """ + features: NotRequired[ + "CustomerSessionService.CreateParamsComponentsCustomerSheetFeatures" + ] + """ + This hash defines whether the customer sheet supports certain features. + """ + + class CreateParamsComponentsCustomerSheetFeatures(TypedDict): + payment_method_allow_redisplay_filters: NotRequired[ + List[Literal["always", "limited", "unspecified"]] + ] + """ + A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the customer sheet displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. + + If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. + """ + payment_method_remove: NotRequired[Literal["disabled", "enabled"]] + """ + Controls whether the customer sheet displays the option to remove a saved payment method." + + Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the [`customer` object](https://docs.stripe.com/api/payment_methods/object#payment_method_object-customer) from that [PaymentMethod](https://docs.stripe.com/api/payment_methods). + """ + + class CreateParamsComponentsMobilePaymentElement(TypedDict): + enabled: bool + """ + Whether the mobile payment element is enabled. + """ + features: NotRequired[ + "CustomerSessionService.CreateParamsComponentsMobilePaymentElementFeatures" + ] + """ + This hash defines whether the mobile payment element supports certain features. + """ + + class CreateParamsComponentsMobilePaymentElementFeatures(TypedDict): + payment_method_allow_redisplay_filters: NotRequired[ + List[Literal["always", "limited", "unspecified"]] + ] + """ + A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the mobile payment element displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. + + If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. + """ + payment_method_redisplay: NotRequired[Literal["disabled", "enabled"]] + """ + Controls whether or not the mobile payment element shows saved payment methods. + """ + payment_method_remove: NotRequired[Literal["disabled", "enabled"]] + """ + Controls whether the mobile payment element displays the option to remove a saved payment method." + + Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the [`customer` object](https://docs.stripe.com/api/payment_methods/object#payment_method_object-customer) from that [PaymentMethod](https://docs.stripe.com/api/payment_methods). + """ + payment_method_save: NotRequired[Literal["disabled", "enabled"]] + """ + Controls whether the mobile payment element displays a checkbox offering to save a new payment method. + + If a customer checks the box, the [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) value on the PaymentMethod is set to `'always'` at confirmation time. For PaymentIntents, the [`setup_future_usage`](https://docs.stripe.com/api/payment_intents/object#payment_intent_object-setup_future_usage) value is also set to the value defined in `payment_method_save_usage`. + """ + payment_method_save_allow_redisplay_override: NotRequired[ + Literal["always", "limited", "unspecified"] + ] + """ + Allows overriding the value of allow_override when saving a new payment method when payment_method_save is set to disabled. Use values: "always", "limited", or "unspecified". + + If not specified, defaults to `nil` (no override value). + """ + class CreateParamsComponentsPaymentElement(TypedDict): enabled: bool """ From 8f576afe574cc23aa824dfe4d039cc6123e18ff7 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:10:48 +0000 Subject: [PATCH 04/31] Update generated code for v1896 and 2025-07-30.preview --- OPENAPI_VERSION | 2 +- stripe/billing_portal/_configuration.py | 12 ++++++++++++ stripe/billing_portal/_configuration_service.py | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 6d92aa4f4..a475aac0f 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1895 \ No newline at end of file +v1896 \ No newline at end of file diff --git a/stripe/billing_portal/_configuration.py b/stripe/billing_portal/_configuration.py index ccd8f9f87..500b4fd43 100644 --- a/stripe/billing_portal/_configuration.py +++ b/stripe/billing_portal/_configuration.py @@ -236,6 +236,10 @@ class CreateParams(RequestOptions): """ Set of [key-value pairs](https://stripe.com/docs/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`. """ + name: NotRequired["Literal['']|str"] + """ + The name of the configuration. + """ class CreateParamsBusinessProfile(TypedDict): headline: NotRequired["Literal['']|str"] @@ -496,6 +500,10 @@ class ModifyParams(RequestOptions): """ Set of [key-value pairs](https://stripe.com/docs/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`. """ + name: NotRequired["Literal['']|str"] + """ + The name of the configuration. + """ class ModifyParamsBusinessProfile(TypedDict): headline: NotRequired["Literal['']|str"] @@ -728,6 +736,10 @@ class RetrieveParams(RequestOptions): """ Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. """ + name: Optional[str] + """ + The name of the configuration. + """ object: Literal["billing_portal.configuration"] """ String representing the object's type. Objects of the same type share the same value. diff --git a/stripe/billing_portal/_configuration_service.py b/stripe/billing_portal/_configuration_service.py index c89bad718..787686d41 100644 --- a/stripe/billing_portal/_configuration_service.py +++ b/stripe/billing_portal/_configuration_service.py @@ -37,6 +37,10 @@ class CreateParams(TypedDict): """ Set of [key-value pairs](https://stripe.com/docs/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`. """ + name: NotRequired["Literal['']|str"] + """ + The name of the configuration. + """ class CreateParamsBusinessProfile(TypedDict): headline: NotRequired["Literal['']|str"] @@ -303,6 +307,10 @@ class UpdateParams(TypedDict): """ Set of [key-value pairs](https://stripe.com/docs/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`. """ + name: NotRequired["Literal['']|str"] + """ + The name of the configuration. + """ class UpdateParamsBusinessProfile(TypedDict): headline: NotRequired["Literal['']|str"] From f865f4a24a4edb8d7931e3bce3d492dc64baac04 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 19:27:35 +0000 Subject: [PATCH 05/31] Update generated code for v1897 and 2025-07-30.preview --- OPENAPI_VERSION | 2 +- stripe/_charge.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index a475aac0f..06591a0ea 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1896 \ No newline at end of file +v1897 \ No newline at end of file diff --git a/stripe/_charge.py b/stripe/_charge.py index de812f283..6cdf3f878 100644 --- a/stripe/_charge.py +++ b/stripe/_charge.py @@ -166,7 +166,7 @@ class Rule(StripeObject): """ network_decline_code: Optional[str] """ - For charges declined by the network, a brand specific alphanumeric code which indicates the reason the authorization failed. + For charges declined by the network, an alphanumeric code which indicates the reason the charge failed. """ network_status: Optional[str] """ From 193b2904504c02c8406cb10b9ffb552c32ca5bd1 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 23:03:22 +0000 Subject: [PATCH 06/31] Update generated code for v1898 and 2025-07-30.preview --- OPENAPI_VERSION | 2 +- stripe/_invoice.py | 1 + stripe/_payment_intent.py | 1 + stripe/_quote_preview_invoice.py | 1 + stripe/_setup_attempt.py | 1 + stripe/_setup_intent.py | 1 + 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 06591a0ea..e5693c187 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1897 \ No newline at end of file +v1898 \ No newline at end of file diff --git a/stripe/_invoice.py b/stripe/_invoice.py index a9e9272c1..d05b742f8 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -462,6 +462,7 @@ class LastFinalizationError(StripeObject): "coupon_expired", "customer_max_payment_methods", "customer_max_subscriptions", + "customer_session_expired", "customer_tax_location_invalid", "debit_not_authorized", "email_invalid", diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index efb8aad98..09eabe865 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -190,6 +190,7 @@ class LastPaymentError(StripeObject): "coupon_expired", "customer_max_payment_methods", "customer_max_subscriptions", + "customer_session_expired", "customer_tax_location_invalid", "debit_not_authorized", "email_invalid", diff --git a/stripe/_quote_preview_invoice.py b/stripe/_quote_preview_invoice.py index 30eee2188..0018c5b98 100644 --- a/stripe/_quote_preview_invoice.py +++ b/stripe/_quote_preview_invoice.py @@ -446,6 +446,7 @@ class LastFinalizationError(StripeObject): "coupon_expired", "customer_max_payment_methods", "customer_max_subscriptions", + "customer_session_expired", "customer_tax_location_invalid", "debit_not_authorized", "email_invalid", diff --git a/stripe/_setup_attempt.py b/stripe/_setup_attempt.py index d4b2dc3d3..b8b0a0e7b 100644 --- a/stripe/_setup_attempt.py +++ b/stripe/_setup_attempt.py @@ -533,6 +533,7 @@ class SetupError(StripeObject): "coupon_expired", "customer_max_payment_methods", "customer_max_subscriptions", + "customer_session_expired", "customer_tax_location_invalid", "debit_not_authorized", "email_invalid", diff --git a/stripe/_setup_intent.py b/stripe/_setup_intent.py index 7f81f2c92..57851f441 100644 --- a/stripe/_setup_intent.py +++ b/stripe/_setup_intent.py @@ -127,6 +127,7 @@ class LastSetupError(StripeObject): "coupon_expired", "customer_max_payment_methods", "customer_max_subscriptions", + "customer_session_expired", "customer_tax_location_invalid", "debit_not_authorized", "email_invalid", From 8517ddac95b67eda777d12a9285342d075209264 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 16:13:41 +0000 Subject: [PATCH 07/31] Update generated code for v1900 and 2025-07-30.preview --- OPENAPI_VERSION | 2 +- stripe/_payment_intent.py | 16 ++++++++++++++++ stripe/_payment_intent_service.py | 12 ++++++++++++ stripe/checkout/_session.py | 8 ++++++++ stripe/checkout/_session_service.py | 4 ++++ 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index e5693c187..cedb28144 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1898 \ No newline at end of file +v1900 \ No newline at end of file diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index 09eabe865..7a45018dd 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -2765,6 +2765,10 @@ class MandateOptions(StripeObject): _inner_class_types = {"mandate_options": MandateOptions} class Pix(StripeObject): + amount_includes_iof: Optional[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. + """ expires_after_seconds: Optional[int] """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. @@ -7931,6 +7935,10 @@ class ConfirmParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): """ class ConfirmParamsPaymentMethodOptionsPix(TypedDict): + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ expires_after_seconds: NotRequired[int] """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. @@ -12124,6 +12132,10 @@ class CreateParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): """ class CreateParamsPaymentMethodOptionsPix(TypedDict): + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ expires_after_seconds: NotRequired[int] """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. @@ -16655,6 +16667,10 @@ class ModifyParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): """ class ModifyParamsPaymentMethodOptionsPix(TypedDict): + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ expires_after_seconds: NotRequired[int] """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. diff --git a/stripe/_payment_intent_service.py b/stripe/_payment_intent_service.py index 4871da2b4..0b752df0d 100644 --- a/stripe/_payment_intent_service.py +++ b/stripe/_payment_intent_service.py @@ -4735,6 +4735,10 @@ class ConfirmParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): """ class ConfirmParamsPaymentMethodOptionsPix(TypedDict): + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ expires_after_seconds: NotRequired[int] """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. @@ -8982,6 +8986,10 @@ class CreateParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): """ class CreateParamsPaymentMethodOptionsPix(TypedDict): + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ expires_after_seconds: NotRequired[int] """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. @@ -13603,6 +13611,10 @@ class UpdateParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): """ class UpdateParamsPaymentMethodOptionsPix(TypedDict): + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ expires_after_seconds: NotRequired[int] """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. diff --git a/stripe/checkout/_session.py b/stripe/checkout/_session.py index 5cddaea94..2d19bbd3a 100644 --- a/stripe/checkout/_session.py +++ b/stripe/checkout/_session.py @@ -1434,6 +1434,10 @@ class MandateOptions(StripeObject): _inner_class_types = {"mandate_options": MandateOptions} class Pix(StripeObject): + amount_includes_iof: Optional[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. + """ expires_after_seconds: Optional[int] """ The number of seconds after which Pix payment will expire. @@ -4124,6 +4128,10 @@ class CreateParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): """ class CreateParamsPaymentMethodOptionsPix(TypedDict): + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ expires_after_seconds: NotRequired[int] """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. diff --git a/stripe/checkout/_session_service.py b/stripe/checkout/_session_service.py index 23b7a876e..27c5e2957 100644 --- a/stripe/checkout/_session_service.py +++ b/stripe/checkout/_session_service.py @@ -2041,6 +2041,10 @@ class CreateParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): """ class CreateParamsPaymentMethodOptionsPix(TypedDict): + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ expires_after_seconds: NotRequired[int] """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. From 43b8dc7c204b6ceb37e3543b6bc295ad03d585c1 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 16:31:42 +0000 Subject: [PATCH 08/31] Update generated code for v1902 and 2025-07-30.preview --- OPENAPI_VERSION | 2 +- stripe/_invoice.py | 1 + stripe/_payment_attempt_record.py | 81 ++++++++++++++++++++-- stripe/_payment_intent.py | 1 + stripe/_payment_record.py | 107 +++++++++++++++++++++++++++--- stripe/_payment_record_service.py | 26 +++++++- stripe/_quote_preview_invoice.py | 1 + stripe/_setup_attempt.py | 1 + stripe/_setup_intent.py | 1 + 9 files changed, 202 insertions(+), 19 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index cedb28144..762d6088f 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1900 \ No newline at end of file +v1902 \ No newline at end of file diff --git a/stripe/_invoice.py b/stripe/_invoice.py index d05b742f8..e34dc7545 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -481,6 +481,7 @@ class LastFinalizationError(StripeObject): "incorrect_cvc", "incorrect_number", "incorrect_zip", + "india_recurring_payment_mandate_canceled", "instant_payouts_config_disabled", "instant_payouts_currency_disabled", "instant_payouts_limit_exceeded", diff --git a/stripe/_payment_attempt_record.py b/stripe/_payment_attempt_record.py index 744bef988..ad6151401 100644 --- a/stripe/_payment_attempt_record.py +++ b/stripe/_payment_attempt_record.py @@ -25,6 +25,26 @@ class PaymentAttemptRecord(ListableAPIResource["PaymentAttemptRecord"]): "payment_attempt_record" ) + class Amount(StripeObject): + 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). + """ + value: int + """ + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. + """ + + class AmountAuthorized(StripeObject): + 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). + """ + value: int + """ + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. + """ + class AmountCanceled(StripeObject): currency: str """ @@ -32,7 +52,7 @@ class AmountCanceled(StripeObject): """ value: int """ - A positive integer representing the amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) for example, 100 cents for 1 USD or 100 for 100 JPY, a zero-decimal currency. + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. """ class AmountFailed(StripeObject): @@ -42,7 +62,7 @@ class AmountFailed(StripeObject): """ value: int """ - A positive integer representing the amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) for example, 100 cents for 1 USD or 100 for 100 JPY, a zero-decimal currency. + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. """ class AmountGuaranteed(StripeObject): @@ -52,7 +72,17 @@ class AmountGuaranteed(StripeObject): """ value: int """ - A positive integer representing the amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) for example, 100 cents for 1 USD or 100 for 100 JPY, a zero-decimal currency. + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. + """ + + class AmountRefunded(StripeObject): + 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). + """ + value: int + """ + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. """ class AmountRequested(StripeObject): @@ -62,7 +92,7 @@ class AmountRequested(StripeObject): """ value: int """ - A positive integer representing the amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) for example, 100 cents for 1 USD or 100 for 100 JPY, a zero-decimal currency. + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. """ class CustomerDetails(StripeObject): @@ -1852,6 +1882,25 @@ class Zip(StripeObject): "zip": Zip, } + class ProcessorDetails(StripeObject): + class Custom(StripeObject): + payment_reference: str + """ + An opaque string for manual reconciliation of this payment, for example a check number or a payment processor ID. + """ + + custom: Optional[Custom] + """ + Custom processors represent payment processors not modeled directly in + the Stripe API. This resource consists of details about the custom processor + used for this payment attempt. + """ + type: Literal["custom"] + """ + The processor used for this payment attempt. + """ + _inner_class_types = {"custom": Custom} + class ShippingDetails(StripeObject): class Address(StripeObject): city: Optional[str] @@ -1909,6 +1958,14 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ + amount: Amount + """ + A representation of an amount of money, consisting of an amount and a currency. + """ + amount_authorized: AmountAuthorized + """ + A representation of an amount of money, consisting of an amount and a currency. + """ amount_canceled: AmountCanceled """ A representation of an amount of money, consisting of an amount and a currency. @@ -1921,10 +1978,18 @@ class RetrieveParams(RequestOptions): """ A representation of an amount of money, consisting of an amount and a currency. """ + amount_refunded: AmountRefunded + """ + A representation of an amount of money, consisting of an amount and a currency. + """ amount_requested: AmountRequested """ A representation of an amount of money, consisting of an amount and a currency. """ + application: Optional[str] + """ + ID of the Connect application that created the PaymentAttemptRecord. + """ created: int """ Time at which the object was created. Measured in seconds since the Unix epoch. @@ -1965,9 +2030,9 @@ class RetrieveParams(RequestOptions): """ ID of the Payment Record this Payment Attempt Record belongs to. """ - payment_reference: Optional[str] + processor_details: ProcessorDetails """ - An opaque string for manual reconciliation of this payment, for example a check number or a payment processor ID. + Processor information associated with this payment. """ reported_by: Literal["self", "stripe"] """ @@ -2041,11 +2106,15 @@ async def retrieve_async( return instance _inner_class_types = { + "amount": Amount, + "amount_authorized": AmountAuthorized, "amount_canceled": AmountCanceled, "amount_failed": AmountFailed, "amount_guaranteed": AmountGuaranteed, + "amount_refunded": AmountRefunded, "amount_requested": AmountRequested, "customer_details": CustomerDetails, "payment_method_details": PaymentMethodDetails, + "processor_details": ProcessorDetails, "shipping_details": ShippingDetails, } diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index 7a45018dd..281ad0aff 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -209,6 +209,7 @@ class LastPaymentError(StripeObject): "incorrect_cvc", "incorrect_number", "incorrect_zip", + "india_recurring_payment_mandate_canceled", "instant_payouts_config_disabled", "instant_payouts_currency_disabled", "instant_payouts_limit_exceeded", diff --git a/stripe/_payment_record.py b/stripe/_payment_record.py index dfc41988e..d281a7537 100644 --- a/stripe/_payment_record.py +++ b/stripe/_payment_record.py @@ -29,6 +29,26 @@ class PaymentRecord(APIResource["PaymentRecord"]): OBJECT_NAME: ClassVar[Literal["payment_record"]] = "payment_record" + class Amount(StripeObject): + 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). + """ + value: int + """ + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. + """ + + class AmountAuthorized(StripeObject): + 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). + """ + value: int + """ + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. + """ + class AmountCanceled(StripeObject): currency: str """ @@ -36,7 +56,7 @@ class AmountCanceled(StripeObject): """ value: int """ - A positive integer representing the amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) for example, 100 cents for 1 USD or 100 for 100 JPY, a zero-decimal currency. + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. """ class AmountFailed(StripeObject): @@ -46,7 +66,7 @@ class AmountFailed(StripeObject): """ value: int """ - A positive integer representing the amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) for example, 100 cents for 1 USD or 100 for 100 JPY, a zero-decimal currency. + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. """ class AmountGuaranteed(StripeObject): @@ -56,7 +76,17 @@ class AmountGuaranteed(StripeObject): """ value: int """ - A positive integer representing the amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) for example, 100 cents for 1 USD or 100 for 100 JPY, a zero-decimal currency. + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. + """ + + class AmountRefunded(StripeObject): + 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). + """ + value: int + """ + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. """ class AmountRequested(StripeObject): @@ -66,7 +96,7 @@ class AmountRequested(StripeObject): """ value: int """ - A positive integer representing the amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) for example, 100 cents for 1 USD or 100 for 100 JPY, a zero-decimal currency. + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. """ class CustomerDetails(StripeObject): @@ -1856,6 +1886,25 @@ class Zip(StripeObject): "zip": Zip, } + class ProcessorDetails(StripeObject): + class Custom(StripeObject): + payment_reference: str + """ + An opaque string for manual reconciliation of this payment, for example a check number or a payment processor ID. + """ + + custom: Optional[Custom] + """ + Custom processors represent payment processors not modeled directly in + the Stripe API. This resource consists of details about the custom processor + used for this payment attempt. + """ + type: Literal["custom"] + """ + The processor used for this payment attempt. + """ + _inner_class_types = {"custom": Custom} + class ShippingDetails(StripeObject): class Address(StripeObject): city: Optional[str] @@ -2159,9 +2208,11 @@ class ReportPaymentParams(RequestOptions): """ Information about the Payment Method debited for this payment. """ - payment_reference: NotRequired[str] + processor_details: NotRequired[ + "PaymentRecord.ReportPaymentParamsProcessorDetails" + ] """ - An opaque string for manual reconciliation of this payment, for example a check number or a payment processor ID. + Processor information for this payment. """ shipping_details: NotRequired[ "PaymentRecord.ReportPaymentParamsShippingDetails" @@ -2177,7 +2228,7 @@ class ReportPaymentParamsAmountRequested(TypedDict): """ value: int """ - A positive integer representing the amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) for example, 100 cents for 1 USD or 100 for 100 JPY, a zero-decimal currency. + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. """ class ReportPaymentParamsCustomerDetails(TypedDict): @@ -2290,6 +2341,24 @@ class ReportPaymentParamsPaymentMethodDetailsCustom(TypedDict): The custom payment method type associated with this payment. """ + class ReportPaymentParamsProcessorDetails(TypedDict): + custom: NotRequired[ + "PaymentRecord.ReportPaymentParamsProcessorDetailsCustom" + ] + """ + Information about the custom processor used to make this payment. + """ + type: Literal["custom"] + """ + The type of the processor details. An additional hash is included on processor_details with a name matching this value. It contains additional information specific to the processor. + """ + + class ReportPaymentParamsProcessorDetailsCustom(TypedDict): + payment_reference: str + """ + An opaque string for manual reconciliation of this payment, for example a check number or a payment processor ID. + """ + class ReportPaymentParamsShippingDetails(TypedDict): address: NotRequired[ "PaymentRecord.ReportPaymentParamsShippingDetailsAddress" @@ -2338,6 +2407,14 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ + amount: Amount + """ + A representation of an amount of money, consisting of an amount and a currency. + """ + amount_authorized: AmountAuthorized + """ + A representation of an amount of money, consisting of an amount and a currency. + """ amount_canceled: AmountCanceled """ A representation of an amount of money, consisting of an amount and a currency. @@ -2350,10 +2427,18 @@ class RetrieveParams(RequestOptions): """ A representation of an amount of money, consisting of an amount and a currency. """ + amount_refunded: AmountRefunded + """ + A representation of an amount of money, consisting of an amount and a currency. + """ amount_requested: AmountRequested """ A representation of an amount of money, consisting of an amount and a currency. """ + application: Optional[str] + """ + ID of the Connect application that created the PaymentRecord. + """ created: int """ Time at which the object was created. Measured in seconds since the Unix epoch. @@ -2394,9 +2479,9 @@ class RetrieveParams(RequestOptions): """ Information about the Payment Method debited for this payment. """ - payment_reference: Optional[str] + processor_details: ProcessorDetails """ - An opaque string for manual reconciliation of this payment, for example a check number or a payment processor ID. + Processor information associated with this payment. """ shipping_details: Optional[ShippingDetails] """ @@ -2968,11 +3053,15 @@ async def retrieve_async( return instance _inner_class_types = { + "amount": Amount, + "amount_authorized": AmountAuthorized, "amount_canceled": AmountCanceled, "amount_failed": AmountFailed, "amount_guaranteed": AmountGuaranteed, + "amount_refunded": AmountRefunded, "amount_requested": AmountRequested, "customer_details": CustomerDetails, "payment_method_details": PaymentMethodDetails, + "processor_details": ProcessorDetails, "shipping_details": ShippingDetails, } diff --git a/stripe/_payment_record_service.py b/stripe/_payment_record_service.py index 9b15c55e3..95b98ab41 100644 --- a/stripe/_payment_record_service.py +++ b/stripe/_payment_record_service.py @@ -277,9 +277,11 @@ class ReportPaymentParams(TypedDict): """ Information about the Payment Method debited for this payment. """ - payment_reference: NotRequired[str] + processor_details: NotRequired[ + "PaymentRecordService.ReportPaymentParamsProcessorDetails" + ] """ - An opaque string for manual reconciliation of this payment, for example a check number or a payment processor ID. + Processor information for this payment. """ shipping_details: NotRequired[ "PaymentRecordService.ReportPaymentParamsShippingDetails" @@ -295,7 +297,7 @@ class ReportPaymentParamsAmountRequested(TypedDict): """ value: int """ - A positive integer representing the amount in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) for example, 100 cents for 1 USD or 100 for 100 JPY, a zero-decimal currency. + A positive integer representing the amount in the currency's [minor unit](https://stripe.com/docs/currencies#zero-decimal). For example, `100` can represent 1 USD or 100 JPY. """ class ReportPaymentParamsCustomerDetails(TypedDict): @@ -408,6 +410,24 @@ class ReportPaymentParamsPaymentMethodDetailsCustom(TypedDict): The custom payment method type associated with this payment. """ + class ReportPaymentParamsProcessorDetails(TypedDict): + custom: NotRequired[ + "PaymentRecordService.ReportPaymentParamsProcessorDetailsCustom" + ] + """ + Information about the custom processor used to make this payment. + """ + type: Literal["custom"] + """ + The type of the processor details. An additional hash is included on processor_details with a name matching this value. It contains additional information specific to the processor. + """ + + class ReportPaymentParamsProcessorDetailsCustom(TypedDict): + payment_reference: str + """ + An opaque string for manual reconciliation of this payment, for example a check number or a payment processor ID. + """ + class ReportPaymentParamsShippingDetails(TypedDict): address: NotRequired[ "PaymentRecordService.ReportPaymentParamsShippingDetailsAddress" diff --git a/stripe/_quote_preview_invoice.py b/stripe/_quote_preview_invoice.py index 0018c5b98..2a5a1995f 100644 --- a/stripe/_quote_preview_invoice.py +++ b/stripe/_quote_preview_invoice.py @@ -465,6 +465,7 @@ class LastFinalizationError(StripeObject): "incorrect_cvc", "incorrect_number", "incorrect_zip", + "india_recurring_payment_mandate_canceled", "instant_payouts_config_disabled", "instant_payouts_currency_disabled", "instant_payouts_limit_exceeded", diff --git a/stripe/_setup_attempt.py b/stripe/_setup_attempt.py index b8b0a0e7b..4ddb8b346 100644 --- a/stripe/_setup_attempt.py +++ b/stripe/_setup_attempt.py @@ -552,6 +552,7 @@ class SetupError(StripeObject): "incorrect_cvc", "incorrect_number", "incorrect_zip", + "india_recurring_payment_mandate_canceled", "instant_payouts_config_disabled", "instant_payouts_currency_disabled", "instant_payouts_limit_exceeded", diff --git a/stripe/_setup_intent.py b/stripe/_setup_intent.py index 57851f441..0043fd859 100644 --- a/stripe/_setup_intent.py +++ b/stripe/_setup_intent.py @@ -146,6 +146,7 @@ class LastSetupError(StripeObject): "incorrect_cvc", "incorrect_number", "incorrect_zip", + "india_recurring_payment_mandate_canceled", "instant_payouts_config_disabled", "instant_payouts_currency_disabled", "instant_payouts_limit_exceeded", From 6021d6e89605779fe8226da0ac6474777efe71b9 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 09:07:22 +0000 Subject: [PATCH 09/31] Update generated code for v1905 and 2025-07-30.preview --- OPENAPI_VERSION | 2 +- stripe/_charge.py | 4 + stripe/_invoice_payment.py | 3 + stripe/_invoice_payment_service.py | 3 + stripe/_mandate.py | 41 +++++- stripe/_payment_attempt_record.py | 4 + stripe/_payment_intent.py | 178 ++++++++++++++++++++++- stripe/_payment_intent_service.py | 132 ++++++++++++++++- stripe/_payment_record.py | 4 + stripe/_setup_attempt.py | 5 + stripe/_setup_intent.py | 216 ++++++++++++++++++++++++++++ stripe/_setup_intent_service.py | 150 +++++++++++++++++++ stripe/checkout/_session.py | 90 +++++++++++- stripe/checkout/_session_service.py | 44 +++++- 14 files changed, 864 insertions(+), 12 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 762d6088f..477664af8 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1902 \ No newline at end of file +v1905 \ No newline at end of file diff --git a/stripe/_charge.py b/stripe/_charge.py index 6cdf3f878..b13d7890d 100644 --- a/stripe/_charge.py +++ b/stripe/_charge.py @@ -1849,6 +1849,10 @@ class Pix(StripeObject): """ Unique transaction id generated by BCB """ + mandate: Optional[str] + """ + ID of the multi use Mandate generated by the PaymentIntent + """ class Promptpay(StripeObject): reference: Optional[str] diff --git a/stripe/_invoice_payment.py b/stripe/_invoice_payment.py index 7760a1d19..ca94beb09 100644 --- a/stripe/_invoice_payment.py +++ b/stripe/_invoice_payment.py @@ -99,6 +99,9 @@ class ListParamsPayment(TypedDict): Only return invoice payments associated by this payment intent ID. """ payment_record: NotRequired[str] + """ + Only return invoice payments associated by this payment record ID. + """ type: Literal["payment_intent", "payment_record"] """ Only return invoice payments associated by this payment type. diff --git a/stripe/_invoice_payment_service.py b/stripe/_invoice_payment_service.py index 8333efad0..2416c9bd8 100644 --- a/stripe/_invoice_payment_service.py +++ b/stripe/_invoice_payment_service.py @@ -46,6 +46,9 @@ class ListParamsPayment(TypedDict): Only return invoice payments associated by this payment intent ID. """ payment_record: NotRequired[str] + """ + Only return invoice payments associated by this payment record ID. + """ type: Literal["payment_intent", "payment_record"] """ Only return invoice payments associated by this payment type. diff --git a/stripe/_mandate.py b/stripe/_mandate.py index 225c2e003..f2ba85c22 100644 --- a/stripe/_mandate.py +++ b/stripe/_mandate.py @@ -46,7 +46,14 @@ class Online(StripeObject): _inner_class_types = {"offline": Offline, "online": Online} class MultiUse(StripeObject): - pass + amount: Optional[int] + """ + The amount of the payment on a multi use mandate. + """ + currency: Optional[str] + """ + The currency of the payment on a multi use mandate. + """ class PaymentMethodDetails(StripeObject): class AcssDebit(StripeObject): @@ -200,6 +207,36 @@ class Payto(StripeObject): Date, in YYYY-MM-DD format, from which payments will be collected. Defaults to confirmation time. """ + class Pix(StripeObject): + amount_includes_iof: Optional[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. + """ + amount_type: Optional[Literal["fixed", "maximum"]] + """ + Type of amount. + """ + end_date: Optional[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. + """ + payment_schedule: Optional[ + Literal[ + "halfyearly", "monthly", "quarterly", "weekly", "yearly" + ] + ] + """ + Schedule at which the future payments will be charged. + """ + reference: Optional[str] + """ + Subscription name displayed to buyers in their bank app. + """ + start_date: Optional[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. + """ + class RevolutPay(StripeObject): pass @@ -233,6 +270,7 @@ class UsBankAccount(StripeObject): nz_bank_account: Optional[NzBankAccount] paypal: Optional[Paypal] payto: Optional[Payto] + pix: Optional[Pix] revolut_pay: Optional[RevolutPay] sepa_debit: Optional[SepaDebit] type: str @@ -255,6 +293,7 @@ class UsBankAccount(StripeObject): "nz_bank_account": NzBankAccount, "paypal": Paypal, "payto": Payto, + "pix": Pix, "revolut_pay": RevolutPay, "sepa_debit": SepaDebit, "us_bank_account": UsBankAccount, diff --git a/stripe/_payment_attempt_record.py b/stripe/_payment_attempt_record.py index ad6151401..c755da5f0 100644 --- a/stripe/_payment_attempt_record.py +++ b/stripe/_payment_attempt_record.py @@ -1486,6 +1486,10 @@ class Pix(StripeObject): """ Unique transaction id generated by BCB """ + mandate: Optional[str] + """ + ID of the multi use Mandate generated by the PaymentIntent + """ class Promptpay(StripeObject): reference: Optional[str] diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index 281ad0aff..b4d29ca58 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -2766,6 +2766,48 @@ class MandateOptions(StripeObject): _inner_class_types = {"mandate_options": MandateOptions} class Pix(StripeObject): + class MandateOptions(StripeObject): + amount: Optional[int] + """ + Amount to be charged for future payments. + """ + amount_includes_iof: Optional[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. + """ + amount_type: Optional[Literal["fixed", "maximum"]] + """ + Type of amount. + """ + currency: Optional[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + """ + end_date: Optional[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. + """ + payment_schedule: Optional[ + Literal[ + "halfyearly", + "monthly", + "quarterly", + "weekly", + "yearly", + ] + ] + """ + Schedule at which the future payments will be charged. + """ + reference: Optional[str] + """ + Subscription name displayed to buyers in their bank app. + """ + start_date: Optional[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. + """ + amount_includes_iof: Optional[Literal["always", "never"]] """ Determines if the amount includes the IOF tax. @@ -2778,7 +2820,8 @@ class Pix(StripeObject): """ The timestamp at which the Pix expires. """ - setup_future_usage: Optional[Literal["none"]] + mandate_options: Optional[MandateOptions] + setup_future_usage: Optional[Literal["none", "off_session"]] """ Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -2788,6 +2831,7 @@ class Pix(StripeObject): 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). """ + _inner_class_types = {"mandate_options": MandateOptions} class Promptpay(StripeObject): setup_future_usage: Optional[Literal["none"]] @@ -7948,7 +7992,13 @@ class ConfirmParamsPaymentMethodOptionsPix(TypedDict): """ The timestamp at which the Pix expires (between 10 and 1209600 seconds in the future). Defaults to 1 day in the future. """ - setup_future_usage: NotRequired[Literal["none"]] + mandate_options: NotRequired[ + "PaymentIntent.ConfirmParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. Only applicable when `setup_future_usage=off_session`. + """ + setup_future_usage: NotRequired[Literal["none", "off_session"]] """ Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -7961,6 +8011,42 @@ class ConfirmParamsPaymentMethodOptionsPix(TypedDict): If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`. """ + class ConfirmParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class ConfirmParamsPaymentMethodOptionsPromptpay(TypedDict): setup_future_usage: NotRequired[Literal["none"]] """ @@ -12145,7 +12231,13 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): """ The timestamp at which the Pix expires (between 10 and 1209600 seconds in the future). Defaults to 1 day in the future. """ - setup_future_usage: NotRequired[Literal["none"]] + mandate_options: NotRequired[ + "PaymentIntent.CreateParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. Only applicable when `setup_future_usage=off_session`. + """ + setup_future_usage: NotRequired[Literal["none", "off_session"]] """ Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -12158,6 +12250,42 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`. """ + class CreateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class CreateParamsPaymentMethodOptionsPromptpay(TypedDict): setup_future_usage: NotRequired[Literal["none"]] """ @@ -16680,7 +16808,13 @@ class ModifyParamsPaymentMethodOptionsPix(TypedDict): """ The timestamp at which the Pix expires (between 10 and 1209600 seconds in the future). Defaults to 1 day in the future. """ - setup_future_usage: NotRequired[Literal["none"]] + mandate_options: NotRequired[ + "PaymentIntent.ModifyParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. Only applicable when `setup_future_usage=off_session`. + """ + setup_future_usage: NotRequired[Literal["none", "off_session"]] """ Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -16693,6 +16827,42 @@ class ModifyParamsPaymentMethodOptionsPix(TypedDict): If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`. """ + class ModifyParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class ModifyParamsPaymentMethodOptionsPromptpay(TypedDict): setup_future_usage: NotRequired[Literal["none"]] """ diff --git a/stripe/_payment_intent_service.py b/stripe/_payment_intent_service.py index 0b752df0d..805387e06 100644 --- a/stripe/_payment_intent_service.py +++ b/stripe/_payment_intent_service.py @@ -4747,7 +4747,13 @@ class ConfirmParamsPaymentMethodOptionsPix(TypedDict): """ The timestamp at which the Pix expires (between 10 and 1209600 seconds in the future). Defaults to 1 day in the future. """ - setup_future_usage: NotRequired[Literal["none"]] + mandate_options: NotRequired[ + "PaymentIntentService.ConfirmParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. Only applicable when `setup_future_usage=off_session`. + """ + setup_future_usage: NotRequired[Literal["none", "off_session"]] """ Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -4760,6 +4766,42 @@ class ConfirmParamsPaymentMethodOptionsPix(TypedDict): If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`. """ + class ConfirmParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class ConfirmParamsPaymentMethodOptionsPromptpay(TypedDict): setup_future_usage: NotRequired[Literal["none"]] """ @@ -8998,7 +9040,13 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): """ The timestamp at which the Pix expires (between 10 and 1209600 seconds in the future). Defaults to 1 day in the future. """ - setup_future_usage: NotRequired[Literal["none"]] + mandate_options: NotRequired[ + "PaymentIntentService.CreateParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. Only applicable when `setup_future_usage=off_session`. + """ + setup_future_usage: NotRequired[Literal["none", "off_session"]] """ Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -9011,6 +9059,42 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`. """ + class CreateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class CreateParamsPaymentMethodOptionsPromptpay(TypedDict): setup_future_usage: NotRequired[Literal["none"]] """ @@ -13623,7 +13707,13 @@ class UpdateParamsPaymentMethodOptionsPix(TypedDict): """ The timestamp at which the Pix expires (between 10 and 1209600 seconds in the future). Defaults to 1 day in the future. """ - setup_future_usage: NotRequired[Literal["none"]] + mandate_options: NotRequired[ + "PaymentIntentService.UpdateParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. Only applicable when `setup_future_usage=off_session`. + """ + setup_future_usage: NotRequired[Literal["none", "off_session"]] """ Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -13636,6 +13726,42 @@ class UpdateParamsPaymentMethodOptionsPix(TypedDict): If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`. """ + class UpdateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class UpdateParamsPaymentMethodOptionsPromptpay(TypedDict): setup_future_usage: NotRequired[Literal["none"]] """ diff --git a/stripe/_payment_record.py b/stripe/_payment_record.py index d281a7537..41eee8aa0 100644 --- a/stripe/_payment_record.py +++ b/stripe/_payment_record.py @@ -1490,6 +1490,10 @@ class Pix(StripeObject): """ Unique transaction id generated by BCB """ + mandate: Optional[str] + """ + ID of the multi use Mandate generated by the PaymentIntent + """ class Promptpay(StripeObject): reference: Optional[str] diff --git a/stripe/_setup_attempt.py b/stripe/_setup_attempt.py index 4ddb8b346..2e341f459 100644 --- a/stripe/_setup_attempt.py +++ b/stripe/_setup_attempt.py @@ -376,6 +376,9 @@ class Paypal(StripeObject): class Payto(StripeObject): pass + class Pix(StripeObject): + pass + class RevolutPay(StripeObject): pass @@ -443,6 +446,7 @@ class UsBankAccount(StripeObject): nz_bank_account: Optional[NzBankAccount] paypal: Optional[Paypal] payto: Optional[Payto] + pix: Optional[Pix] revolut_pay: Optional[RevolutPay] sepa_debit: Optional[SepaDebit] sofort: Optional[Sofort] @@ -472,6 +476,7 @@ class UsBankAccount(StripeObject): "nz_bank_account": NzBankAccount, "paypal": Paypal, "payto": Payto, + "pix": Pix, "revolut_pay": RevolutPay, "sepa_debit": SepaDebit, "sofort": Sofort, diff --git a/stripe/_setup_intent.py b/stripe/_setup_intent.py index 0043fd859..737c04ecd 100644 --- a/stripe/_setup_intent.py +++ b/stripe/_setup_intent.py @@ -390,6 +390,28 @@ class QrCode(StripeObject): qr_code: QrCode _inner_class_types = {"qr_code": QrCode} + class PixDisplayQrCode(StripeObject): + data: Optional[str] + """ + The raw data string used to generate QR code, it should be used together with QR code library. + """ + expires_at: Optional[int] + """ + The date (unix timestamp) when the PIX expires. + """ + hosted_instructions_url: Optional[str] + """ + The URL to the hosted pix instructions page, which allows customers to view the pix QR code. + """ + image_url_png: Optional[str] + """ + The image_url_png string used to render png QR code + """ + image_url_svg: Optional[str] + """ + The image_url_svg string used to render svg QR code + """ + class RedirectToUrl(StripeObject): return_url: Optional[str] """ @@ -417,6 +439,7 @@ class VerifyWithMicrodeposits(StripeObject): cashapp_handle_redirect_or_display_qr_code: Optional[ CashappHandleRedirectOrDisplayQrCode ] + pix_display_qr_code: Optional[PixDisplayQrCode] redirect_to_url: Optional[RedirectToUrl] type: str """ @@ -429,6 +452,7 @@ class VerifyWithMicrodeposits(StripeObject): verify_with_microdeposits: Optional[VerifyWithMicrodeposits] _inner_class_types = { "cashapp_handle_redirect_or_display_qr_code": CashappHandleRedirectOrDisplayQrCode, + "pix_display_qr_code": PixDisplayQrCode, "redirect_to_url": RedirectToUrl, "verify_with_microdeposits": VerifyWithMicrodeposits, } @@ -662,6 +686,52 @@ class MandateOptions(StripeObject): mandate_options: Optional[MandateOptions] _inner_class_types = {"mandate_options": MandateOptions} + class Pix(StripeObject): + class MandateOptions(StripeObject): + amount: Optional[int] + """ + Amount to be charged for future payments. + """ + amount_includes_iof: Optional[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. + """ + amount_type: Optional[Literal["fixed", "maximum"]] + """ + Type of amount. + """ + currency: Optional[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + """ + end_date: Optional[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. + """ + payment_schedule: Optional[ + Literal[ + "halfyearly", + "monthly", + "quarterly", + "weekly", + "yearly", + ] + ] + """ + Schedule at which the future payments will be charged. + """ + reference: Optional[str] + """ + Subscription name displayed to buyers in their bank app. + """ + start_date: Optional[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. + """ + + mandate_options: Optional[MandateOptions] + _inner_class_types = {"mandate_options": MandateOptions} + class SepaDebit(StripeObject): class MandateOptions(StripeObject): reference_prefix: Optional[str] @@ -757,6 +827,7 @@ class MandateOptions(StripeObject): link: Optional[Link] paypal: Optional[Paypal] payto: Optional[Payto] + pix: Optional[Pix] sepa_debit: Optional[SepaDebit] us_bank_account: Optional[UsBankAccount] _inner_class_types = { @@ -769,6 +840,7 @@ class MandateOptions(StripeObject): "link": Link, "paypal": Paypal, "payto": Payto, + "pix": Pix, "sepa_debit": SepaDebit, "us_bank_account": UsBankAccount, } @@ -1763,6 +1835,10 @@ class ConfirmParamsPaymentMethodOptions(TypedDict): """ If this is a `payto` SetupIntent, this sub-hash contains details about the PayTo payment method options. """ + pix: NotRequired["SetupIntent.ConfirmParamsPaymentMethodOptionsPix"] + """ + If this is a `pix` SetupIntent, this sub-hash contains details about the Pix payment method options. + """ sepa_debit: NotRequired[ "SetupIntent.ConfirmParamsPaymentMethodOptionsSepaDebit" ] @@ -2212,6 +2288,50 @@ class ConfirmParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): Date, in YYYY-MM-DD format, from which payments will be collected. Defaults to confirmation time. """ + class ConfirmParamsPaymentMethodOptionsPix(TypedDict): + mandate_options: NotRequired[ + "SetupIntent.ConfirmParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. + """ + + class ConfirmParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class ConfirmParamsPaymentMethodOptionsSepaDebit(TypedDict): mandate_options: NotRequired[ "SetupIntent.ConfirmParamsPaymentMethodOptionsSepaDebitMandateOptions" @@ -3382,6 +3502,10 @@ class CreateParamsPaymentMethodOptions(TypedDict): """ If this is a `payto` SetupIntent, this sub-hash contains details about the PayTo payment method options. """ + pix: NotRequired["SetupIntent.CreateParamsPaymentMethodOptionsPix"] + """ + If this is a `pix` SetupIntent, this sub-hash contains details about the Pix payment method options. + """ sepa_debit: NotRequired[ "SetupIntent.CreateParamsPaymentMethodOptionsSepaDebit" ] @@ -3831,6 +3955,50 @@ class CreateParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): Date, in YYYY-MM-DD format, from which payments will be collected. Defaults to confirmation time. """ + class CreateParamsPaymentMethodOptionsPix(TypedDict): + mandate_options: NotRequired[ + "SetupIntent.CreateParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. + """ + + class CreateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class CreateParamsPaymentMethodOptionsSepaDebit(TypedDict): mandate_options: NotRequired[ "SetupIntent.CreateParamsPaymentMethodOptionsSepaDebitMandateOptions" @@ -4970,6 +5138,10 @@ class ModifyParamsPaymentMethodOptions(TypedDict): """ If this is a `payto` SetupIntent, this sub-hash contains details about the PayTo payment method options. """ + pix: NotRequired["SetupIntent.ModifyParamsPaymentMethodOptionsPix"] + """ + If this is a `pix` SetupIntent, this sub-hash contains details about the Pix payment method options. + """ sepa_debit: NotRequired[ "SetupIntent.ModifyParamsPaymentMethodOptionsSepaDebit" ] @@ -5419,6 +5591,50 @@ class ModifyParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): Date, in YYYY-MM-DD format, from which payments will be collected. Defaults to confirmation time. """ + class ModifyParamsPaymentMethodOptionsPix(TypedDict): + mandate_options: NotRequired[ + "SetupIntent.ModifyParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. + """ + + class ModifyParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class ModifyParamsPaymentMethodOptionsSepaDebit(TypedDict): mandate_options: NotRequired[ "SetupIntent.ModifyParamsPaymentMethodOptionsSepaDebitMandateOptions" diff --git a/stripe/_setup_intent_service.py b/stripe/_setup_intent_service.py index e367872f3..f7ddb58fc 100644 --- a/stripe/_setup_intent_service.py +++ b/stripe/_setup_intent_service.py @@ -1058,6 +1058,12 @@ class ConfirmParamsPaymentMethodOptions(TypedDict): """ If this is a `payto` SetupIntent, this sub-hash contains details about the PayTo payment method options. """ + pix: NotRequired[ + "SetupIntentService.ConfirmParamsPaymentMethodOptionsPix" + ] + """ + If this is a `pix` SetupIntent, this sub-hash contains details about the Pix payment method options. + """ sepa_debit: NotRequired[ "SetupIntentService.ConfirmParamsPaymentMethodOptionsSepaDebit" ] @@ -1507,6 +1513,50 @@ class ConfirmParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): Date, in YYYY-MM-DD format, from which payments will be collected. Defaults to confirmation time. """ + class ConfirmParamsPaymentMethodOptionsPix(TypedDict): + mandate_options: NotRequired[ + "SetupIntentService.ConfirmParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. + """ + + class ConfirmParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class ConfirmParamsPaymentMethodOptionsSepaDebit(TypedDict): mandate_options: NotRequired[ "SetupIntentService.ConfirmParamsPaymentMethodOptionsSepaDebitMandateOptions" @@ -2729,6 +2779,12 @@ class CreateParamsPaymentMethodOptions(TypedDict): """ If this is a `payto` SetupIntent, this sub-hash contains details about the PayTo payment method options. """ + pix: NotRequired[ + "SetupIntentService.CreateParamsPaymentMethodOptionsPix" + ] + """ + If this is a `pix` SetupIntent, this sub-hash contains details about the Pix payment method options. + """ sepa_debit: NotRequired[ "SetupIntentService.CreateParamsPaymentMethodOptionsSepaDebit" ] @@ -3178,6 +3234,50 @@ class CreateParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): Date, in YYYY-MM-DD format, from which payments will be collected. Defaults to confirmation time. """ + class CreateParamsPaymentMethodOptionsPix(TypedDict): + mandate_options: NotRequired[ + "SetupIntentService.CreateParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. + """ + + class CreateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class CreateParamsPaymentMethodOptionsSepaDebit(TypedDict): mandate_options: NotRequired[ "SetupIntentService.CreateParamsPaymentMethodOptionsSepaDebitMandateOptions" @@ -4379,6 +4479,12 @@ class UpdateParamsPaymentMethodOptions(TypedDict): """ If this is a `payto` SetupIntent, this sub-hash contains details about the PayTo payment method options. """ + pix: NotRequired[ + "SetupIntentService.UpdateParamsPaymentMethodOptionsPix" + ] + """ + If this is a `pix` SetupIntent, this sub-hash contains details about the Pix payment method options. + """ sepa_debit: NotRequired[ "SetupIntentService.UpdateParamsPaymentMethodOptionsSepaDebit" ] @@ -4828,6 +4934,50 @@ class UpdateParamsPaymentMethodOptionsPaytoMandateOptions(TypedDict): Date, in YYYY-MM-DD format, from which payments will be collected. Defaults to confirmation time. """ + class UpdateParamsPaymentMethodOptionsPix(TypedDict): + mandate_options: NotRequired[ + "SetupIntentService.UpdateParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. + """ + + class UpdateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class UpdateParamsPaymentMethodOptionsSepaDebit(TypedDict): mandate_options: NotRequired[ "SetupIntentService.UpdateParamsPaymentMethodOptionsSepaDebitMandateOptions" diff --git a/stripe/checkout/_session.py b/stripe/checkout/_session.py index 2d19bbd3a..1ecf5041b 100644 --- a/stripe/checkout/_session.py +++ b/stripe/checkout/_session.py @@ -1434,6 +1434,48 @@ class MandateOptions(StripeObject): _inner_class_types = {"mandate_options": MandateOptions} class Pix(StripeObject): + class MandateOptions(StripeObject): + amount: Optional[int] + """ + Amount to be charged for future payments. + """ + amount_includes_iof: Optional[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. + """ + amount_type: Optional[Literal["fixed", "maximum"]] + """ + Type of amount. + """ + currency: Optional[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + """ + end_date: Optional[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. + """ + payment_schedule: Optional[ + Literal[ + "halfyearly", + "monthly", + "quarterly", + "weekly", + "yearly", + ] + ] + """ + Schedule at which the future payments will be charged. + """ + reference: Optional[str] + """ + Subscription name displayed to buyers in their bank app. + """ + start_date: Optional[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. + """ + amount_includes_iof: Optional[Literal["always", "never"]] """ Determines if the amount includes the IOF tax. @@ -1442,7 +1484,8 @@ class Pix(StripeObject): """ The number of seconds after which Pix payment will expire. """ - setup_future_usage: Optional[Literal["none"]] + mandate_options: Optional[MandateOptions] + setup_future_usage: Optional[Literal["none", "off_session"]] """ Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -1452,6 +1495,7 @@ class Pix(StripeObject): 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). """ + _inner_class_types = {"mandate_options": MandateOptions} class RevolutPay(StripeObject): setup_future_usage: Optional[Literal["none", "off_session"]] @@ -4136,7 +4180,13 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. """ - setup_future_usage: NotRequired[Literal["none"]] + mandate_options: NotRequired[ + "Session.CreateParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. + """ + setup_future_usage: NotRequired[Literal["none", "off_session"]] """ Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -4147,6 +4197,42 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): 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 CreateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class CreateParamsPaymentMethodOptionsRevolutPay(TypedDict): setup_future_usage: NotRequired[Literal["none", "off_session"]] """ diff --git a/stripe/checkout/_session_service.py b/stripe/checkout/_session_service.py index 27c5e2957..93e5f889d 100644 --- a/stripe/checkout/_session_service.py +++ b/stripe/checkout/_session_service.py @@ -2049,7 +2049,13 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. """ - setup_future_usage: NotRequired[Literal["none"]] + mandate_options: NotRequired[ + "SessionService.CreateParamsPaymentMethodOptionsPixMandateOptions" + ] + """ + Additional fields for mandate creation. + """ + setup_future_usage: NotRequired[Literal["none", "off_session"]] """ Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -2060,6 +2066,42 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): 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 CreateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): + amount: NotRequired[int] + """ + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + """ + amount_includes_iof: NotRequired[Literal["always", "never"]] + """ + Determines if the amount includes the IOF tax. Defaults to `never`. + """ + amount_type: NotRequired[Literal["fixed", "maximum"]] + """ + Type of amount. Defaults to `maximum`. + """ + currency: NotRequired[str] + """ + Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Only `brl` is supported currently. + """ + end_date: NotRequired[str] + """ + Date when the mandate expires and no further payments will be charged, in `YYYY-MM-DD`. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. + """ + payment_schedule: NotRequired[ + Literal["halfyearly", "monthly", "quarterly", "weekly", "yearly"] + ] + """ + Schedule at which the future payments will be charged. Defaults to `weekly`. + """ + reference: NotRequired[str] + """ + Subscription name displayed to buyers in their bank app. Defaults to the displayable business name. + """ + start_date: NotRequired[str] + """ + Start date of the mandate, in `YYYY-MM-DD`. Start date should be at least 3 days in the future. Defaults to 3 days after the current date. + """ + class CreateParamsPaymentMethodOptionsRevolutPay(TypedDict): setup_future_usage: NotRequired[Literal["none", "off_session"]] """ From de434096891184752aa3cbc90e149ffc640db9e1 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 17:50:42 +0000 Subject: [PATCH 10/31] Update generated code for v1908 and 2025-07-30.preview --- OPENAPI_VERSION | 2 +- stripe/_dispute.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 477664af8..e791695ec 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1905 \ No newline at end of file +v1908 \ No newline at end of file diff --git a/stripe/_dispute.py b/stripe/_dispute.py index 96c4dabcd..bf045f1d6 100644 --- a/stripe/_dispute.py +++ b/stripe/_dispute.py @@ -374,7 +374,9 @@ class Card(StripeObject): """ Card brand. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa` or `unknown`. """ - case_type: Literal["chargeback", "compliance", "inquiry"] + case_type: Literal[ + "block", "chargeback", "compliance", "inquiry", "resolution" + ] """ The type of dispute opened. Different case types may have varying fees and financial impact. """ @@ -864,7 +866,7 @@ class RetrieveParams(RequestOptions): "won", ] """ - Current status of dispute. Possible values are `warning_needs_response`, `warning_under_review`, `warning_closed`, `needs_response`, `under_review`, `won`, or `lost`. + The current status of a dispute. Possible values include:`warning_needs_response`, `warning_under_review`, `warning_closed`, `needs_response`, `under_review`, `won`, `lost`, or `prevented`. """ @classmethod From 7d9441c7a1494eee930b53a19e35c0363b054176 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 20:51:31 +0000 Subject: [PATCH 11/31] Update generated code for v1909 and 2025-07-30.preview --- OPENAPI_VERSION | 2 +- stripe/_subscription.py | 4 ++-- stripe/_subscription_service.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index e791695ec..59f963b0e 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1908 \ No newline at end of file +v1909 \ No newline at end of file diff --git a/stripe/_subscription.py b/stripe/_subscription.py index 6dc243991..b94d95d4c 100644 --- a/stripe/_subscription.py +++ b/stripe/_subscription.py @@ -1513,13 +1513,13 @@ class ListParams(RequestOptions): "Subscription.ListParamsCurrentPeriodEnd|int" ] """ - Only return subscriptions whose current_period_end falls within the given date interval. + Only return subscriptions whose minimum item current_period_end falls within the given date interval. """ current_period_start: NotRequired[ "Subscription.ListParamsCurrentPeriodStart|int" ] """ - Only return subscriptions whose current_period_start falls within the given date interval. + Only return subscriptions whose maximum item current_period_start falls within the given date interval. """ customer: NotRequired[str] """ diff --git a/stripe/_subscription_service.py b/stripe/_subscription_service.py index 10e888e9e..b7c21d37e 100644 --- a/stripe/_subscription_service.py +++ b/stripe/_subscription_service.py @@ -963,13 +963,13 @@ class ListParams(TypedDict): "SubscriptionService.ListParamsCurrentPeriodEnd|int" ] """ - Only return subscriptions whose current_period_end falls within the given date interval. + Only return subscriptions whose minimum item current_period_end falls within the given date interval. """ current_period_start: NotRequired[ "SubscriptionService.ListParamsCurrentPeriodStart|int" ] """ - Only return subscriptions whose current_period_start falls within the given date interval. + Only return subscriptions whose maximum item current_period_start falls within the given date interval. """ customer: NotRequired[str] """ From 747288d9c0d4c16aee4088b3b95329b8600011c4 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 21:39:18 +0000 Subject: [PATCH 12/31] Update generated code for v1909 and 2025-08-27.preview --- API_VERSION | 2 +- stripe/v2/money_management/_financial_account.py | 4 ++++ stripe/v2/money_management/_financial_account_service.py | 4 ++++ stripe/v2/money_management/_outbound_payment_quote.py | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/API_VERSION b/API_VERSION index 9cd676743..23360ba3d 100644 --- a/API_VERSION +++ b/API_VERSION @@ -1 +1 @@ -2025-07-30.preview \ No newline at end of file +2025-08-27.preview \ No newline at end of file diff --git a/stripe/v2/money_management/_financial_account.py b/stripe/v2/money_management/_financial_account.py index 68b666b95..eceb90878 100644 --- a/stripe/v2/money_management/_financial_account.py +++ b/stripe/v2/money_management/_financial_account.py @@ -507,6 +507,10 @@ class Storage(StripeObject): """ Time at which the object was created. """ + display_name: Optional[str] + """ + A descriptive name for the FinancialAccount, up to 50 characters long. This name will be used in the Stripe Dashboard and embedded components. + """ id: str """ Unique identifier for the object. diff --git a/stripe/v2/money_management/_financial_account_service.py b/stripe/v2/money_management/_financial_account_service.py index c9757cff3..0c9836920 100644 --- a/stripe/v2/money_management/_financial_account_service.py +++ b/stripe/v2/money_management/_financial_account_service.py @@ -29,6 +29,10 @@ class CloseParamsForwardingSettings(TypedDict): """ class CreateParams(TypedDict): + display_name: NotRequired[str] + """ + A descriptive name for the FinancialAccount, up to 50 characters long. This name will be used in the Stripe Dashboard and embedded components. + """ metadata: NotRequired[Dict[str, str]] """ Metadata associated with the FinancialAccount. diff --git a/stripe/v2/money_management/_outbound_payment_quote.py b/stripe/v2/money_management/_outbound_payment_quote.py index 2fea18bfb..42087643f 100644 --- a/stripe/v2/money_management/_outbound_payment_quote.py +++ b/stripe/v2/money_management/_outbound_payment_quote.py @@ -8,7 +8,7 @@ class OutboundPaymentQuote(StripeObject): """ - OutboundPaymentQuote represents a quote + OutboundPaymentQuote represents a quote that provides fee and amount estimates for OutboundPayment. """ OBJECT_NAME: ClassVar[ From cb47fca1646478b85837a029bfaee4fedbf438c5 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 22:00:28 +0000 Subject: [PATCH 13/31] Update generated code for v1910 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/terminal/_configuration.py | 32 +++++++++++++++++++++++ stripe/terminal/_configuration_service.py | 24 +++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 59f963b0e..d0e3cb346 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1909 \ No newline at end of file +v1910 \ No newline at end of file diff --git a/stripe/terminal/_configuration.py b/stripe/terminal/_configuration.py index 7ee2d8a12..2b3a18d70 100644 --- a/stripe/terminal/_configuration.py +++ b/stripe/terminal/_configuration.py @@ -49,6 +49,12 @@ class Offline(StripeObject): Determines whether to allow transactions to be collected while reader is offline. Defaults to false. """ + class ReaderSecurity(StripeObject): + admin_menu_passcode: str + """ + Passcode used to access a reader's admin menu. + """ + class RebootWindow(StripeObject): end_hour: int """ @@ -494,6 +500,12 @@ class CreateParams(RequestOptions): """ Configurations for collecting transactions offline. """ + reader_security: NotRequired[ + "Literal['']|Configuration.CreateParamsReaderSecurity" + ] + """ + Configurations for reader security settings. + """ reboot_window: NotRequired["Configuration.CreateParamsRebootWindow"] """ Reboot time settings for readers that support customized reboot time configuration. @@ -527,6 +539,12 @@ class CreateParamsOffline(TypedDict): Determines whether to allow transactions to be collected while reader is offline. Defaults to false. """ + class CreateParamsReaderSecurity(TypedDict): + admin_menu_passcode: NotRequired["Literal['']|str"] + """ + Passcode used to access a reader's admin menu. + """ + class CreateParamsRebootWindow(TypedDict): end_hour: int """ @@ -1047,6 +1065,12 @@ class ModifyParams(RequestOptions): """ Configurations for collecting transactions offline. """ + reader_security: NotRequired[ + "Literal['']|Configuration.ModifyParamsReaderSecurity" + ] + """ + Configurations for reader security settings. + """ reboot_window: NotRequired[ "Literal['']|Configuration.ModifyParamsRebootWindow" ] @@ -1086,6 +1110,12 @@ class ModifyParamsOffline(TypedDict): Determines whether to allow transactions to be collected while reader is offline. Defaults to false. """ + class ModifyParamsReaderSecurity(TypedDict): + admin_menu_passcode: NotRequired["Literal['']|str"] + """ + Passcode used to access a reader's admin menu. + """ + class ModifyParamsRebootWindow(TypedDict): end_hour: int """ @@ -1594,6 +1624,7 @@ class RetrieveParams(RequestOptions): String representing the object's type. Objects of the same type share the same value. """ offline: Optional[Offline] + reader_security: Optional[ReaderSecurity] reboot_window: Optional[RebootWindow] stripe_s700: Optional[StripeS700] tipping: Optional[Tipping] @@ -1829,6 +1860,7 @@ async def retrieve_async( _inner_class_types = { "bbpos_wisepos_e": BbposWiseposE, "offline": Offline, + "reader_security": ReaderSecurity, "reboot_window": RebootWindow, "stripe_s700": StripeS700, "tipping": Tipping, diff --git a/stripe/terminal/_configuration_service.py b/stripe/terminal/_configuration_service.py index f291dce53..0f8d3cb22 100644 --- a/stripe/terminal/_configuration_service.py +++ b/stripe/terminal/_configuration_service.py @@ -31,6 +31,12 @@ class CreateParams(TypedDict): """ Configurations for collecting transactions offline. """ + reader_security: NotRequired[ + "Literal['']|ConfigurationService.CreateParamsReaderSecurity" + ] + """ + Configurations for reader security settings. + """ reboot_window: NotRequired[ "ConfigurationService.CreateParamsRebootWindow" ] @@ -70,6 +76,12 @@ class CreateParamsOffline(TypedDict): Determines whether to allow transactions to be collected while reader is offline. Defaults to false. """ + class CreateParamsReaderSecurity(TypedDict): + admin_menu_passcode: NotRequired["Literal['']|str"] + """ + Passcode used to access a reader's admin menu. + """ + class CreateParamsRebootWindow(TypedDict): end_hour: int """ @@ -600,6 +612,12 @@ class UpdateParams(TypedDict): """ Configurations for collecting transactions offline. """ + reader_security: NotRequired[ + "Literal['']|ConfigurationService.UpdateParamsReaderSecurity" + ] + """ + Configurations for reader security settings. + """ reboot_window: NotRequired[ "Literal['']|ConfigurationService.UpdateParamsRebootWindow" ] @@ -641,6 +659,12 @@ class UpdateParamsOffline(TypedDict): Determines whether to allow transactions to be collected while reader is offline. Defaults to false. """ + class UpdateParamsReaderSecurity(TypedDict): + admin_menu_passcode: NotRequired["Literal['']|str"] + """ + Passcode used to access a reader's admin menu. + """ + class UpdateParamsRebootWindow(TypedDict): end_hour: int """ From f03ebd4ba00bffdb87e3a9f6c65175dc423f72ea Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 22:16:53 +0000 Subject: [PATCH 14/31] Update generated code for v1911 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/_customer_session.py | 170 ---------------------------- stripe/_customer_session_service.py | 86 -------------- 3 files changed, 1 insertion(+), 257 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index d0e3cb346..f6d4c9d3d 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1910 \ No newline at end of file +v1911 \ No newline at end of file diff --git a/stripe/_customer_session.py b/stripe/_customer_session.py index 72d0d67a1..d0b4b6c4a 100644 --- a/stripe/_customer_session.py +++ b/stripe/_customer_session.py @@ -36,80 +36,6 @@ class BuyButton(StripeObject): Whether the buy button is enabled. """ - class CustomerSheet(StripeObject): - class Features(StripeObject): - payment_method_allow_redisplay_filters: Optional[ - List[Literal["always", "limited", "unspecified"]] - ] - """ - A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the customer sheet displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. - - If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. - """ - payment_method_remove: Optional[Literal["disabled", "enabled"]] - """ - Controls whether the customer sheet displays the option to remove a saved payment method." - - Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the [`customer` object](https://docs.stripe.com/api/payment_methods/object#payment_method_object-customer) from that [PaymentMethod](https://docs.stripe.com/api/payment_methods). - """ - - enabled: bool - """ - Whether the customer sheet is enabled. - """ - features: Optional[Features] - """ - This hash defines whether the customer sheet supports certain features. - """ - _inner_class_types = {"features": Features} - - class MobilePaymentElement(StripeObject): - class Features(StripeObject): - payment_method_allow_redisplay_filters: Optional[ - List[Literal["always", "limited", "unspecified"]] - ] - """ - A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the mobile payment element displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. - - If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. - """ - payment_method_redisplay: Optional[ - Literal["disabled", "enabled"] - ] - """ - Controls whether or not the mobile payment element shows saved payment methods. - """ - payment_method_remove: Optional[Literal["disabled", "enabled"]] - """ - Controls whether the mobile payment element displays the option to remove a saved payment method." - - Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the [`customer` object](https://docs.stripe.com/api/payment_methods/object#payment_method_object-customer) from that [PaymentMethod](https://docs.stripe.com/api/payment_methods). - """ - payment_method_save: Optional[Literal["disabled", "enabled"]] - """ - Controls whether the mobile payment element displays a checkbox offering to save a new payment method. - - If a customer checks the box, the [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) value on the PaymentMethod is set to `'always'` at confirmation time. For PaymentIntents, the [`setup_future_usage`](https://docs.stripe.com/api/payment_intents/object#payment_intent_object-setup_future_usage) value is also set to the value defined in `payment_method_save_usage`. - """ - payment_method_save_allow_redisplay_override: Optional[ - Literal["always", "limited", "unspecified"] - ] - """ - Allows overriding the value of allow_override when saving a new payment method when payment_method_save is set to disabled. Use values: "always", "limited", or "unspecified". - - If not specified, defaults to `nil` (no override value). - """ - - enabled: bool - """ - Whether the mobile payment element is enabled. - """ - features: Optional[Features] - """ - This hash defines whether the mobile payment element supports certain features. - """ - _inner_class_types = {"features": Features} - class PaymentElement(StripeObject): class Features(StripeObject): payment_method_allow_redisplay_filters: List[ @@ -169,14 +95,6 @@ class PricingTable(StripeObject): """ This hash contains whether the buy button is enabled. """ - customer_sheet: Optional[CustomerSheet] - """ - This hash contains whether the customer sheet is enabled and the features it supports. - """ - mobile_payment_element: Optional[MobilePaymentElement] - """ - This hash contains whether the mobile payment element is enabled and the features it supports. - """ payment_element: PaymentElement """ This hash contains whether the Payment Element is enabled and the features it supports. @@ -187,8 +105,6 @@ class PricingTable(StripeObject): """ _inner_class_types = { "buy_button": BuyButton, - "customer_sheet": CustomerSheet, - "mobile_payment_element": MobilePaymentElement, "payment_element": PaymentElement, "pricing_table": PricingTable, } @@ -218,18 +134,6 @@ class CreateParamsComponents(TypedDict): """ Configuration for buy button. """ - customer_sheet: NotRequired[ - "CustomerSession.CreateParamsComponentsCustomerSheet" - ] - """ - Configuration for the customer sheet. - """ - mobile_payment_element: NotRequired[ - "CustomerSession.CreateParamsComponentsMobilePaymentElement" - ] - """ - Configuration for the mobile payment element. - """ payment_element: NotRequired[ "CustomerSession.CreateParamsComponentsPaymentElement" ] @@ -249,80 +153,6 @@ class CreateParamsComponentsBuyButton(TypedDict): Whether the buy button is enabled. """ - class CreateParamsComponentsCustomerSheet(TypedDict): - enabled: bool - """ - Whether the customer sheet is enabled. - """ - features: NotRequired[ - "CustomerSession.CreateParamsComponentsCustomerSheetFeatures" - ] - """ - This hash defines whether the customer sheet supports certain features. - """ - - class CreateParamsComponentsCustomerSheetFeatures(TypedDict): - payment_method_allow_redisplay_filters: NotRequired[ - List[Literal["always", "limited", "unspecified"]] - ] - """ - A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the customer sheet displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. - - If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. - """ - payment_method_remove: NotRequired[Literal["disabled", "enabled"]] - """ - Controls whether the customer sheet displays the option to remove a saved payment method." - - Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the [`customer` object](https://docs.stripe.com/api/payment_methods/object#payment_method_object-customer) from that [PaymentMethod](https://docs.stripe.com/api/payment_methods). - """ - - class CreateParamsComponentsMobilePaymentElement(TypedDict): - enabled: bool - """ - Whether the mobile payment element is enabled. - """ - features: NotRequired[ - "CustomerSession.CreateParamsComponentsMobilePaymentElementFeatures" - ] - """ - This hash defines whether the mobile payment element supports certain features. - """ - - class CreateParamsComponentsMobilePaymentElementFeatures(TypedDict): - payment_method_allow_redisplay_filters: NotRequired[ - List[Literal["always", "limited", "unspecified"]] - ] - """ - A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the mobile payment element displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. - - If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. - """ - payment_method_redisplay: NotRequired[Literal["disabled", "enabled"]] - """ - Controls whether or not the mobile payment element shows saved payment methods. - """ - payment_method_remove: NotRequired[Literal["disabled", "enabled"]] - """ - Controls whether the mobile payment element displays the option to remove a saved payment method." - - Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the [`customer` object](https://docs.stripe.com/api/payment_methods/object#payment_method_object-customer) from that [PaymentMethod](https://docs.stripe.com/api/payment_methods). - """ - payment_method_save: NotRequired[Literal["disabled", "enabled"]] - """ - Controls whether the mobile payment element displays a checkbox offering to save a new payment method. - - If a customer checks the box, the [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) value on the PaymentMethod is set to `'always'` at confirmation time. For PaymentIntents, the [`setup_future_usage`](https://docs.stripe.com/api/payment_intents/object#payment_intent_object-setup_future_usage) value is also set to the value defined in `payment_method_save_usage`. - """ - payment_method_save_allow_redisplay_override: NotRequired[ - Literal["always", "limited", "unspecified"] - ] - """ - Allows overriding the value of allow_override when saving a new payment method when payment_method_save is set to disabled. Use values: "always", "limited", or "unspecified". - - If not specified, defaults to `nil` (no override value). - """ - class CreateParamsComponentsPaymentElement(TypedDict): enabled: bool """ diff --git a/stripe/_customer_session_service.py b/stripe/_customer_session_service.py index 0fc841fa2..45cb77aed 100644 --- a/stripe/_customer_session_service.py +++ b/stripe/_customer_session_service.py @@ -33,18 +33,6 @@ class CreateParamsComponents(TypedDict): """ Configuration for buy button. """ - customer_sheet: NotRequired[ - "CustomerSessionService.CreateParamsComponentsCustomerSheet" - ] - """ - Configuration for the customer sheet. - """ - mobile_payment_element: NotRequired[ - "CustomerSessionService.CreateParamsComponentsMobilePaymentElement" - ] - """ - Configuration for the mobile payment element. - """ payment_element: NotRequired[ "CustomerSessionService.CreateParamsComponentsPaymentElement" ] @@ -64,80 +52,6 @@ class CreateParamsComponentsBuyButton(TypedDict): Whether the buy button is enabled. """ - class CreateParamsComponentsCustomerSheet(TypedDict): - enabled: bool - """ - Whether the customer sheet is enabled. - """ - features: NotRequired[ - "CustomerSessionService.CreateParamsComponentsCustomerSheetFeatures" - ] - """ - This hash defines whether the customer sheet supports certain features. - """ - - class CreateParamsComponentsCustomerSheetFeatures(TypedDict): - payment_method_allow_redisplay_filters: NotRequired[ - List[Literal["always", "limited", "unspecified"]] - ] - """ - A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the customer sheet displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. - - If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. - """ - payment_method_remove: NotRequired[Literal["disabled", "enabled"]] - """ - Controls whether the customer sheet displays the option to remove a saved payment method." - - Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the [`customer` object](https://docs.stripe.com/api/payment_methods/object#payment_method_object-customer) from that [PaymentMethod](https://docs.stripe.com/api/payment_methods). - """ - - class CreateParamsComponentsMobilePaymentElement(TypedDict): - enabled: bool - """ - Whether the mobile payment element is enabled. - """ - features: NotRequired[ - "CustomerSessionService.CreateParamsComponentsMobilePaymentElementFeatures" - ] - """ - This hash defines whether the mobile payment element supports certain features. - """ - - class CreateParamsComponentsMobilePaymentElementFeatures(TypedDict): - payment_method_allow_redisplay_filters: NotRequired[ - List[Literal["always", "limited", "unspecified"]] - ] - """ - A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the mobile payment element displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. - - If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. - """ - payment_method_redisplay: NotRequired[Literal["disabled", "enabled"]] - """ - Controls whether or not the mobile payment element shows saved payment methods. - """ - payment_method_remove: NotRequired[Literal["disabled", "enabled"]] - """ - Controls whether the mobile payment element displays the option to remove a saved payment method." - - Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the [`customer` object](https://docs.stripe.com/api/payment_methods/object#payment_method_object-customer) from that [PaymentMethod](https://docs.stripe.com/api/payment_methods). - """ - payment_method_save: NotRequired[Literal["disabled", "enabled"]] - """ - Controls whether the mobile payment element displays a checkbox offering to save a new payment method. - - If a customer checks the box, the [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) value on the PaymentMethod is set to `'always'` at confirmation time. For PaymentIntents, the [`setup_future_usage`](https://docs.stripe.com/api/payment_intents/object#payment_intent_object-setup_future_usage) value is also set to the value defined in `payment_method_save_usage`. - """ - payment_method_save_allow_redisplay_override: NotRequired[ - Literal["always", "limited", "unspecified"] - ] - """ - Allows overriding the value of allow_override when saving a new payment method when payment_method_save is set to disabled. Use values: "always", "limited", or "unspecified". - - If not specified, defaults to `nil` (no override value). - """ - class CreateParamsComponentsPaymentElement(TypedDict): enabled: bool """ From f7be7855f479f82a14a57b10581064c805b67dd6 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 23:31:07 +0000 Subject: [PATCH 15/31] Update generated code for v1913 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/_account_session.py | 34 ++++++++ stripe/_account_session_service.py | 21 +++++ stripe/_balance_settings.py | 124 ++++++++++++++++------------ stripe/_balance_settings_service.py | 32 ++++--- 5 files changed, 145 insertions(+), 68 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index f6d4c9d3d..e8a4fda16 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1911 \ No newline at end of file +v1913 \ No newline at end of file diff --git a/stripe/_account_session.py b/stripe/_account_session.py index 0828cb428..348fd211f 100644 --- a/stripe/_account_session.py +++ b/stripe/_account_session.py @@ -367,6 +367,17 @@ class Features(StripeObject): features: Features _inner_class_types = {"features": Features} + class PayoutDetails(StripeObject): + class Features(StripeObject): + pass + + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: Features + _inner_class_types = {"features": Features} + class Payouts(StripeObject): class Features(StripeObject): disable_stripe_user_authentication: bool @@ -447,6 +458,7 @@ class Features(StripeObject): payment_details: PaymentDetails payment_disputes: PaymentDisputes payments: Payments + payout_details: PayoutDetails payouts: Payouts payouts_list: PayoutsList tax_registrations: TaxRegistrations @@ -469,6 +481,7 @@ class Features(StripeObject): "payment_details": PaymentDetails, "payment_disputes": PaymentDisputes, "payments": Payments, + "payout_details": PayoutDetails, "payouts": Payouts, "payouts_list": PayoutsList, "tax_registrations": TaxRegistrations, @@ -618,6 +631,12 @@ class CreateParamsComponents(TypedDict): """ Configuration for the [payments](https://docs.stripe.com/connect/supported-embedded-components/payments/) embedded component. """ + payout_details: NotRequired[ + "AccountSession.CreateParamsComponentsPayoutDetails" + ] + """ + Configuration for the [payout details](https://docs.stripe.com/connect/supported-embedded-components/payout-details/) embedded component. + """ payouts: NotRequired["AccountSession.CreateParamsComponentsPayouts"] """ Configuration for the [payouts](https://docs.stripe.com/connect/supported-embedded-components/payouts/) embedded component. @@ -1162,6 +1181,21 @@ class CreateParamsComponentsPaymentsFeatures(TypedDict): Whether sending refunds is enabled. This is `true` by default. """ + class CreateParamsComponentsPayoutDetails(TypedDict): + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: NotRequired[ + "AccountSession.CreateParamsComponentsPayoutDetailsFeatures" + ] + """ + An empty list, because this embedded component has no features. + """ + + class CreateParamsComponentsPayoutDetailsFeatures(TypedDict): + pass + class CreateParamsComponentsPayouts(TypedDict): enabled: bool """ diff --git a/stripe/_account_session_service.py b/stripe/_account_session_service.py index 5e5bccc2e..3a9172d0d 100644 --- a/stripe/_account_session_service.py +++ b/stripe/_account_session_service.py @@ -155,6 +155,12 @@ class CreateParamsComponents(TypedDict): """ Configuration for the [payments](https://docs.stripe.com/connect/supported-embedded-components/payments/) embedded component. """ + payout_details: NotRequired[ + "AccountSessionService.CreateParamsComponentsPayoutDetails" + ] + """ + Configuration for the [payout details](https://docs.stripe.com/connect/supported-embedded-components/payout-details/) embedded component. + """ payouts: NotRequired[ "AccountSessionService.CreateParamsComponentsPayouts" ] @@ -701,6 +707,21 @@ class CreateParamsComponentsPaymentsFeatures(TypedDict): Whether sending refunds is enabled. This is `true` by default. """ + class CreateParamsComponentsPayoutDetails(TypedDict): + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: NotRequired[ + "AccountSessionService.CreateParamsComponentsPayoutDetailsFeatures" + ] + """ + An empty list, because this embedded component has no features. + """ + + class CreateParamsComponentsPayoutDetailsFeatures(TypedDict): + pass + class CreateParamsComponentsPayouts(TypedDict): enabled: bool """ diff --git a/stripe/_balance_settings.py b/stripe/_balance_settings.py index c8f74913c..63cc306bf 100644 --- a/stripe/_balance_settings.py +++ b/stripe/_balance_settings.py @@ -22,75 +22,100 @@ class BalanceSettings( OBJECT_NAME: ClassVar[Literal["balance_settings"]] = "balance_settings" - class Payouts(StripeObject): - class Schedule(StripeObject): - interval: Optional[Literal["daily", "manual", "monthly", "weekly"]] + class Payments(StripeObject): + class Payouts(StripeObject): + class Schedule(StripeObject): + interval: Optional[ + Literal["daily", "manual", "monthly", "weekly"] + ] + """ + How frequently funds will be paid out. One of `manual` (payouts only created via API call), `daily`, `weekly`, or `monthly`. + """ + monthly_payout_days: Optional[List[int]] + """ + The day of the month funds will be paid out. Only shown if `interval` is monthly. Payouts scheduled between the 29th and 31st of the month are sent on the last day of shorter months. + """ + weekly_payout_days: Optional[ + List[ + Literal[ + "friday", + "monday", + "saturday", + "sunday", + "thursday", + "tuesday", + "wednesday", + ] + ] + ] + """ + The days of the week when available funds are paid out, specified as an array, for example, [`monday`, `tuesday`]. Only shown if `interval` is weekly. + """ + + schedule: Optional[Schedule] """ - How frequently funds will be paid out. One of `manual` (payouts only created via API call), `daily`, `weekly`, or `monthly`. + Details on when funds from charges are available, and when they are paid out to an external account. See our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation for details. """ - monthly_payout_days: Optional[List[int]] + statement_descriptor: Optional[str] """ - The day of the month funds will be paid out. Only shown if `interval` is monthly. Payouts scheduled between the 29th and 31st of the month are sent on the last day of shorter months. + The text that appears on the bank account statement for payouts. If not set, this defaults to the platform's bank descriptor as set in the Dashboard. """ - weekly_payout_days: Optional[ - List[ - Literal[ - "friday", - "monday", - "saturday", - "sunday", - "thursday", - "tuesday", - "wednesday", - ] - ] - ] + status: Literal["disabled", "enabled"] """ - The days of the week when available funds are paid out, specified as an array, for example, [`monday`, `tuesday`]. Only shown if `interval` is weekly. + Whether the funds in this account can be paid out. """ + _inner_class_types = {"schedule": Schedule} - schedule: Optional[Schedule] + class SettlementTiming(StripeObject): + delay_days: int + """ + The number of days charge funds are held before becoming available. + """ + + debit_negative_balances: Optional[bool] """ - Details on when funds from charges are available, and when they are paid out to an external account. See our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation for details. + A Boolean indicating if Stripe should try to reclaim negative balances from an attached bank account. See [Understanding Connect account balances](https://docs.stripe.com/connect/account-balances) for details. The default value is `false` when [controller.requirement_collection](https://docs.stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts, otherwise `true`. """ - statement_descriptor: Optional[str] + payouts: Optional[Payouts] """ - The text that appears on the bank account statement for payouts. If not set, this defaults to the platform's bank descriptor as set in the Dashboard. + Settings specific to the account's payouts. """ - status: Literal["disabled", "enabled"] + settlement_timing: SettlementTiming + _inner_class_types = { + "payouts": Payouts, + "settlement_timing": SettlementTiming, + } + + class ModifyParams(RequestOptions): + expand: NotRequired[List[str]] """ - Whether the funds in this account can be paid out. + Specifies which fields in the response should be expanded. """ - _inner_class_types = {"schedule": Schedule} - - class SettlementTiming(StripeObject): - delay_days: int + payments: "BalanceSettings.ModifyParamsPayments" """ - The number of days charge funds are held before becoming available. + Settings that apply to the [Payments Balance](https://docs.stripe.com/api/balance). """ - class ModifyParams(RequestOptions): + class ModifyParamsPayments(TypedDict): debit_negative_balances: NotRequired[bool] """ A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. For details, see [Understanding Connect Account Balances](https://docs.stripe.com/connect/account-balances). """ - expand: NotRequired[List[str]] - """ - Specifies which fields in the response should be expanded. - """ - payouts: NotRequired["BalanceSettings.ModifyParamsPayouts"] + payouts: NotRequired["BalanceSettings.ModifyParamsPaymentsPayouts"] """ Settings specific to the account's payouts. """ settlement_timing: NotRequired[ - "BalanceSettings.ModifyParamsSettlementTiming" + "BalanceSettings.ModifyParamsPaymentsSettlementTiming" ] """ Settings related to the account's balance settlement timing. """ - class ModifyParamsPayouts(TypedDict): - schedule: NotRequired["BalanceSettings.ModifyParamsPayoutsSchedule"] + class ModifyParamsPaymentsPayouts(TypedDict): + schedule: NotRequired[ + "BalanceSettings.ModifyParamsPaymentsPayoutsSchedule" + ] """ Details on when funds from charges are available, and when they are paid out to an external account. For details, see our [Setting Bank and Debit Card Payouts](https://docs.stripe.com/connect/bank-transfers#payout-information) documentation. """ @@ -99,7 +124,7 @@ class ModifyParamsPayouts(TypedDict): The text that appears on the bank account statement for payouts. If not set, this defaults to the platform's bank descriptor as set in the Dashboard. """ - class ModifyParamsPayoutsSchedule(TypedDict): + class ModifyParamsPaymentsPayoutsSchedule(TypedDict): interval: NotRequired[Literal["daily", "manual", "monthly", "weekly"]] """ How frequently available funds are paid out. One of: `daily`, `manual`, `weekly`, or `monthly`. Default is `daily`. @@ -125,7 +150,7 @@ class ModifyParamsPayoutsSchedule(TypedDict): The days of the week when available funds are paid out, specified as an array, e.g., [`monday`, `tuesday`]. (required and applicable only if `interval` is `weekly`.) """ - class ModifyParamsSettlementTiming(TypedDict): + class ModifyParamsPaymentsSettlementTiming(TypedDict): delay_days_override: NotRequired[int] """ The number of days charge funds are held before becoming available. May also be set to `minimum`, representing the lowest available value for the account country. Default is `minimum`. The `delay_days` parameter remains at the last configured value if `payouts.schedule.interval` is `manual`. [Learn more about controlling payout delay days](https://docs.stripe.com/connect/manage-payout-schedule). @@ -137,19 +162,11 @@ class RetrieveParams(RequestOptions): Specifies which fields in the response should be expanded. """ - debit_negative_balances: Optional[bool] - """ - A Boolean indicating if Stripe should try to reclaim negative balances from an attached bank account. See [Understanding Connect account balances](https://docs.stripe.com/connect/account-balances) for details. The default value is `false` when [controller.requirement_collection](https://docs.stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts, otherwise `true`. - """ object: Literal["balance_settings"] """ String representing the object's type. Objects of the same type share the same value. """ - payouts: Optional[Payouts] - """ - Settings specific to the account's payouts. - """ - settlement_timing: SettlementTiming + payments: Payments @classmethod def modify( @@ -213,7 +230,4 @@ async def retrieve_async( def class_url(cls): return "/v1/balance_settings" - _inner_class_types = { - "payouts": Payouts, - "settlement_timing": SettlementTiming, - } + _inner_class_types = {"payments": Payments} diff --git a/stripe/_balance_settings_service.py b/stripe/_balance_settings_service.py index 3b658223a..a198761d3 100644 --- a/stripe/_balance_settings_service.py +++ b/stripe/_balance_settings_service.py @@ -15,28 +15,36 @@ class RetrieveParams(TypedDict): """ class UpdateParams(TypedDict): - debit_negative_balances: NotRequired[bool] - """ - A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. For details, see [Understanding Connect Account Balances](https://docs.stripe.com/connect/account-balances). - """ expand: NotRequired[List[str]] """ Specifies which fields in the response should be expanded. """ - payouts: NotRequired["BalanceSettingsService.UpdateParamsPayouts"] + payments: "BalanceSettingsService.UpdateParamsPayments" + """ + Settings that apply to the [Payments Balance](https://docs.stripe.com/api/balance). + """ + + class UpdateParamsPayments(TypedDict): + debit_negative_balances: NotRequired[bool] + """ + A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. For details, see [Understanding Connect Account Balances](https://docs.stripe.com/connect/account-balances). + """ + payouts: NotRequired[ + "BalanceSettingsService.UpdateParamsPaymentsPayouts" + ] """ Settings specific to the account's payouts. """ settlement_timing: NotRequired[ - "BalanceSettingsService.UpdateParamsSettlementTiming" + "BalanceSettingsService.UpdateParamsPaymentsSettlementTiming" ] """ Settings related to the account's balance settlement timing. """ - class UpdateParamsPayouts(TypedDict): + class UpdateParamsPaymentsPayouts(TypedDict): schedule: NotRequired[ - "BalanceSettingsService.UpdateParamsPayoutsSchedule" + "BalanceSettingsService.UpdateParamsPaymentsPayoutsSchedule" ] """ Details on when funds from charges are available, and when they are paid out to an external account. For details, see our [Setting Bank and Debit Card Payouts](https://docs.stripe.com/connect/bank-transfers#payout-information) documentation. @@ -46,7 +54,7 @@ class UpdateParamsPayouts(TypedDict): The text that appears on the bank account statement for payouts. If not set, this defaults to the platform's bank descriptor as set in the Dashboard. """ - class UpdateParamsPayoutsSchedule(TypedDict): + class UpdateParamsPaymentsPayoutsSchedule(TypedDict): interval: NotRequired[Literal["daily", "manual", "monthly", "weekly"]] """ How frequently available funds are paid out. One of: `daily`, `manual`, `weekly`, or `monthly`. Default is `daily`. @@ -72,7 +80,7 @@ class UpdateParamsPayoutsSchedule(TypedDict): The days of the week when available funds are paid out, specified as an array, e.g., [`monday`, `tuesday`]. (required and applicable only if `interval` is `weekly`.) """ - class UpdateParamsSettlementTiming(TypedDict): + class UpdateParamsPaymentsSettlementTiming(TypedDict): delay_days_override: NotRequired[int] """ The number of days charge funds are held before becoming available. May also be set to `minimum`, representing the lowest available value for the account country. Default is `minimum`. The `delay_days` parameter remains at the last configured value if `payouts.schedule.interval` is `manual`. [Learn more about controlling payout delay days](https://docs.stripe.com/connect/manage-payout-schedule). @@ -120,7 +128,7 @@ async def retrieve_async( def update( self, - params: "BalanceSettingsService.UpdateParams" = {}, + params: "BalanceSettingsService.UpdateParams", options: RequestOptions = {}, ) -> BalanceSettings: """ @@ -140,7 +148,7 @@ def update( async def update_async( self, - params: "BalanceSettingsService.UpdateParams" = {}, + params: "BalanceSettingsService.UpdateParams", options: RequestOptions = {}, ) -> BalanceSettings: """ From 366692ee2d7e746f7f3d3010f458f490e9620dd9 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 15 Aug 2025 17:25:35 +0000 Subject: [PATCH 16/31] Update generated code for v1915 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/_charge.py | 10 ++++++++-- stripe/_payment_attempt_record.py | 10 ++++++++-- stripe/_payment_record.py | 10 ++++++++-- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index e8a4fda16..3c79d96ae 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1913 \ No newline at end of file +v1915 \ No newline at end of file diff --git a/stripe/_charge.py b/stripe/_charge.py index b13d7890d..478ade4e5 100644 --- a/stripe/_charge.py +++ b/stripe/_charge.py @@ -440,7 +440,10 @@ class Bancontact(StripeObject): """ class Billie(StripeObject): - pass + transaction_id: Optional[str] + """ + The Billie transaction ID associated with this payment. + """ class Blik(StripeObject): buyer_id: Optional[str] @@ -1923,7 +1926,10 @@ class SamsungPay(StripeObject): """ class Satispay(StripeObject): - pass + transaction_id: Optional[str] + """ + The Satispay transaction ID associated with this payment. + """ class SepaCreditTransfer(StripeObject): bank_name: Optional[str] diff --git a/stripe/_payment_attempt_record.py b/stripe/_payment_attempt_record.py index c755da5f0..f7c0af7db 100644 --- a/stripe/_payment_attempt_record.py +++ b/stripe/_payment_attempt_record.py @@ -355,7 +355,10 @@ class Bancontact(StripeObject): """ class Billie(StripeObject): - pass + transaction_id: Optional[str] + """ + The Billie transaction ID associated with this payment. + """ class BillingDetails(StripeObject): class Address(StripeObject): @@ -1560,7 +1563,10 @@ class SamsungPay(StripeObject): """ class Satispay(StripeObject): - pass + transaction_id: Optional[str] + """ + The Satispay transaction ID associated with this payment. + """ class SepaCreditTransfer(StripeObject): bank_name: Optional[str] diff --git a/stripe/_payment_record.py b/stripe/_payment_record.py index 41eee8aa0..9c0d962ae 100644 --- a/stripe/_payment_record.py +++ b/stripe/_payment_record.py @@ -359,7 +359,10 @@ class Bancontact(StripeObject): """ class Billie(StripeObject): - pass + transaction_id: Optional[str] + """ + The Billie transaction ID associated with this payment. + """ class BillingDetails(StripeObject): class Address(StripeObject): @@ -1564,7 +1567,10 @@ class SamsungPay(StripeObject): """ class Satispay(StripeObject): - pass + transaction_id: Optional[str] + """ + The Satispay transaction ID associated with this payment. + """ class SepaCreditTransfer(StripeObject): bank_name: Optional[str] From 676903f115b372f71e054f333a54d4a3a87f200f Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 15 Aug 2025 19:34:32 +0000 Subject: [PATCH 17/31] Update generated code for v1916 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/_balance.py | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 3c79d96ae..31963baef 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1915 \ No newline at end of file +v1916 \ No newline at end of file diff --git a/stripe/_balance.py b/stripe/_balance.py index 91e52b97b..da5c027db 100644 --- a/stripe/_balance.py +++ b/stripe/_balance.py @@ -12,14 +12,9 @@ class Balance(SingletonAPIResource["Balance"]): This is an object representing your Stripe balance. You can retrieve it to see the balance currently on your Stripe account. - You can also retrieve the balance history, which contains a list of - [transactions](https://stripe.com/docs/reporting/balance-transaction-types) that contributed to the balance - (charges, payouts, and so forth). + The top-level `available` and `pending` comprise your "payments balance." - The available and pending amounts for each currency are broken down further by - payment source types. - - Related guide: [Understanding Connect account balances](https://stripe.com/docs/connect/account-balances) + Related guide: [Balances and settlement time](https://stripe.com/docs/payments/balances), [Understanding Connect account balances](https://stripe.com/docs/connect/account-balances) """ OBJECT_NAME: ClassVar[Literal["balance"]] = "balance" From b22bc64987acce5fd5084d74266e27245aed56f1 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 15 Aug 2025 22:09:01 +0000 Subject: [PATCH 18/31] Update generated code for v1918 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/_account_session.py | 68 ++++++++++++++++++++++++++++++ stripe/_account_session_service.py | 42 ++++++++++++++++++ 3 files changed, 111 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 31963baef..b3f599c4c 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1916 \ No newline at end of file +v1918 \ No newline at end of file diff --git a/stripe/_account_session.py b/stripe/_account_session.py index 348fd211f..2f36a012f 100644 --- a/stripe/_account_session.py +++ b/stripe/_account_session.py @@ -57,6 +57,17 @@ class Features(StripeObject): features: Features _inner_class_types = {"features": Features} + class BalanceReport(StripeObject): + class Features(StripeObject): + pass + + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: Features + _inner_class_types = {"features": Features} + class Balances(StripeObject): class Features(StripeObject): disable_stripe_user_authentication: bool @@ -378,6 +389,17 @@ class Features(StripeObject): features: Features _inner_class_types = {"features": Features} + class PayoutReconciliationReport(StripeObject): + class Features(StripeObject): + pass + + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: Features + _inner_class_types = {"features": Features} + class Payouts(StripeObject): class Features(StripeObject): disable_stripe_user_authentication: bool @@ -443,6 +465,7 @@ class Features(StripeObject): account_management: AccountManagement account_onboarding: AccountOnboarding + balance_report: BalanceReport balances: Balances capital_financing: Optional[CapitalFinancing] capital_financing_application: Optional[CapitalFinancingApplication] @@ -459,6 +482,7 @@ class Features(StripeObject): payment_disputes: PaymentDisputes payments: Payments payout_details: PayoutDetails + payout_reconciliation_report: PayoutReconciliationReport payouts: Payouts payouts_list: PayoutsList tax_registrations: TaxRegistrations @@ -466,6 +490,7 @@ class Features(StripeObject): _inner_class_types = { "account_management": AccountManagement, "account_onboarding": AccountOnboarding, + "balance_report": BalanceReport, "balances": Balances, "capital_financing": CapitalFinancing, "capital_financing_application": CapitalFinancingApplication, @@ -482,6 +507,7 @@ class Features(StripeObject): "payment_disputes": PaymentDisputes, "payments": Payments, "payout_details": PayoutDetails, + "payout_reconciliation_report": PayoutReconciliationReport, "payouts": Payouts, "payouts_list": PayoutsList, "tax_registrations": TaxRegistrations, @@ -527,6 +553,12 @@ class CreateParamsComponents(TypedDict): """ Configuration for the [app viewport](https://docs.stripe.com/connect/supported-embedded-components/app-viewport/) embedded component. """ + balance_report: NotRequired[ + "AccountSession.CreateParamsComponentsBalanceReport" + ] + """ + Configuration for the [balance report](https://docs.stripe.com/connect/supported-embedded-components/financial-reports#balance-report) embedded component. + """ balances: NotRequired["AccountSession.CreateParamsComponentsBalances"] """ Configuration for the [balances](https://docs.stripe.com/connect/supported-embedded-components/balances/) embedded component. @@ -637,6 +669,12 @@ class CreateParamsComponents(TypedDict): """ Configuration for the [payout details](https://docs.stripe.com/connect/supported-embedded-components/payout-details/) embedded component. """ + payout_reconciliation_report: NotRequired[ + "AccountSession.CreateParamsComponentsPayoutReconciliationReport" + ] + """ + Configuration for the [payout reconciliation report](https://docs.stripe.com/connect/supported-embedded-components/financial-reports#payout-reconciliation-report) embedded component. + """ payouts: NotRequired["AccountSession.CreateParamsComponentsPayouts"] """ Configuration for the [payouts](https://docs.stripe.com/connect/supported-embedded-components/payouts/) embedded component. @@ -764,6 +802,21 @@ class CreateParamsComponentsAppViewportFeatures(TypedDict): The list of apps allowed to be enabled in the embedded component. """ + class CreateParamsComponentsBalanceReport(TypedDict): + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: NotRequired[ + "AccountSession.CreateParamsComponentsBalanceReportFeatures" + ] + """ + An empty list, because this embedded component has no features. + """ + + class CreateParamsComponentsBalanceReportFeatures(TypedDict): + pass + class CreateParamsComponentsBalances(TypedDict): enabled: bool """ @@ -1196,6 +1249,21 @@ class CreateParamsComponentsPayoutDetails(TypedDict): class CreateParamsComponentsPayoutDetailsFeatures(TypedDict): pass + class CreateParamsComponentsPayoutReconciliationReport(TypedDict): + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: NotRequired[ + "AccountSession.CreateParamsComponentsPayoutReconciliationReportFeatures" + ] + """ + An empty list, because this embedded component has no features. + """ + + class CreateParamsComponentsPayoutReconciliationReportFeatures(TypedDict): + pass + class CreateParamsComponentsPayouts(TypedDict): enabled: bool """ diff --git a/stripe/_account_session_service.py b/stripe/_account_session_service.py index 3a9172d0d..cae1b9c05 100644 --- a/stripe/_account_session_service.py +++ b/stripe/_account_session_service.py @@ -47,6 +47,12 @@ class CreateParamsComponents(TypedDict): """ Configuration for the [app viewport](https://docs.stripe.com/connect/supported-embedded-components/app-viewport/) embedded component. """ + balance_report: NotRequired[ + "AccountSessionService.CreateParamsComponentsBalanceReport" + ] + """ + Configuration for the [balance report](https://docs.stripe.com/connect/supported-embedded-components/financial-reports#balance-report) embedded component. + """ balances: NotRequired[ "AccountSessionService.CreateParamsComponentsBalances" ] @@ -161,6 +167,12 @@ class CreateParamsComponents(TypedDict): """ Configuration for the [payout details](https://docs.stripe.com/connect/supported-embedded-components/payout-details/) embedded component. """ + payout_reconciliation_report: NotRequired[ + "AccountSessionService.CreateParamsComponentsPayoutReconciliationReport" + ] + """ + Configuration for the [payout reconciliation report](https://docs.stripe.com/connect/supported-embedded-components/financial-reports#payout-reconciliation-report) embedded component. + """ payouts: NotRequired[ "AccountSessionService.CreateParamsComponentsPayouts" ] @@ -290,6 +302,21 @@ class CreateParamsComponentsAppViewportFeatures(TypedDict): The list of apps allowed to be enabled in the embedded component. """ + class CreateParamsComponentsBalanceReport(TypedDict): + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: NotRequired[ + "AccountSessionService.CreateParamsComponentsBalanceReportFeatures" + ] + """ + An empty list, because this embedded component has no features. + """ + + class CreateParamsComponentsBalanceReportFeatures(TypedDict): + pass + class CreateParamsComponentsBalances(TypedDict): enabled: bool """ @@ -722,6 +749,21 @@ class CreateParamsComponentsPayoutDetails(TypedDict): class CreateParamsComponentsPayoutDetailsFeatures(TypedDict): pass + class CreateParamsComponentsPayoutReconciliationReport(TypedDict): + enabled: bool + """ + Whether the embedded component is enabled. + """ + features: NotRequired[ + "AccountSessionService.CreateParamsComponentsPayoutReconciliationReportFeatures" + ] + """ + An empty list, because this embedded component has no features. + """ + + class CreateParamsComponentsPayoutReconciliationReportFeatures(TypedDict): + pass + class CreateParamsComponentsPayouts(TypedDict): enabled: bool """ From ff183a293be8cfab8969687d168839f0ab4a79d6 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 15 Aug 2025 22:34:52 +0000 Subject: [PATCH 19/31] Update generated code for v1920 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/_payment_intent.py | 128 ++++++++++++++++++++++++++++++ stripe/_payment_intent_service.py | 64 +++++++++++++++ 3 files changed, 193 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index b3f599c4c..d98cfe36d 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1918 \ No newline at end of file +v1920 \ No newline at end of file diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index b4d29ca58..e5a250f3c 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -8522,6 +8522,70 @@ class CreateParams(RequestOptions): """ Set to `true` to fail the payment attempt if the PaymentIntent transitions into `requires_action`. Use this parameter for simpler integrations that don't handle customer actions, such as [saving cards without authentication](https://stripe.com/docs/payments/save-card-without-authentication). This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). """ + excluded_payment_method_types: NotRequired[ + List[ + Literal[ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "card", + "cashapp", + "crypto", + "customer_balance", + "eps", + "fpx", + "giropay", + "gopay", + "grabpay", + "id_bank_transfer", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "mb_way", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "payto", + "pix", + "promptpay", + "qris", + "rechnung", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "shopeepay", + "sofort", + "stripe_balance", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ] + ] + ] + """ + The list of payment method types to exclude from use with this payment. + """ expand: NotRequired[List[str]] """ Specifies which fields in the response should be expanded. @@ -17423,6 +17487,70 @@ class VerifyMicrodepositsParams(RequestOptions): """ An arbitrary string attached to the object. Often useful for displaying to users. """ + excluded_payment_method_types: Optional[ + List[ + Literal[ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "card", + "cashapp", + "crypto", + "customer_balance", + "eps", + "fpx", + "giropay", + "gopay", + "grabpay", + "id_bank_transfer", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "mb_way", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "payto", + "pix", + "promptpay", + "qris", + "rechnung", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "shopeepay", + "sofort", + "stripe_balance", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ] + ] + ] + """ + The list of payment method types to exclude from use with this payment. + """ fx_quote: Optional[str] """ The FX Quote used for the PaymentIntent. diff --git a/stripe/_payment_intent_service.py b/stripe/_payment_intent_service.py index 805387e06..c14148c32 100644 --- a/stripe/_payment_intent_service.py +++ b/stripe/_payment_intent_service.py @@ -5279,6 +5279,70 @@ class CreateParams(TypedDict): """ Set to `true` to fail the payment attempt if the PaymentIntent transitions into `requires_action`. Use this parameter for simpler integrations that don't handle customer actions, such as [saving cards without authentication](https://stripe.com/docs/payments/save-card-without-authentication). This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). """ + excluded_payment_method_types: NotRequired[ + List[ + Literal[ + "acss_debit", + "affirm", + "afterpay_clearpay", + "alipay", + "alma", + "amazon_pay", + "au_becs_debit", + "bacs_debit", + "bancontact", + "billie", + "blik", + "boleto", + "card", + "cashapp", + "crypto", + "customer_balance", + "eps", + "fpx", + "giropay", + "gopay", + "grabpay", + "id_bank_transfer", + "ideal", + "kakao_pay", + "klarna", + "konbini", + "kr_card", + "mb_way", + "mobilepay", + "multibanco", + "naver_pay", + "nz_bank_account", + "oxxo", + "p24", + "pay_by_bank", + "payco", + "paynow", + "paypal", + "payto", + "pix", + "promptpay", + "qris", + "rechnung", + "revolut_pay", + "samsung_pay", + "satispay", + "sepa_debit", + "shopeepay", + "sofort", + "stripe_balance", + "swish", + "twint", + "us_bank_account", + "wechat_pay", + "zip", + ] + ] + ] + """ + The list of payment method types to exclude from use with this payment. + """ expand: NotRequired[List[str]] """ Specifies which fields in the response should be expanded. From 854532e18fbec41d54f025d483e6688915bce789 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 17:42:40 +0000 Subject: [PATCH 20/31] Update generated code for v1922 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/_payment_intent.py | 6 +++--- stripe/_payment_intent_service.py | 6 +++--- stripe/_setup_intent.py | 6 +++--- stripe/_setup_intent_service.py | 6 +++--- stripe/checkout/_session.py | 2 +- stripe/checkout/_session_service.py | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index d98cfe36d..932be5781 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1920 \ No newline at end of file +v1922 \ No newline at end of file diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index e5a250f3c..627adde25 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -8014,7 +8014,7 @@ class ConfirmParamsPaymentMethodOptionsPix(TypedDict): class ConfirmParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ @@ -12317,7 +12317,7 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): class CreateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ @@ -16894,7 +16894,7 @@ class ModifyParamsPaymentMethodOptionsPix(TypedDict): class ModifyParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ diff --git a/stripe/_payment_intent_service.py b/stripe/_payment_intent_service.py index c14148c32..660532bcd 100644 --- a/stripe/_payment_intent_service.py +++ b/stripe/_payment_intent_service.py @@ -4769,7 +4769,7 @@ class ConfirmParamsPaymentMethodOptionsPix(TypedDict): class ConfirmParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ @@ -9126,7 +9126,7 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): class CreateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ @@ -13793,7 +13793,7 @@ class UpdateParamsPaymentMethodOptionsPix(TypedDict): class UpdateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ diff --git a/stripe/_setup_intent.py b/stripe/_setup_intent.py index 737c04ecd..67586088c 100644 --- a/stripe/_setup_intent.py +++ b/stripe/_setup_intent.py @@ -2299,7 +2299,7 @@ class ConfirmParamsPaymentMethodOptionsPix(TypedDict): class ConfirmParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ @@ -3966,7 +3966,7 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): class CreateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ @@ -5602,7 +5602,7 @@ class ModifyParamsPaymentMethodOptionsPix(TypedDict): class ModifyParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ diff --git a/stripe/_setup_intent_service.py b/stripe/_setup_intent_service.py index f7ddb58fc..f6cad97b2 100644 --- a/stripe/_setup_intent_service.py +++ b/stripe/_setup_intent_service.py @@ -1524,7 +1524,7 @@ class ConfirmParamsPaymentMethodOptionsPix(TypedDict): class ConfirmParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ @@ -3245,7 +3245,7 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): class CreateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ @@ -4945,7 +4945,7 @@ class UpdateParamsPaymentMethodOptionsPix(TypedDict): class UpdateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ diff --git a/stripe/checkout/_session.py b/stripe/checkout/_session.py index 1ecf5041b..afd76e1fc 100644 --- a/stripe/checkout/_session.py +++ b/stripe/checkout/_session.py @@ -4200,7 +4200,7 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): class CreateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ diff --git a/stripe/checkout/_session_service.py b/stripe/checkout/_session_service.py index 93e5f889d..3d6dc6621 100644 --- a/stripe/checkout/_session_service.py +++ b/stripe/checkout/_session_service.py @@ -2069,7 +2069,7 @@ class CreateParamsPaymentMethodOptionsPix(TypedDict): class CreateParamsPaymentMethodOptionsPixMandateOptions(TypedDict): amount: NotRequired[int] """ - Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 250 BRL. + Amount to be charged for future payments. Required when `amount_type=fixed`. If not provided for `amount_type=maximum`, defaults to 40000. """ amount_includes_iof: NotRequired[Literal["always", "never"]] """ From e77dcc4f3abef08b144f0515f06a8ffc07893df8 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 18:09:32 +0000 Subject: [PATCH 21/31] Update generated code for v1923 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/terminal/_reader.py | 2 +- stripe/test_helpers/terminal/_reader_service.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 932be5781..3467bbcfb 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1922 \ No newline at end of file +v1923 \ No newline at end of file diff --git a/stripe/terminal/_reader.py b/stripe/terminal/_reader.py index 5c595d614..54c2fdd3e 100644 --- a/stripe/terminal/_reader.py +++ b/stripe/terminal/_reader.py @@ -774,7 +774,7 @@ class PresentPaymentMethodParams(RequestOptions): """ class PresentPaymentMethodParamsCard(TypedDict): - cvc: str + cvc: NotRequired[str] """ Card security code. """ diff --git a/stripe/test_helpers/terminal/_reader_service.py b/stripe/test_helpers/terminal/_reader_service.py index 411abcf4e..197a76b6b 100644 --- a/stripe/test_helpers/terminal/_reader_service.py +++ b/stripe/test_helpers/terminal/_reader_service.py @@ -40,7 +40,7 @@ class PresentPaymentMethodParams(TypedDict): """ class PresentPaymentMethodParamsCard(TypedDict): - cvc: str + cvc: NotRequired[str] """ Card security code. """ From 4c550e7fe0e9583f8fd95b6e15f0cbe533d07906 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 18:51:04 +0000 Subject: [PATCH 22/31] Update generated code for v1925 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/_subscription.py | 76 +++++++++++++++++++++++++++++++ stripe/_subscription_service.py | 80 +++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 3467bbcfb..799caa8e8 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1923 \ No newline at end of file +v1925 \ No newline at end of file diff --git a/stripe/_subscription.py b/stripe/_subscription.py index b94d95d4c..c47395ba2 100644 --- a/stripe/_subscription.py +++ b/stripe/_subscription.py @@ -800,6 +800,14 @@ class CreateParamsAddInvoiceItem(TypedDict): """ The coupons to redeem into discounts for the item. """ + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ + period: NotRequired["Subscription.CreateParamsAddInvoiceItemPeriod"] + """ + The period associated with this invoice item. Defaults to the current period of the subscription. + """ price: NotRequired[str] """ The ID of the price object. One of `price` or `price_data` is required. @@ -865,6 +873,36 @@ class CreateParamsAddInvoiceItemDiscountDiscountEndDuration(TypedDict): The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration. """ + class CreateParamsAddInvoiceItemPeriod(TypedDict): + end: "Subscription.CreateParamsAddInvoiceItemPeriodEnd" + """ + End of the invoice item period. + """ + start: "Subscription.CreateParamsAddInvoiceItemPeriodStart" + """ + Start of the invoice item period. + """ + + class CreateParamsAddInvoiceItemPeriodEnd(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to `period.start`. + """ + type: Literal["min_item_period_end", "timestamp"] + """ + Select how to calculate the end of the invoice item period. + """ + + class CreateParamsAddInvoiceItemPeriodStart(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to `period.end`. + """ + type: Literal["max_item_period_start", "now", "timestamp"] + """ + Select how to calculate the start of the invoice item period. + """ + class CreateParamsAddInvoiceItemPriceData(TypedDict): currency: str """ @@ -1822,6 +1860,14 @@ class ModifyParamsAddInvoiceItem(TypedDict): """ The coupons to redeem into discounts for the item. """ + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ + period: NotRequired["Subscription.ModifyParamsAddInvoiceItemPeriod"] + """ + The period associated with this invoice item. Defaults to the current period of the subscription. + """ price: NotRequired[str] """ The ID of the price object. One of `price` or `price_data` is required. @@ -1887,6 +1933,36 @@ class ModifyParamsAddInvoiceItemDiscountDiscountEndDuration(TypedDict): The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration. """ + class ModifyParamsAddInvoiceItemPeriod(TypedDict): + end: "Subscription.ModifyParamsAddInvoiceItemPeriodEnd" + """ + End of the invoice item period. + """ + start: "Subscription.ModifyParamsAddInvoiceItemPeriodStart" + """ + Start of the invoice item period. + """ + + class ModifyParamsAddInvoiceItemPeriodEnd(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to `period.start`. + """ + type: Literal["min_item_period_end", "timestamp"] + """ + Select how to calculate the end of the invoice item period. + """ + + class ModifyParamsAddInvoiceItemPeriodStart(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to `period.end`. + """ + type: Literal["max_item_period_start", "now", "timestamp"] + """ + Select how to calculate the start of the invoice item period. + """ + class ModifyParamsAddInvoiceItemPriceData(TypedDict): currency: str """ diff --git a/stripe/_subscription_service.py b/stripe/_subscription_service.py index b7c21d37e..7fc5f2476 100644 --- a/stripe/_subscription_service.py +++ b/stripe/_subscription_service.py @@ -242,6 +242,16 @@ class CreateParamsAddInvoiceItem(TypedDict): """ The coupons to redeem into discounts for the item. """ + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ + period: NotRequired[ + "SubscriptionService.CreateParamsAddInvoiceItemPeriod" + ] + """ + The period associated with this invoice item. Defaults to the current period of the subscription. + """ price: NotRequired[str] """ The ID of the price object. One of `price` or `price_data` is required. @@ -307,6 +317,36 @@ class CreateParamsAddInvoiceItemDiscountDiscountEndDuration(TypedDict): The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration. """ + class CreateParamsAddInvoiceItemPeriod(TypedDict): + end: "SubscriptionService.CreateParamsAddInvoiceItemPeriodEnd" + """ + End of the invoice item period. + """ + start: "SubscriptionService.CreateParamsAddInvoiceItemPeriodStart" + """ + Start of the invoice item period. + """ + + class CreateParamsAddInvoiceItemPeriodEnd(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to `period.start`. + """ + type: Literal["min_item_period_end", "timestamp"] + """ + Select how to calculate the end of the invoice item period. + """ + + class CreateParamsAddInvoiceItemPeriodStart(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to `period.end`. + """ + type: Literal["max_item_period_start", "now", "timestamp"] + """ + Select how to calculate the start of the invoice item period. + """ + class CreateParamsAddInvoiceItemPriceData(TypedDict): currency: str """ @@ -1320,6 +1360,16 @@ class UpdateParamsAddInvoiceItem(TypedDict): """ The coupons to redeem into discounts for the item. """ + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ + period: NotRequired[ + "SubscriptionService.UpdateParamsAddInvoiceItemPeriod" + ] + """ + The period associated with this invoice item. Defaults to the current period of the subscription. + """ price: NotRequired[str] """ The ID of the price object. One of `price` or `price_data` is required. @@ -1385,6 +1435,36 @@ class UpdateParamsAddInvoiceItemDiscountDiscountEndDuration(TypedDict): The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration. """ + class UpdateParamsAddInvoiceItemPeriod(TypedDict): + end: "SubscriptionService.UpdateParamsAddInvoiceItemPeriodEnd" + """ + End of the invoice item period. + """ + start: "SubscriptionService.UpdateParamsAddInvoiceItemPeriodStart" + """ + Start of the invoice item period. + """ + + class UpdateParamsAddInvoiceItemPeriodEnd(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to `period.start`. + """ + type: Literal["min_item_period_end", "timestamp"] + """ + Select how to calculate the end of the invoice item period. + """ + + class UpdateParamsAddInvoiceItemPeriodStart(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to `period.end`. + """ + type: Literal["max_item_period_start", "now", "timestamp"] + """ + Select how to calculate the start of the invoice item period. + """ + class UpdateParamsAddInvoiceItemPriceData(TypedDict): currency: str """ From a817e1dc9dc89d8a9a508defb7cfd21230788d3a Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 20:39:23 +0000 Subject: [PATCH 23/31] Update generated code for v1926 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/_invoice.py | 46 +++++++ stripe/_invoice_service.py | 46 +++++++ stripe/_payment_attempt_record.py | 4 + stripe/_payment_attempt_record_service.py | 4 + .../_quote_preview_subscription_schedule.py | 36 +++++- stripe/_subscription_schedule.py | 120 +++++++++++++++++- stripe/_subscription_schedule_service.py | 80 ++++++++++++ 8 files changed, 335 insertions(+), 3 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 799caa8e8..a31c5d0c6 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1925 \ No newline at end of file +v1926 \ No newline at end of file diff --git a/stripe/_invoice.py b/stripe/_invoice.py index e34dc7545..b9aabd667 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -3602,6 +3602,16 @@ class CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItem(TypedDict): """ The coupons to redeem into discounts for the item. """ + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ + period: NotRequired[ + "Invoice.CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPeriod" + ] + """ + The period associated with this invoice item. Defaults to the period of the underlying subscription that surrounds the start of the phase. + """ price: NotRequired[str] """ The ID of the price object. One of `price` or `price_data` is required. @@ -3673,6 +3683,42 @@ class CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndDu The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration. """ + class CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPeriod( + TypedDict, + ): + end: "Invoice.CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPeriodEnd" + """ + End of the invoice item period. + """ + start: "Invoice.CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPeriodStart" + """ + Start of the invoice item period. + """ + + class CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPeriodEnd( + TypedDict, + ): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to `period.start`. + """ + type: Literal["min_item_period_end", "phase_end", "timestamp"] + """ + Select how to calculate the end of the invoice item period. + """ + + class CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPeriodStart( + TypedDict, + ): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to `period.end`. + """ + type: Literal["max_item_period_start", "phase_start", "timestamp"] + """ + Select how to calculate the start of the invoice item period. + """ + class CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPriceData( TypedDict, ): diff --git a/stripe/_invoice_service.py b/stripe/_invoice_service.py index 40fd3d99f..f3f2a9447 100644 --- a/stripe/_invoice_service.py +++ b/stripe/_invoice_service.py @@ -2361,6 +2361,16 @@ class CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItem(TypedDict): """ The coupons to redeem into discounts for the item. """ + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ + period: NotRequired[ + "InvoiceService.CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPeriod" + ] + """ + The period associated with this invoice item. Defaults to the period of the underlying subscription that surrounds the start of the phase. + """ price: NotRequired[str] """ The ID of the price object. One of `price` or `price_data` is required. @@ -2432,6 +2442,42 @@ class CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndDu The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration. """ + class CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPeriod( + TypedDict, + ): + end: "InvoiceService.CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPeriodEnd" + """ + End of the invoice item period. + """ + start: "InvoiceService.CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPeriodStart" + """ + Start of the invoice item period. + """ + + class CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPeriodEnd( + TypedDict, + ): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to `period.start`. + """ + type: Literal["min_item_period_end", "phase_end", "timestamp"] + """ + Select how to calculate the end of the invoice item period. + """ + + class CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPeriodStart( + TypedDict, + ): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to `period.end`. + """ + type: Literal["max_item_period_start", "phase_start", "timestamp"] + """ + Select how to calculate the start of the invoice item period. + """ + class CreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPriceData( TypedDict, ): diff --git a/stripe/_payment_attempt_record.py b/stripe/_payment_attempt_record.py index f7c0af7db..69ab57f23 100644 --- a/stripe/_payment_attempt_record.py +++ b/stripe/_payment_attempt_record.py @@ -1957,6 +1957,10 @@ class ListParams(RequestOptions): """ Specifies which fields in the response should be expanded. """ + limit: NotRequired[int] + """ + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + """ payment_record: str """ The ID of the Payment Record. diff --git a/stripe/_payment_attempt_record_service.py b/stripe/_payment_attempt_record_service.py index 922b9dc49..a320c1aa4 100644 --- a/stripe/_payment_attempt_record_service.py +++ b/stripe/_payment_attempt_record_service.py @@ -15,6 +15,10 @@ class ListParams(TypedDict): """ Specifies which fields in the response should be expanded. """ + limit: NotRequired[int] + """ + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + """ payment_record: str """ The ID of the Payment Record. diff --git a/stripe/_quote_preview_subscription_schedule.py b/stripe/_quote_preview_subscription_schedule.py index 24a7898cf..b1d108245 100644 --- a/stripe/_quote_preview_subscription_schedule.py +++ b/stripe/_quote_preview_subscription_schedule.py @@ -228,10 +228,44 @@ class DiscountEnd(StripeObject): """ _inner_class_types = {"discount_end": DiscountEnd} + class Period(StripeObject): + class End(StripeObject): + timestamp: Optional[int] + """ + A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to `period.start`. + """ + type: Literal[ + "min_item_period_end", "phase_end", "timestamp" + ] + """ + Select how to calculate the end of the invoice item period. + """ + + class Start(StripeObject): + timestamp: Optional[int] + """ + A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to `period.end`. + """ + type: Literal[ + "max_item_period_start", "phase_start", "timestamp" + ] + """ + Select how to calculate the start of the invoice item period. + """ + + end: End + start: Start + _inner_class_types = {"end": End, "start": Start} + discounts: List[Discount] """ The stackable discounts that will be applied to the item. """ + metadata: Optional[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + """ + period: Period price: ExpandableField["Price"] """ ID of the price used to generate the invoice item. @@ -244,7 +278,7 @@ class DiscountEnd(StripeObject): """ The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item. """ - _inner_class_types = {"discounts": Discount} + _inner_class_types = {"discounts": Discount, "period": Period} class AutomaticTax(StripeObject): class Liability(StripeObject): diff --git a/stripe/_subscription_schedule.py b/stripe/_subscription_schedule.py index be38ac120..eec7e1b79 100644 --- a/stripe/_subscription_schedule.py +++ b/stripe/_subscription_schedule.py @@ -236,10 +236,44 @@ class DiscountEnd(StripeObject): """ _inner_class_types = {"discount_end": DiscountEnd} + class Period(StripeObject): + class End(StripeObject): + timestamp: Optional[int] + """ + A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to `period.start`. + """ + type: Literal[ + "min_item_period_end", "phase_end", "timestamp" + ] + """ + Select how to calculate the end of the invoice item period. + """ + + class Start(StripeObject): + timestamp: Optional[int] + """ + A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to `period.end`. + """ + type: Literal[ + "max_item_period_start", "phase_start", "timestamp" + ] + """ + Select how to calculate the start of the invoice item period. + """ + + end: End + start: Start + _inner_class_types = {"end": End, "start": Start} + discounts: List[Discount] """ The stackable discounts that will be applied to the item. """ + metadata: Optional[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + """ + period: Period price: ExpandableField["Price"] """ ID of the price used to generate the invoice item. @@ -252,7 +286,7 @@ class DiscountEnd(StripeObject): """ The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item. """ - _inner_class_types = {"discounts": Discount} + _inner_class_types = {"discounts": Discount, "period": Period} class AutomaticTax(StripeObject): class Liability(StripeObject): @@ -1520,6 +1554,16 @@ class CreateParamsPhaseAddInvoiceItem(TypedDict): """ The coupons to redeem into discounts for the item. """ + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ + period: NotRequired[ + "SubscriptionSchedule.CreateParamsPhaseAddInvoiceItemPeriod" + ] + """ + The period associated with this invoice item. Defaults to the period of the underlying subscription that surrounds the start of the phase. + """ price: NotRequired[str] """ The ID of the price object. One of `price` or `price_data` is required. @@ -1587,6 +1631,38 @@ class CreateParamsPhaseAddInvoiceItemDiscountDiscountEndDuration( The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration. """ + class CreateParamsPhaseAddInvoiceItemPeriod(TypedDict): + end: "SubscriptionSchedule.CreateParamsPhaseAddInvoiceItemPeriodEnd" + """ + End of the invoice item period. + """ + start: ( + "SubscriptionSchedule.CreateParamsPhaseAddInvoiceItemPeriodStart" + ) + """ + Start of the invoice item period. + """ + + class CreateParamsPhaseAddInvoiceItemPeriodEnd(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to `period.start`. + """ + type: Literal["min_item_period_end", "phase_end", "timestamp"] + """ + Select how to calculate the end of the invoice item period. + """ + + class CreateParamsPhaseAddInvoiceItemPeriodStart(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to `period.end`. + """ + type: Literal["max_item_period_start", "phase_start", "timestamp"] + """ + Select how to calculate the start of the invoice item period. + """ + class CreateParamsPhaseAddInvoiceItemPriceData(TypedDict): currency: str """ @@ -2332,6 +2408,16 @@ class ModifyParamsPhaseAddInvoiceItem(TypedDict): """ The coupons to redeem into discounts for the item. """ + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ + period: NotRequired[ + "SubscriptionSchedule.ModifyParamsPhaseAddInvoiceItemPeriod" + ] + """ + The period associated with this invoice item. Defaults to the period of the underlying subscription that surrounds the start of the phase. + """ price: NotRequired[str] """ The ID of the price object. One of `price` or `price_data` is required. @@ -2399,6 +2485,38 @@ class ModifyParamsPhaseAddInvoiceItemDiscountDiscountEndDuration( The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration. """ + class ModifyParamsPhaseAddInvoiceItemPeriod(TypedDict): + end: "SubscriptionSchedule.ModifyParamsPhaseAddInvoiceItemPeriodEnd" + """ + End of the invoice item period. + """ + start: ( + "SubscriptionSchedule.ModifyParamsPhaseAddInvoiceItemPeriodStart" + ) + """ + Start of the invoice item period. + """ + + class ModifyParamsPhaseAddInvoiceItemPeriodEnd(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to `period.start`. + """ + type: Literal["min_item_period_end", "phase_end", "timestamp"] + """ + Select how to calculate the end of the invoice item period. + """ + + class ModifyParamsPhaseAddInvoiceItemPeriodStart(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to `period.end`. + """ + type: Literal["max_item_period_start", "phase_start", "timestamp"] + """ + Select how to calculate the start of the invoice item period. + """ + class ModifyParamsPhaseAddInvoiceItemPriceData(TypedDict): currency: str """ diff --git a/stripe/_subscription_schedule_service.py b/stripe/_subscription_schedule_service.py index 4b8304c83..f1d726d08 100644 --- a/stripe/_subscription_schedule_service.py +++ b/stripe/_subscription_schedule_service.py @@ -961,6 +961,16 @@ class CreateParamsPhaseAddInvoiceItem(TypedDict): """ The coupons to redeem into discounts for the item. """ + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ + period: NotRequired[ + "SubscriptionScheduleService.CreateParamsPhaseAddInvoiceItemPeriod" + ] + """ + The period associated with this invoice item. Defaults to the period of the underlying subscription that surrounds the start of the phase. + """ price: NotRequired[str] """ The ID of the price object. One of `price` or `price_data` is required. @@ -1028,6 +1038,36 @@ class CreateParamsPhaseAddInvoiceItemDiscountDiscountEndDuration( The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration. """ + class CreateParamsPhaseAddInvoiceItemPeriod(TypedDict): + end: "SubscriptionScheduleService.CreateParamsPhaseAddInvoiceItemPeriodEnd" + """ + End of the invoice item period. + """ + start: "SubscriptionScheduleService.CreateParamsPhaseAddInvoiceItemPeriodStart" + """ + Start of the invoice item period. + """ + + class CreateParamsPhaseAddInvoiceItemPeriodEnd(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to `period.start`. + """ + type: Literal["min_item_period_end", "phase_end", "timestamp"] + """ + Select how to calculate the end of the invoice item period. + """ + + class CreateParamsPhaseAddInvoiceItemPeriodStart(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to `period.end`. + """ + type: Literal["max_item_period_start", "phase_start", "timestamp"] + """ + Select how to calculate the start of the invoice item period. + """ + class CreateParamsPhaseAddInvoiceItemPriceData(TypedDict): currency: str """ @@ -1797,6 +1837,16 @@ class UpdateParamsPhaseAddInvoiceItem(TypedDict): """ The coupons to redeem into discounts for the item. """ + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://stripe.com/docs/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`. + """ + period: NotRequired[ + "SubscriptionScheduleService.UpdateParamsPhaseAddInvoiceItemPeriod" + ] + """ + The period associated with this invoice item. Defaults to the period of the underlying subscription that surrounds the start of the phase. + """ price: NotRequired[str] """ The ID of the price object. One of `price` or `price_data` is required. @@ -1864,6 +1914,36 @@ class UpdateParamsPhaseAddInvoiceItemDiscountDiscountEndDuration( The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration. """ + class UpdateParamsPhaseAddInvoiceItemPeriod(TypedDict): + end: "SubscriptionScheduleService.UpdateParamsPhaseAddInvoiceItemPeriodEnd" + """ + End of the invoice item period. + """ + start: "SubscriptionScheduleService.UpdateParamsPhaseAddInvoiceItemPeriodStart" + """ + Start of the invoice item period. + """ + + class UpdateParamsPhaseAddInvoiceItemPeriodEnd(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to `period.start`. + """ + type: Literal["min_item_period_end", "phase_end", "timestamp"] + """ + Select how to calculate the end of the invoice item period. + """ + + class UpdateParamsPhaseAddInvoiceItemPeriodStart(TypedDict): + timestamp: NotRequired[int] + """ + A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to `period.end`. + """ + type: Literal["max_item_period_start", "phase_start", "timestamp"] + """ + Select how to calculate the start of the invoice item period. + """ + class UpdateParamsPhaseAddInvoiceItemPriceData(TypedDict): currency: str """ From 03249f170e15667de3eb3dec85d39c5c33ba74a4 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 23:28:42 +0000 Subject: [PATCH 24/31] Update generated code for v1927 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/terminal/_reader.py | 2 +- stripe/test_helpers/terminal/_reader_service.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index a31c5d0c6..13e074dce 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1926 \ No newline at end of file +v1927 \ No newline at end of file diff --git a/stripe/terminal/_reader.py b/stripe/terminal/_reader.py index 54c2fdd3e..5c595d614 100644 --- a/stripe/terminal/_reader.py +++ b/stripe/terminal/_reader.py @@ -774,7 +774,7 @@ class PresentPaymentMethodParams(RequestOptions): """ class PresentPaymentMethodParamsCard(TypedDict): - cvc: NotRequired[str] + cvc: str """ Card security code. """ diff --git a/stripe/test_helpers/terminal/_reader_service.py b/stripe/test_helpers/terminal/_reader_service.py index 197a76b6b..411abcf4e 100644 --- a/stripe/test_helpers/terminal/_reader_service.py +++ b/stripe/test_helpers/terminal/_reader_service.py @@ -40,7 +40,7 @@ class PresentPaymentMethodParams(TypedDict): """ class PresentPaymentMethodParamsCard(TypedDict): - cvc: NotRequired[str] + cvc: str """ Card security code. """ From 2f16b33b0b8f02e05807e17d2b18b1839d8f18b9 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 19 Aug 2025 01:27:26 +0000 Subject: [PATCH 25/31] Update generated code for v1929 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/issuing/_card.py | 8 ++++++++ stripe/issuing/_card_service.py | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 13e074dce..3d0c01d10 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1927 \ No newline at end of file +v1929 \ No newline at end of file diff --git a/stripe/issuing/_card.py b/stripe/issuing/_card.py index 592bc3cef..05fb2443c 100644 --- a/stripe/issuing/_card.py +++ b/stripe/issuing/_card.py @@ -1182,6 +1182,14 @@ class CreateParams(RequestOptions): """ The currency for the card. """ + exp_month: NotRequired[int] + """ + The desired expiration month (1-12) for this card if [specifying a custom expiration date](https://docs.stripe.com/issuing/cards/virtual/issue-cards?testing-method=with-code#exp-dates). + """ + exp_year: NotRequired[int] + """ + The desired 4-digit expiration year for this card if [specifying a custom expiration date](https://docs.stripe.com/issuing/cards/virtual/issue-cards?testing-method=with-code#exp-dates). + """ expand: NotRequired[List[str]] """ Specifies which fields in the response should be expanded. diff --git a/stripe/issuing/_card_service.py b/stripe/issuing/_card_service.py index 6e47b8b00..7773f84ab 100644 --- a/stripe/issuing/_card_service.py +++ b/stripe/issuing/_card_service.py @@ -19,6 +19,14 @@ class CreateParams(TypedDict): """ The currency for the card. """ + exp_month: NotRequired[int] + """ + The desired expiration month (1-12) for this card if [specifying a custom expiration date](https://docs.stripe.com/issuing/cards/virtual/issue-cards?testing-method=with-code#exp-dates). + """ + exp_year: NotRequired[int] + """ + The desired 4-digit expiration year for this card if [specifying a custom expiration date](https://docs.stripe.com/issuing/cards/virtual/issue-cards?testing-method=with-code#exp-dates). + """ expand: NotRequired[List[str]] """ Specifies which fields in the response should be expanded. From b8e632bcfcd7649d1cf2ad9b19b9745f8374d844 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 19 Aug 2025 18:05:48 +0000 Subject: [PATCH 26/31] Update generated code for v1930 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/terminal/_reader.py | 2 +- .../test_helpers/terminal/_reader_service.py | 2 +- stripe/v2/core/_account.py | 45 +++++++++++ stripe/v2/core/_account_service.py | 74 +++++++++++++++++++ stripe/v2/core/_person.py | 16 ++++ stripe/v2/core/accounts/_person_service.py | 32 ++++++++ stripe/v2/money_management/_transaction.py | 6 ++ .../v2/money_management/_transaction_entry.py | 6 ++ 9 files changed, 182 insertions(+), 3 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 3d0c01d10..e51dab946 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1929 \ No newline at end of file +v1930 \ No newline at end of file diff --git a/stripe/terminal/_reader.py b/stripe/terminal/_reader.py index 5c595d614..54c2fdd3e 100644 --- a/stripe/terminal/_reader.py +++ b/stripe/terminal/_reader.py @@ -774,7 +774,7 @@ class PresentPaymentMethodParams(RequestOptions): """ class PresentPaymentMethodParamsCard(TypedDict): - cvc: str + cvc: NotRequired[str] """ Card security code. """ diff --git a/stripe/test_helpers/terminal/_reader_service.py b/stripe/test_helpers/terminal/_reader_service.py index 411abcf4e..197a76b6b 100644 --- a/stripe/test_helpers/terminal/_reader_service.py +++ b/stripe/test_helpers/terminal/_reader_service.py @@ -40,7 +40,7 @@ class PresentPaymentMethodParams(TypedDict): """ class PresentPaymentMethodParamsCard(TypedDict): - cvc: str + cvc: NotRequired[str] """ Card security code. """ diff --git a/stripe/v2/core/_account.py b/stripe/v2/core/_account.py index 3ab26fe35..6ffa8c5c4 100644 --- a/stripe/v2/core/_account.py +++ b/stripe/v2/core/_account.py @@ -702,6 +702,10 @@ class Address(StripeObject): """ _inner_class_types = {"address": Address} + applied: bool + """ + Represents the state of the configuration, and can be updated to deactivate or re-apply a configuration. + """ automatic_indirect_tax: Optional[AutomaticIndirectTax] """ Automatic indirect tax settings to be used when automatic tax calculation is enabled on the customer's invoices, subscriptions, checkout sessions, or payment links. Surfaces if automatic tax calculation is possible given the current customer location information. @@ -2997,6 +3001,10 @@ class Address(StripeObject): """ _inner_class_types = {"address": Address} + applied: bool + """ + Represents the state of the configuration, and can be updated to deactivate or re-apply a configuration. + """ bacs_debit_payments: Optional[BacsDebitPayments] """ Settings used for Bacs debit payments. @@ -3348,6 +3356,10 @@ class DefaultOutboundDestination(StripeObject): Closed Enum. The payout method type of the default outbound destination. """ + applied: bool + """ + Represents the state of the configuration, and can be updated to deactivate or re-apply a configuration. + """ capabilities: Optional[Capabilities] """ Capabilities that have been requested on the Recipient Configuration. @@ -3757,6 +3769,10 @@ class StatusDetail(StripeObject): "outbound_transfers": OutboundTransfers, } + applied: bool + """ + Represents the state of the configuration, and can be updated to deactivate or re-apply a configuration. + """ capabilities: Optional[Capabilities] """ Capabilities that have been requested on the Storer Configuration. @@ -4674,10 +4690,13 @@ class IdNumber(StripeObject): type: Literal[ "ae_crn", "ae_vat", + "ao_nif", "at_fn", "au_abn", "au_acn", "au_in", + "az_tin", + "bd_etin", "be_cbe", "bg_uic", "br_cnpj", @@ -4687,11 +4706,14 @@ class IdNumber(StripeObject): "ca_rid", "ch_chid", "ch_uid", + "cr_cpj", + "cr_nite", "cy_tic", "cz_ico", "de_hrn", "de_vat", "dk_cvr", + "do_rcn", "ee_rk", "es_cif", "fi_yt", @@ -4700,6 +4722,7 @@ class IdNumber(StripeObject): "gb_crn", "gi_crn", "gr_gemi", + "gt_nit", "hk_br", "hk_cr", "hk_mbs", @@ -4708,6 +4731,7 @@ class IdNumber(StripeObject): "it_rea", "it_vat", "jp_cn", + "kz_bin", "li_uid", "lt_ccrn", "lu_rcs", @@ -4717,12 +4741,17 @@ class IdNumber(StripeObject): "my_brn", "my_coid", "my_sst", + "mz_nuit", "nl_kvk", "no_orgnr", "nz_bn", + "pe_ruc", + "pk_ntn", "pl_regon", "pt_vat", "ro_cui", + "sa_crn", + "sa_tin", "se_orgnr", "sg_uen", "si_msp", @@ -6170,12 +6199,28 @@ class Visa(StripeObject): class IdNumber(StripeObject): type: Literal[ "ae_eid", + "ao_nif", + "az_tin", + "bd_brc", + "bd_etin", + "bd_nid", "br_cpf", + "cr_cpf", + "cr_dimex", + "cr_nite", "de_stn", + "do_rcn", + "gt_nit", "hk_id", + "kz_iin", "mx_rfc", "my_nric", + "mz_nuit", "nl_bsn", + "pe_dni", + "pk_cnic", + "pk_snic", + "sa_tin", "sg_fin", "sg_nric", "th_lc", diff --git a/stripe/v2/core/_account_service.py b/stripe/v2/core/_account_service.py index eaeb476cd..4663be9bf 100644 --- a/stripe/v2/core/_account_service.py +++ b/stripe/v2/core/_account_service.py @@ -3059,10 +3059,13 @@ class CreateParamsIdentityBusinessDetailsIdNumber(TypedDict): type: Literal[ "ae_crn", "ae_vat", + "ao_nif", "at_fn", "au_abn", "au_acn", "au_in", + "az_tin", + "bd_etin", "be_cbe", "bg_uic", "br_cnpj", @@ -3072,11 +3075,14 @@ class CreateParamsIdentityBusinessDetailsIdNumber(TypedDict): "ca_rid", "ch_chid", "ch_uid", + "cr_cpj", + "cr_nite", "cy_tic", "cz_ico", "de_hrn", "de_vat", "dk_cvr", + "do_rcn", "ee_rk", "es_cif", "fi_yt", @@ -3085,6 +3091,7 @@ class CreateParamsIdentityBusinessDetailsIdNumber(TypedDict): "gb_crn", "gi_crn", "gr_gemi", + "gt_nit", "hk_br", "hk_cr", "hk_mbs", @@ -3093,6 +3100,7 @@ class CreateParamsIdentityBusinessDetailsIdNumber(TypedDict): "it_rea", "it_vat", "jp_cn", + "kz_bin", "li_uid", "lt_ccrn", "lu_rcs", @@ -3102,12 +3110,17 @@ class CreateParamsIdentityBusinessDetailsIdNumber(TypedDict): "my_brn", "my_coid", "my_sst", + "mz_nuit", "nl_kvk", "no_orgnr", "nz_bn", + "pe_ruc", + "pk_ntn", "pl_regon", "pt_vat", "ro_cui", + "sa_crn", + "sa_tin", "se_orgnr", "sg_uen", "si_msp", @@ -4798,12 +4811,28 @@ class CreateParamsIdentityIndividualDocumentsVisa(TypedDict): class CreateParamsIdentityIndividualIdNumber(TypedDict): type: Literal[ "ae_eid", + "ao_nif", + "az_tin", + "bd_brc", + "bd_etin", + "bd_nid", "br_cpf", + "cr_cpf", + "cr_dimex", + "cr_nite", "de_stn", + "do_rcn", + "gt_nit", "hk_id", + "kz_iin", "mx_rfc", "my_nric", + "mz_nuit", "nl_bsn", + "pe_dni", + "pk_cnic", + "pk_snic", + "sa_tin", "sg_fin", "sg_nric", "th_lc", @@ -5554,6 +5583,10 @@ class UpdateParamsConfiguration(TypedDict): """ class UpdateParamsConfigurationCustomer(TypedDict): + applied: NotRequired[bool] + """ + Represents the state of the configuration, and can be updated to deactivate or re-apply a configuration. + """ automatic_indirect_tax: NotRequired[ "AccountService.UpdateParamsConfigurationCustomerAutomaticIndirectTax" ] @@ -5982,6 +6015,10 @@ class UpdateParamsConfigurationCustomerShippingAddress(TypedDict): """ class UpdateParamsConfigurationMerchant(TypedDict): + applied: NotRequired[bool] + """ + Represents the state of the configuration, and can be updated to deactivate or re-apply a configuration. + """ bacs_debit_payments: NotRequired[ "AccountService.UpdateParamsConfigurationMerchantBacsDebitPayments" ] @@ -6980,6 +7017,10 @@ class UpdateParamsConfigurationMerchantSupportAddress(TypedDict): """ class UpdateParamsConfigurationRecipient(TypedDict): + applied: NotRequired[bool] + """ + Represents the state of the configuration, and can be updated to deactivate or re-apply a configuration. + """ capabilities: NotRequired[ "AccountService.UpdateParamsConfigurationRecipientCapabilities" ] @@ -7068,6 +7109,10 @@ class UpdateParamsConfigurationRecipientCapabilitiesStripeBalanceStripeTransfers """ class UpdateParamsConfigurationStorer(TypedDict): + applied: NotRequired[bool] + """ + Represents the state of the configuration, and can be updated to deactivate or re-apply a configuration. + """ capabilities: NotRequired[ "AccountService.UpdateParamsConfigurationStorerCapabilities" ] @@ -8574,10 +8619,13 @@ class UpdateParamsIdentityBusinessDetailsIdNumber(TypedDict): type: Literal[ "ae_crn", "ae_vat", + "ao_nif", "at_fn", "au_abn", "au_acn", "au_in", + "az_tin", + "bd_etin", "be_cbe", "bg_uic", "br_cnpj", @@ -8587,11 +8635,14 @@ class UpdateParamsIdentityBusinessDetailsIdNumber(TypedDict): "ca_rid", "ch_chid", "ch_uid", + "cr_cpj", + "cr_nite", "cy_tic", "cz_ico", "de_hrn", "de_vat", "dk_cvr", + "do_rcn", "ee_rk", "es_cif", "fi_yt", @@ -8600,6 +8651,7 @@ class UpdateParamsIdentityBusinessDetailsIdNumber(TypedDict): "gb_crn", "gi_crn", "gr_gemi", + "gt_nit", "hk_br", "hk_cr", "hk_mbs", @@ -8608,6 +8660,7 @@ class UpdateParamsIdentityBusinessDetailsIdNumber(TypedDict): "it_rea", "it_vat", "jp_cn", + "kz_bin", "li_uid", "lt_ccrn", "lu_rcs", @@ -8617,12 +8670,17 @@ class UpdateParamsIdentityBusinessDetailsIdNumber(TypedDict): "my_brn", "my_coid", "my_sst", + "mz_nuit", "nl_kvk", "no_orgnr", "nz_bn", + "pe_ruc", + "pk_ntn", "pl_regon", "pt_vat", "ro_cui", + "sa_crn", + "sa_tin", "se_orgnr", "sg_uen", "si_msp", @@ -10357,12 +10415,28 @@ class UpdateParamsIdentityIndividualDocumentsVisa(TypedDict): class UpdateParamsIdentityIndividualIdNumber(TypedDict): type: Literal[ "ae_eid", + "ao_nif", + "az_tin", + "bd_brc", + "bd_etin", + "bd_nid", "br_cpf", + "cr_cpf", + "cr_dimex", + "cr_nite", "de_stn", + "do_rcn", + "gt_nit", "hk_id", + "kz_iin", "mx_rfc", "my_nric", + "mz_nuit", "nl_bsn", + "pe_dni", + "pk_cnic", + "pk_snic", + "sa_tin", "sg_fin", "sg_nric", "th_lc", diff --git a/stripe/v2/core/_person.py b/stripe/v2/core/_person.py index 78ad9e5f2..f0da471c1 100644 --- a/stripe/v2/core/_person.py +++ b/stripe/v2/core/_person.py @@ -743,12 +743,28 @@ class Visa(StripeObject): class IdNumber(StripeObject): type: Literal[ "ae_eid", + "ao_nif", + "az_tin", + "bd_brc", + "bd_etin", + "bd_nid", "br_cpf", + "cr_cpf", + "cr_dimex", + "cr_nite", "de_stn", + "do_rcn", + "gt_nit", "hk_id", + "kz_iin", "mx_rfc", "my_nric", + "mz_nuit", "nl_bsn", + "pe_dni", + "pk_cnic", + "pk_snic", + "sa_tin", "sg_fin", "sg_nric", "th_lc", diff --git a/stripe/v2/core/accounts/_person_service.py b/stripe/v2/core/accounts/_person_service.py index 06ddc4dfa..34aeeb08c 100644 --- a/stripe/v2/core/accounts/_person_service.py +++ b/stripe/v2/core/accounts/_person_service.py @@ -1075,12 +1075,28 @@ class CreateParamsDocumentsVisa(TypedDict): class CreateParamsIdNumber(TypedDict): type: Literal[ "ae_eid", + "ao_nif", + "az_tin", + "bd_brc", + "bd_etin", + "bd_nid", "br_cpf", + "cr_cpf", + "cr_dimex", + "cr_nite", "de_stn", + "do_rcn", + "gt_nit", "hk_id", + "kz_iin", "mx_rfc", "my_nric", + "mz_nuit", "nl_bsn", + "pe_dni", + "pk_cnic", + "pk_snic", + "sa_tin", "sg_fin", "sg_nric", "th_lc", @@ -2825,12 +2841,28 @@ class UpdateParamsDocumentsVisa(TypedDict): class UpdateParamsIdNumber(TypedDict): type: Literal[ "ae_eid", + "ao_nif", + "az_tin", + "bd_brc", + "bd_etin", + "bd_nid", "br_cpf", + "cr_cpf", + "cr_dimex", + "cr_nite", "de_stn", + "do_rcn", + "gt_nit", "hk_id", + "kz_iin", "mx_rfc", "my_nric", + "mz_nuit", "nl_bsn", + "pe_dni", + "pk_cnic", + "pk_snic", + "sa_tin", "sg_fin", "sg_nric", "th_lc", diff --git a/stripe/v2/money_management/_transaction.py b/stripe/v2/money_management/_transaction.py index 2548cda83..b4fc713f5 100644 --- a/stripe/v2/money_management/_transaction.py +++ b/stripe/v2/money_management/_transaction.py @@ -34,6 +34,10 @@ class Flow(StripeObject): """ If applicable, the ID of the Adjustment that created this Transaction. """ + currency_conversion: Optional[str] + """ + In the future, this will be the ID of the currency conversion that created this Transaction. For now, this field is always null. + """ fee_transaction: Optional[str] """ If applicable, the ID of the FeeTransaction that created this Transaction. @@ -60,6 +64,7 @@ class Flow(StripeObject): """ type: Literal[ "adjustment", + "currency_conversion", "fee_transaction", "inbound_transfer", "outbound_payment", @@ -92,6 +97,7 @@ class StatusTransitions(StripeObject): """ category: Literal[ "adjustment", + "currency_conversion", "inbound_transfer", "outbound_payment", "outbound_transfer", diff --git a/stripe/v2/money_management/_transaction_entry.py b/stripe/v2/money_management/_transaction_entry.py index a055bd5bd..995487444 100644 --- a/stripe/v2/money_management/_transaction_entry.py +++ b/stripe/v2/money_management/_transaction_entry.py @@ -35,6 +35,10 @@ class Flow(StripeObject): """ If applicable, the ID of the Adjustment that created this Transaction. """ + currency_conversion: Optional[str] + """ + In the future, this will be the ID of the currency conversion that created this Transaction. For now, this field is always null. + """ fee_transaction: Optional[str] """ If applicable, the ID of the FeeTransaction that created this Transaction. @@ -61,6 +65,7 @@ class Flow(StripeObject): """ type: Literal[ "adjustment", + "currency_conversion", "fee_transaction", "inbound_transfer", "outbound_payment", @@ -74,6 +79,7 @@ class Flow(StripeObject): category: Literal[ "adjustment", + "currency_conversion", "inbound_transfer", "outbound_payment", "outbound_transfer", From df9ce2b2282dce3e2c77b0a02fd504c82ade40fc Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 19 Aug 2025 20:07:00 +0000 Subject: [PATCH 27/31] Update generated code for v1931 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/_charge.py | 8 ++++++++ stripe/_payment_attempt_record.py | 8 ++++++++ stripe/_payment_record.py | 8 ++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index e51dab946..f2a5be902 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1930 \ No newline at end of file +v1931 \ No newline at end of file diff --git a/stripe/_charge.py b/stripe/_charge.py index 478ade4e5..46b1ca40d 100644 --- a/stripe/_charge.py +++ b/stripe/_charge.py @@ -1703,6 +1703,14 @@ class Payco(StripeObject): """ class Paynow(StripeObject): + location: Optional[str] + """ + ID of the [location](https://stripe.com/docs/api/terminal/locations) that this transaction's reader is assigned to. + """ + reader: Optional[str] + """ + ID of the [reader](https://stripe.com/docs/api/terminal/readers) this transaction was made on. + """ reference: Optional[str] """ Reference number associated with this PayNow payment diff --git a/stripe/_payment_attempt_record.py b/stripe/_payment_attempt_record.py index 69ab57f23..16a467590 100644 --- a/stripe/_payment_attempt_record.py +++ b/stripe/_payment_attempt_record.py @@ -1340,6 +1340,14 @@ class Payco(StripeObject): """ class Paynow(StripeObject): + location: Optional[str] + """ + ID of the [location](https://stripe.com/docs/api/terminal/locations) that this transaction's reader is assigned to. + """ + reader: Optional[str] + """ + ID of the [reader](https://stripe.com/docs/api/terminal/readers) this transaction was made on. + """ reference: Optional[str] """ Reference number associated with this PayNow payment diff --git a/stripe/_payment_record.py b/stripe/_payment_record.py index 9c0d962ae..83f9aa0bf 100644 --- a/stripe/_payment_record.py +++ b/stripe/_payment_record.py @@ -1344,6 +1344,14 @@ class Payco(StripeObject): """ class Paynow(StripeObject): + location: Optional[str] + """ + ID of the [location](https://stripe.com/docs/api/terminal/locations) that this transaction's reader is assigned to. + """ + reader: Optional[str] + """ + ID of the [reader](https://stripe.com/docs/api/terminal/readers) this transaction was made on. + """ reference: Optional[str] """ Reference number associated with this PayNow payment From 343d3d2118a23353e3b71467ca72658ab63ecf1d Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 20 Aug 2025 01:15:23 +0000 Subject: [PATCH 28/31] Update generated code for v1932 and 2025-08-27.preview --- OPENAPI_VERSION | 2 +- stripe/_api_requestor.py | 36 ++--- stripe/_error.py | 58 +++---- stripe/events/_event_classes.py | 92 +++++------ tests/test_generated_examples.py | 252 +++++++++++++++---------------- 5 files changed, 220 insertions(+), 220 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index f2a5be902..6598803dc 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1931 \ No newline at end of file +v1932 \ No newline at end of file diff --git a/stripe/_api_requestor.py b/stripe/_api_requestor.py index 3cab29a9d..2a49b430b 100644 --- a/stripe/_api_requestor.py +++ b/stripe/_api_requestor.py @@ -369,37 +369,37 @@ def specific_v2_api_error(self, rbody, rcode, resp, rheaders, error_data): code, ) # switchCases: The beginning of the section generated from our OpenAPI spec - elif type == "temporary_session_expired": - return error.TemporarySessionExpiredError(**error_args) - elif type == "non_zero_balance": - return error.NonZeroBalanceError(**error_args) + elif type == "already_canceled": + return error.AlreadyCanceledError(**error_args) elif type == "already_exists": return error.AlreadyExistsError(**error_args) + elif type == "blocked_by_stripe": + return error.BlockedByStripeError(**error_args) + elif type == "controlled_by_dashboard": + return error.ControlledByDashboardError(**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": - return error.AlreadyCanceledError(**error_args) - elif type == "not_cancelable": - return error.NotCancelableError(**error_args) elif type == "insufficient_funds": return error.InsufficientFundsError(**error_args) - elif type == "quota_exceeded": - return error.QuotaExceededError(**error_args) - elif type == "recipient_not_notifiable": - return error.RecipientNotNotifiableError(**error_args) - elif type == "invalid_payout_method": - return error.InvalidPayoutMethodError(**error_args) - elif type == "controlled_by_dashboard": - return error.ControlledByDashboardError(**error_args) elif type == "invalid_payment_method": return error.InvalidPaymentMethodError( **error_args, invalid_param=error_data.get("invalid_param"), ) + elif type == "invalid_payout_method": + return error.InvalidPayoutMethodError(**error_args) + elif type == "non_zero_balance": + return error.NonZeroBalanceError(**error_args) + elif type == "not_cancelable": + return error.NotCancelableError(**error_args) + elif type == "quota_exceeded": + return error.QuotaExceededError(**error_args) + elif type == "recipient_not_notifiable": + return error.RecipientNotNotifiableError(**error_args) + elif type == "temporary_session_expired": + return error.TemporarySessionExpiredError(**error_args) # switchCases: The end of the section generated from our OpenAPI spec return self.specific_v1_api_error( diff --git a/stripe/_error.py b/stripe/_error.py index 80b1955b1..c7205f2ad 100644 --- a/stripe/_error.py +++ b/stripe/_error.py @@ -188,11 +188,7 @@ def __init__(self, message, sig_header, http_body=None): # classDefinitions: The beginning of the section generated from our OpenAPI spec -class TemporarySessionExpiredError(StripeError): - pass - - -class NonZeroBalanceError(StripeError): +class AlreadyCanceledError(StripeError): pass @@ -200,43 +196,23 @@ class AlreadyExistsError(StripeError): pass -class FeatureNotEnabledError(StripeError): - pass - - -class FinancialAccountNotOpenError(StripeError): - pass - - class BlockedByStripeError(StripeError): pass -class AlreadyCanceledError(StripeError): - pass - - -class NotCancelableError(StripeError): - pass - - -class InsufficientFundsError(StripeError): - pass - - -class QuotaExceededError(StripeError): +class ControlledByDashboardError(StripeError): pass -class RecipientNotNotifiableError(StripeError): +class FeatureNotEnabledError(StripeError): pass -class InvalidPayoutMethodError(StripeError): +class FinancialAccountNotOpenError(StripeError): pass -class ControlledByDashboardError(StripeError): +class InsufficientFundsError(StripeError): pass @@ -262,4 +238,28 @@ def __init__( self.invalid_param = invalid_param +class InvalidPayoutMethodError(StripeError): + pass + + +class NonZeroBalanceError(StripeError): + pass + + +class NotCancelableError(StripeError): + pass + + +class QuotaExceededError(StripeError): + pass + + +class RecipientNotNotifiableError(StripeError): + pass + + +class TemporarySessionExpiredError(StripeError): + pass + + # classDefinitions: The end of the section generated from our OpenAPI spec diff --git a/stripe/events/_event_classes.py b/stripe/events/_event_classes.py index f5d6ea5b5..b58aca280 100644 --- a/stripe/events/_event_classes.py +++ b/stripe/events/_event_classes.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec -from stripe.events._v2_core_account_including_requirements_updated_event import ( - V2CoreAccountIncludingRequirementsUpdatedEvent, +from stripe.events._v1_billing_meter_error_report_triggered_event import ( + V1BillingMeterErrorReportTriggeredEvent, ) -from stripe.events._v2_core_account_link_returned_event import ( - V2CoreAccountLinkReturnedEvent, +from stripe.events._v1_billing_meter_no_meter_found_event import ( + V1BillingMeterNoMeterFoundEvent, ) from stripe.events._v2_core_account_closed_event import ( V2CoreAccountClosedEvent, @@ -15,27 +15,12 @@ from stripe.events._v2_core_account_updated_event import ( V2CoreAccountUpdatedEvent, ) -from stripe.events._v2_core_account_including_defaults_updated_event import ( - V2CoreAccountIncludingDefaultsUpdatedEvent, -) from stripe.events._v2_core_account_including_configuration_customer_capability_status_updated_event import ( V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEvent, ) from stripe.events._v2_core_account_including_configuration_customer_updated_event import ( V2CoreAccountIncludingConfigurationCustomerUpdatedEvent, ) -from stripe.events._v2_core_account_including_identity_updated_event import ( - V2CoreAccountIncludingIdentityUpdatedEvent, -) -from stripe.events._v2_core_account_person_created_event import ( - V2CoreAccountPersonCreatedEvent, -) -from stripe.events._v2_core_account_person_deleted_event import ( - V2CoreAccountPersonDeletedEvent, -) -from stripe.events._v2_core_account_person_updated_event import ( - V2CoreAccountPersonUpdatedEvent, -) from stripe.events._v2_core_account_including_configuration_merchant_capability_status_updated_event import ( V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEvent, ) @@ -54,14 +39,32 @@ from stripe.events._v2_core_account_including_configuration_storer_updated_event import ( V2CoreAccountIncludingConfigurationStorerUpdatedEvent, ) -from stripe.events._v2_money_management_adjustment_created_event import ( - V2MoneyManagementAdjustmentCreatedEvent, +from stripe.events._v2_core_account_including_defaults_updated_event import ( + V2CoreAccountIncludingDefaultsUpdatedEvent, ) -from stripe.events._v1_billing_meter_error_report_triggered_event import ( - V1BillingMeterErrorReportTriggeredEvent, +from stripe.events._v2_core_account_including_identity_updated_event import ( + V2CoreAccountIncludingIdentityUpdatedEvent, ) -from stripe.events._v1_billing_meter_no_meter_found_event import ( - V1BillingMeterNoMeterFoundEvent, +from stripe.events._v2_core_account_including_requirements_updated_event import ( + V2CoreAccountIncludingRequirementsUpdatedEvent, +) +from stripe.events._v2_core_account_link_returned_event import ( + V2CoreAccountLinkReturnedEvent, +) +from stripe.events._v2_core_account_person_created_event import ( + V2CoreAccountPersonCreatedEvent, +) +from stripe.events._v2_core_account_person_deleted_event import ( + V2CoreAccountPersonDeletedEvent, +) +from stripe.events._v2_core_account_person_updated_event import ( + V2CoreAccountPersonUpdatedEvent, +) +from stripe.events._v2_core_event_destination_ping_event import ( + V2CoreEventDestinationPingEvent, +) +from stripe.events._v2_money_management_adjustment_created_event import ( + V2MoneyManagementAdjustmentCreatedEvent, ) from stripe.events._v2_money_management_financial_account_created_event import ( V2MoneyManagementFinancialAccountCreatedEvent, @@ -93,27 +96,6 @@ from stripe.events._v2_money_management_inbound_transfer_bank_debit_succeeded_event import ( V2MoneyManagementInboundTransferBankDebitSucceededEvent, ) -from stripe.events._v2_core_event_destination_ping_event import ( - V2CoreEventDestinationPingEvent, -) -from stripe.events._v2_payments_off_session_payment_authorization_attempt_failed_event import ( - V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEvent, -) -from stripe.events._v2_payments_off_session_payment_authorization_attempt_started_event import ( - V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEvent, -) -from stripe.events._v2_payments_off_session_payment_canceled_event import ( - V2PaymentsOffSessionPaymentCanceledEvent, -) -from stripe.events._v2_payments_off_session_payment_created_event import ( - V2PaymentsOffSessionPaymentCreatedEvent, -) -from stripe.events._v2_payments_off_session_payment_failed_event import ( - V2PaymentsOffSessionPaymentFailedEvent, -) -from stripe.events._v2_payments_off_session_payment_succeeded_event import ( - V2PaymentsOffSessionPaymentSucceededEvent, -) from stripe.events._v2_money_management_outbound_payment_canceled_event import ( V2MoneyManagementOutboundPaymentCanceledEvent, ) @@ -186,6 +168,24 @@ from stripe.events._v2_money_management_transaction_updated_event import ( V2MoneyManagementTransactionUpdatedEvent, ) +from stripe.events._v2_payments_off_session_payment_authorization_attempt_failed_event import ( + V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEvent, +) +from stripe.events._v2_payments_off_session_payment_authorization_attempt_started_event import ( + V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEvent, +) +from stripe.events._v2_payments_off_session_payment_canceled_event import ( + V2PaymentsOffSessionPaymentCanceledEvent, +) +from stripe.events._v2_payments_off_session_payment_created_event import ( + V2PaymentsOffSessionPaymentCreatedEvent, +) +from stripe.events._v2_payments_off_session_payment_failed_event import ( + V2PaymentsOffSessionPaymentFailedEvent, +) +from stripe.events._v2_payments_off_session_payment_succeeded_event import ( + V2PaymentsOffSessionPaymentSucceededEvent, +) THIN_EVENT_CLASSES = { diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index 56c6b585a..a95ecb679 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -34950,13 +34950,13 @@ def test_v2_test_helpers_financial_address_post_2_service( is_json=True, ) - def test_temporary_session_expired_error_service( + def test_already_canceled_error_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "post", - "/v2/billing/meter_event_stream", - rbody='{"error":{"type":"temporary_session_expired","code":"billing_meter_event_session_expired"}}', + "/v2/money_management/outbound_payments/id_123/cancel", + rbody='{"error":{"type":"already_canceled","code":"outbound_payment_already_canceled"}}', rcode=400, ) client = StripeClient( @@ -34965,34 +34965,25 @@ def test_temporary_session_expired_error_service( ) try: - client.v2.billing.meter_event_stream.create( - { - "events": [ - { - "event_name": "event_name", - "payload": {"key": "payload"}, - }, - ], - } - ) - except _error.TemporarySessionExpiredError: + client.v2.money_management.outbound_payments.cancel("id_123") + except _error.AlreadyCanceledError: pass http_client_mock.assert_requested( "post", - path="/v2/billing/meter_event_stream", + path="/v2/money_management/outbound_payments/id_123/cancel", query_string="", - api_base="https://meter-events.stripe.com", - post_data='{"events":[{"event_name":"event_name","payload":{"key":"payload"}}]}', + api_base="https://api.stripe.com", + post_data="{}", is_json=True, ) - def test_non_zero_balance_error_service( + def test_already_exists_error_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "post", - "/v2/money_management/financial_accounts/id_123/close", - rbody='{"error":{"type":"non_zero_balance","code":"closing_financial_account_with_non_zero_balances"}}', + "/v2/money_management/financial_accounts", + rbody='{"error":{"type":"already_exists","code":"already_exists"}}', rcode=400, ) client = StripeClient( @@ -35001,25 +34992,29 @@ def test_non_zero_balance_error_service( ) try: - client.v2.money_management.financial_accounts.close("id_123") - except _error.NonZeroBalanceError: + client.v2.money_management.financial_accounts.create( + { + "type": "storage", + } + ) + except _error.AlreadyExistsError: pass http_client_mock.assert_requested( "post", - path="/v2/money_management/financial_accounts/id_123/close", + path="/v2/money_management/financial_accounts", query_string="", api_base="https://api.stripe.com", - post_data="{}", + post_data='{"type":"storage"}', is_json=True, ) - def test_already_exists_error_service( + def test_blocked_by_stripe_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"}}', + "/v2/core/vault/us_bank_accounts", + rbody='{"error":{"type":"blocked_by_stripe","code":"inbound_transfer_not_allowed"}}', rcode=400, ) client = StripeClient( @@ -35028,19 +35023,46 @@ def test_already_exists_error_service( ) try: - client.v2.money_management.financial_accounts.create( + client.v2.core.vault.us_bank_accounts.create( { - "type": "storage", + "account_number": "account_number", } ) - except _error.AlreadyExistsError: + except _error.BlockedByStripeError: pass http_client_mock.assert_requested( "post", - path="/v2/money_management/financial_accounts", + path="/v2/core/vault/us_bank_accounts", query_string="", api_base="https://api.stripe.com", - post_data='{"type":"storage"}', + post_data='{"account_number":"account_number"}', + is_json=True, + ) + + def test_controlled_by_dashboard_error_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/core/vault/us_bank_accounts/id_123/archive", + rbody='{"error":{"type":"controlled_by_dashboard","code":"bank_account_cannot_be_archived"}}', + rcode=400, + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + try: + client.v2.core.vault.us_bank_accounts.archive("id_123") + except _error.ControlledByDashboardError: + pass + http_client_mock.assert_requested( + "post", + path="/v2/core/vault/us_bank_accounts/id_123/archive", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", is_json=True, ) @@ -35107,13 +35129,49 @@ def test_financial_account_not_open_error_service( is_json=True, ) - def test_blocked_by_stripe_error_service( + def test_insufficient_funds_error_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/money_management/outbound_payments", + rbody='{"error":{"type":"insufficient_funds","code":"insufficient_funds"}}', + rcode=400, + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + try: + client.v2.money_management.outbound_payments.create( + { + "amount": {"currency": "USD", "value": 96}, + "from": { + "currency": "usd", + "financial_account": "financial_account", + }, + "to": {"recipient": "recipient"}, + } + ) + except _error.InsufficientFundsError: + pass + http_client_mock.assert_requested( + "post", + path="/v2/money_management/outbound_payments", + query_string="", + api_base="https://api.stripe.com", + post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"recipient":"recipient"}}', + is_json=True, + ) + + def test_invalid_payment_method_error_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "post", "/v2/core/vault/us_bank_accounts", - rbody='{"error":{"type":"blocked_by_stripe","code":"inbound_transfer_not_allowed"}}', + rbody='{"error":{"type":"invalid_payment_method","code":"invalid_us_bank_account"}}', rcode=400, ) client = StripeClient( @@ -35127,7 +35185,7 @@ def test_blocked_by_stripe_error_service( "account_number": "account_number", } ) - except _error.BlockedByStripeError: + except _error.InvalidPaymentMethodError: pass http_client_mock.assert_requested( "post", @@ -35138,13 +35196,13 @@ def test_blocked_by_stripe_error_service( is_json=True, ) - def test_already_canceled_error_service( + def test_invalid_payout_method_error_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "post", - "/v2/money_management/outbound_payments/id_123/cancel", - rbody='{"error":{"type":"already_canceled","code":"outbound_payment_already_canceled"}}', + "/v2/money_management/outbound_setup_intents", + rbody='{"error":{"type":"invalid_payout_method","code":"invalid_payout_method"}}', rcode=400, ) client = StripeClient( @@ -35153,25 +35211,25 @@ def test_already_canceled_error_service( ) try: - client.v2.money_management.outbound_payments.cancel("id_123") - except _error.AlreadyCanceledError: + client.v2.money_management.outbound_setup_intents.create() + except _error.InvalidPayoutMethodError: pass http_client_mock.assert_requested( "post", - path="/v2/money_management/outbound_payments/id_123/cancel", + path="/v2/money_management/outbound_setup_intents", query_string="", api_base="https://api.stripe.com", post_data="{}", is_json=True, ) - def test_not_cancelable_error_service( + def test_non_zero_balance_error_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "post", - "/v2/money_management/outbound_payments/id_123/cancel", - rbody='{"error":{"type":"not_cancelable","code":"outbound_payment_not_cancelable"}}', + "/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( @@ -35180,25 +35238,25 @@ def test_not_cancelable_error_service( ) try: - client.v2.money_management.outbound_payments.cancel("id_123") - except _error.NotCancelableError: + client.v2.money_management.financial_accounts.close("id_123") + except _error.NonZeroBalanceError: pass http_client_mock.assert_requested( "post", - path="/v2/money_management/outbound_payments/id_123/cancel", + path="/v2/money_management/financial_accounts/id_123/close", query_string="", api_base="https://api.stripe.com", post_data="{}", is_json=True, ) - def test_insufficient_funds_error_service( + def test_not_cancelable_error_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "post", - "/v2/money_management/outbound_payments", - rbody='{"error":{"type":"insufficient_funds","code":"insufficient_funds"}}', + "/v2/money_management/outbound_payments/id_123/cancel", + rbody='{"error":{"type":"not_cancelable","code":"outbound_payment_not_cancelable"}}', rcode=400, ) client = StripeClient( @@ -35207,24 +35265,15 @@ def test_insufficient_funds_error_service( ) try: - client.v2.money_management.outbound_payments.create( - { - "amount": {"currency": "USD", "value": 96}, - "from": { - "currency": "usd", - "financial_account": "financial_account", - }, - "to": {"recipient": "recipient"}, - } - ) - except _error.InsufficientFundsError: + client.v2.money_management.outbound_payments.cancel("id_123") + except _error.NotCancelableError: pass http_client_mock.assert_requested( "post", - path="/v2/money_management/outbound_payments", + path="/v2/money_management/outbound_payments/id_123/cancel", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"recipient":"recipient"}}', + post_data="{}", is_json=True, ) @@ -35295,67 +35344,13 @@ def test_recipient_not_notifiable_error_service( is_json=True, ) - def test_invalid_payout_method_error_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "post", - "/v2/money_management/outbound_setup_intents", - rbody='{"error":{"type":"invalid_payout_method","code":"invalid_payout_method"}}', - rcode=400, - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - try: - client.v2.money_management.outbound_setup_intents.create() - except _error.InvalidPayoutMethodError: - pass - http_client_mock.assert_requested( - "post", - path="/v2/money_management/outbound_setup_intents", - query_string="", - api_base="https://api.stripe.com", - post_data="{}", - is_json=True, - ) - - def test_controlled_by_dashboard_error_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "post", - "/v2/core/vault/us_bank_accounts/id_123/archive", - rbody='{"error":{"type":"controlled_by_dashboard","code":"bank_account_cannot_be_archived"}}', - rcode=400, - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - try: - client.v2.core.vault.us_bank_accounts.archive("id_123") - except _error.ControlledByDashboardError: - pass - http_client_mock.assert_requested( - "post", - path="/v2/core/vault/us_bank_accounts/id_123/archive", - query_string="", - api_base="https://api.stripe.com", - post_data="{}", - is_json=True, - ) - - def test_invalid_payment_method_error_service( + def test_temporary_session_expired_error_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "post", - "/v2/core/vault/us_bank_accounts", - rbody='{"error":{"type":"invalid_payment_method","code":"invalid_us_bank_account"}}', + "/v2/billing/meter_event_stream", + rbody='{"error":{"type":"temporary_session_expired","code":"billing_meter_event_session_expired"}}', rcode=400, ) client = StripeClient( @@ -35364,18 +35359,23 @@ def test_invalid_payment_method_error_service( ) try: - client.v2.core.vault.us_bank_accounts.create( + client.v2.billing.meter_event_stream.create( { - "account_number": "account_number", + "events": [ + { + "event_name": "event_name", + "payload": {"key": "payload"}, + }, + ], } ) - except _error.InvalidPaymentMethodError: + except _error.TemporarySessionExpiredError: pass http_client_mock.assert_requested( "post", - path="/v2/core/vault/us_bank_accounts", + path="/v2/billing/meter_event_stream", query_string="", - api_base="https://api.stripe.com", - post_data='{"account_number":"account_number"}', + api_base="https://meter-events.stripe.com", + post_data='{"events":[{"event_name":"event_name","payload":{"key":"payload"}}]}', is_json=True, ) From 5974991e334ac93b5b0f46b07cfb9ca18135f927 Mon Sep 17 00:00:00 2001 From: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com> Date: Thu, 21 Aug 2025 11:31:22 -0400 Subject: [PATCH 29/31] Introduce V1 namespaces in StripeClient (#1549) * Introduced V1 namespaces * Updated migration guide link --- stripe/__init__.py | 1 + stripe/_stripe_client.py | 775 +- stripe/_v1_services.py | 160 + tests/test_generated_examples.py | 12976 ++++++++++++++++++++++++++--- 4 files changed, 12578 insertions(+), 1334 deletions(-) create mode 100644 stripe/_v1_services.py diff --git a/stripe/__init__.py b/stripe/__init__.py index 5b98fd411..4aea00eae 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -567,6 +567,7 @@ def __getattr__(name): ) from stripe._transfer_service import TransferService as TransferService from stripe._treasury_service import TreasuryService as TreasuryService +from stripe._v1_services import V1Services as V1Services from stripe._v2_services import V2Services as V2Services from stripe._webhook_endpoint import WebhookEndpoint as WebhookEndpoint from stripe._webhook_endpoint_service import ( diff --git a/stripe/_stripe_client.py b/stripe/_stripe_client.py index e6fb417c9..cdc34e7b6 100644 --- a/stripe/_stripe_client.py +++ b/stripe/_stripe_client.py @@ -35,6 +35,8 @@ from stripe._oauth_service import OAuthService # services: The beginning of the section generated from our OpenAPI spec +from stripe._v1_services import V1Services +from stripe._v2_services import V2Services from stripe._account_service import AccountService from stripe._account_link_service import AccountLinkService from stripe._account_session_service import AccountSessionService @@ -108,7 +110,6 @@ from stripe._transfer_service import TransferService from stripe._treasury_service import TreasuryService from stripe._webhook_endpoint_service import WebhookEndpointService -from stripe._v2_services import V2Services # services: The end of the section generated from our OpenAPI spec @@ -186,85 +187,7 @@ def __init__( self.oauth = OAuthService(self._requestor, self._options) # top-level services: The beginning of the section generated from our OpenAPI spec - self.accounts = AccountService(self._requestor) - self.account_links = AccountLinkService(self._requestor) - self.account_sessions = AccountSessionService(self._requestor) - self.apple_pay_domains = ApplePayDomainService(self._requestor) - self.application_fees = ApplicationFeeService(self._requestor) - self.apps = AppsService(self._requestor) - self.balance = BalanceService(self._requestor) - self.balance_transactions = BalanceTransactionService(self._requestor) - self.billing = BillingService(self._requestor) - self.billing_portal = BillingPortalService(self._requestor) - self.charges = ChargeService(self._requestor) - self.checkout = CheckoutService(self._requestor) - self.climate = ClimateService(self._requestor) - self.confirmation_tokens = ConfirmationTokenService(self._requestor) - self.test_helpers = TestHelpersService(self._requestor) - self.country_specs = CountrySpecService(self._requestor) - self.coupons = CouponService(self._requestor) - self.credit_notes = CreditNoteService(self._requestor) - self.customers = CustomerService(self._requestor) - self.customer_sessions = CustomerSessionService(self._requestor) - self.disputes = DisputeService(self._requestor) - self.entitlements = EntitlementsService(self._requestor) - self.ephemeral_keys = EphemeralKeyService(self._requestor) - self.events = EventService(self._requestor) - self.exchange_rates = ExchangeRateService(self._requestor) - self.files = FileService(self._requestor) - self.file_links = FileLinkService(self._requestor) - self.financial_connections = FinancialConnectionsService( - self._requestor - ) - self.forwarding = ForwardingService(self._requestor) - self.identity = IdentityService(self._requestor) - self.invoices = InvoiceService(self._requestor) - self.invoice_payments = InvoicePaymentService(self._requestor) - self.invoice_rendering_templates = InvoiceRenderingTemplateService( - self._requestor, - ) - self.invoice_items = InvoiceItemService(self._requestor) - self.issuing = IssuingService(self._requestor) - self.mandates = MandateService(self._requestor) - self.payment_intents = PaymentIntentService(self._requestor) - self.payment_links = PaymentLinkService(self._requestor) - self.payment_methods = PaymentMethodService(self._requestor) - self.payment_method_configurations = PaymentMethodConfigurationService( - self._requestor, - ) - self.payment_method_domains = PaymentMethodDomainService( - self._requestor - ) - self.payouts = PayoutService(self._requestor) - self.plans = PlanService(self._requestor) - self.prices = PriceService(self._requestor) - self.products = ProductService(self._requestor) - self.promotion_codes = PromotionCodeService(self._requestor) - self.quotes = QuoteService(self._requestor) - self.radar = RadarService(self._requestor) - self.refunds = RefundService(self._requestor) - self.reporting = ReportingService(self._requestor) - self.reviews = ReviewService(self._requestor) - self.sigma = SigmaService(self._requestor) - self.setup_attempts = SetupAttemptService(self._requestor) - self.setup_intents = SetupIntentService(self._requestor) - self.shipping_rates = ShippingRateService(self._requestor) - self.sources = SourceService(self._requestor) - self.subscriptions = SubscriptionService(self._requestor) - self.subscription_items = SubscriptionItemService(self._requestor) - self.subscription_schedules = SubscriptionScheduleService( - self._requestor - ) - self.tax = TaxService(self._requestor) - self.tax_codes = TaxCodeService(self._requestor) - self.tax_ids = TaxIdService(self._requestor) - self.tax_rates = TaxRateService(self._requestor) - self.terminal = TerminalService(self._requestor) - self.tokens = TokenService(self._requestor) - self.topups = TopupService(self._requestor) - self.transfers = TransferService(self._requestor) - self.treasury = TreasuryService(self._requestor) - self.webhook_endpoints = WebhookEndpointService(self._requestor) + self.v1 = V1Services(self._requestor) self.v2 = V2Services(self._requestor) # top-level services: The end of the section generated from our OpenAPI spec @@ -372,4 +295,696 @@ def deserialize( ) # deprecated v1 services: The beginning of the section generated from our OpenAPI spec + @property + def accounts(self) -> AccountService: + """ + Deprecation Warning: + StripeClient.accounts will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.accounts. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.accounts + + @property + def account_links(self) -> AccountLinkService: + """ + Deprecation Warning: + StripeClient.account_links will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.account_links. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.account_links + + @property + def account_sessions(self) -> AccountSessionService: + """ + Deprecation Warning: + StripeClient.account_sessions will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.account_sessions. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.account_sessions + + @property + def apple_pay_domains(self) -> ApplePayDomainService: + """ + Deprecation Warning: + StripeClient.apple_pay_domains will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.apple_pay_domains. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.apple_pay_domains + + @property + def application_fees(self) -> ApplicationFeeService: + """ + Deprecation Warning: + StripeClient.application_fees will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.application_fees. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.application_fees + + @property + def apps(self) -> AppsService: + """ + Deprecation Warning: + StripeClient.apps will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.apps. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.apps + + @property + def balance(self) -> BalanceService: + """ + Deprecation Warning: + StripeClient.balance will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.balance. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.balance + + @property + def balance_transactions(self) -> BalanceTransactionService: + """ + Deprecation Warning: + StripeClient.balance_transactions will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.balance_transactions. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.balance_transactions + + @property + def billing(self) -> BillingService: + """ + Deprecation Warning: + StripeClient.billing will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.billing. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.billing + + @property + def billing_portal(self) -> BillingPortalService: + """ + Deprecation Warning: + StripeClient.billing_portal will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.billing_portal. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.billing_portal + + @property + def charges(self) -> ChargeService: + """ + Deprecation Warning: + StripeClient.charges will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.charges. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.charges + + @property + def checkout(self) -> CheckoutService: + """ + Deprecation Warning: + StripeClient.checkout will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.checkout. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.checkout + + @property + def climate(self) -> ClimateService: + """ + Deprecation Warning: + StripeClient.climate will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.climate. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.climate + + @property + def confirmation_tokens(self) -> ConfirmationTokenService: + """ + Deprecation Warning: + StripeClient.confirmation_tokens will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.confirmation_tokens. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.confirmation_tokens + + @property + def test_helpers(self) -> TestHelpersService: + """ + Deprecation Warning: + StripeClient.test_helpers will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.test_helpers. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.test_helpers + + @property + def country_specs(self) -> CountrySpecService: + """ + Deprecation Warning: + StripeClient.country_specs will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.country_specs. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.country_specs + + @property + def coupons(self) -> CouponService: + """ + Deprecation Warning: + StripeClient.coupons will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.coupons. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.coupons + + @property + def credit_notes(self) -> CreditNoteService: + """ + Deprecation Warning: + StripeClient.credit_notes will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.credit_notes. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.credit_notes + + @property + def customers(self) -> CustomerService: + """ + Deprecation Warning: + StripeClient.customers will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.customers. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.customers + + @property + def customer_sessions(self) -> CustomerSessionService: + """ + Deprecation Warning: + StripeClient.customer_sessions will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.customer_sessions. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.customer_sessions + + @property + def disputes(self) -> DisputeService: + """ + Deprecation Warning: + StripeClient.disputes will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.disputes. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.disputes + + @property + def entitlements(self) -> EntitlementsService: + """ + Deprecation Warning: + StripeClient.entitlements will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.entitlements. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.entitlements + + @property + def ephemeral_keys(self) -> EphemeralKeyService: + """ + Deprecation Warning: + StripeClient.ephemeral_keys will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.ephemeral_keys. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.ephemeral_keys + + @property + def events(self) -> EventService: + """ + Deprecation Warning: + StripeClient.events will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.events. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.events + + @property + def exchange_rates(self) -> ExchangeRateService: + """ + Deprecation Warning: + StripeClient.exchange_rates will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.exchange_rates. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.exchange_rates + + @property + def files(self) -> FileService: + """ + Deprecation Warning: + StripeClient.files will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.files. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.files + + @property + def file_links(self) -> FileLinkService: + """ + Deprecation Warning: + StripeClient.file_links will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.file_links. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.file_links + + @property + def financial_connections(self) -> FinancialConnectionsService: + """ + Deprecation Warning: + StripeClient.financial_connections will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.financial_connections. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.financial_connections + + @property + def forwarding(self) -> ForwardingService: + """ + Deprecation Warning: + StripeClient.forwarding will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.forwarding. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.forwarding + + @property + def identity(self) -> IdentityService: + """ + Deprecation Warning: + StripeClient.identity will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.identity. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.identity + + @property + def invoices(self) -> InvoiceService: + """ + Deprecation Warning: + StripeClient.invoices will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.invoices. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.invoices + + @property + def invoice_payments(self) -> InvoicePaymentService: + """ + Deprecation Warning: + StripeClient.invoice_payments will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.invoice_payments. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.invoice_payments + + @property + def invoice_rendering_templates(self) -> InvoiceRenderingTemplateService: + """ + Deprecation Warning: + StripeClient.invoice_rendering_templates will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.invoice_rendering_templates. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.invoice_rendering_templates + + @property + def invoice_items(self) -> InvoiceItemService: + """ + Deprecation Warning: + StripeClient.invoice_items will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.invoice_items. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.invoice_items + + @property + def issuing(self) -> IssuingService: + """ + Deprecation Warning: + StripeClient.issuing will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.issuing. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.issuing + + @property + def mandates(self) -> MandateService: + """ + Deprecation Warning: + StripeClient.mandates will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.mandates. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.mandates + + @property + def payment_intents(self) -> PaymentIntentService: + """ + Deprecation Warning: + StripeClient.payment_intents will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.payment_intents. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.payment_intents + + @property + def payment_links(self) -> PaymentLinkService: + """ + Deprecation Warning: + StripeClient.payment_links will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.payment_links. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.payment_links + + @property + def payment_methods(self) -> PaymentMethodService: + """ + Deprecation Warning: + StripeClient.payment_methods will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.payment_methods. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.payment_methods + + @property + def payment_method_configurations( + self, + ) -> PaymentMethodConfigurationService: + """ + Deprecation Warning: + StripeClient.payment_method_configurations will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.payment_method_configurations. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.payment_method_configurations + + @property + def payment_method_domains(self) -> PaymentMethodDomainService: + """ + Deprecation Warning: + StripeClient.payment_method_domains will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.payment_method_domains. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.payment_method_domains + + @property + def payouts(self) -> PayoutService: + """ + Deprecation Warning: + StripeClient.payouts will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.payouts. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.payouts + + @property + def plans(self) -> PlanService: + """ + Deprecation Warning: + StripeClient.plans will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.plans. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.plans + + @property + def prices(self) -> PriceService: + """ + Deprecation Warning: + StripeClient.prices will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.prices. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.prices + + @property + def products(self) -> ProductService: + """ + Deprecation Warning: + StripeClient.products will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.products. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.products + + @property + def promotion_codes(self) -> PromotionCodeService: + """ + Deprecation Warning: + StripeClient.promotion_codes will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.promotion_codes. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.promotion_codes + + @property + def quotes(self) -> QuoteService: + """ + Deprecation Warning: + StripeClient.quotes will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.quotes. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.quotes + + @property + def radar(self) -> RadarService: + """ + Deprecation Warning: + StripeClient.radar will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.radar. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.radar + + @property + def refunds(self) -> RefundService: + """ + Deprecation Warning: + StripeClient.refunds will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.refunds. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.refunds + + @property + def reporting(self) -> ReportingService: + """ + Deprecation Warning: + StripeClient.reporting will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.reporting. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.reporting + + @property + def reviews(self) -> ReviewService: + """ + Deprecation Warning: + StripeClient.reviews will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.reviews. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.reviews + + @property + def sigma(self) -> SigmaService: + """ + Deprecation Warning: + StripeClient.sigma will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.sigma. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.sigma + + @property + def setup_attempts(self) -> SetupAttemptService: + """ + Deprecation Warning: + StripeClient.setup_attempts will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.setup_attempts. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.setup_attempts + + @property + def setup_intents(self) -> SetupIntentService: + """ + Deprecation Warning: + StripeClient.setup_intents will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.setup_intents. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.setup_intents + + @property + def shipping_rates(self) -> ShippingRateService: + """ + Deprecation Warning: + StripeClient.shipping_rates will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.shipping_rates. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.shipping_rates + + @property + def sources(self) -> SourceService: + """ + Deprecation Warning: + StripeClient.sources will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.sources. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.sources + + @property + def subscriptions(self) -> SubscriptionService: + """ + Deprecation Warning: + StripeClient.subscriptions will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.subscriptions. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.subscriptions + + @property + def subscription_items(self) -> SubscriptionItemService: + """ + Deprecation Warning: + StripeClient.subscription_items will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.subscription_items. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.subscription_items + + @property + def subscription_schedules(self) -> SubscriptionScheduleService: + """ + Deprecation Warning: + StripeClient.subscription_schedules will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.subscription_schedules. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.subscription_schedules + + @property + def tax(self) -> TaxService: + """ + Deprecation Warning: + StripeClient.tax will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.tax. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.tax + + @property + def tax_codes(self) -> TaxCodeService: + """ + Deprecation Warning: + StripeClient.tax_codes will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.tax_codes. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.tax_codes + + @property + def tax_ids(self) -> TaxIdService: + """ + Deprecation Warning: + StripeClient.tax_ids will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.tax_ids. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.tax_ids + + @property + def tax_rates(self) -> TaxRateService: + """ + Deprecation Warning: + StripeClient.tax_rates will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.tax_rates. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.tax_rates + + @property + def terminal(self) -> TerminalService: + """ + Deprecation Warning: + StripeClient.terminal will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.terminal. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.terminal + + @property + def tokens(self) -> TokenService: + """ + Deprecation Warning: + StripeClient.tokens will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.tokens. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.tokens + + @property + def topups(self) -> TopupService: + """ + Deprecation Warning: + StripeClient.topups will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.topups. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.topups + + @property + def transfers(self) -> TransferService: + """ + Deprecation Warning: + StripeClient.transfers will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.transfers. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.transfers + + @property + def treasury(self) -> TreasuryService: + """ + Deprecation Warning: + StripeClient.treasury will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.treasury. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.treasury + + @property + def webhook_endpoints(self) -> WebhookEndpointService: + """ + Deprecation Warning: + StripeClient.webhook_endpoints will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.webhook_endpoints. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.webhook_endpoints + # deprecated v1 services: The end of the section generated from our OpenAPI spec diff --git a/stripe/_v1_services.py b/stripe/_v1_services.py new file mode 100644 index 000000000..929125c90 --- /dev/null +++ b/stripe/_v1_services.py @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._account_link_service import AccountLinkService +from stripe._account_service import AccountService +from stripe._account_session_service import AccountSessionService +from stripe._apple_pay_domain_service import ApplePayDomainService +from stripe._application_fee_service import ApplicationFeeService +from stripe._apps_service import AppsService +from stripe._balance_service import BalanceService +from stripe._balance_transaction_service import BalanceTransactionService +from stripe._billing_portal_service import BillingPortalService +from stripe._billing_service import BillingService +from stripe._charge_service import ChargeService +from stripe._checkout_service import CheckoutService +from stripe._climate_service import ClimateService +from stripe._confirmation_token_service import ConfirmationTokenService +from stripe._country_spec_service import CountrySpecService +from stripe._coupon_service import CouponService +from stripe._credit_note_service import CreditNoteService +from stripe._customer_service import CustomerService +from stripe._customer_session_service import CustomerSessionService +from stripe._dispute_service import DisputeService +from stripe._entitlements_service import EntitlementsService +from stripe._ephemeral_key_service import EphemeralKeyService +from stripe._event_service import EventService +from stripe._exchange_rate_service import ExchangeRateService +from stripe._file_link_service import FileLinkService +from stripe._file_service import FileService +from stripe._financial_connections_service import FinancialConnectionsService +from stripe._forwarding_service import ForwardingService +from stripe._identity_service import IdentityService +from stripe._invoice_item_service import InvoiceItemService +from stripe._invoice_payment_service import InvoicePaymentService +from stripe._invoice_rendering_template_service import ( + InvoiceRenderingTemplateService, +) +from stripe._invoice_service import InvoiceService +from stripe._issuing_service import IssuingService +from stripe._mandate_service import MandateService +from stripe._payment_intent_service import PaymentIntentService +from stripe._payment_link_service import PaymentLinkService +from stripe._payment_method_configuration_service import ( + PaymentMethodConfigurationService, +) +from stripe._payment_method_domain_service import PaymentMethodDomainService +from stripe._payment_method_service import PaymentMethodService +from stripe._payout_service import PayoutService +from stripe._plan_service import PlanService +from stripe._price_service import PriceService +from stripe._product_service import ProductService +from stripe._promotion_code_service import PromotionCodeService +from stripe._quote_service import QuoteService +from stripe._radar_service import RadarService +from stripe._refund_service import RefundService +from stripe._reporting_service import ReportingService +from stripe._review_service import ReviewService +from stripe._setup_attempt_service import SetupAttemptService +from stripe._setup_intent_service import SetupIntentService +from stripe._shipping_rate_service import ShippingRateService +from stripe._sigma_service import SigmaService +from stripe._source_service import SourceService +from stripe._stripe_service import StripeService +from stripe._subscription_item_service import SubscriptionItemService +from stripe._subscription_schedule_service import SubscriptionScheduleService +from stripe._subscription_service import SubscriptionService +from stripe._tax_code_service import TaxCodeService +from stripe._tax_id_service import TaxIdService +from stripe._tax_rate_service import TaxRateService +from stripe._tax_service import TaxService +from stripe._terminal_service import TerminalService +from stripe._test_helpers_service import TestHelpersService +from stripe._token_service import TokenService +from stripe._topup_service import TopupService +from stripe._transfer_service import TransferService +from stripe._treasury_service import TreasuryService +from stripe._webhook_endpoint_service import WebhookEndpointService + + +class V1Services(StripeService): + def __init__(self, requestor): + super().__init__(requestor) + self.accounts = AccountService(self._requestor) + self.account_links = AccountLinkService(self._requestor) + self.account_sessions = AccountSessionService(self._requestor) + self.apple_pay_domains = ApplePayDomainService(self._requestor) + self.application_fees = ApplicationFeeService(self._requestor) + self.apps = AppsService(self._requestor) + self.balance = BalanceService(self._requestor) + self.balance_transactions = BalanceTransactionService(self._requestor) + self.billing = BillingService(self._requestor) + self.billing_portal = BillingPortalService(self._requestor) + self.charges = ChargeService(self._requestor) + self.checkout = CheckoutService(self._requestor) + self.climate = ClimateService(self._requestor) + self.confirmation_tokens = ConfirmationTokenService(self._requestor) + self.test_helpers = TestHelpersService(self._requestor) + self.country_specs = CountrySpecService(self._requestor) + self.coupons = CouponService(self._requestor) + self.credit_notes = CreditNoteService(self._requestor) + self.customers = CustomerService(self._requestor) + self.customer_sessions = CustomerSessionService(self._requestor) + self.disputes = DisputeService(self._requestor) + self.entitlements = EntitlementsService(self._requestor) + self.ephemeral_keys = EphemeralKeyService(self._requestor) + self.events = EventService(self._requestor) + self.exchange_rates = ExchangeRateService(self._requestor) + self.files = FileService(self._requestor) + self.file_links = FileLinkService(self._requestor) + self.financial_connections = FinancialConnectionsService( + self._requestor, + ) + self.forwarding = ForwardingService(self._requestor) + self.identity = IdentityService(self._requestor) + self.invoices = InvoiceService(self._requestor) + self.invoice_payments = InvoicePaymentService(self._requestor) + self.invoice_rendering_templates = InvoiceRenderingTemplateService( + self._requestor, + ) + self.invoice_items = InvoiceItemService(self._requestor) + self.issuing = IssuingService(self._requestor) + self.mandates = MandateService(self._requestor) + self.payment_intents = PaymentIntentService(self._requestor) + self.payment_links = PaymentLinkService(self._requestor) + self.payment_methods = PaymentMethodService(self._requestor) + self.payment_method_configurations = PaymentMethodConfigurationService( + self._requestor, + ) + self.payment_method_domains = PaymentMethodDomainService( + self._requestor, + ) + self.payouts = PayoutService(self._requestor) + self.plans = PlanService(self._requestor) + self.prices = PriceService(self._requestor) + self.products = ProductService(self._requestor) + self.promotion_codes = PromotionCodeService(self._requestor) + self.quotes = QuoteService(self._requestor) + self.radar = RadarService(self._requestor) + self.refunds = RefundService(self._requestor) + self.reporting = ReportingService(self._requestor) + self.reviews = ReviewService(self._requestor) + self.sigma = SigmaService(self._requestor) + self.setup_attempts = SetupAttemptService(self._requestor) + self.setup_intents = SetupIntentService(self._requestor) + self.shipping_rates = ShippingRateService(self._requestor) + self.sources = SourceService(self._requestor) + self.subscriptions = SubscriptionService(self._requestor) + self.subscription_items = SubscriptionItemService(self._requestor) + self.subscription_schedules = SubscriptionScheduleService( + self._requestor, + ) + self.tax = TaxService(self._requestor) + self.tax_codes = TaxCodeService(self._requestor) + self.tax_ids = TaxIdService(self._requestor) + self.tax_rates = TaxRateService(self._requestor) + self.terminal = TerminalService(self._requestor) + self.tokens = TokenService(self._requestor) + self.topups = TopupService(self._requestor) + self.transfers = TransferService(self._requestor) + self.treasury = TreasuryService(self._requestor) + self.webhook_endpoints = WebhookEndpointService(self._requestor) diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index be4386aa5..94b395a47 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -10,6 +10,34 @@ class TestGeneratedExamples(object): + def test_account_links_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/account_links", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.account_links.create( + { + "account": "acct_xxxxxxxxxxxxx", + "refresh_url": "https://example.com/reauth", + "return_url": "https://example.com/return", + "type": "account_onboarding", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/account_links", + query_string="", + api_base="https://api.stripe.com", + post_data="account=acct_xxxxxxxxxxxxx&refresh_url=https%3A%2F%2Fexample.com%2Freauth&return_url=https%3A%2F%2Fexample.com%2Freturn&type=account_onboarding", + ) + def test_account_links_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -38,7 +66,7 @@ def test_account_links_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.account_links.create( + client.v1.account_links.create( { "account": "acct_xxxxxxxxxxxxx", "refresh_url": "https://example.com/reauth", @@ -84,7 +112,7 @@ async def test_account_links_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.account_links.create_async( + await client.v1.account_links.create_async( { "account": "acct_xxxxxxxxxxxxx", "refresh_url": "https://example.com/reauth", @@ -100,6 +128,26 @@ async def test_account_links_post_service_async( post_data="account=acct_xxxxxxxxxxxxx&refresh_url=https%3A%2F%2Fexample.com%2Freauth&return_url=https%3A%2F%2Fexample.com%2Freturn&type=account_onboarding", ) + def test_accounts_capabilities_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/capabilities", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.capabilities.list("acct_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/accounts/acct_xxxxxxxxxxxxx/capabilities", + query_string="", + api_base="https://api.stripe.com", + ) + def test_accounts_capabilities_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -122,7 +170,7 @@ def test_accounts_capabilities_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.capabilities.list("acct_xxxxxxxxxxxxx") + client.v1.accounts.capabilities.list("acct_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/accounts/acct_xxxxxxxxxxxxx/capabilities", @@ -154,7 +202,7 @@ async def test_accounts_capabilities_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.capabilities.list_async("acct_xxxxxxxxxxxxx") + await client.v1.accounts.capabilities.list_async("acct_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/accounts/acct_xxxxxxxxxxxxx/capabilities", @@ -162,6 +210,29 @@ async def test_accounts_capabilities_get_service_async( api_base="https://api.stripe.com", ) + def test_accounts_capabilities_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.capabilities.retrieve( + "acct_xxxxxxxxxxxxx", + "card_payments", + ) + http_client_mock.assert_requested( + "get", + path="/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments", + query_string="", + api_base="https://api.stripe.com", + ) + def test_accounts_capabilities_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -187,7 +258,7 @@ def test_accounts_capabilities_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.capabilities.retrieve( + client.v1.accounts.capabilities.retrieve( "acct_xxxxxxxxxxxxx", "card_payments", ) @@ -225,7 +296,7 @@ async def test_accounts_capabilities_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.capabilities.retrieve_async( + await client.v1.accounts.capabilities.retrieve_async( "acct_xxxxxxxxxxxxx", "card_payments", ) @@ -236,6 +307,31 @@ async def test_accounts_capabilities_get_2_service_async( api_base="https://api.stripe.com", ) + def test_accounts_capabilities_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.capabilities.update( + "acct_xxxxxxxxxxxxx", + "card_payments", + {"requested": True}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments", + query_string="", + api_base="https://api.stripe.com", + post_data="requested=true", + ) + def test_accounts_capabilities_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -263,7 +359,7 @@ def test_accounts_capabilities_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.capabilities.update( + client.v1.accounts.capabilities.update( "acct_xxxxxxxxxxxxx", "card_payments", {"requested": True}, @@ -305,7 +401,7 @@ async def test_accounts_capabilities_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.capabilities.update_async( + await client.v1.accounts.capabilities.update_async( "acct_xxxxxxxxxxxxx", "card_payments", {"requested": True}, @@ -318,6 +414,26 @@ async def test_accounts_capabilities_post_service_async( post_data="requested=true", ) + def test_accounts_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/accounts/acct_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.delete("acct_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/accounts/acct_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_accounts_delete(self, http_client_mock: HTTPClientMock) -> None: stripe.Account.delete("acct_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -338,7 +454,7 @@ def test_accounts_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.delete("acct_xxxxxxxxxxxxx") + client.v1.accounts.delete("acct_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/accounts/acct_xxxxxxxxxxxxx", @@ -370,7 +486,7 @@ async def test_accounts_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.delete_async("acct_xxxxxxxxxxxxx") + await client.v1.accounts.delete_async("acct_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/accounts/acct_xxxxxxxxxxxxx", @@ -378,6 +494,29 @@ async def test_accounts_delete_service_async( api_base="https://api.stripe.com", ) + def test_accounts_external_accounts_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts/ba_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.external_accounts.delete( + "acct_xxxxxxxxxxxxx", + "ba_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "delete", + path="/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts/ba_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_accounts_external_accounts_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -403,7 +542,7 @@ def test_accounts_external_accounts_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.external_accounts.delete( + client.v1.accounts.external_accounts.delete( "acct_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx", ) @@ -441,7 +580,7 @@ async def test_accounts_external_accounts_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.external_accounts.delete_async( + await client.v1.accounts.external_accounts.delete_async( "acct_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx", ) @@ -452,6 +591,29 @@ async def test_accounts_external_accounts_delete_service_async( api_base="https://api.stripe.com", ) + def test_accounts_external_accounts_delete_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts/card_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.external_accounts.delete( + "acct_xxxxxxxxxxxxx", + "card_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "delete", + path="/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts/card_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_accounts_external_accounts_delete_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -477,7 +639,7 @@ def test_accounts_external_accounts_delete_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.external_accounts.delete( + client.v1.accounts.external_accounts.delete( "acct_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx", ) @@ -515,7 +677,7 @@ async def test_accounts_external_accounts_delete_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.external_accounts.delete_async( + await client.v1.accounts.external_accounts.delete_async( "acct_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx", ) @@ -526,6 +688,30 @@ async def test_accounts_external_accounts_delete_2_service_async( api_base="https://api.stripe.com", ) + def test_accounts_external_accounts_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.external_accounts.list( + "acct_xxxxxxxxxxxxx", + {"limit": 3}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_accounts_external_accounts_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -552,7 +738,7 @@ def test_accounts_external_accounts_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.external_accounts.list( + client.v1.accounts.external_accounts.list( "acct_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -591,7 +777,7 @@ async def test_accounts_external_accounts_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.external_accounts.list_async( + await client.v1.accounts.external_accounts.list_async( "acct_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -602,6 +788,30 @@ async def test_accounts_external_accounts_get_service_async( api_base="https://api.stripe.com", ) + def test_accounts_external_accounts_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts", + "object=bank_account&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.external_accounts.list( + "acct_xxxxxxxxxxxxx", + {"object": "bank_account", "limit": 3}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts", + query_string="object=bank_account&limit=3", + api_base="https://api.stripe.com", + ) + def test_accounts_external_accounts_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -629,7 +839,7 @@ def test_accounts_external_accounts_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.external_accounts.list( + client.v1.accounts.external_accounts.list( "acct_xxxxxxxxxxxxx", {"object": "bank_account", "limit": 3}, ) @@ -669,7 +879,7 @@ async def test_accounts_external_accounts_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.external_accounts.list_async( + await client.v1.accounts.external_accounts.list_async( "acct_xxxxxxxxxxxxx", {"object": "bank_account", "limit": 3}, ) @@ -680,6 +890,30 @@ async def test_accounts_external_accounts_get_2_service_async( api_base="https://api.stripe.com", ) + def test_accounts_external_accounts_get_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts", + "object=card&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.external_accounts.list( + "acct_xxxxxxxxxxxxx", + {"object": "card", "limit": 3}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts", + query_string="object=card&limit=3", + api_base="https://api.stripe.com", + ) + def test_accounts_external_accounts_get_3( self, http_client_mock: HTTPClientMock ) -> None: @@ -707,7 +941,7 @@ def test_accounts_external_accounts_get_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.external_accounts.list( + client.v1.accounts.external_accounts.list( "acct_xxxxxxxxxxxxx", {"object": "card", "limit": 3}, ) @@ -747,7 +981,7 @@ async def test_accounts_external_accounts_get_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.external_accounts.list_async( + await client.v1.accounts.external_accounts.list_async( "acct_xxxxxxxxxxxxx", {"object": "card", "limit": 3}, ) @@ -758,6 +992,29 @@ async def test_accounts_external_accounts_get_3_service_async( api_base="https://api.stripe.com", ) + def test_accounts_external_accounts_get_4_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts/ba_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.external_accounts.retrieve( + "acct_xxxxxxxxxxxxx", + "ba_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "get", + path="/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts/ba_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_accounts_external_accounts_get_4( self, http_client_mock: HTTPClientMock ) -> None: @@ -783,7 +1040,7 @@ def test_accounts_external_accounts_get_4_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.external_accounts.retrieve( + client.v1.accounts.external_accounts.retrieve( "acct_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx", ) @@ -821,7 +1078,7 @@ async def test_accounts_external_accounts_get_4_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.external_accounts.retrieve_async( + await client.v1.accounts.external_accounts.retrieve_async( "acct_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx", ) @@ -832,6 +1089,29 @@ async def test_accounts_external_accounts_get_4_service_async( api_base="https://api.stripe.com", ) + def test_accounts_external_accounts_get_5_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts/card_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.external_accounts.retrieve( + "acct_xxxxxxxxxxxxx", + "card_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "get", + path="/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts/card_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_accounts_external_accounts_get_5( self, http_client_mock: HTTPClientMock ) -> None: @@ -857,7 +1137,7 @@ def test_accounts_external_accounts_get_5_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.external_accounts.retrieve( + client.v1.accounts.external_accounts.retrieve( "acct_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx", ) @@ -895,7 +1175,7 @@ async def test_accounts_external_accounts_get_5_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.external_accounts.retrieve_async( + await client.v1.accounts.external_accounts.retrieve_async( "acct_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx", ) @@ -906,6 +1186,30 @@ async def test_accounts_external_accounts_get_5_service_async( api_base="https://api.stripe.com", ) + def test_accounts_external_accounts_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.external_accounts.create( + "acct_xxxxxxxxxxxxx", + {"external_account": "btok_xxxxxxxxxxxxx"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts", + query_string="", + api_base="https://api.stripe.com", + post_data="external_account=btok_xxxxxxxxxxxxx", + ) + def test_accounts_external_accounts_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -932,7 +1236,7 @@ def test_accounts_external_accounts_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.external_accounts.create( + client.v1.accounts.external_accounts.create( "acct_xxxxxxxxxxxxx", {"external_account": "btok_xxxxxxxxxxxxx"}, ) @@ -972,7 +1276,7 @@ async def test_accounts_external_accounts_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.external_accounts.create_async( + await client.v1.accounts.external_accounts.create_async( "acct_xxxxxxxxxxxxx", {"external_account": "btok_xxxxxxxxxxxxx"}, ) @@ -984,6 +1288,30 @@ async def test_accounts_external_accounts_post_service_async( post_data="external_account=btok_xxxxxxxxxxxxx", ) + def test_accounts_external_accounts_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.external_accounts.create( + "acct_xxxxxxxxxxxxx", + {"external_account": "tok_xxxx_debit"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts", + query_string="", + api_base="https://api.stripe.com", + post_data="external_account=tok_xxxx_debit", + ) + def test_accounts_external_accounts_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -1010,7 +1338,7 @@ def test_accounts_external_accounts_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.external_accounts.create( + client.v1.accounts.external_accounts.create( "acct_xxxxxxxxxxxxx", {"external_account": "tok_xxxx_debit"}, ) @@ -1050,7 +1378,7 @@ async def test_accounts_external_accounts_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.external_accounts.create_async( + await client.v1.accounts.external_accounts.create_async( "acct_xxxxxxxxxxxxx", {"external_account": "tok_xxxx_debit"}, ) @@ -1062,6 +1390,31 @@ async def test_accounts_external_accounts_post_2_service_async( post_data="external_account=tok_xxxx_debit", ) + def test_accounts_external_accounts_post_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts/ba_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.external_accounts.update( + "acct_xxxxxxxxxxxxx", + "ba_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts/ba_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_accounts_external_accounts_post_3( self, http_client_mock: HTTPClientMock ) -> None: @@ -1089,7 +1442,7 @@ def test_accounts_external_accounts_post_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.external_accounts.update( + client.v1.accounts.external_accounts.update( "acct_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -1131,7 +1484,7 @@ async def test_accounts_external_accounts_post_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.external_accounts.update_async( + await client.v1.accounts.external_accounts.update_async( "acct_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -1144,6 +1497,31 @@ async def test_accounts_external_accounts_post_3_service_async( post_data="metadata[order_id]=6735", ) + def test_accounts_external_accounts_post_4_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts/card_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.external_accounts.update( + "acct_xxxxxxxxxxxxx", + "card_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/accounts/acct_xxxxxxxxxxxxx/external_accounts/card_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_accounts_external_accounts_post_4( self, http_client_mock: HTTPClientMock ) -> None: @@ -1171,7 +1549,7 @@ def test_accounts_external_accounts_post_4_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.external_accounts.update( + client.v1.accounts.external_accounts.update( "acct_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -1213,7 +1591,7 @@ async def test_accounts_external_accounts_post_4_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.external_accounts.update_async( + await client.v1.accounts.external_accounts.update_async( "acct_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -1226,6 +1604,27 @@ async def test_accounts_external_accounts_post_4_service_async( post_data="metadata[order_id]=6735", ) + def test_accounts_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/accounts", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/accounts", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_accounts_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Account.list(limit=3) http_client_mock.assert_requested( @@ -1247,7 +1646,7 @@ def test_accounts_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.list({"limit": 3}) + client.v1.accounts.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/accounts", @@ -1280,7 +1679,7 @@ async def test_accounts_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.list_async({"limit": 3}) + await client.v1.accounts.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/accounts", @@ -1288,6 +1687,26 @@ async def test_accounts_get_service_async( api_base="https://api.stripe.com", ) + def test_accounts_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.retrieve("acct_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/accounts/acct_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_accounts_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Account.retrieve("acct_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -1308,7 +1727,7 @@ def test_accounts_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.retrieve("acct_xxxxxxxxxxxxx") + client.v1.accounts.retrieve("acct_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/accounts/acct_xxxxxxxxxxxxx", @@ -1340,7 +1759,7 @@ async def test_accounts_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.retrieve_async("acct_xxxxxxxxxxxxx") + await client.v1.accounts.retrieve_async("acct_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/accounts/acct_xxxxxxxxxxxxx", @@ -1348,6 +1767,26 @@ async def test_accounts_get_2_service_async( api_base="https://api.stripe.com", ) + def test_accounts_login_links_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/login_links", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.login_links.create("acct_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/accounts/acct_xxxxxxxxxxxxx/login_links", + query_string="", + api_base="https://api.stripe.com", + ) + def test_accounts_login_links_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -1370,7 +1809,7 @@ def test_accounts_login_links_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.login_links.create("acct_xxxxxxxxxxxxx") + client.v1.accounts.login_links.create("acct_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/accounts/acct_xxxxxxxxxxxxx/login_links", @@ -1402,7 +1841,7 @@ async def test_accounts_login_links_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.login_links.create_async("acct_xxxxxxxxxxxxx") + await client.v1.accounts.login_links.create_async("acct_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/accounts/acct_xxxxxxxxxxxxx/login_links", @@ -1410,6 +1849,29 @@ async def test_accounts_login_links_post_service_async( api_base="https://api.stripe.com", ) + def test_accounts_persons_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.persons.delete( + "acct_xxxxxxxxxxxxx", + "person_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "delete", + path="/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_accounts_persons_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -1435,7 +1897,7 @@ def test_accounts_persons_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.persons.delete( + client.v1.accounts.persons.delete( "acct_xxxxxxxxxxxxx", "person_xxxxxxxxxxxxx", ) @@ -1473,7 +1935,7 @@ async def test_accounts_persons_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.persons.delete_async( + await client.v1.accounts.persons.delete_async( "acct_xxxxxxxxxxxxx", "person_xxxxxxxxxxxxx", ) @@ -1484,6 +1946,30 @@ async def test_accounts_persons_delete_service_async( api_base="https://api.stripe.com", ) + def test_accounts_persons_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/persons", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.persons.list( + "acct_xxxxxxxxxxxxx", + {"limit": 3}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/accounts/acct_xxxxxxxxxxxxx/persons", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_accounts_persons_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -1510,7 +1996,7 @@ def test_accounts_persons_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.persons.list( + client.v1.accounts.persons.list( "acct_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -1549,7 +2035,7 @@ async def test_accounts_persons_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.persons.list_async( + await client.v1.accounts.persons.list_async( "acct_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -1560,6 +2046,29 @@ async def test_accounts_persons_get_service_async( api_base="https://api.stripe.com", ) + def test_accounts_persons_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.persons.retrieve( + "acct_xxxxxxxxxxxxx", + "person_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "get", + path="/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_accounts_persons_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -1585,7 +2094,7 @@ def test_accounts_persons_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.persons.retrieve( + client.v1.accounts.persons.retrieve( "acct_xxxxxxxxxxxxx", "person_xxxxxxxxxxxxx", ) @@ -1623,7 +2132,7 @@ async def test_accounts_persons_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.persons.retrieve_async( + await client.v1.accounts.persons.retrieve_async( "acct_xxxxxxxxxxxxx", "person_xxxxxxxxxxxxx", ) @@ -1634,22 +2143,7 @@ async def test_accounts_persons_get_2_service_async( api_base="https://api.stripe.com", ) - def test_accounts_persons_post( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.Account.create_person( - "acct_xxxxxxxxxxxxx", - first_name="Jane", - last_name="Diaz", - ) - http_client_mock.assert_requested( - "post", - path="/v1/accounts/acct_xxxxxxxxxxxxx/persons", - query_string="", - post_data="first_name=Jane&last_name=Diaz", - ) - - def test_accounts_persons_post_service( + def test_accounts_persons_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -1673,6 +2167,45 @@ def test_accounts_persons_post_service( post_data="first_name=Jane&last_name=Diaz", ) + def test_accounts_persons_post( + self, http_client_mock: HTTPClientMock + ) -> None: + stripe.Account.create_person( + "acct_xxxxxxxxxxxxx", + first_name="Jane", + last_name="Diaz", + ) + http_client_mock.assert_requested( + "post", + path="/v1/accounts/acct_xxxxxxxxxxxxx/persons", + query_string="", + post_data="first_name=Jane&last_name=Diaz", + ) + + def test_accounts_persons_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/persons", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v1.accounts.persons.create( + "acct_xxxxxxxxxxxxx", + {"first_name": "Jane", "last_name": "Diaz"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/accounts/acct_xxxxxxxxxxxxx/persons", + query_string="", + api_base="https://api.stripe.com", + post_data="first_name=Jane&last_name=Diaz", + ) + @pytest.mark.anyio async def test_accounts_persons_post_async( self, http_client_mock: HTTPClientMock @@ -1702,7 +2235,7 @@ async def test_accounts_persons_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.persons.create_async( + await client.v1.accounts.persons.create_async( "acct_xxxxxxxxxxxxx", {"first_name": "Jane", "last_name": "Diaz"}, ) @@ -1714,6 +2247,31 @@ async def test_accounts_persons_post_service_async( post_data="first_name=Jane&last_name=Diaz", ) + def test_accounts_persons_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.persons.update( + "acct_xxxxxxxxxxxxx", + "person_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_accounts_persons_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -1741,7 +2299,7 @@ def test_accounts_persons_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.persons.update( + client.v1.accounts.persons.update( "acct_xxxxxxxxxxxxx", "person_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -1783,7 +2341,7 @@ async def test_accounts_persons_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.persons.update_async( + await client.v1.accounts.persons.update_async( "acct_xxxxxxxxxxxxx", "person_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -1796,6 +2354,37 @@ async def test_accounts_persons_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_accounts_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/accounts", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.create( + { + "type": "custom", + "country": "US", + "email": "jenny.rosen@example.com", + "capabilities": { + "card_payments": {"requested": True}, + "transfers": {"requested": True}, + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/accounts", + query_string="", + api_base="https://api.stripe.com", + post_data="type=custom&country=US&email=jenny.rosen%40example.com&capabilities[card_payments][requested]=true&capabilities[transfers][requested]=true", + ) + def test_accounts_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Account.create( type="custom", @@ -1825,7 +2414,7 @@ def test_accounts_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.create( + client.v1.accounts.create( { "type": "custom", "country": "US", @@ -1877,7 +2466,7 @@ async def test_accounts_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.create_async( + await client.v1.accounts.create_async( { "type": "custom", "country": "US", @@ -1896,6 +2485,30 @@ async def test_accounts_post_service_async( post_data="type=custom&country=US&email=jenny.rosen%40example.com&capabilities[card_payments][requested]=true&capabilities[transfers][requested]=true", ) + def test_accounts_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.update( + "acct_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/accounts/acct_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_accounts_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Account.modify( "acct_xxxxxxxxxxxxx", @@ -1920,7 +2533,7 @@ def test_accounts_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.update( + client.v1.accounts.update( "acct_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -1960,7 +2573,7 @@ async def test_accounts_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.update_async( + await client.v1.accounts.update_async( "acct_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -1972,6 +2585,30 @@ async def test_accounts_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_accounts_reject_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/reject", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.accounts.reject( + "acct_xxxxxxxxxxxxx", + {"reason": "fraud"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/accounts/acct_xxxxxxxxxxxxx/reject", + query_string="", + api_base="https://api.stripe.com", + post_data="reason=fraud", + ) + def test_accounts_reject_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -1998,7 +2635,7 @@ def test_accounts_reject_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.accounts.reject( + client.v1.accounts.reject( "acct_xxxxxxxxxxxxx", {"reason": "fraud"}, ) @@ -2038,7 +2675,7 @@ async def test_accounts_reject_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.accounts.reject_async( + await client.v1.accounts.reject_async( "acct_xxxxxxxxxxxxx", {"reason": "fraud"}, ) @@ -2050,6 +2687,27 @@ async def test_accounts_reject_post_service_async( post_data="reason=fraud", ) + def test_application_fees_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/application_fees", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.application_fees.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/application_fees", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_application_fees_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -2073,7 +2731,7 @@ def test_application_fees_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.application_fees.list({"limit": 3}) + client.v1.application_fees.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/application_fees", @@ -2106,7 +2764,7 @@ async def test_application_fees_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.application_fees.list_async({"limit": 3}) + await client.v1.application_fees.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/application_fees", @@ -2114,6 +2772,26 @@ async def test_application_fees_get_service_async( api_base="https://api.stripe.com", ) + def test_application_fees_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/application_fees/fee_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.application_fees.retrieve("fee_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/application_fees/fee_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_application_fees_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -2136,7 +2814,7 @@ def test_application_fees_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.application_fees.retrieve("fee_xxxxxxxxxxxxx") + client.v1.application_fees.retrieve("fee_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/application_fees/fee_xxxxxxxxxxxxx", @@ -2168,7 +2846,7 @@ async def test_application_fees_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.application_fees.retrieve_async("fee_xxxxxxxxxxxxx") + await client.v1.application_fees.retrieve_async("fee_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/application_fees/fee_xxxxxxxxxxxxx", @@ -2176,6 +2854,30 @@ async def test_application_fees_get_2_service_async( api_base="https://api.stripe.com", ) + def test_application_fees_refunds_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/application_fees/fee_xxxxxxxxxxxxx/refunds", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.application_fees.refunds.list( + "fee_xxxxxxxxxxxxx", + {"limit": 3}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/application_fees/fee_xxxxxxxxxxxxx/refunds", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_application_fees_refunds_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -2202,7 +2904,7 @@ def test_application_fees_refunds_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.application_fees.refunds.list( + client.v1.application_fees.refunds.list( "fee_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -2241,7 +2943,7 @@ async def test_application_fees_refunds_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.application_fees.refunds.list_async( + await client.v1.application_fees.refunds.list_async( "fee_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -2252,6 +2954,29 @@ async def test_application_fees_refunds_get_service_async( api_base="https://api.stripe.com", ) + def test_application_fees_refunds_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.application_fees.refunds.retrieve( + "fee_xxxxxxxxxxxxx", + "fr_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "get", + path="/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_application_fees_refunds_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -2277,7 +3002,7 @@ def test_application_fees_refunds_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.application_fees.refunds.retrieve( + client.v1.application_fees.refunds.retrieve( "fee_xxxxxxxxxxxxx", "fr_xxxxxxxxxxxxx", ) @@ -2315,7 +3040,7 @@ async def test_application_fees_refunds_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.application_fees.refunds.retrieve_async( + await client.v1.application_fees.refunds.retrieve_async( "fee_xxxxxxxxxxxxx", "fr_xxxxxxxxxxxxx", ) @@ -2326,6 +3051,26 @@ async def test_application_fees_refunds_get_2_service_async( api_base="https://api.stripe.com", ) + def test_application_fees_refunds_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/application_fees/fee_xxxxxxxxxxxxx/refunds", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.application_fees.refunds.create("fee_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/application_fees/fee_xxxxxxxxxxxxx/refunds", + query_string="", + api_base="https://api.stripe.com", + ) + def test_application_fees_refunds_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -2348,7 +3093,7 @@ def test_application_fees_refunds_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.application_fees.refunds.create("fee_xxxxxxxxxxxxx") + client.v1.application_fees.refunds.create("fee_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/application_fees/fee_xxxxxxxxxxxxx/refunds", @@ -2380,30 +3125,17 @@ async def test_application_fees_refunds_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.application_fees.refunds.create_async("fee_xxxxxxxxxxxxx") - http_client_mock.assert_requested( - "post", - path="/v1/application_fees/fee_xxxxxxxxxxxxx/refunds", - query_string="", - api_base="https://api.stripe.com", - ) - - def test_application_fees_refunds_post_2( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.ApplicationFee.modify_refund( + await client.v1.application_fees.refunds.create_async( "fee_xxxxxxxxxxxxx", - "fr_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, ) http_client_mock.assert_requested( "post", - path="/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", + path="/v1/application_fees/fee_xxxxxxxxxxxxx/refunds", query_string="", - post_data="metadata[order_id]=6735", + api_base="https://api.stripe.com", ) - def test_application_fees_refunds_post_2_service( + def test_application_fees_refunds_post_2_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -2428,6 +3160,46 @@ def test_application_fees_refunds_post_2_service( post_data="metadata[order_id]=6735", ) + def test_application_fees_refunds_post_2( + self, http_client_mock: HTTPClientMock + ) -> None: + stripe.ApplicationFee.modify_refund( + "fee_xxxxxxxxxxxxx", + "fr_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", + query_string="", + post_data="metadata[order_id]=6735", + ) + + def test_application_fees_refunds_post_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v1.application_fees.refunds.update( + "fee_xxxxxxxxxxxxx", + "fr_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + @pytest.mark.anyio async def test_application_fees_refunds_post_2_async( self, http_client_mock: HTTPClientMock @@ -2457,7 +3229,7 @@ async def test_application_fees_refunds_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.application_fees.refunds.update_async( + await client.v1.application_fees.refunds.update_async( "fee_xxxxxxxxxxxxx", "fr_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -2470,6 +3242,32 @@ async def test_application_fees_refunds_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_apps_secrets_delete_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/apps/secrets/delete", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.apps.secrets.delete_where( + { + "name": "my-api-key", + "scope": {"type": "account"}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/apps/secrets/delete", + query_string="", + api_base="https://api.stripe.com", + post_data="name=my-api-key&scope[type]=account", + ) + def test_apps_secrets_delete_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -2496,7 +3294,7 @@ def test_apps_secrets_delete_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.apps.secrets.delete_where( + client.v1.apps.secrets.delete_where( { "name": "my-api-key", "scope": {"type": "account"}, @@ -2538,7 +3336,7 @@ async def test_apps_secrets_delete_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.apps.secrets.delete_where_async( + await client.v1.apps.secrets.delete_where_async( { "name": "my-api-key", "scope": {"type": "account"}, @@ -2552,6 +3350,32 @@ async def test_apps_secrets_delete_post_service_async( post_data="name=my-api-key&scope[type]=account", ) + def test_apps_secrets_find_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/apps/secrets/find", + "name=sec_123&scope[type]=account", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.apps.secrets.find( + { + "name": "sec_123", + "scope": {"type": "account"}, + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/apps/secrets/find", + query_string="name=sec_123&scope[type]=account", + api_base="https://api.stripe.com", + ) + def test_apps_secrets_find_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -2578,7 +3402,7 @@ def test_apps_secrets_find_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.apps.secrets.find( + client.v1.apps.secrets.find( { "name": "sec_123", "scope": {"type": "account"}, @@ -2619,7 +3443,7 @@ async def test_apps_secrets_find_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.apps.secrets.find_async( + await client.v1.apps.secrets.find_async( { "name": "sec_123", "scope": {"type": "account"}, @@ -2632,6 +3456,27 @@ async def test_apps_secrets_find_get_service_async( api_base="https://api.stripe.com", ) + def test_apps_secrets_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/apps/secrets", + "scope[type]=account&limit=2", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.apps.secrets.list({"scope": {"type": "account"}, "limit": 2}) + http_client_mock.assert_requested( + "get", + path="/v1/apps/secrets", + query_string="scope[type]=account&limit=2", + api_base="https://api.stripe.com", + ) + def test_apps_secrets_get(self, http_client_mock: HTTPClientMock) -> None: stripe.apps.Secret.list( scope={"type": "account"}, @@ -2656,7 +3501,7 @@ def test_apps_secrets_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.apps.secrets.list({"scope": {"type": "account"}, "limit": 2}) + client.v1.apps.secrets.list({"scope": {"type": "account"}, "limit": 2}) http_client_mock.assert_requested( "get", path="/v1/apps/secrets", @@ -2692,7 +3537,7 @@ async def test_apps_secrets_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.apps.secrets.list_async( + await client.v1.apps.secrets.list_async( { "scope": {"type": "account"}, "limit": 2, @@ -2705,6 +3550,27 @@ async def test_apps_secrets_get_service_async( api_base="https://api.stripe.com", ) + def test_apps_secrets_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/apps/secrets", + "scope[type]=account&limit=2", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.apps.secrets.list({"scope": {"type": "account"}, "limit": 2}) + http_client_mock.assert_requested( + "get", + path="/v1/apps/secrets", + query_string="scope[type]=account&limit=2", + api_base="https://api.stripe.com", + ) + def test_apps_secrets_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -2731,7 +3597,7 @@ def test_apps_secrets_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.apps.secrets.list({"scope": {"type": "account"}, "limit": 2}) + client.v1.apps.secrets.list({"scope": {"type": "account"}, "limit": 2}) http_client_mock.assert_requested( "get", path="/v1/apps/secrets", @@ -2767,7 +3633,7 @@ async def test_apps_secrets_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.apps.secrets.list_async( + await client.v1.apps.secrets.list_async( { "scope": {"type": "account"}, "limit": 2, @@ -2780,6 +3646,33 @@ async def test_apps_secrets_get_2_service_async( api_base="https://api.stripe.com", ) + def test_apps_secrets_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/apps/secrets", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.apps.secrets.create( + { + "name": "sec_123", + "payload": "very secret string", + "scope": {"type": "account"}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/apps/secrets", + query_string="", + api_base="https://api.stripe.com", + post_data="name=sec_123&payload=very%20secret%20string&scope[type]=account", + ) + def test_apps_secrets_post(self, http_client_mock: HTTPClientMock) -> None: stripe.apps.Secret.create( name="sec_123", @@ -2805,7 +3698,7 @@ def test_apps_secrets_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.apps.secrets.create( + client.v1.apps.secrets.create( { "name": "sec_123", "payload": "very secret string", @@ -2849,7 +3742,7 @@ async def test_apps_secrets_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.apps.secrets.create_async( + await client.v1.apps.secrets.create_async( { "name": "sec_123", "payload": "very secret string", @@ -2864,6 +3757,33 @@ async def test_apps_secrets_post_service_async( post_data="name=sec_123&payload=very%20secret%20string&scope[type]=account", ) + def test_apps_secrets_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/apps/secrets", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.apps.secrets.create( + { + "name": "my-api-key", + "payload": "secret_key_xxxxxx", + "scope": {"type": "account"}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/apps/secrets", + query_string="", + api_base="https://api.stripe.com", + post_data="name=my-api-key&payload=secret_key_xxxxxx&scope[type]=account", + ) + def test_apps_secrets_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -2891,7 +3811,7 @@ def test_apps_secrets_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.apps.secrets.create( + client.v1.apps.secrets.create( { "name": "my-api-key", "payload": "secret_key_xxxxxx", @@ -2935,7 +3855,7 @@ async def test_apps_secrets_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.apps.secrets.create_async( + await client.v1.apps.secrets.create_async( { "name": "my-api-key", "payload": "secret_key_xxxxxx", @@ -2950,6 +3870,27 @@ async def test_apps_secrets_post_2_service_async( post_data="name=my-api-key&payload=secret_key_xxxxxx&scope[type]=account", ) + def test_balance_transactions_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/balance_transactions", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.balance_transactions.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/balance_transactions", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_balance_transactions_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -2973,7 +3914,7 @@ def test_balance_transactions_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.balance_transactions.list({"limit": 3}) + client.v1.balance_transactions.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/balance_transactions", @@ -3006,7 +3947,7 @@ async def test_balance_transactions_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.balance_transactions.list_async({"limit": 3}) + await client.v1.balance_transactions.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/balance_transactions", @@ -3014,6 +3955,26 @@ async def test_balance_transactions_get_service_async( api_base="https://api.stripe.com", ) + def test_balance_transactions_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/balance_transactions/txn_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.balance_transactions.retrieve("txn_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/balance_transactions/txn_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_balance_transactions_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -3036,7 +3997,7 @@ def test_balance_transactions_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.balance_transactions.retrieve("txn_xxxxxxxxxxxxx") + client.v1.balance_transactions.retrieve("txn_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/balance_transactions/txn_xxxxxxxxxxxxx", @@ -3068,7 +4029,9 @@ async def test_balance_transactions_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.balance_transactions.retrieve_async("txn_xxxxxxxxxxxxx") + await client.v1.balance_transactions.retrieve_async( + "txn_xxxxxxxxxxxxx" + ) http_client_mock.assert_requested( "get", path="/v1/balance_transactions/txn_xxxxxxxxxxxxx", @@ -3076,6 +4039,27 @@ async def test_balance_transactions_get_2_service_async( api_base="https://api.stripe.com", ) + def test_billing_portal_configurations_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/billing_portal/configurations", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.billing_portal.configurations.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/billing_portal/configurations", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_billing_portal_configurations_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -3099,7 +4083,7 @@ def test_billing_portal_configurations_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.billing_portal.configurations.list({"limit": 3}) + client.v1.billing_portal.configurations.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/billing_portal/configurations", @@ -3132,7 +4116,7 @@ async def test_billing_portal_configurations_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.billing_portal.configurations.list_async({"limit": 3}) + await client.v1.billing_portal.configurations.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/billing_portal/configurations", @@ -3140,6 +4124,26 @@ async def test_billing_portal_configurations_get_service_async( api_base="https://api.stripe.com", ) + def test_billing_portal_configurations_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.billing_portal.configurations.retrieve("bpc_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_billing_portal_configurations_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -3162,7 +4166,7 @@ def test_billing_portal_configurations_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.billing_portal.configurations.retrieve("bpc_xxxxxxxxxxxxx") + client.v1.billing_portal.configurations.retrieve("bpc_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", @@ -3196,7 +4200,7 @@ async def test_billing_portal_configurations_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.billing_portal.configurations.retrieve_async( + await client.v1.billing_portal.configurations.retrieve_async( "bpc_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -3206,6 +4210,41 @@ async def test_billing_portal_configurations_get_2_service_async( api_base="https://api.stripe.com", ) + def test_billing_portal_configurations_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/billing_portal/configurations", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.billing_portal.configurations.create( + { + "features": { + "customer_update": { + "allowed_updates": ["email", "tax_id"], + "enabled": True, + }, + "invoice_history": {"enabled": True}, + }, + "business_profile": { + "privacy_policy_url": "https://example.com/privacy", + "terms_of_service_url": "https://example.com/terms", + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/billing_portal/configurations", + query_string="", + api_base="https://api.stripe.com", + post_data="features[customer_update][allowed_updates][0]=email&features[customer_update][allowed_updates][1]=tax_id&features[customer_update][enabled]=true&features[invoice_history][enabled]=true&business_profile[privacy_policy_url]=https%3A%2F%2Fexample.com%2Fprivacy&business_profile[terms_of_service_url]=https%3A%2F%2Fexample.com%2Fterms", + ) + def test_billing_portal_configurations_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -3241,7 +4280,7 @@ def test_billing_portal_configurations_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.billing_portal.configurations.create( + client.v1.billing_portal.configurations.create( { "features": { "customer_update": { @@ -3301,7 +4340,7 @@ async def test_billing_portal_configurations_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.billing_portal.configurations.create_async( + await client.v1.billing_portal.configurations.create_async( { "features": { "customer_update": { @@ -3324,6 +4363,35 @@ async def test_billing_portal_configurations_post_service_async( post_data="features[customer_update][allowed_updates][0]=email&features[customer_update][allowed_updates][1]=tax_id&features[customer_update][enabled]=true&features[invoice_history][enabled]=true&business_profile[privacy_policy_url]=https%3A%2F%2Fexample.com%2Fprivacy&business_profile[terms_of_service_url]=https%3A%2F%2Fexample.com%2Fterms", ) + def test_billing_portal_configurations_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.billing_portal.configurations.update( + "bpc_xxxxxxxxxxxxx", + { + "business_profile": { + "privacy_policy_url": "https://example.com/privacy", + "terms_of_service_url": "https://example.com/terms", + }, + }, + ) + http_client_mock.assert_requested( + "post", + path="/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="business_profile[privacy_policy_url]=https%3A%2F%2Fexample.com%2Fprivacy&business_profile[terms_of_service_url]=https%3A%2F%2Fexample.com%2Fterms", + ) + def test_billing_portal_configurations_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -3353,7 +4421,7 @@ def test_billing_portal_configurations_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.billing_portal.configurations.update( + client.v1.billing_portal.configurations.update( "bpc_xxxxxxxxxxxxx", { "business_profile": { @@ -3401,7 +4469,7 @@ async def test_billing_portal_configurations_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.billing_portal.configurations.update_async( + await client.v1.billing_portal.configurations.update_async( "bpc_xxxxxxxxxxxxx", { "business_profile": { @@ -3418,6 +4486,32 @@ async def test_billing_portal_configurations_post_2_service_async( post_data="business_profile[privacy_policy_url]=https%3A%2F%2Fexample.com%2Fprivacy&business_profile[terms_of_service_url]=https%3A%2F%2Fexample.com%2Fterms", ) + def test_billing_portal_sessions_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/billing_portal/sessions", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.billing_portal.sessions.create( + { + "customer": "cus_xxxxxxxxxxxxx", + "return_url": "https://example.com/account", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/billing_portal/sessions", + query_string="", + api_base="https://api.stripe.com", + post_data="customer=cus_xxxxxxxxxxxxx&return_url=https%3A%2F%2Fexample.com%2Faccount", + ) + def test_billing_portal_sessions_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -3444,7 +4538,7 @@ def test_billing_portal_sessions_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.billing_portal.sessions.create( + client.v1.billing_portal.sessions.create( { "customer": "cus_xxxxxxxxxxxxx", "return_url": "https://example.com/account", @@ -3486,7 +4580,7 @@ async def test_billing_portal_sessions_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.billing_portal.sessions.create_async( + await client.v1.billing_portal.sessions.create_async( { "customer": "cus_xxxxxxxxxxxxx", "return_url": "https://example.com/account", @@ -3500,6 +4594,26 @@ async def test_billing_portal_sessions_post_service_async( post_data="customer=cus_xxxxxxxxxxxxx&return_url=https%3A%2F%2Fexample.com%2Faccount", ) + def test_charges_capture_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/charges/ch_xxxxxxxxxxxxx/capture", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.charges.capture("ch_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/charges/ch_xxxxxxxxxxxxx/capture", + query_string="", + api_base="https://api.stripe.com", + ) + def test_charges_capture_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -3522,7 +4636,7 @@ def test_charges_capture_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.charges.capture("ch_xxxxxxxxxxxxx") + client.v1.charges.capture("ch_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/charges/ch_xxxxxxxxxxxxx/capture", @@ -3554,7 +4668,7 @@ async def test_charges_capture_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.charges.capture_async("ch_xxxxxxxxxxxxx") + await client.v1.charges.capture_async("ch_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/charges/ch_xxxxxxxxxxxxx/capture", @@ -3562,6 +4676,27 @@ async def test_charges_capture_post_service_async( api_base="https://api.stripe.com", ) + def test_charges_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/charges", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.charges.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/charges", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_charges_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Charge.list(limit=3) http_client_mock.assert_requested( @@ -3583,7 +4718,7 @@ def test_charges_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.charges.list({"limit": 3}) + client.v1.charges.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/charges", @@ -3616,7 +4751,7 @@ async def test_charges_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.charges.list_async({"limit": 3}) + await client.v1.charges.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/charges", @@ -3624,6 +4759,26 @@ async def test_charges_get_service_async( api_base="https://api.stripe.com", ) + def test_charges_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/charges/ch_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.charges.retrieve("ch_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/charges/ch_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_charges_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Charge.retrieve("ch_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -3644,7 +4799,7 @@ def test_charges_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.charges.retrieve("ch_xxxxxxxxxxxxx") + client.v1.charges.retrieve("ch_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/charges/ch_xxxxxxxxxxxxx", @@ -3676,7 +4831,7 @@ async def test_charges_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.charges.retrieve_async("ch_xxxxxxxxxxxxx") + await client.v1.charges.retrieve_async("ch_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/charges/ch_xxxxxxxxxxxxx", @@ -3684,6 +4839,34 @@ async def test_charges_get_2_service_async( api_base="https://api.stripe.com", ) + def test_charges_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/charges", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.charges.create( + { + "amount": 2000, + "currency": "usd", + "source": "tok_xxxx", + "description": "My First Test Charge (created for API docs at https://www.stripe.com/docs/api)", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/charges", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=2000¤cy=usd&source=tok_xxxx&description=My%20First%20Test%20Charge%20%28created%20for%20API%20docs%20at%20https%3A%2F%2Fwww.stripe.com%2Fdocs%2Fapi%29", + ) + def test_charges_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Charge.create( amount=2000, @@ -3710,7 +4893,7 @@ def test_charges_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.charges.create( + client.v1.charges.create( { "amount": 2000, "currency": "usd", @@ -3756,7 +4939,7 @@ async def test_charges_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.charges.create_async( + await client.v1.charges.create_async( { "amount": 2000, "currency": "usd", @@ -3772,6 +4955,30 @@ async def test_charges_post_service_async( post_data="amount=2000¤cy=usd&source=tok_xxxx&description=My%20First%20Test%20Charge%20%28created%20for%20API%20docs%20at%20https%3A%2F%2Fwww.stripe.com%2Fdocs%2Fapi%29", ) + def test_charges_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/charges/ch_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.charges.update( + "ch_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/charges/ch_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_charges_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Charge.modify( "ch_xxxxxxxxxxxxx", @@ -3796,7 +5003,7 @@ def test_charges_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.charges.update( + client.v1.charges.update( "ch_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -3836,7 +5043,7 @@ async def test_charges_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.charges.update_async( + await client.v1.charges.update_async( "ch_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -3848,6 +5055,31 @@ async def test_charges_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_charges_search_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/charges/search", + "query=amount%3E999%20AND%20metadata%5B%27order_id%27%5D%3A%276735%27", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.charges.search( + { + "query": "amount>999 AND metadata['order_id']:'6735'", + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/charges/search", + query_string="query=amount%3E999%20AND%20metadata%5B%27order_id%27%5D%3A%276735%27", + api_base="https://api.stripe.com", + ) + def test_charges_search_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -3873,7 +5105,7 @@ def test_charges_search_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.charges.search( + client.v1.charges.search( { "query": "amount>999 AND metadata['order_id']:'6735'", } @@ -3912,7 +5144,7 @@ async def test_charges_search_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.charges.search_async( + await client.v1.charges.search_async( { "query": "amount>999 AND metadata['order_id']:'6735'", } @@ -3924,6 +5156,26 @@ async def test_charges_search_get_service_async( api_base="https://api.stripe.com", ) + def test_checkout_sessions_expire_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/checkout/sessions/sess_xyz/expire", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.checkout.sessions.expire("sess_xyz") + http_client_mock.assert_requested( + "post", + path="/v1/checkout/sessions/sess_xyz/expire", + query_string="", + api_base="https://api.stripe.com", + ) + def test_checkout_sessions_expire_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -3946,7 +5198,7 @@ def test_checkout_sessions_expire_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.checkout.sessions.expire("sess_xyz") + client.v1.checkout.sessions.expire("sess_xyz") http_client_mock.assert_requested( "post", path="/v1/checkout/sessions/sess_xyz/expire", @@ -3978,7 +5230,7 @@ async def test_checkout_sessions_expire_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.checkout.sessions.expire_async("sess_xyz") + await client.v1.checkout.sessions.expire_async("sess_xyz") http_client_mock.assert_requested( "post", path="/v1/checkout/sessions/sess_xyz/expire", @@ -3986,6 +5238,26 @@ async def test_checkout_sessions_expire_post_service_async( api_base="https://api.stripe.com", ) + def test_checkout_sessions_expire_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx/expire", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.checkout.sessions.expire("cs_test_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx/expire", + query_string="", + api_base="https://api.stripe.com", + ) + def test_checkout_sessions_expire_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -4008,7 +5280,7 @@ def test_checkout_sessions_expire_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.checkout.sessions.expire("cs_test_xxxxxxxxxxxxx") + client.v1.checkout.sessions.expire("cs_test_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx/expire", @@ -4040,7 +5312,7 @@ async def test_checkout_sessions_expire_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.checkout.sessions.expire_async("cs_test_xxxxxxxxxxxxx") + await client.v1.checkout.sessions.expire_async("cs_test_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx/expire", @@ -4048,6 +5320,27 @@ async def test_checkout_sessions_expire_post_2_service_async( api_base="https://api.stripe.com", ) + def test_checkout_sessions_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/checkout/sessions", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.checkout.sessions.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/checkout/sessions", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_checkout_sessions_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -4071,7 +5364,7 @@ def test_checkout_sessions_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.checkout.sessions.list({"limit": 3}) + client.v1.checkout.sessions.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/checkout/sessions", @@ -4104,7 +5397,7 @@ async def test_checkout_sessions_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.checkout.sessions.list_async({"limit": 3}) + await client.v1.checkout.sessions.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/checkout/sessions", @@ -4112,6 +5405,26 @@ async def test_checkout_sessions_get_service_async( api_base="https://api.stripe.com", ) + def test_checkout_sessions_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.checkout.sessions.retrieve("cs_test_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_checkout_sessions_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -4134,7 +5447,7 @@ def test_checkout_sessions_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.checkout.sessions.retrieve("cs_test_xxxxxxxxxxxxx") + client.v1.checkout.sessions.retrieve("cs_test_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx", @@ -4166,7 +5479,9 @@ async def test_checkout_sessions_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.checkout.sessions.retrieve_async("cs_test_xxxxxxxxxxxxx") + await client.v1.checkout.sessions.retrieve_async( + "cs_test_xxxxxxxxxxxxx", + ) http_client_mock.assert_requested( "get", path="/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx", @@ -4174,6 +5489,26 @@ async def test_checkout_sessions_get_2_service_async( api_base="https://api.stripe.com", ) + def test_checkout_sessions_line_items_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/checkout/sessions/sess_xyz/line_items", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.checkout.sessions.line_items.list("sess_xyz") + http_client_mock.assert_requested( + "get", + path="/v1/checkout/sessions/sess_xyz/line_items", + query_string="", + api_base="https://api.stripe.com", + ) + def test_checkout_sessions_line_items_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -4196,7 +5531,7 @@ def test_checkout_sessions_line_items_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.checkout.sessions.line_items.list("sess_xyz") + client.v1.checkout.sessions.line_items.list("sess_xyz") http_client_mock.assert_requested( "get", path="/v1/checkout/sessions/sess_xyz/line_items", @@ -4228,7 +5563,7 @@ async def test_checkout_sessions_line_items_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.checkout.sessions.line_items.list_async("sess_xyz") + await client.v1.checkout.sessions.line_items.list_async("sess_xyz") http_client_mock.assert_requested( "get", path="/v1/checkout/sessions/sess_xyz/line_items", @@ -4236,6 +5571,45 @@ async def test_checkout_sessions_line_items_get_service_async( api_base="https://api.stripe.com", ) + def test_checkout_sessions_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/checkout/sessions", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.checkout.sessions.create( + { + "success_url": "https://example.com/success", + "cancel_url": "https://example.com/cancel", + "mode": "payment", + "shipping_options": [ + {"shipping_rate": "shr_standard"}, + { + "shipping_rate_data": { + "display_name": "Standard", + "delivery_estimate": { + "minimum": {"unit": "day", "value": 5}, + "maximum": {"unit": "day", "value": 7}, + }, + }, + }, + ], + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/checkout/sessions", + query_string="", + api_base="https://api.stripe.com", + post_data="success_url=https%3A%2F%2Fexample.com%2Fsuccess&cancel_url=https%3A%2F%2Fexample.com%2Fcancel&mode=payment&shipping_options[0][shipping_rate]=shr_standard&shipping_options[1][shipping_rate_data][display_name]=Standard&shipping_options[1][shipping_rate_data][delivery_estimate][minimum][unit]=day&shipping_options[1][shipping_rate_data][delivery_estimate][minimum][value]=5&shipping_options[1][shipping_rate_data][delivery_estimate][maximum][unit]=day&shipping_options[1][shipping_rate_data][delivery_estimate][maximum][value]=7", + ) + def test_checkout_sessions_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -4275,7 +5649,7 @@ def test_checkout_sessions_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.checkout.sessions.create( + client.v1.checkout.sessions.create( { "success_url": "https://example.com/success", "cancel_url": "https://example.com/cancel", @@ -4343,7 +5717,7 @@ async def test_checkout_sessions_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.checkout.sessions.create_async( + await client.v1.checkout.sessions.create_async( { "success_url": "https://example.com/success", "cancel_url": "https://example.com/cancel", @@ -4370,6 +5744,35 @@ async def test_checkout_sessions_post_service_async( post_data="success_url=https%3A%2F%2Fexample.com%2Fsuccess&cancel_url=https%3A%2F%2Fexample.com%2Fcancel&mode=payment&shipping_options[0][shipping_rate]=shr_standard&shipping_options[1][shipping_rate_data][display_name]=Standard&shipping_options[1][shipping_rate_data][delivery_estimate][minimum][unit]=day&shipping_options[1][shipping_rate_data][delivery_estimate][minimum][value]=5&shipping_options[1][shipping_rate_data][delivery_estimate][maximum][unit]=day&shipping_options[1][shipping_rate_data][delivery_estimate][maximum][value]=7", ) + def test_checkout_sessions_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/checkout/sessions", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.checkout.sessions.create( + { + "success_url": "https://example.com/success", + "line_items": [ + {"price": "price_xxxxxxxxxxxxx", "quantity": 2} + ], + "mode": "payment", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/checkout/sessions", + query_string="", + api_base="https://api.stripe.com", + post_data="success_url=https%3A%2F%2Fexample.com%2Fsuccess&line_items[0][price]=price_xxxxxxxxxxxxx&line_items[0][quantity]=2&mode=payment", + ) + def test_checkout_sessions_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -4397,7 +5800,7 @@ def test_checkout_sessions_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.checkout.sessions.create( + client.v1.checkout.sessions.create( { "success_url": "https://example.com/success", "line_items": [ @@ -4443,7 +5846,7 @@ async def test_checkout_sessions_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.checkout.sessions.create_async( + await client.v1.checkout.sessions.create_async( { "success_url": "https://example.com/success", "line_items": [ @@ -4480,6 +5883,27 @@ def test_core_events_get_service( api_base="https://api.stripe.com", ) + def test_country_specs_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/country_specs", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.country_specs.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/country_specs", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_country_specs_get(self, http_client_mock: HTTPClientMock) -> None: stripe.CountrySpec.list(limit=3) http_client_mock.assert_requested( @@ -4501,7 +5925,7 @@ def test_country_specs_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.country_specs.list({"limit": 3}) + client.v1.country_specs.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/country_specs", @@ -4534,7 +5958,7 @@ async def test_country_specs_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.country_specs.list_async({"limit": 3}) + await client.v1.country_specs.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/country_specs", @@ -4542,6 +5966,26 @@ async def test_country_specs_get_service_async( api_base="https://api.stripe.com", ) + def test_country_specs_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/country_specs/US", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.country_specs.retrieve("US") + http_client_mock.assert_requested( + "get", + path="/v1/country_specs/US", + query_string="", + api_base="https://api.stripe.com", + ) + def test_country_specs_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -4564,7 +6008,7 @@ def test_country_specs_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.country_specs.retrieve("US") + client.v1.country_specs.retrieve("US") http_client_mock.assert_requested( "get", path="/v1/country_specs/US", @@ -4596,7 +6040,7 @@ async def test_country_specs_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.country_specs.retrieve_async("US") + await client.v1.country_specs.retrieve_async("US") http_client_mock.assert_requested( "get", path="/v1/country_specs/US", @@ -4604,6 +6048,26 @@ async def test_country_specs_get_2_service_async( api_base="https://api.stripe.com", ) + def test_coupons_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/coupons/Z4OV52SU", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.coupons.delete("Z4OV52SU") + http_client_mock.assert_requested( + "delete", + path="/v1/coupons/Z4OV52SU", + query_string="", + api_base="https://api.stripe.com", + ) + def test_coupons_delete(self, http_client_mock: HTTPClientMock) -> None: stripe.Coupon.delete("Z4OV52SU") http_client_mock.assert_requested( @@ -4624,7 +6088,7 @@ def test_coupons_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.coupons.delete("Z4OV52SU") + client.v1.coupons.delete("Z4OV52SU") http_client_mock.assert_requested( "delete", path="/v1/coupons/Z4OV52SU", @@ -4656,7 +6120,7 @@ async def test_coupons_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.coupons.delete_async("Z4OV52SU") + await client.v1.coupons.delete_async("Z4OV52SU") http_client_mock.assert_requested( "delete", path="/v1/coupons/Z4OV52SU", @@ -4664,6 +6128,27 @@ async def test_coupons_delete_service_async( api_base="https://api.stripe.com", ) + def test_coupons_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/coupons", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.coupons.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/coupons", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_coupons_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Coupon.list(limit=3) http_client_mock.assert_requested( @@ -4685,7 +6170,7 @@ def test_coupons_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.coupons.list({"limit": 3}) + client.v1.coupons.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/coupons", @@ -4718,7 +6203,7 @@ async def test_coupons_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.coupons.list_async({"limit": 3}) + await client.v1.coupons.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/coupons", @@ -4726,6 +6211,26 @@ async def test_coupons_get_service_async( api_base="https://api.stripe.com", ) + def test_coupons_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/coupons/Z4OV52SU", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.coupons.retrieve("Z4OV52SU") + http_client_mock.assert_requested( + "get", + path="/v1/coupons/Z4OV52SU", + query_string="", + api_base="https://api.stripe.com", + ) + def test_coupons_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Coupon.retrieve("Z4OV52SU") http_client_mock.assert_requested( @@ -4746,7 +6251,7 @@ def test_coupons_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.coupons.retrieve("Z4OV52SU") + client.v1.coupons.retrieve("Z4OV52SU") http_client_mock.assert_requested( "get", path="/v1/coupons/Z4OV52SU", @@ -4778,7 +6283,7 @@ async def test_coupons_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.coupons.retrieve_async("Z4OV52SU") + await client.v1.coupons.retrieve_async("Z4OV52SU") http_client_mock.assert_requested( "get", path="/v1/coupons/Z4OV52SU", @@ -4786,6 +6291,27 @@ async def test_coupons_get_2_service_async( api_base="https://api.stripe.com", ) + def test_coupons_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/coupons", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.coupons.create({"percent_off": 25.5, "duration": "once"}) + http_client_mock.assert_requested( + "post", + path="/v1/coupons", + query_string="", + api_base="https://api.stripe.com", + post_data="percent_off=25.5&duration=once", + ) + def test_coupons_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Coupon.create( percent_off=25.5, @@ -4810,7 +6336,7 @@ def test_coupons_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.coupons.create({"percent_off": 25.5, "duration": "once"}) + client.v1.coupons.create({"percent_off": 25.5, "duration": "once"}) http_client_mock.assert_requested( "post", path="/v1/coupons", @@ -4847,7 +6373,7 @@ async def test_coupons_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.coupons.create_async( + await client.v1.coupons.create_async( { "percent_off": 25.5, "duration": "once", @@ -4861,19 +6387,7 @@ async def test_coupons_post_service_async( post_data="percent_off=25.5&duration=once", ) - def test_coupons_post_2(self, http_client_mock: HTTPClientMock) -> None: - stripe.Coupon.modify( - "Z4OV52SU", - metadata={"order_id": "6735"}, - ) - http_client_mock.assert_requested( - "post", - path="/v1/coupons/Z4OV52SU", - query_string="", - post_data="metadata[order_id]=6735", - ) - - def test_coupons_post_2_service( + def test_coupons_post_2_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -4897,6 +6411,42 @@ def test_coupons_post_2_service( post_data="metadata[order_id]=6735", ) + def test_coupons_post_2(self, http_client_mock: HTTPClientMock) -> None: + stripe.Coupon.modify( + "Z4OV52SU", + metadata={"order_id": "6735"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/coupons/Z4OV52SU", + query_string="", + post_data="metadata[order_id]=6735", + ) + + def test_coupons_post_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/coupons/Z4OV52SU", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v1.coupons.update( + "Z4OV52SU", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/coupons/Z4OV52SU", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + @pytest.mark.anyio async def test_coupons_post_2_async( self, http_client_mock: HTTPClientMock @@ -4925,7 +6475,7 @@ async def test_coupons_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.coupons.update_async( + await client.v1.coupons.update_async( "Z4OV52SU", {"metadata": {"order_id": "6735"}}, ) @@ -4937,6 +6487,27 @@ async def test_coupons_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_credit_notes_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/credit_notes", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.credit_notes.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/credit_notes", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_credit_notes_get(self, http_client_mock: HTTPClientMock) -> None: stripe.CreditNote.list(limit=3) http_client_mock.assert_requested( @@ -4958,7 +6529,7 @@ def test_credit_notes_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.credit_notes.list({"limit": 3}) + client.v1.credit_notes.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/credit_notes", @@ -4991,7 +6562,7 @@ async def test_credit_notes_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.credit_notes.list_async({"limit": 3}) + await client.v1.credit_notes.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/credit_notes", @@ -4999,6 +6570,30 @@ async def test_credit_notes_get_service_async( api_base="https://api.stripe.com", ) + def test_credit_notes_lines_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/credit_notes/cn_xxxxxxxxxxxxx/lines", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.credit_notes.line_items.list( + "cn_xxxxxxxxxxxxx", + {"limit": 3}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/credit_notes/cn_xxxxxxxxxxxxx/lines", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_credit_notes_lines_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -5025,7 +6620,7 @@ def test_credit_notes_lines_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.credit_notes.line_items.list( + client.v1.credit_notes.line_items.list( "cn_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -5064,7 +6659,7 @@ async def test_credit_notes_lines_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.credit_notes.line_items.list_async( + await client.v1.credit_notes.line_items.list_async( "cn_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -5075,6 +6670,38 @@ async def test_credit_notes_lines_get_service_async( api_base="https://api.stripe.com", ) + def test_credit_notes_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/credit_notes", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.credit_notes.create( + { + "invoice": "in_xxxxxxxxxxxxx", + "lines": [ + { + "type": "invoice_line_item", + "invoice_line_item": "il_xxxxxxxxxxxxx", + "quantity": 1, + }, + ], + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/credit_notes", + query_string="", + api_base="https://api.stripe.com", + post_data="invoice=in_xxxxxxxxxxxxx&lines[0][type]=invoice_line_item&lines[0][invoice_line_item]=il_xxxxxxxxxxxxx&lines[0][quantity]=1", + ) + def test_credit_notes_post(self, http_client_mock: HTTPClientMock) -> None: stripe.CreditNote.create( invoice="in_xxxxxxxxxxxxx", @@ -5105,7 +6732,7 @@ def test_credit_notes_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.credit_notes.create( + client.v1.credit_notes.create( { "invoice": "in_xxxxxxxxxxxxx", "lines": [ @@ -5159,7 +6786,7 @@ async def test_credit_notes_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.credit_notes.create_async( + await client.v1.credit_notes.create_async( { "invoice": "in_xxxxxxxxxxxxx", "lines": [ @@ -5179,6 +6806,38 @@ async def test_credit_notes_post_service_async( post_data="invoice=in_xxxxxxxxxxxxx&lines[0][type]=invoice_line_item&lines[0][invoice_line_item]=il_xxxxxxxxxxxxx&lines[0][quantity]=1", ) + def test_credit_notes_preview_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/credit_notes/preview", + "invoice=in_xxxxxxxxxxxxx&lines[0][type]=invoice_line_item&lines[0][invoice_line_item]=il_xxxxxxxxxxxxx&lines[0][quantity]=1", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.credit_notes.preview( + { + "invoice": "in_xxxxxxxxxxxxx", + "lines": [ + { + "type": "invoice_line_item", + "invoice_line_item": "il_xxxxxxxxxxxxx", + "quantity": 1, + }, + ], + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/credit_notes/preview", + query_string="invoice=in_xxxxxxxxxxxxx&lines[0][type]=invoice_line_item&lines[0][invoice_line_item]=il_xxxxxxxxxxxxx&lines[0][quantity]=1", + api_base="https://api.stripe.com", + ) + def test_credit_notes_preview_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -5211,7 +6870,7 @@ def test_credit_notes_preview_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.credit_notes.preview( + client.v1.credit_notes.preview( { "invoice": "in_xxxxxxxxxxxxx", "lines": [ @@ -5264,7 +6923,7 @@ async def test_credit_notes_preview_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.credit_notes.preview_async( + await client.v1.credit_notes.preview_async( { "invoice": "in_xxxxxxxxxxxxx", "lines": [ @@ -5283,6 +6942,32 @@ async def test_credit_notes_preview_get_service_async( api_base="https://api.stripe.com", ) + def test_credit_notes_preview_lines_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/credit_notes/preview/lines", + "limit=3&invoice=in_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.credit_notes.preview_lines.list( + { + "limit": 3, + "invoice": "in_xxxxxxxxxxxxx", + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/credit_notes/preview/lines", + query_string="limit=3&invoice=in_xxxxxxxxxxxxx", + api_base="https://api.stripe.com", + ) + def test_credit_notes_preview_lines_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -5309,7 +6994,7 @@ def test_credit_notes_preview_lines_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.credit_notes.preview_lines.list( + client.v1.credit_notes.preview_lines.list( { "limit": 3, "invoice": "in_xxxxxxxxxxxxx", @@ -5350,7 +7035,7 @@ async def test_credit_notes_preview_lines_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.credit_notes.preview_lines.list_async( + await client.v1.credit_notes.preview_lines.list_async( { "limit": 3, "invoice": "in_xxxxxxxxxxxxx", @@ -5363,6 +7048,26 @@ async def test_credit_notes_preview_lines_get_service_async( api_base="https://api.stripe.com", ) + def test_credit_notes_void_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/credit_notes/cn_xxxxxxxxxxxxx/void", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.credit_notes.void_credit_note("cn_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/credit_notes/cn_xxxxxxxxxxxxx/void", + query_string="", + api_base="https://api.stripe.com", + ) + def test_credit_notes_void_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -5385,7 +7090,7 @@ def test_credit_notes_void_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.credit_notes.void_credit_note("cn_xxxxxxxxxxxxx") + client.v1.credit_notes.void_credit_note("cn_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/credit_notes/cn_xxxxxxxxxxxxx/void", @@ -5417,7 +7122,7 @@ async def test_credit_notes_void_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.credit_notes.void_credit_note_async("cn_xxxxxxxxxxxxx") + await client.v1.credit_notes.void_credit_note_async("cn_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/credit_notes/cn_xxxxxxxxxxxxx/void", @@ -5425,6 +7130,32 @@ async def test_credit_notes_void_post_service_async( api_base="https://api.stripe.com", ) + def test_customer_sessions_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customer_sessions", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customer_sessions.create( + { + "customer": "cus_123", + "components": {"buy_button": {"enabled": True}}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/customer_sessions", + query_string="", + api_base="https://api.stripe.com", + post_data="customer=cus_123&components[buy_button][enabled]=true", + ) + def test_customer_sessions_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -5451,7 +7182,7 @@ def test_customer_sessions_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customer_sessions.create( + client.v1.customer_sessions.create( { "customer": "cus_123", "components": {"buy_button": {"enabled": True}}, @@ -5493,7 +7224,7 @@ async def test_customer_sessions_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customer_sessions.create_async( + await client.v1.customer_sessions.create_async( { "customer": "cus_123", "components": {"buy_button": {"enabled": True}}, @@ -5507,6 +7238,30 @@ async def test_customer_sessions_post_service_async( post_data="customer=cus_123&components[buy_button][enabled]=true", ) + def test_customers_balance_transactions_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.balance_transactions.list( + "cus_xxxxxxxxxxxxx", + {"limit": 3}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_customers_balance_transactions_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -5533,7 +7288,7 @@ def test_customers_balance_transactions_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.balance_transactions.list( + client.v1.customers.balance_transactions.list( "cus_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -5572,7 +7327,7 @@ async def test_customers_balance_transactions_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.balance_transactions.list_async( + await client.v1.customers.balance_transactions.list_async( "cus_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -5583,20 +7338,7 @@ async def test_customers_balance_transactions_get_service_async( api_base="https://api.stripe.com", ) - def test_customers_balance_transactions_get_2( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.Customer.retrieve_balance_transaction( - "cus_xxxxxxxxxxxxx", - "cbtxn_xxxxxxxxxxxxx", - ) - http_client_mock.assert_requested( - "get", - path="/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx", - query_string="", - ) - - def test_customers_balance_transactions_get_2_service( + def test_customers_balance_transactions_get_2_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -5619,11 +7361,10 @@ def test_customers_balance_transactions_get_2_service( api_base="https://api.stripe.com", ) - @pytest.mark.anyio - async def test_customers_balance_transactions_get_2_async( + def test_customers_balance_transactions_get_2( self, http_client_mock: HTTPClientMock ) -> None: - await stripe.Customer.retrieve_balance_transaction_async( + stripe.Customer.retrieve_balance_transaction( "cus_xxxxxxxxxxxxx", "cbtxn_xxxxxxxxxxxxx", ) @@ -5633,8 +7374,7 @@ async def test_customers_balance_transactions_get_2_async( query_string="", ) - @pytest.mark.anyio - async def test_customers_balance_transactions_get_2_service_async( + def test_customers_balance_transactions_get_2_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -5646,7 +7386,7 @@ async def test_customers_balance_transactions_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.balance_transactions.retrieve_async( + client.v1.customers.balance_transactions.retrieve( "cus_xxxxxxxxxxxxx", "cbtxn_xxxxxxxxxxxxx", ) @@ -5657,6 +7397,68 @@ async def test_customers_balance_transactions_get_2_service_async( api_base="https://api.stripe.com", ) + @pytest.mark.anyio + async def test_customers_balance_transactions_get_2_async( + self, http_client_mock: HTTPClientMock + ) -> None: + await stripe.Customer.retrieve_balance_transaction_async( + "cus_xxxxxxxxxxxxx", + "cbtxn_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx", + query_string="", + ) + + @pytest.mark.anyio + async def test_customers_balance_transactions_get_2_service_async( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + await client.v1.customers.balance_transactions.retrieve_async( + "cus_xxxxxxxxxxxxx", + "cbtxn_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_customers_balance_transactions_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.balance_transactions.create( + "cus_xxxxxxxxxxxxx", + {"amount": -500, "currency": "usd"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=-500¤cy=usd", + ) + def test_customers_balance_transactions_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -5684,7 +7486,7 @@ def test_customers_balance_transactions_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.balance_transactions.create( + client.v1.customers.balance_transactions.create( "cus_xxxxxxxxxxxxx", {"amount": -500, "currency": "usd"}, ) @@ -5725,7 +7527,7 @@ async def test_customers_balance_transactions_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.balance_transactions.create_async( + await client.v1.customers.balance_transactions.create_async( "cus_xxxxxxxxxxxxx", {"amount": -500, "currency": "usd"}, ) @@ -5737,6 +7539,31 @@ async def test_customers_balance_transactions_post_service_async( post_data="amount=-500¤cy=usd", ) + def test_customers_balance_transactions_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.balance_transactions.update( + "cus_xxxxxxxxxxxxx", + "cbtxn_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_customers_balance_transactions_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -5764,7 +7591,7 @@ def test_customers_balance_transactions_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.balance_transactions.update( + client.v1.customers.balance_transactions.update( "cus_xxxxxxxxxxxxx", "cbtxn_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -5806,7 +7633,7 @@ async def test_customers_balance_transactions_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.balance_transactions.update_async( + await client.v1.customers.balance_transactions.update_async( "cus_xxxxxxxxxxxxx", "cbtxn_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -5819,6 +7646,26 @@ async def test_customers_balance_transactions_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_customers_cash_balance_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_123/cash_balance", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.cash_balance.retrieve("cus_123") + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_123/cash_balance", + query_string="", + api_base="https://api.stripe.com", + ) + def test_customers_cash_balance_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -5841,7 +7688,7 @@ def test_customers_cash_balance_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.cash_balance.retrieve("cus_123") + client.v1.customers.cash_balance.retrieve("cus_123") http_client_mock.assert_requested( "get", path="/v1/customers/cus_123/cash_balance", @@ -5873,7 +7720,7 @@ async def test_customers_cash_balance_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.cash_balance.retrieve_async("cus_123") + await client.v1.customers.cash_balance.retrieve_async("cus_123") http_client_mock.assert_requested( "get", path="/v1/customers/cus_123/cash_balance", @@ -5881,6 +7728,30 @@ async def test_customers_cash_balance_get_service_async( api_base="https://api.stripe.com", ) + def test_customers_cash_balance_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customers/cus_123/cash_balance", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.cash_balance.update( + "cus_123", + {"settings": {"reconciliation_mode": "manual"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers/cus_123/cash_balance", + query_string="", + api_base="https://api.stripe.com", + post_data="settings[reconciliation_mode]=manual", + ) + def test_customers_cash_balance_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -5907,7 +7778,7 @@ def test_customers_cash_balance_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.cash_balance.update( + client.v1.customers.cash_balance.update( "cus_123", {"settings": {"reconciliation_mode": "manual"}}, ) @@ -5947,7 +7818,7 @@ async def test_customers_cash_balance_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.cash_balance.update_async( + await client.v1.customers.cash_balance.update_async( "cus_123", {"settings": {"reconciliation_mode": "manual"}}, ) @@ -5959,6 +7830,30 @@ async def test_customers_cash_balance_post_service_async( post_data="settings[reconciliation_mode]=manual", ) + def test_customers_cash_balance_transactions_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_123/cash_balance_transactions", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.cash_balance_transactions.list( + "cus_123", + {"limit": 3}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_123/cash_balance_transactions", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_customers_cash_balance_transactions_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -5985,7 +7880,7 @@ def test_customers_cash_balance_transactions_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.cash_balance_transactions.list( + client.v1.customers.cash_balance_transactions.list( "cus_123", {"limit": 3}, ) @@ -6024,7 +7919,7 @@ async def test_customers_cash_balance_transactions_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.cash_balance_transactions.list_async( + await client.v1.customers.cash_balance_transactions.list_async( "cus_123", {"limit": 3}, ) @@ -6035,6 +7930,26 @@ async def test_customers_cash_balance_transactions_get_service_async( api_base="https://api.stripe.com", ) + def test_customers_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/customers/cus_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.delete("cus_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/customers/cus_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_customers_delete(self, http_client_mock: HTTPClientMock) -> None: stripe.Customer.delete("cus_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -6055,7 +7970,7 @@ def test_customers_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.delete("cus_xxxxxxxxxxxxx") + client.v1.customers.delete("cus_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/customers/cus_xxxxxxxxxxxxx", @@ -6087,7 +8002,7 @@ async def test_customers_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.delete_async("cus_xxxxxxxxxxxxx") + await client.v1.customers.delete_async("cus_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/customers/cus_xxxxxxxxxxxxx", @@ -6095,6 +8010,37 @@ async def test_customers_delete_service_async( api_base="https://api.stripe.com", ) + def test_customers_funding_instructions_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customers/cus_123/funding_instructions", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.funding_instructions.create( + "cus_123", + { + "bank_transfer": { + "requested_address_types": ["zengin"], + "type": "jp_bank_transfer", + }, + "currency": "usd", + "funding_type": "bank_transfer", + }, + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers/cus_123/funding_instructions", + query_string="", + api_base="https://api.stripe.com", + post_data="bank_transfer[requested_address_types][0]=zengin&bank_transfer[type]=jp_bank_transfer¤cy=usd&funding_type=bank_transfer", + ) + def test_customers_funding_instructions_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -6126,7 +8072,7 @@ def test_customers_funding_instructions_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.funding_instructions.create( + client.v1.customers.funding_instructions.create( "cus_123", { "bank_transfer": { @@ -6178,7 +8124,7 @@ async def test_customers_funding_instructions_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.funding_instructions.create_async( + await client.v1.customers.funding_instructions.create_async( "cus_123", { "bank_transfer": { @@ -6197,6 +8143,27 @@ async def test_customers_funding_instructions_post_service_async( post_data="bank_transfer[requested_address_types][0]=zengin&bank_transfer[type]=jp_bank_transfer¤cy=usd&funding_type=bank_transfer", ) + def test_customers_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/customers", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_customers_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Customer.list(limit=3) http_client_mock.assert_requested( @@ -6218,7 +8185,7 @@ def test_customers_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.list({"limit": 3}) + client.v1.customers.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/customers", @@ -6251,7 +8218,28 @@ async def test_customers_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.list_async({"limit": 3}) + await client.v1.customers.list_async({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/customers", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + + def test_customers_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/customers", @@ -6280,7 +8268,7 @@ def test_customers_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.list({"limit": 3}) + client.v1.customers.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/customers", @@ -6313,7 +8301,7 @@ async def test_customers_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.list_async({"limit": 3}) + await client.v1.customers.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/customers", @@ -6321,6 +8309,26 @@ async def test_customers_get_2_service_async( api_base="https://api.stripe.com", ) + def test_customers_get_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.retrieve("cus_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_customers_get_3(self, http_client_mock: HTTPClientMock) -> None: stripe.Customer.retrieve("cus_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -6341,7 +8349,7 @@ def test_customers_get_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.retrieve("cus_xxxxxxxxxxxxx") + client.v1.customers.retrieve("cus_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/customers/cus_xxxxxxxxxxxxx", @@ -6373,7 +8381,7 @@ async def test_customers_get_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.retrieve_async("cus_xxxxxxxxxxxxx") + await client.v1.customers.retrieve_async("cus_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/customers/cus_xxxxxxxxxxxxx", @@ -6381,6 +8389,30 @@ async def test_customers_get_3_service_async( api_base="https://api.stripe.com", ) + def test_customers_payment_methods_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_xyz/payment_methods", + "type=card", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.payment_methods.list( + "cus_xyz", + {"type": "card"}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xyz/payment_methods", + query_string="type=card", + api_base="https://api.stripe.com", + ) + def test_customers_payment_methods_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -6407,7 +8439,7 @@ def test_customers_payment_methods_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.payment_methods.list( + client.v1.customers.payment_methods.list( "cus_xyz", {"type": "card"}, ) @@ -6446,7 +8478,7 @@ async def test_customers_payment_methods_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.payment_methods.list_async( + await client.v1.customers.payment_methods.list_async( "cus_xyz", {"type": "card"}, ) @@ -6457,6 +8489,30 @@ async def test_customers_payment_methods_get_service_async( api_base="https://api.stripe.com", ) + def test_customers_payment_methods_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/payment_methods", + "type=card", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.payment_methods.list( + "cus_xxxxxxxxxxxxx", + {"type": "card"}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xxxxxxxxxxxxx/payment_methods", + query_string="type=card", + api_base="https://api.stripe.com", + ) + def test_customers_payment_methods_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -6483,7 +8539,7 @@ def test_customers_payment_methods_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.payment_methods.list( + client.v1.customers.payment_methods.list( "cus_xxxxxxxxxxxxx", {"type": "card"}, ) @@ -6522,7 +8578,7 @@ async def test_customers_payment_methods_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.payment_methods.list_async( + await client.v1.customers.payment_methods.list_async( "cus_xxxxxxxxxxxxx", {"type": "card"}, ) @@ -6533,6 +8589,31 @@ async def test_customers_payment_methods_get_2_service_async( api_base="https://api.stripe.com", ) + def test_customers_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customers", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.create( + { + "description": "My First Test Customer (created for API docs at https://www.stripe.com/docs/api)", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers", + query_string="", + api_base="https://api.stripe.com", + post_data="description=My%20First%20Test%20Customer%20%28created%20for%20API%20docs%20at%20https%3A%2F%2Fwww.stripe.com%2Fdocs%2Fapi%29", + ) + def test_customers_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Customer.create( description="My First Test Customer (created for API docs at https://www.stripe.com/docs/api)", @@ -6556,7 +8637,7 @@ def test_customers_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.create( + client.v1.customers.create( { "description": "My First Test Customer (created for API docs at https://www.stripe.com/docs/api)", } @@ -6596,7 +8677,7 @@ async def test_customers_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.create_async( + await client.v1.customers.create_async( { "description": "My First Test Customer (created for API docs at https://www.stripe.com/docs/api)", } @@ -6609,6 +8690,30 @@ async def test_customers_post_service_async( post_data="description=My%20First%20Test%20Customer%20%28created%20for%20API%20docs%20at%20https%3A%2F%2Fwww.stripe.com%2Fdocs%2Fapi%29", ) + def test_customers_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customers/cus_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.update( + "cus_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers/cus_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_customers_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Customer.modify( "cus_xxxxxxxxxxxxx", @@ -6633,7 +8738,7 @@ def test_customers_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.update( + client.v1.customers.update( "cus_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -6673,7 +8778,7 @@ async def test_customers_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.update_async( + await client.v1.customers.update_async( "cus_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -6685,6 +8790,31 @@ async def test_customers_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_customers_search_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/search", + "query=name%3A%27fakename%27%20AND%20metadata%5B%27foo%27%5D%3A%27bar%27", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.search( + { + "query": "name:'fakename' AND metadata['foo']:'bar'", + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/search", + query_string="query=name%3A%27fakename%27%20AND%20metadata%5B%27foo%27%5D%3A%27bar%27", + api_base="https://api.stripe.com", + ) + def test_customers_search_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -6710,7 +8840,7 @@ def test_customers_search_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.search( + client.v1.customers.search( { "query": "name:'fakename' AND metadata['foo']:'bar'", } @@ -6749,7 +8879,32 @@ async def test_customers_search_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.search_async( + await client.v1.customers.search_async( + { + "query": "name:'fakename' AND metadata['foo']:'bar'", + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/search", + query_string="query=name%3A%27fakename%27%20AND%20metadata%5B%27foo%27%5D%3A%27bar%27", + api_base="https://api.stripe.com", + ) + + def test_customers_search_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/search", + "query=name%3A%27fakename%27%20AND%20metadata%5B%27foo%27%5D%3A%27bar%27", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.search( { "query": "name:'fakename' AND metadata['foo']:'bar'", } @@ -6786,7 +8941,7 @@ def test_customers_search_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.search( + client.v1.customers.search( { "query": "name:'fakename' AND metadata['foo']:'bar'", } @@ -6825,7 +8980,7 @@ async def test_customers_search_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.search_async( + await client.v1.customers.search_async( { "query": "name:'fakename' AND metadata['foo']:'bar'", } @@ -6837,6 +8992,29 @@ async def test_customers_search_get_2_service_async( api_base="https://api.stripe.com", ) + def test_customers_sources_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.sources.detach( + "cus_xxxxxxxxxxxxx", + "ba_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "delete", + path="/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_customers_sources_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -6862,7 +9040,7 @@ def test_customers_sources_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.sources.detach( + client.v1.sources.detach( "cus_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx", ) @@ -6900,7 +9078,7 @@ async def test_customers_sources_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.sources.detach_async( + await client.v1.sources.detach_async( "cus_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx", ) @@ -6911,6 +9089,29 @@ async def test_customers_sources_delete_service_async( api_base="https://api.stripe.com", ) + def test_customers_sources_delete_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.sources.detach( + "cus_xxxxxxxxxxxxx", + "card_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "delete", + path="/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_customers_sources_delete_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -6936,7 +9137,7 @@ def test_customers_sources_delete_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.sources.detach( + client.v1.sources.detach( "cus_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx", ) @@ -6974,7 +9175,7 @@ async def test_customers_sources_delete_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.sources.detach_async( + await client.v1.sources.detach_async( "cus_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx", ) @@ -6985,6 +9186,30 @@ async def test_customers_sources_delete_2_service_async( api_base="https://api.stripe.com", ) + def test_customers_sources_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/sources", + "object=bank_account&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.payment_sources.list( + "cus_xxxxxxxxxxxxx", + {"object": "bank_account", "limit": 3}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xxxxxxxxxxxxx/sources", + query_string="object=bank_account&limit=3", + api_base="https://api.stripe.com", + ) + def test_customers_sources_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -7012,7 +9237,7 @@ def test_customers_sources_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.payment_sources.list( + client.v1.customers.payment_sources.list( "cus_xxxxxxxxxxxxx", {"object": "bank_account", "limit": 3}, ) @@ -7052,7 +9277,7 @@ async def test_customers_sources_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.payment_sources.list_async( + await client.v1.customers.payment_sources.list_async( "cus_xxxxxxxxxxxxx", {"object": "bank_account", "limit": 3}, ) @@ -7063,6 +9288,30 @@ async def test_customers_sources_get_service_async( api_base="https://api.stripe.com", ) + def test_customers_sources_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/sources", + "object=card&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.payment_sources.list( + "cus_xxxxxxxxxxxxx", + {"object": "card", "limit": 3}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xxxxxxxxxxxxx/sources", + query_string="object=card&limit=3", + api_base="https://api.stripe.com", + ) + def test_customers_sources_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -7090,7 +9339,7 @@ def test_customers_sources_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.payment_sources.list( + client.v1.customers.payment_sources.list( "cus_xxxxxxxxxxxxx", {"object": "card", "limit": 3}, ) @@ -7130,7 +9379,7 @@ async def test_customers_sources_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.payment_sources.list_async( + await client.v1.customers.payment_sources.list_async( "cus_xxxxxxxxxxxxx", {"object": "card", "limit": 3}, ) @@ -7141,20 +9390,7 @@ async def test_customers_sources_get_2_service_async( api_base="https://api.stripe.com", ) - def test_customers_sources_get_3( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.Customer.retrieve_source( - "cus_xxxxxxxxxxxxx", - "ba_xxxxxxxxxxxxx", - ) - http_client_mock.assert_requested( - "get", - path="/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx", - query_string="", - ) - - def test_customers_sources_get_3_service( + def test_customers_sources_get_3_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -7177,11 +9413,10 @@ def test_customers_sources_get_3_service( api_base="https://api.stripe.com", ) - @pytest.mark.anyio - async def test_customers_sources_get_3_async( + def test_customers_sources_get_3( self, http_client_mock: HTTPClientMock ) -> None: - await stripe.Customer.retrieve_source_async( + stripe.Customer.retrieve_source( "cus_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx", ) @@ -7191,8 +9426,7 @@ async def test_customers_sources_get_3_async( query_string="", ) - @pytest.mark.anyio - async def test_customers_sources_get_3_service_async( + def test_customers_sources_get_3_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -7204,7 +9438,7 @@ async def test_customers_sources_get_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.payment_sources.retrieve_async( + client.v1.customers.payment_sources.retrieve( "cus_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx", ) @@ -7215,6 +9449,67 @@ async def test_customers_sources_get_3_service_async( api_base="https://api.stripe.com", ) + @pytest.mark.anyio + async def test_customers_sources_get_3_async( + self, http_client_mock: HTTPClientMock + ) -> None: + await stripe.Customer.retrieve_source_async( + "cus_xxxxxxxxxxxxx", + "ba_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx", + query_string="", + ) + + @pytest.mark.anyio + async def test_customers_sources_get_3_service_async( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + await client.v1.customers.payment_sources.retrieve_async( + "cus_xxxxxxxxxxxxx", + "ba_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_customers_sources_get_4_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.payment_sources.retrieve( + "cus_xxxxxxxxxxxxx", + "card_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_customers_sources_get_4( self, http_client_mock: HTTPClientMock ) -> None: @@ -7240,7 +9535,7 @@ def test_customers_sources_get_4_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.payment_sources.retrieve( + client.v1.customers.payment_sources.retrieve( "cus_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx", ) @@ -7278,7 +9573,7 @@ async def test_customers_sources_get_4_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.payment_sources.retrieve_async( + await client.v1.customers.payment_sources.retrieve_async( "cus_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx", ) @@ -7289,6 +9584,31 @@ async def test_customers_sources_get_4_service_async( api_base="https://api.stripe.com", ) + def test_customers_sources_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customers/cus_123/sources/card_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.payment_sources.update( + "cus_123", + "card_123", + {"account_holder_name": "Kamil"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers/cus_123/sources/card_123", + query_string="", + api_base="https://api.stripe.com", + post_data="account_holder_name=Kamil", + ) + def test_customers_sources_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -7316,7 +9636,7 @@ def test_customers_sources_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.payment_sources.update( + client.v1.customers.payment_sources.update( "cus_123", "card_123", {"account_holder_name": "Kamil"}, @@ -7358,7 +9678,7 @@ async def test_customers_sources_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.payment_sources.update_async( + await client.v1.customers.payment_sources.update_async( "cus_123", "card_123", {"account_holder_name": "Kamil"}, @@ -7371,6 +9691,30 @@ async def test_customers_sources_post_service_async( post_data="account_holder_name=Kamil", ) + def test_customers_sources_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customers/cus_xxxxxxxxxxxxx/sources", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.payment_sources.create( + "cus_xxxxxxxxxxxxx", + {"source": "btok_xxxxxxxxxxxxx"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers/cus_xxxxxxxxxxxxx/sources", + query_string="", + api_base="https://api.stripe.com", + post_data="source=btok_xxxxxxxxxxxxx", + ) + def test_customers_sources_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -7397,7 +9741,7 @@ def test_customers_sources_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.payment_sources.create( + client.v1.customers.payment_sources.create( "cus_xxxxxxxxxxxxx", {"source": "btok_xxxxxxxxxxxxx"}, ) @@ -7437,7 +9781,7 @@ async def test_customers_sources_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.payment_sources.create_async( + await client.v1.customers.payment_sources.create_async( "cus_xxxxxxxxxxxxx", {"source": "btok_xxxxxxxxxxxxx"}, ) @@ -7449,6 +9793,30 @@ async def test_customers_sources_post_2_service_async( post_data="source=btok_xxxxxxxxxxxxx", ) + def test_customers_sources_post_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customers/cus_xxxxxxxxxxxxx/sources", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.payment_sources.create( + "cus_xxxxxxxxxxxxx", + {"source": "tok_xxxx"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers/cus_xxxxxxxxxxxxx/sources", + query_string="", + api_base="https://api.stripe.com", + post_data="source=tok_xxxx", + ) + def test_customers_sources_post_3( self, http_client_mock: HTTPClientMock ) -> None: @@ -7475,7 +9843,7 @@ def test_customers_sources_post_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.payment_sources.create( + client.v1.customers.payment_sources.create( "cus_xxxxxxxxxxxxx", {"source": "tok_xxxx"}, ) @@ -7515,7 +9883,7 @@ async def test_customers_sources_post_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.payment_sources.create_async( + await client.v1.customers.payment_sources.create_async( "cus_xxxxxxxxxxxxx", {"source": "tok_xxxx"}, ) @@ -7527,6 +9895,31 @@ async def test_customers_sources_post_3_service_async( post_data="source=tok_xxxx", ) + def test_customers_sources_post_4_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.payment_sources.update( + "cus_xxxxxxxxxxxxx", + "ba_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_customers_sources_post_4( self, http_client_mock: HTTPClientMock ) -> None: @@ -7554,7 +9947,7 @@ def test_customers_sources_post_4_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.payment_sources.update( + client.v1.customers.payment_sources.update( "cus_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -7596,7 +9989,7 @@ async def test_customers_sources_post_4_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.payment_sources.update_async( + await client.v1.customers.payment_sources.update_async( "cus_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -7609,6 +10002,31 @@ async def test_customers_sources_post_4_service_async( post_data="metadata[order_id]=6735", ) + def test_customers_sources_post_5_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.payment_sources.update( + "cus_xxxxxxxxxxxxx", + "card_xxxxxxxxxxxxx", + {"name": "Jenny Rosen"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="name=Jenny%20Rosen", + ) + def test_customers_sources_post_5( self, http_client_mock: HTTPClientMock ) -> None: @@ -7636,7 +10054,7 @@ def test_customers_sources_post_5_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.payment_sources.update( + client.v1.customers.payment_sources.update( "cus_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx", {"name": "Jenny Rosen"}, @@ -7678,7 +10096,7 @@ async def test_customers_sources_post_5_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.payment_sources.update_async( + await client.v1.customers.payment_sources.update_async( "cus_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx", {"name": "Jenny Rosen"}, @@ -7691,6 +10109,29 @@ async def test_customers_sources_post_5_service_async( post_data="name=Jenny%20Rosen", ) + def test_customers_tax_ids_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.tax_ids.delete( + "cus_xxxxxxxxxxxxx", + "txi_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "delete", + path="/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_customers_tax_ids_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -7716,7 +10157,7 @@ def test_customers_tax_ids_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.tax_ids.delete( + client.v1.customers.tax_ids.delete( "cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx", ) @@ -7754,7 +10195,7 @@ async def test_customers_tax_ids_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.tax_ids.delete_async( + await client.v1.customers.tax_ids.delete_async( "cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx", ) @@ -7765,6 +10206,30 @@ async def test_customers_tax_ids_delete_service_async( api_base="https://api.stripe.com", ) + def test_customers_tax_ids_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/tax_ids", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.tax_ids.list( + "cus_xxxxxxxxxxxxx", + {"limit": 3}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xxxxxxxxxxxxx/tax_ids", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_customers_tax_ids_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -7791,7 +10256,7 @@ def test_customers_tax_ids_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.tax_ids.list( + client.v1.customers.tax_ids.list( "cus_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -7830,7 +10295,7 @@ async def test_customers_tax_ids_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.tax_ids.list_async( + await client.v1.customers.tax_ids.list_async( "cus_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -7841,6 +10306,29 @@ async def test_customers_tax_ids_get_service_async( api_base="https://api.stripe.com", ) + def test_customers_tax_ids_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.customers.tax_ids.retrieve( + "cus_xxxxxxxxxxxxx", + "txi_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "get", + path="/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_customers_tax_ids_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -7866,7 +10354,7 @@ def test_customers_tax_ids_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.customers.tax_ids.retrieve( + client.v1.customers.tax_ids.retrieve( "cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx", ) @@ -7904,7 +10392,7 @@ async def test_customers_tax_ids_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.tax_ids.retrieve_async( + await client.v1.customers.tax_ids.retrieve_async( "cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx", ) @@ -7915,22 +10403,7 @@ async def test_customers_tax_ids_get_2_service_async( api_base="https://api.stripe.com", ) - def test_customers_tax_ids_post( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.Customer.create_tax_id( - "cus_xxxxxxxxxxxxx", - type="eu_vat", - value="DE123456789", - ) - http_client_mock.assert_requested( - "post", - path="/v1/customers/cus_xxxxxxxxxxxxx/tax_ids", - query_string="", - post_data="type=eu_vat&value=DE123456789", - ) - - def test_customers_tax_ids_post_service( + def test_customers_tax_ids_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -7954,6 +10427,45 @@ def test_customers_tax_ids_post_service( post_data="type=eu_vat&value=DE123456789", ) + def test_customers_tax_ids_post( + self, http_client_mock: HTTPClientMock + ) -> None: + stripe.Customer.create_tax_id( + "cus_xxxxxxxxxxxxx", + type="eu_vat", + value="DE123456789", + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers/cus_xxxxxxxxxxxxx/tax_ids", + query_string="", + post_data="type=eu_vat&value=DE123456789", + ) + + def test_customers_tax_ids_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/customers/cus_xxxxxxxxxxxxx/tax_ids", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v1.customers.tax_ids.create( + "cus_xxxxxxxxxxxxx", + {"type": "eu_vat", "value": "DE123456789"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/customers/cus_xxxxxxxxxxxxx/tax_ids", + query_string="", + api_base="https://api.stripe.com", + post_data="type=eu_vat&value=DE123456789", + ) + @pytest.mark.anyio async def test_customers_tax_ids_post_async( self, http_client_mock: HTTPClientMock @@ -7983,7 +10495,7 @@ async def test_customers_tax_ids_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.customers.tax_ids.create_async( + await client.v1.customers.tax_ids.create_async( "cus_xxxxxxxxxxxxx", {"type": "eu_vat", "value": "DE123456789"}, ) @@ -7995,6 +10507,26 @@ async def test_customers_tax_ids_post_service_async( post_data="type=eu_vat&value=DE123456789", ) + def test_disputes_close_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/disputes/dp_xxxxxxxxxxxxx/close", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.disputes.close("dp_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/disputes/dp_xxxxxxxxxxxxx/close", + query_string="", + api_base="https://api.stripe.com", + ) + def test_disputes_close_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -8017,7 +10549,7 @@ def test_disputes_close_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.disputes.close("dp_xxxxxxxxxxxxx") + client.v1.disputes.close("dp_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/disputes/dp_xxxxxxxxxxxxx/close", @@ -8049,7 +10581,7 @@ async def test_disputes_close_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.disputes.close_async("dp_xxxxxxxxxxxxx") + await client.v1.disputes.close_async("dp_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/disputes/dp_xxxxxxxxxxxxx/close", @@ -8057,6 +10589,27 @@ async def test_disputes_close_post_service_async( api_base="https://api.stripe.com", ) + def test_disputes_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/disputes", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.disputes.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/disputes", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_disputes_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Dispute.list(limit=3) http_client_mock.assert_requested( @@ -8078,7 +10631,7 @@ def test_disputes_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.disputes.list({"limit": 3}) + client.v1.disputes.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/disputes", @@ -8111,7 +10664,7 @@ async def test_disputes_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.disputes.list_async({"limit": 3}) + await client.v1.disputes.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/disputes", @@ -8119,6 +10672,26 @@ async def test_disputes_get_service_async( api_base="https://api.stripe.com", ) + def test_disputes_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/disputes/dp_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.disputes.retrieve("dp_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/disputes/dp_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_disputes_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Dispute.retrieve("dp_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -8139,7 +10712,7 @@ def test_disputes_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.disputes.retrieve("dp_xxxxxxxxxxxxx") + client.v1.disputes.retrieve("dp_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/disputes/dp_xxxxxxxxxxxxx", @@ -8171,7 +10744,7 @@ async def test_disputes_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.disputes.retrieve_async("dp_xxxxxxxxxxxxx") + await client.v1.disputes.retrieve_async("dp_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/disputes/dp_xxxxxxxxxxxxx", @@ -8179,6 +10752,30 @@ async def test_disputes_get_2_service_async( api_base="https://api.stripe.com", ) + def test_disputes_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/disputes/dp_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.disputes.update( + "dp_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/disputes/dp_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_disputes_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Dispute.modify( "dp_xxxxxxxxxxxxx", @@ -8203,7 +10800,7 @@ def test_disputes_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.disputes.update( + client.v1.disputes.update( "dp_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -8243,7 +10840,7 @@ async def test_disputes_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.disputes.update_async( + await client.v1.disputes.update_async( "dp_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -8255,6 +10852,27 @@ async def test_disputes_post_service_async( post_data="metadata[order_id]=6735", ) + def test_events_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/events", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.events.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/events", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_events_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Event.list(limit=3) http_client_mock.assert_requested( @@ -8276,7 +10894,7 @@ def test_events_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.events.list({"limit": 3}) + client.v1.events.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/events", @@ -8309,7 +10927,7 @@ async def test_events_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.events.list_async({"limit": 3}) + await client.v1.events.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/events", @@ -8317,6 +10935,26 @@ async def test_events_get_service_async( api_base="https://api.stripe.com", ) + def test_events_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/events/evt_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.events.retrieve("evt_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/events/evt_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_events_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Event.retrieve("evt_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -8337,7 +10975,7 @@ def test_events_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.events.retrieve("evt_xxxxxxxxxxxxx") + client.v1.events.retrieve("evt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/events/evt_xxxxxxxxxxxxx", @@ -8369,7 +11007,7 @@ async def test_events_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.events.retrieve_async("evt_xxxxxxxxxxxxx") + await client.v1.events.retrieve_async("evt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/events/evt_xxxxxxxxxxxxx", @@ -8377,6 +11015,27 @@ async def test_events_get_2_service_async( api_base="https://api.stripe.com", ) + def test_file_links_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/file_links", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.file_links.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/file_links", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_file_links_get(self, http_client_mock: HTTPClientMock) -> None: stripe.FileLink.list(limit=3) http_client_mock.assert_requested( @@ -8398,7 +11057,7 @@ def test_file_links_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.file_links.list({"limit": 3}) + client.v1.file_links.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/file_links", @@ -8431,7 +11090,7 @@ async def test_file_links_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.file_links.list_async({"limit": 3}) + await client.v1.file_links.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/file_links", @@ -8439,6 +11098,26 @@ async def test_file_links_get_service_async( api_base="https://api.stripe.com", ) + def test_file_links_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/file_links/link_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.file_links.retrieve("link_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/file_links/link_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_file_links_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.FileLink.retrieve("link_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -8459,7 +11138,7 @@ def test_file_links_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.file_links.retrieve("link_xxxxxxxxxxxxx") + client.v1.file_links.retrieve("link_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/file_links/link_xxxxxxxxxxxxx", @@ -8491,7 +11170,7 @@ async def test_file_links_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.file_links.retrieve_async("link_xxxxxxxxxxxxx") + await client.v1.file_links.retrieve_async("link_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/file_links/link_xxxxxxxxxxxxx", @@ -8499,6 +11178,27 @@ async def test_file_links_get_2_service_async( api_base="https://api.stripe.com", ) + def test_file_links_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/file_links", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.file_links.create({"file": "file_xxxxxxxxxxxxx"}) + http_client_mock.assert_requested( + "post", + path="/v1/file_links", + query_string="", + api_base="https://api.stripe.com", + post_data="file=file_xxxxxxxxxxxxx", + ) + def test_file_links_post(self, http_client_mock: HTTPClientMock) -> None: stripe.FileLink.create(file="file_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -8520,7 +11220,7 @@ def test_file_links_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.file_links.create({"file": "file_xxxxxxxxxxxxx"}) + client.v1.file_links.create({"file": "file_xxxxxxxxxxxxx"}) http_client_mock.assert_requested( "post", path="/v1/file_links", @@ -8554,7 +11254,7 @@ async def test_file_links_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.file_links.create_async({"file": "file_xxxxxxxxxxxxx"}) + await client.v1.file_links.create_async({"file": "file_xxxxxxxxxxxxx"}) http_client_mock.assert_requested( "post", path="/v1/file_links", @@ -8563,6 +11263,30 @@ async def test_file_links_post_service_async( post_data="file=file_xxxxxxxxxxxxx", ) + def test_file_links_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/file_links/link_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.file_links.update( + "link_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/file_links/link_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_file_links_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.FileLink.modify( "link_xxxxxxxxxxxxx", @@ -8587,7 +11311,7 @@ def test_file_links_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.file_links.update( + client.v1.file_links.update( "link_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -8627,7 +11351,7 @@ async def test_file_links_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.file_links.update_async( + await client.v1.file_links.update_async( "link_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -8639,6 +11363,27 @@ async def test_file_links_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_files_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/files", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.files.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/files", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_files_get(self, http_client_mock: HTTPClientMock) -> None: stripe.File.list(limit=3) http_client_mock.assert_requested( @@ -8658,7 +11403,7 @@ def test_files_get_service(self, http_client_mock: HTTPClientMock) -> None: http_client=http_client_mock.get_mock_http_client(), ) - client.files.list({"limit": 3}) + client.v1.files.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/files", @@ -8691,7 +11436,7 @@ async def test_files_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.files.list_async({"limit": 3}) + await client.v1.files.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/files", @@ -8699,6 +11444,26 @@ async def test_files_get_service_async( api_base="https://api.stripe.com", ) + def test_files_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/files/file_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.files.retrieve("file_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/files/file_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_files_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.File.retrieve("file_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -8719,7 +11484,7 @@ def test_files_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.files.retrieve("file_xxxxxxxxxxxxx") + client.v1.files.retrieve("file_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/files/file_xxxxxxxxxxxxx", @@ -8751,7 +11516,7 @@ async def test_files_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.files.retrieve_async("file_xxxxxxxxxxxxx") + await client.v1.files.retrieve_async("file_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/files/file_xxxxxxxxxxxxx", @@ -8759,6 +11524,31 @@ async def test_files_get_2_service_async( api_base="https://api.stripe.com", ) + def test_files_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/files", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.files.create( + { + "purpose": "account_requirement", + "file": io.StringIO("foo"), + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/files", + query_string="", + api_base="https://files.stripe.com", + ) + def test_files_post(self, http_client_mock: HTTPClientMock) -> None: stripe.File.create( purpose="account_requirement", @@ -8782,7 +11572,7 @@ def test_files_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.files.create( + client.v1.files.create( { "purpose": "account_requirement", "file": io.StringIO("foo"), @@ -8822,7 +11612,7 @@ async def test_files_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.files.create_async( + await client.v1.files.create_async( { "purpose": "account_requirement", "file": io.StringIO("foo"), @@ -8835,6 +11625,26 @@ async def test_files_post_service_async( api_base="https://files.stripe.com", ) + def test_financial_connections_accounts_disconnect_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/financial_connections/accounts/fca_xyz/disconnect", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.accounts.disconnect("fca_xyz") + http_client_mock.assert_requested( + "post", + path="/v1/financial_connections/accounts/fca_xyz/disconnect", + query_string="", + api_base="https://api.stripe.com", + ) + def test_financial_connections_accounts_disconnect_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -8857,7 +11667,7 @@ def test_financial_connections_accounts_disconnect_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.accounts.disconnect("fca_xyz") + client.v1.financial_connections.accounts.disconnect("fca_xyz") http_client_mock.assert_requested( "post", path="/v1/financial_connections/accounts/fca_xyz/disconnect", @@ -8889,7 +11699,9 @@ async def test_financial_connections_accounts_disconnect_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.accounts.disconnect_async("fca_xyz") + await client.v1.financial_connections.accounts.disconnect_async( + "fca_xyz", + ) http_client_mock.assert_requested( "post", path="/v1/financial_connections/accounts/fca_xyz/disconnect", @@ -8897,6 +11709,26 @@ async def test_financial_connections_accounts_disconnect_post_service_async( api_base="https://api.stripe.com", ) + def test_financial_connections_accounts_disconnect_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/disconnect", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.accounts.disconnect("fca_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/disconnect", + query_string="", + api_base="https://api.stripe.com", + ) + def test_financial_connections_accounts_disconnect_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -8919,7 +11751,9 @@ def test_financial_connections_accounts_disconnect_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.accounts.disconnect("fca_xxxxxxxxxxxxx") + client.v1.financial_connections.accounts.disconnect( + "fca_xxxxxxxxxxxxx" + ) http_client_mock.assert_requested( "post", path="/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/disconnect", @@ -8953,7 +11787,7 @@ async def test_financial_connections_accounts_disconnect_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.accounts.disconnect_async( + await client.v1.financial_connections.accounts.disconnect_async( "fca_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -8963,6 +11797,26 @@ async def test_financial_connections_accounts_disconnect_post_2_service_async( api_base="https://api.stripe.com", ) + def test_financial_connections_accounts_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/financial_connections/accounts", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.accounts.list() + http_client_mock.assert_requested( + "get", + path="/v1/financial_connections/accounts", + query_string="", + api_base="https://api.stripe.com", + ) + def test_financial_connections_accounts_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -8985,7 +11839,7 @@ def test_financial_connections_accounts_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.accounts.list() + client.v1.financial_connections.accounts.list() http_client_mock.assert_requested( "get", path="/v1/financial_connections/accounts", @@ -9017,7 +11871,7 @@ async def test_financial_connections_accounts_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.accounts.list_async() + await client.v1.financial_connections.accounts.list_async() http_client_mock.assert_requested( "get", path="/v1/financial_connections/accounts", @@ -9025,6 +11879,26 @@ async def test_financial_connections_accounts_get_service_async( api_base="https://api.stripe.com", ) + def test_financial_connections_accounts_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/financial_connections/accounts/fca_xyz", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.accounts.retrieve("fca_xyz") + http_client_mock.assert_requested( + "get", + path="/v1/financial_connections/accounts/fca_xyz", + query_string="", + api_base="https://api.stripe.com", + ) + def test_financial_connections_accounts_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -9047,7 +11921,7 @@ def test_financial_connections_accounts_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.accounts.retrieve("fca_xyz") + client.v1.financial_connections.accounts.retrieve("fca_xyz") http_client_mock.assert_requested( "get", path="/v1/financial_connections/accounts/fca_xyz", @@ -9079,7 +11953,9 @@ async def test_financial_connections_accounts_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.accounts.retrieve_async("fca_xyz") + await client.v1.financial_connections.accounts.retrieve_async( + "fca_xyz" + ) http_client_mock.assert_requested( "get", path="/v1/financial_connections/accounts/fca_xyz", @@ -9087,6 +11963,31 @@ async def test_financial_connections_accounts_get_2_service_async( api_base="https://api.stripe.com", ) + def test_financial_connections_accounts_get_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/financial_connections/accounts", + "account_holder[customer]=cus_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.accounts.list( + { + "account_holder": {"customer": "cus_xxxxxxxxxxxxx"}, + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/financial_connections/accounts", + query_string="account_holder[customer]=cus_xxxxxxxxxxxxx", + api_base="https://api.stripe.com", + ) + def test_financial_connections_accounts_get_3( self, http_client_mock: HTTPClientMock ) -> None: @@ -9112,7 +12013,7 @@ def test_financial_connections_accounts_get_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.accounts.list( + client.v1.financial_connections.accounts.list( { "account_holder": {"customer": "cus_xxxxxxxxxxxxx"}, } @@ -9151,7 +12052,7 @@ async def test_financial_connections_accounts_get_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.accounts.list_async( + await client.v1.financial_connections.accounts.list_async( { "account_holder": {"customer": "cus_xxxxxxxxxxxxx"}, } @@ -9163,6 +12064,26 @@ async def test_financial_connections_accounts_get_3_service_async( api_base="https://api.stripe.com", ) + def test_financial_connections_accounts_get_4_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.accounts.retrieve("fca_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_financial_connections_accounts_get_4( self, http_client_mock: HTTPClientMock ) -> None: @@ -9185,7 +12106,7 @@ def test_financial_connections_accounts_get_4_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.accounts.retrieve("fca_xxxxxxxxxxxxx") + client.v1.financial_connections.accounts.retrieve("fca_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx", @@ -9219,7 +12140,7 @@ async def test_financial_connections_accounts_get_4_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.accounts.retrieve_async( + await client.v1.financial_connections.accounts.retrieve_async( "fca_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -9229,6 +12150,30 @@ async def test_financial_connections_accounts_get_4_service_async( api_base="https://api.stripe.com", ) + def test_financial_connections_accounts_owners_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/financial_connections/accounts/fca_xyz/owners", + "ownership=fcaowns_xyz", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.accounts.owners.list( + "fca_xyz", + {"ownership": "fcaowns_xyz"}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/financial_connections/accounts/fca_xyz/owners", + query_string="ownership=fcaowns_xyz", + api_base="https://api.stripe.com", + ) + def test_financial_connections_accounts_owners_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -9255,7 +12200,7 @@ def test_financial_connections_accounts_owners_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.accounts.owners.list( + client.v1.financial_connections.accounts.owners.list( "fca_xyz", {"ownership": "fcaowns_xyz"}, ) @@ -9294,7 +12239,7 @@ async def test_financial_connections_accounts_owners_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.accounts.owners.list_async( + await client.v1.financial_connections.accounts.owners.list_async( "fca_xyz", {"ownership": "fcaowns_xyz"}, ) @@ -9305,6 +12250,30 @@ async def test_financial_connections_accounts_owners_get_service_async( api_base="https://api.stripe.com", ) + def test_financial_connections_accounts_owners_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/owners", + "limit=3&ownership=fcaowns_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.accounts.owners.list( + "fca_xxxxxxxxxxxxx", + {"limit": 3, "ownership": "fcaowns_xxxxxxxxxxxxx"}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/owners", + query_string="limit=3&ownership=fcaowns_xxxxxxxxxxxxx", + api_base="https://api.stripe.com", + ) + def test_financial_connections_accounts_owners_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -9332,7 +12301,7 @@ def test_financial_connections_accounts_owners_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.accounts.owners.list( + client.v1.financial_connections.accounts.owners.list( "fca_xxxxxxxxxxxxx", {"limit": 3, "ownership": "fcaowns_xxxxxxxxxxxxx"}, ) @@ -9372,7 +12341,7 @@ async def test_financial_connections_accounts_owners_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.accounts.owners.list_async( + await client.v1.financial_connections.accounts.owners.list_async( "fca_xxxxxxxxxxxxx", {"limit": 3, "ownership": "fcaowns_xxxxxxxxxxxxx"}, ) @@ -9383,6 +12352,30 @@ async def test_financial_connections_accounts_owners_get_2_service_async( api_base="https://api.stripe.com", ) + def test_financial_connections_accounts_refresh_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/financial_connections/accounts/fca_xyz/refresh", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.accounts.refresh( + "fca_xyz", + {"features": ["balance"]}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/financial_connections/accounts/fca_xyz/refresh", + query_string="", + api_base="https://api.stripe.com", + post_data="features[0]=balance", + ) + def test_financial_connections_accounts_refresh_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -9409,7 +12402,7 @@ def test_financial_connections_accounts_refresh_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.accounts.refresh( + client.v1.financial_connections.accounts.refresh( "fca_xyz", {"features": ["balance"]}, ) @@ -9449,7 +12442,7 @@ async def test_financial_connections_accounts_refresh_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.accounts.refresh_async( + await client.v1.financial_connections.accounts.refresh_async( "fca_xyz", {"features": ["balance"]}, ) @@ -9461,21 +12454,7 @@ async def test_financial_connections_accounts_refresh_post_service_async( post_data="features[0]=balance", ) - def test_financial_connections_accounts_subscribe_post( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.financial_connections.Account.subscribe( - "fa_123", - features=["transactions"], - ) - http_client_mock.assert_requested( - "post", - path="/v1/financial_connections/accounts/fa_123/subscribe", - query_string="", - post_data="features[0]=transactions", - ) - - def test_financial_connections_accounts_subscribe_post_service( + def test_financial_connections_accounts_subscribe_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -9499,6 +12478,44 @@ def test_financial_connections_accounts_subscribe_post_service( post_data="features[0]=transactions", ) + def test_financial_connections_accounts_subscribe_post( + self, http_client_mock: HTTPClientMock + ) -> None: + stripe.financial_connections.Account.subscribe( + "fa_123", + features=["transactions"], + ) + http_client_mock.assert_requested( + "post", + path="/v1/financial_connections/accounts/fa_123/subscribe", + query_string="", + post_data="features[0]=transactions", + ) + + def test_financial_connections_accounts_subscribe_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/financial_connections/accounts/fa_123/subscribe", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v1.financial_connections.accounts.subscribe( + "fa_123", + {"features": ["transactions"]}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/financial_connections/accounts/fa_123/subscribe", + query_string="", + api_base="https://api.stripe.com", + post_data="features[0]=transactions", + ) + @pytest.mark.anyio async def test_financial_connections_accounts_subscribe_post_async( self, http_client_mock: HTTPClientMock @@ -9527,7 +12544,7 @@ async def test_financial_connections_accounts_subscribe_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.accounts.subscribe_async( + await client.v1.financial_connections.accounts.subscribe_async( "fa_123", {"features": ["transactions"]}, ) @@ -9539,6 +12556,30 @@ async def test_financial_connections_accounts_subscribe_post_service_async( post_data="features[0]=transactions", ) + def test_financial_connections_accounts_unsubscribe_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/financial_connections/accounts/fa_123/unsubscribe", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.accounts.unsubscribe( + "fa_123", + {"features": ["transactions"]}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/financial_connections/accounts/fa_123/unsubscribe", + query_string="", + api_base="https://api.stripe.com", + post_data="features[0]=transactions", + ) + def test_financial_connections_accounts_unsubscribe_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -9565,7 +12606,7 @@ def test_financial_connections_accounts_unsubscribe_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.accounts.unsubscribe( + client.v1.financial_connections.accounts.unsubscribe( "fa_123", {"features": ["transactions"]}, ) @@ -9605,7 +12646,7 @@ async def test_financial_connections_accounts_unsubscribe_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.accounts.unsubscribe_async( + await client.v1.financial_connections.accounts.unsubscribe_async( "fa_123", {"features": ["transactions"]}, ) @@ -9617,6 +12658,26 @@ async def test_financial_connections_accounts_unsubscribe_post_service_async( post_data="features[0]=transactions", ) + def test_financial_connections_sessions_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/financial_connections/sessions/fcsess_xyz", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.sessions.retrieve("fcsess_xyz") + http_client_mock.assert_requested( + "get", + path="/v1/financial_connections/sessions/fcsess_xyz", + query_string="", + api_base="https://api.stripe.com", + ) + def test_financial_connections_sessions_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -9639,7 +12700,7 @@ def test_financial_connections_sessions_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.sessions.retrieve("fcsess_xyz") + client.v1.financial_connections.sessions.retrieve("fcsess_xyz") http_client_mock.assert_requested( "get", path="/v1/financial_connections/sessions/fcsess_xyz", @@ -9671,8 +12732,8 @@ async def test_financial_connections_sessions_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.sessions.retrieve_async( - "fcsess_xyz" + await client.v1.financial_connections.sessions.retrieve_async( + "fcsess_xyz", ) http_client_mock.assert_requested( "get", @@ -9681,6 +12742,26 @@ async def test_financial_connections_sessions_get_service_async( api_base="https://api.stripe.com", ) + def test_financial_connections_sessions_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/financial_connections/sessions/fcsess_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.sessions.retrieve("fcsess_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/financial_connections/sessions/fcsess_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_financial_connections_sessions_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -9703,7 +12784,9 @@ def test_financial_connections_sessions_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.sessions.retrieve("fcsess_xxxxxxxxxxxxx") + client.v1.financial_connections.sessions.retrieve( + "fcsess_xxxxxxxxxxxxx", + ) http_client_mock.assert_requested( "get", path="/v1/financial_connections/sessions/fcsess_xxxxxxxxxxxxx", @@ -9737,7 +12820,7 @@ async def test_financial_connections_sessions_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.sessions.retrieve_async( + await client.v1.financial_connections.sessions.retrieve_async( "fcsess_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -9747,6 +12830,32 @@ async def test_financial_connections_sessions_get_2_service_async( api_base="https://api.stripe.com", ) + def test_financial_connections_sessions_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/financial_connections/sessions", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.sessions.create( + { + "account_holder": {"type": "customer", "customer": "cus_123"}, + "permissions": ["balances"], + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/financial_connections/sessions", + query_string="", + api_base="https://api.stripe.com", + post_data="account_holder[type]=customer&account_holder[customer]=cus_123&permissions[0]=balances", + ) + def test_financial_connections_sessions_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -9773,7 +12882,7 @@ def test_financial_connections_sessions_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.sessions.create( + client.v1.financial_connections.sessions.create( { "account_holder": {"type": "customer", "customer": "cus_123"}, "permissions": ["balances"], @@ -9815,7 +12924,7 @@ async def test_financial_connections_sessions_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.sessions.create_async( + await client.v1.financial_connections.sessions.create_async( { "account_holder": {"type": "customer", "customer": "cus_123"}, "permissions": ["balances"], @@ -9829,6 +12938,36 @@ async def test_financial_connections_sessions_post_service_async( post_data="account_holder[type]=customer&account_holder[customer]=cus_123&permissions[0]=balances", ) + def test_financial_connections_sessions_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/financial_connections/sessions", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.sessions.create( + { + "account_holder": { + "type": "customer", + "customer": "cus_xxxxxxxxxxxxx", + }, + "permissions": ["payment_method", "balances"], + "filters": {"countries": ["US"]}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/financial_connections/sessions", + query_string="", + api_base="https://api.stripe.com", + post_data="account_holder[type]=customer&account_holder[customer]=cus_xxxxxxxxxxxxx&permissions[0]=payment_method&permissions[1]=balances&filters[countries][0]=US", + ) + def test_financial_connections_sessions_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -9859,7 +12998,7 @@ def test_financial_connections_sessions_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.sessions.create( + client.v1.financial_connections.sessions.create( { "account_holder": { "type": "customer", @@ -9909,7 +13048,7 @@ async def test_financial_connections_sessions_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.sessions.create_async( + await client.v1.financial_connections.sessions.create_async( { "account_holder": { "type": "customer", @@ -9927,6 +13066,26 @@ async def test_financial_connections_sessions_post_2_service_async( post_data="account_holder[type]=customer&account_holder[customer]=cus_xxxxxxxxxxxxx&permissions[0]=payment_method&permissions[1]=balances&filters[countries][0]=US", ) + def test_financial_connections_transactions_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/financial_connections/transactions/tr_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.transactions.retrieve("tr_123") + http_client_mock.assert_requested( + "get", + path="/v1/financial_connections/transactions/tr_123", + query_string="", + api_base="https://api.stripe.com", + ) + def test_financial_connections_transactions_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -9949,7 +13108,7 @@ def test_financial_connections_transactions_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.transactions.retrieve("tr_123") + client.v1.financial_connections.transactions.retrieve("tr_123") http_client_mock.assert_requested( "get", path="/v1/financial_connections/transactions/tr_123", @@ -9981,8 +13140,8 @@ async def test_financial_connections_transactions_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.transactions.retrieve_async( - "tr_123" + await client.v1.financial_connections.transactions.retrieve_async( + "tr_123", ) http_client_mock.assert_requested( "get", @@ -9991,6 +13150,27 @@ async def test_financial_connections_transactions_get_service_async( api_base="https://api.stripe.com", ) + def test_financial_connections_transactions_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/financial_connections/transactions", + "account=fca_xyz", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.financial_connections.transactions.list({"account": "fca_xyz"}) + http_client_mock.assert_requested( + "get", + path="/v1/financial_connections/transactions", + query_string="account=fca_xyz", + api_base="https://api.stripe.com", + ) + def test_financial_connections_transactions_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -10014,7 +13194,11 @@ def test_financial_connections_transactions_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.financial_connections.transactions.list({"account": "fca_xyz"}) + client.v1.financial_connections.transactions.list( + { + "account": "fca_xyz", + } + ) http_client_mock.assert_requested( "get", path="/v1/financial_connections/transactions", @@ -10049,7 +13233,7 @@ async def test_financial_connections_transactions_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.financial_connections.transactions.list_async( + await client.v1.financial_connections.transactions.list_async( { "account": "fca_xyz", } @@ -10061,6 +13245,27 @@ async def test_financial_connections_transactions_get_2_service_async( api_base="https://api.stripe.com", ) + def test_identity_verification_reports_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/identity/verification_reports", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.identity.verification_reports.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/identity/verification_reports", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_identity_verification_reports_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -10084,7 +13289,7 @@ def test_identity_verification_reports_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.identity.verification_reports.list({"limit": 3}) + client.v1.identity.verification_reports.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/identity/verification_reports", @@ -10117,7 +13322,7 @@ async def test_identity_verification_reports_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.identity.verification_reports.list_async({"limit": 3}) + await client.v1.identity.verification_reports.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/identity/verification_reports", @@ -10125,6 +13330,26 @@ async def test_identity_verification_reports_get_service_async( api_base="https://api.stripe.com", ) + def test_identity_verification_reports_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/identity/verification_reports/vr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.identity.verification_reports.retrieve("vr_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/identity/verification_reports/vr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_identity_verification_reports_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -10147,7 +13372,7 @@ def test_identity_verification_reports_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.identity.verification_reports.retrieve("vr_xxxxxxxxxxxxx") + client.v1.identity.verification_reports.retrieve("vr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/identity/verification_reports/vr_xxxxxxxxxxxxx", @@ -10181,7 +13406,7 @@ async def test_identity_verification_reports_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.identity.verification_reports.retrieve_async( + await client.v1.identity.verification_reports.retrieve_async( "vr_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -10191,6 +13416,26 @@ async def test_identity_verification_reports_get_2_service_async( api_base="https://api.stripe.com", ) + def test_identity_verification_sessions_cancel_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.identity.verification_sessions.cancel("vs_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/cancel", + query_string="", + api_base="https://api.stripe.com", + ) + def test_identity_verification_sessions_cancel_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -10213,7 +13458,7 @@ def test_identity_verification_sessions_cancel_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.identity.verification_sessions.cancel("vs_xxxxxxxxxxxxx") + client.v1.identity.verification_sessions.cancel("vs_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/cancel", @@ -10247,7 +13492,7 @@ async def test_identity_verification_sessions_cancel_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.identity.verification_sessions.cancel_async( + await client.v1.identity.verification_sessions.cancel_async( "vs_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -10257,6 +13502,27 @@ async def test_identity_verification_sessions_cancel_post_service_async( api_base="https://api.stripe.com", ) + def test_identity_verification_sessions_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/identity/verification_sessions", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.identity.verification_sessions.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/identity/verification_sessions", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_identity_verification_sessions_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -10280,7 +13546,7 @@ def test_identity_verification_sessions_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.identity.verification_sessions.list({"limit": 3}) + client.v1.identity.verification_sessions.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/identity/verification_sessions", @@ -10313,7 +13579,7 @@ async def test_identity_verification_sessions_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.identity.verification_sessions.list_async({"limit": 3}) + await client.v1.identity.verification_sessions.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/identity/verification_sessions", @@ -10321,6 +13587,26 @@ async def test_identity_verification_sessions_get_service_async( api_base="https://api.stripe.com", ) + def test_identity_verification_sessions_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.identity.verification_sessions.retrieve("vs_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_identity_verification_sessions_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -10343,7 +13629,7 @@ def test_identity_verification_sessions_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.identity.verification_sessions.retrieve("vs_xxxxxxxxxxxxx") + client.v1.identity.verification_sessions.retrieve("vs_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx", @@ -10377,7 +13663,7 @@ async def test_identity_verification_sessions_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.identity.verification_sessions.retrieve_async( + await client.v1.identity.verification_sessions.retrieve_async( "vs_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -10387,6 +13673,27 @@ async def test_identity_verification_sessions_get_2_service_async( api_base="https://api.stripe.com", ) + def test_identity_verification_sessions_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/identity/verification_sessions", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.identity.verification_sessions.create({"type": "document"}) + http_client_mock.assert_requested( + "post", + path="/v1/identity/verification_sessions", + query_string="", + api_base="https://api.stripe.com", + post_data="type=document", + ) + def test_identity_verification_sessions_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -10410,7 +13717,7 @@ def test_identity_verification_sessions_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.identity.verification_sessions.create({"type": "document"}) + client.v1.identity.verification_sessions.create({"type": "document"}) http_client_mock.assert_requested( "post", path="/v1/identity/verification_sessions", @@ -10444,7 +13751,7 @@ async def test_identity_verification_sessions_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.identity.verification_sessions.create_async( + await client.v1.identity.verification_sessions.create_async( { "type": "document", } @@ -10457,6 +13764,30 @@ async def test_identity_verification_sessions_post_service_async( post_data="type=document", ) + def test_identity_verification_sessions_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.identity.verification_sessions.update( + "vs_xxxxxxxxxxxxx", + {"type": "id_number"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="type=id_number", + ) + def test_identity_verification_sessions_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -10483,7 +13814,7 @@ def test_identity_verification_sessions_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.identity.verification_sessions.update( + client.v1.identity.verification_sessions.update( "vs_xxxxxxxxxxxxx", {"type": "id_number"}, ) @@ -10523,7 +13854,7 @@ async def test_identity_verification_sessions_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.identity.verification_sessions.update_async( + await client.v1.identity.verification_sessions.update_async( "vs_xxxxxxxxxxxxx", {"type": "id_number"}, ) @@ -10535,6 +13866,26 @@ async def test_identity_verification_sessions_post_2_service_async( post_data="type=id_number", ) + def test_identity_verification_sessions_redact_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/redact", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.identity.verification_sessions.redact("vs_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/redact", + query_string="", + api_base="https://api.stripe.com", + ) + def test_identity_verification_sessions_redact_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -10557,7 +13908,7 @@ def test_identity_verification_sessions_redact_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.identity.verification_sessions.redact("vs_xxxxxxxxxxxxx") + client.v1.identity.verification_sessions.redact("vs_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/redact", @@ -10591,7 +13942,7 @@ async def test_identity_verification_sessions_redact_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.identity.verification_sessions.redact_async( + await client.v1.identity.verification_sessions.redact_async( "vs_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -10601,6 +13952,26 @@ async def test_identity_verification_sessions_redact_post_service_async( api_base="https://api.stripe.com", ) + def test_invoiceitems_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/invoiceitems/ii_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoice_items.delete("ii_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/invoiceitems/ii_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_invoiceitems_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -10623,7 +13994,7 @@ def test_invoiceitems_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoice_items.delete("ii_xxxxxxxxxxxxx") + client.v1.invoice_items.delete("ii_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/invoiceitems/ii_xxxxxxxxxxxxx", @@ -10655,7 +14026,7 @@ async def test_invoiceitems_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoice_items.delete_async("ii_xxxxxxxxxxxxx") + await client.v1.invoice_items.delete_async("ii_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/invoiceitems/ii_xxxxxxxxxxxxx", @@ -10663,6 +14034,27 @@ async def test_invoiceitems_delete_service_async( api_base="https://api.stripe.com", ) + def test_invoiceitems_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/invoiceitems", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoice_items.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/invoiceitems", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_invoiceitems_get(self, http_client_mock: HTTPClientMock) -> None: stripe.InvoiceItem.list(limit=3) http_client_mock.assert_requested( @@ -10684,7 +14076,7 @@ def test_invoiceitems_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoice_items.list({"limit": 3}) + client.v1.invoice_items.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/invoiceitems", @@ -10717,7 +14109,7 @@ async def test_invoiceitems_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoice_items.list_async({"limit": 3}) + await client.v1.invoice_items.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/invoiceitems", @@ -10725,6 +14117,26 @@ async def test_invoiceitems_get_service_async( api_base="https://api.stripe.com", ) + def test_invoiceitems_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/invoiceitems/ii_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoice_items.retrieve("ii_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/invoiceitems/ii_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_invoiceitems_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -10747,7 +14159,7 @@ def test_invoiceitems_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoice_items.retrieve("ii_xxxxxxxxxxxxx") + client.v1.invoice_items.retrieve("ii_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/invoiceitems/ii_xxxxxxxxxxxxx", @@ -10779,7 +14191,7 @@ async def test_invoiceitems_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoice_items.retrieve_async("ii_xxxxxxxxxxxxx") + await client.v1.invoice_items.retrieve_async("ii_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/invoiceitems/ii_xxxxxxxxxxxxx", @@ -10787,6 +14199,27 @@ async def test_invoiceitems_get_2_service_async( api_base="https://api.stripe.com", ) + def test_invoiceitems_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/invoiceitems", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoice_items.create({"customer": "cus_xxxxxxxxxxxxx"}) + http_client_mock.assert_requested( + "post", + path="/v1/invoiceitems", + query_string="", + api_base="https://api.stripe.com", + post_data="customer=cus_xxxxxxxxxxxxx", + ) + def test_invoiceitems_post(self, http_client_mock: HTTPClientMock) -> None: stripe.InvoiceItem.create(customer="cus_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -10808,7 +14241,7 @@ def test_invoiceitems_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoice_items.create({"customer": "cus_xxxxxxxxxxxxx"}) + client.v1.invoice_items.create({"customer": "cus_xxxxxxxxxxxxx"}) http_client_mock.assert_requested( "post", path="/v1/invoiceitems", @@ -10842,7 +14275,7 @@ async def test_invoiceitems_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoice_items.create_async( + await client.v1.invoice_items.create_async( { "customer": "cus_xxxxxxxxxxxxx", } @@ -10855,6 +14288,30 @@ async def test_invoiceitems_post_service_async( post_data="customer=cus_xxxxxxxxxxxxx", ) + def test_invoiceitems_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/invoiceitems/ii_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoice_items.update( + "ii_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/invoiceitems/ii_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_invoiceitems_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -10881,7 +14338,7 @@ def test_invoiceitems_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoice_items.update( + client.v1.invoice_items.update( "ii_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -10921,7 +14378,7 @@ async def test_invoiceitems_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoice_items.update_async( + await client.v1.invoice_items.update_async( "ii_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -10933,6 +14390,26 @@ async def test_invoiceitems_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_invoices_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/invoices/in_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoices.delete("in_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/invoices/in_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_invoices_delete(self, http_client_mock: HTTPClientMock) -> None: stripe.Invoice.delete("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -10953,7 +14430,7 @@ def test_invoices_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoices.delete("in_xxxxxxxxxxxxx") + client.v1.invoices.delete("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/invoices/in_xxxxxxxxxxxxx", @@ -10985,7 +14462,7 @@ async def test_invoices_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoices.delete_async("in_xxxxxxxxxxxxx") + await client.v1.invoices.delete_async("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/invoices/in_xxxxxxxxxxxxx", @@ -10993,6 +14470,26 @@ async def test_invoices_delete_service_async( api_base="https://api.stripe.com", ) + def test_invoices_finalize_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/invoices/in_xxxxxxxxxxxxx/finalize", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoices.finalize_invoice("in_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/invoices/in_xxxxxxxxxxxxx/finalize", + query_string="", + api_base="https://api.stripe.com", + ) + def test_invoices_finalize_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -11015,7 +14512,7 @@ def test_invoices_finalize_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoices.finalize_invoice("in_xxxxxxxxxxxxx") + client.v1.invoices.finalize_invoice("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/invoices/in_xxxxxxxxxxxxx/finalize", @@ -11047,7 +14544,7 @@ async def test_invoices_finalize_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoices.finalize_invoice_async("in_xxxxxxxxxxxxx") + await client.v1.invoices.finalize_invoice_async("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/invoices/in_xxxxxxxxxxxxx/finalize", @@ -11055,6 +14552,27 @@ async def test_invoices_finalize_post_service_async( api_base="https://api.stripe.com", ) + def test_invoices_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/invoices", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoices.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/invoices", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_invoices_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Invoice.list(limit=3) http_client_mock.assert_requested( @@ -11076,7 +14594,7 @@ def test_invoices_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoices.list({"limit": 3}) + client.v1.invoices.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/invoices", @@ -11109,7 +14627,7 @@ async def test_invoices_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoices.list_async({"limit": 3}) + await client.v1.invoices.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/invoices", @@ -11117,6 +14635,26 @@ async def test_invoices_get_service_async( api_base="https://api.stripe.com", ) + def test_invoices_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/invoices/in_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoices.retrieve("in_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/invoices/in_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_invoices_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Invoice.retrieve("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -11137,7 +14675,7 @@ def test_invoices_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoices.retrieve("in_xxxxxxxxxxxxx") + client.v1.invoices.retrieve("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/invoices/in_xxxxxxxxxxxxx", @@ -11169,7 +14707,7 @@ async def test_invoices_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoices.retrieve_async("in_xxxxxxxxxxxxx") + await client.v1.invoices.retrieve_async("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/invoices/in_xxxxxxxxxxxxx", @@ -11177,6 +14715,30 @@ async def test_invoices_get_2_service_async( api_base="https://api.stripe.com", ) + def test_invoices_get_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/invoices/in_xxxxxxxxxxxxx", + "expand[0]=customer", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoices.retrieve( + "in_xxxxxxxxxxxxx", + {"expand": ["customer"]}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/invoices/in_xxxxxxxxxxxxx", + query_string="expand[0]=customer", + api_base="https://api.stripe.com", + ) + def test_invoices_get_3(self, http_client_mock: HTTPClientMock) -> None: stripe.Invoice.retrieve( "in_xxxxxxxxxxxxx", @@ -11201,7 +14763,7 @@ def test_invoices_get_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoices.retrieve( + client.v1.invoices.retrieve( "in_xxxxxxxxxxxxx", {"expand": ["customer"]}, ) @@ -11240,7 +14802,7 @@ async def test_invoices_get_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoices.retrieve_async( + await client.v1.invoices.retrieve_async( "in_xxxxxxxxxxxxx", {"expand": ["customer"]}, ) @@ -11251,6 +14813,26 @@ async def test_invoices_get_3_service_async( api_base="https://api.stripe.com", ) + def test_invoices_mark_uncollectible_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/invoices/in_xxxxxxxxxxxxx/mark_uncollectible", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoices.mark_uncollectible("in_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/invoices/in_xxxxxxxxxxxxx/mark_uncollectible", + query_string="", + api_base="https://api.stripe.com", + ) + def test_invoices_mark_uncollectible_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -11273,7 +14855,7 @@ def test_invoices_mark_uncollectible_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoices.mark_uncollectible("in_xxxxxxxxxxxxx") + client.v1.invoices.mark_uncollectible("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/invoices/in_xxxxxxxxxxxxx/mark_uncollectible", @@ -11305,7 +14887,7 @@ async def test_invoices_mark_uncollectible_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoices.mark_uncollectible_async("in_xxxxxxxxxxxxx") + await client.v1.invoices.mark_uncollectible_async("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/invoices/in_xxxxxxxxxxxxx/mark_uncollectible", @@ -11313,6 +14895,26 @@ async def test_invoices_mark_uncollectible_post_service_async( api_base="https://api.stripe.com", ) + def test_invoices_pay_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/invoices/in_xxxxxxxxxxxxx/pay", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoices.pay("in_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/invoices/in_xxxxxxxxxxxxx/pay", + query_string="", + api_base="https://api.stripe.com", + ) + def test_invoices_pay_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Invoice.pay("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -11333,7 +14935,7 @@ def test_invoices_pay_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoices.pay("in_xxxxxxxxxxxxx") + client.v1.invoices.pay("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/invoices/in_xxxxxxxxxxxxx/pay", @@ -11365,7 +14967,7 @@ async def test_invoices_pay_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoices.pay_async("in_xxxxxxxxxxxxx") + await client.v1.invoices.pay_async("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/invoices/in_xxxxxxxxxxxxx/pay", @@ -11373,6 +14975,27 @@ async def test_invoices_pay_post_service_async( api_base="https://api.stripe.com", ) + def test_invoices_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/invoices", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoices.create({"customer": "cus_xxxxxxxxxxxxx"}) + http_client_mock.assert_requested( + "post", + path="/v1/invoices", + query_string="", + api_base="https://api.stripe.com", + post_data="customer=cus_xxxxxxxxxxxxx", + ) + def test_invoices_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Invoice.create(customer="cus_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -11394,7 +15017,7 @@ def test_invoices_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoices.create({"customer": "cus_xxxxxxxxxxxxx"}) + client.v1.invoices.create({"customer": "cus_xxxxxxxxxxxxx"}) http_client_mock.assert_requested( "post", path="/v1/invoices", @@ -11428,7 +15051,9 @@ async def test_invoices_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoices.create_async({"customer": "cus_xxxxxxxxxxxxx"}) + await client.v1.invoices.create_async( + {"customer": "cus_xxxxxxxxxxxxx"} + ) http_client_mock.assert_requested( "post", path="/v1/invoices", @@ -11437,6 +15062,30 @@ async def test_invoices_post_service_async( post_data="customer=cus_xxxxxxxxxxxxx", ) + def test_invoices_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/invoices/in_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoices.update( + "in_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/invoices/in_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_invoices_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Invoice.modify( "in_xxxxxxxxxxxxx", @@ -11461,7 +15110,7 @@ def test_invoices_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoices.update( + client.v1.invoices.update( "in_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -11501,7 +15150,7 @@ async def test_invoices_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoices.update_async( + await client.v1.invoices.update_async( "in_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -11513,6 +15162,31 @@ async def test_invoices_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_invoices_search_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/invoices/search", + "query=total%3E999%20AND%20metadata%5B%27order_id%27%5D%3A%276735%27", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoices.search( + { + "query": "total>999 AND metadata['order_id']:'6735'", + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/invoices/search", + query_string="query=total%3E999%20AND%20metadata%5B%27order_id%27%5D%3A%276735%27", + api_base="https://api.stripe.com", + ) + def test_invoices_search_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -11538,7 +15212,7 @@ def test_invoices_search_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoices.search( + client.v1.invoices.search( { "query": "total>999 AND metadata['order_id']:'6735'", } @@ -11577,7 +15251,7 @@ async def test_invoices_search_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoices.search_async( + await client.v1.invoices.search_async( { "query": "total>999 AND metadata['order_id']:'6735'", } @@ -11589,6 +15263,26 @@ async def test_invoices_search_get_service_async( api_base="https://api.stripe.com", ) + def test_invoices_send_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/invoices/in_xxxxxxxxxxxxx/send", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoices.send_invoice("in_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/invoices/in_xxxxxxxxxxxxx/send", + query_string="", + api_base="https://api.stripe.com", + ) + def test_invoices_send_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -11611,7 +15305,7 @@ def test_invoices_send_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoices.send_invoice("in_xxxxxxxxxxxxx") + client.v1.invoices.send_invoice("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/invoices/in_xxxxxxxxxxxxx/send", @@ -11643,7 +15337,7 @@ async def test_invoices_send_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoices.send_invoice_async("in_xxxxxxxxxxxxx") + await client.v1.invoices.send_invoice_async("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/invoices/in_xxxxxxxxxxxxx/send", @@ -11651,6 +15345,26 @@ async def test_invoices_send_post_service_async( api_base="https://api.stripe.com", ) + def test_invoices_void_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/invoices/in_xxxxxxxxxxxxx/void", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.invoices.void_invoice("in_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/invoices/in_xxxxxxxxxxxxx/void", + query_string="", + api_base="https://api.stripe.com", + ) + def test_invoices_void_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -11673,7 +15387,7 @@ def test_invoices_void_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.invoices.void_invoice("in_xxxxxxxxxxxxx") + client.v1.invoices.void_invoice("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/invoices/in_xxxxxxxxxxxxx/void", @@ -11705,7 +15419,7 @@ async def test_invoices_void_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.invoices.void_invoice_async("in_xxxxxxxxxxxxx") + await client.v1.invoices.void_invoice_async("in_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/invoices/in_xxxxxxxxxxxxx/void", @@ -11713,6 +15427,26 @@ async def test_invoices_void_post_service_async( api_base="https://api.stripe.com", ) + def test_issuing_authorizations_approve_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/approve", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.authorizations.approve("iauth_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/approve", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_authorizations_approve_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -11735,7 +15469,7 @@ def test_issuing_authorizations_approve_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.authorizations.approve("iauth_xxxxxxxxxxxxx") + client.v1.issuing.authorizations.approve("iauth_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/approve", @@ -11767,8 +15501,8 @@ async def test_issuing_authorizations_approve_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.authorizations.approve_async( - "iauth_xxxxxxxxxxxxx" + await client.v1.issuing.authorizations.approve_async( + "iauth_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( "post", @@ -11777,6 +15511,26 @@ async def test_issuing_authorizations_approve_post_service_async( api_base="https://api.stripe.com", ) + def test_issuing_authorizations_decline_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/decline", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.authorizations.decline("iauth_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/decline", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_authorizations_decline_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -11799,7 +15553,7 @@ def test_issuing_authorizations_decline_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.authorizations.decline("iauth_xxxxxxxxxxxxx") + client.v1.issuing.authorizations.decline("iauth_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/decline", @@ -11831,8 +15585,8 @@ async def test_issuing_authorizations_decline_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.authorizations.decline_async( - "iauth_xxxxxxxxxxxxx" + await client.v1.issuing.authorizations.decline_async( + "iauth_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( "post", @@ -11841,6 +15595,27 @@ async def test_issuing_authorizations_decline_post_service_async( api_base="https://api.stripe.com", ) + def test_issuing_authorizations_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/authorizations", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.authorizations.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/issuing/authorizations", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_issuing_authorizations_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -11864,7 +15639,7 @@ def test_issuing_authorizations_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.authorizations.list({"limit": 3}) + client.v1.issuing.authorizations.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/issuing/authorizations", @@ -11897,7 +15672,7 @@ async def test_issuing_authorizations_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.authorizations.list_async({"limit": 3}) + await client.v1.issuing.authorizations.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/issuing/authorizations", @@ -11905,6 +15680,26 @@ async def test_issuing_authorizations_get_service_async( api_base="https://api.stripe.com", ) + def test_issuing_authorizations_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.authorizations.retrieve("iauth_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_authorizations_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -11927,7 +15722,7 @@ def test_issuing_authorizations_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.authorizations.retrieve("iauth_xxxxxxxxxxxxx") + client.v1.issuing.authorizations.retrieve("iauth_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", @@ -11961,7 +15756,7 @@ async def test_issuing_authorizations_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.authorizations.retrieve_async( + await client.v1.issuing.authorizations.retrieve_async( "iauth_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -11971,6 +15766,30 @@ async def test_issuing_authorizations_get_2_service_async( api_base="https://api.stripe.com", ) + def test_issuing_authorizations_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.authorizations.update( + "iauth_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_issuing_authorizations_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -11997,7 +15816,7 @@ def test_issuing_authorizations_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.authorizations.update( + client.v1.issuing.authorizations.update( "iauth_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -12037,7 +15856,7 @@ async def test_issuing_authorizations_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.authorizations.update_async( + await client.v1.issuing.authorizations.update_async( "iauth_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -12049,6 +15868,27 @@ async def test_issuing_authorizations_post_service_async( post_data="metadata[order_id]=6735", ) + def test_issuing_cardholders_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/cardholders", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.cardholders.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/issuing/cardholders", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_issuing_cardholders_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -12072,7 +15912,7 @@ def test_issuing_cardholders_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.cardholders.list({"limit": 3}) + client.v1.issuing.cardholders.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/issuing/cardholders", @@ -12105,7 +15945,7 @@ async def test_issuing_cardholders_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.cardholders.list_async({"limit": 3}) + await client.v1.issuing.cardholders.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/issuing/cardholders", @@ -12113,6 +15953,26 @@ async def test_issuing_cardholders_get_service_async( api_base="https://api.stripe.com", ) + def test_issuing_cardholders_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.cardholders.retrieve("ich_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_cardholders_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -12135,7 +15995,7 @@ def test_issuing_cardholders_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.cardholders.retrieve("ich_xxxxxxxxxxxxx") + client.v1.issuing.cardholders.retrieve("ich_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", @@ -12167,7 +16027,7 @@ async def test_issuing_cardholders_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.cardholders.retrieve_async("ich_xxxxxxxxxxxxx") + await client.v1.issuing.cardholders.retrieve_async("ich_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", @@ -12175,6 +16035,43 @@ async def test_issuing_cardholders_get_2_service_async( api_base="https://api.stripe.com", ) + def test_issuing_cardholders_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/issuing/cardholders", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.cardholders.create( + { + "type": "individual", + "name": "Jenny Rosen", + "email": "jenny.rosen@example.com", + "phone_number": "+18888675309", + "billing": { + "address": { + "line1": "1234 Main Street", + "city": "San Francisco", + "state": "CA", + "country": "US", + "postal_code": "94111", + }, + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/issuing/cardholders", + query_string="", + api_base="https://api.stripe.com", + post_data="type=individual&name=Jenny%20Rosen&email=jenny.rosen%40example.com&phone_number=%2B18888675309&billing[address][line1]=1234%20Main%20Street&billing[address][city]=San%20Francisco&billing[address][state]=CA&billing[address][country]=US&billing[address][postal_code]=94111", + ) + def test_issuing_cardholders_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -12212,7 +16109,7 @@ def test_issuing_cardholders_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.cardholders.create( + client.v1.issuing.cardholders.create( { "type": "individual", "name": "Jenny Rosen", @@ -12276,7 +16173,7 @@ async def test_issuing_cardholders_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.cardholders.create_async( + await client.v1.issuing.cardholders.create_async( { "type": "individual", "name": "Jenny Rosen", @@ -12301,6 +16198,30 @@ async def test_issuing_cardholders_post_service_async( post_data="type=individual&name=Jenny%20Rosen&email=jenny.rosen%40example.com&phone_number=%2B18888675309&billing[address][line1]=1234%20Main%20Street&billing[address][city]=San%20Francisco&billing[address][state]=CA&billing[address][country]=US&billing[address][postal_code]=94111", ) + def test_issuing_cardholders_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.cardholders.update( + "ich_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_issuing_cardholders_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -12327,7 +16248,7 @@ def test_issuing_cardholders_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.cardholders.update( + client.v1.issuing.cardholders.update( "ich_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -12367,7 +16288,7 @@ async def test_issuing_cardholders_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.cardholders.update_async( + await client.v1.issuing.cardholders.update_async( "ich_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -12379,6 +16300,27 @@ async def test_issuing_cardholders_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_issuing_cards_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/cards", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.cards.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/issuing/cards", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_issuing_cards_get(self, http_client_mock: HTTPClientMock) -> None: stripe.issuing.Card.list(limit=3) http_client_mock.assert_requested( @@ -12400,7 +16342,7 @@ def test_issuing_cards_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.cards.list({"limit": 3}) + client.v1.issuing.cards.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/issuing/cards", @@ -12433,7 +16375,7 @@ async def test_issuing_cards_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.cards.list_async({"limit": 3}) + await client.v1.issuing.cards.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/issuing/cards", @@ -12441,6 +16383,26 @@ async def test_issuing_cards_get_service_async( api_base="https://api.stripe.com", ) + def test_issuing_cards_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/cards/ic_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.cards.retrieve("ic_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/issuing/cards/ic_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_cards_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -12463,7 +16425,7 @@ def test_issuing_cards_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.cards.retrieve("ic_xxxxxxxxxxxxx") + client.v1.issuing.cards.retrieve("ic_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/issuing/cards/ic_xxxxxxxxxxxxx", @@ -12495,7 +16457,7 @@ async def test_issuing_cards_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.cards.retrieve_async("ic_xxxxxxxxxxxxx") + await client.v1.issuing.cards.retrieve_async("ic_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/issuing/cards/ic_xxxxxxxxxxxxx", @@ -12503,6 +16465,33 @@ async def test_issuing_cards_get_2_service_async( api_base="https://api.stripe.com", ) + def test_issuing_cards_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/issuing/cards", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.cards.create( + { + "cardholder": "ich_xxxxxxxxxxxxx", + "currency": "usd", + "type": "virtual", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/issuing/cards", + query_string="", + api_base="https://api.stripe.com", + post_data="cardholder=ich_xxxxxxxxxxxxx¤cy=usd&type=virtual", + ) + def test_issuing_cards_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -12530,7 +16519,7 @@ def test_issuing_cards_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.cards.create( + client.v1.issuing.cards.create( { "cardholder": "ich_xxxxxxxxxxxxx", "currency": "usd", @@ -12574,7 +16563,7 @@ async def test_issuing_cards_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.cards.create_async( + await client.v1.issuing.cards.create_async( { "cardholder": "ich_xxxxxxxxxxxxx", "currency": "usd", @@ -12589,6 +16578,30 @@ async def test_issuing_cards_post_service_async( post_data="cardholder=ich_xxxxxxxxxxxxx¤cy=usd&type=virtual", ) + def test_issuing_cards_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/issuing/cards/ic_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.cards.update( + "ic_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/issuing/cards/ic_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_issuing_cards_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -12615,7 +16628,7 @@ def test_issuing_cards_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.cards.update( + client.v1.issuing.cards.update( "ic_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -12655,7 +16668,7 @@ async def test_issuing_cards_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.cards.update_async( + await client.v1.issuing.cards.update_async( "ic_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -12667,6 +16680,27 @@ async def test_issuing_cards_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_issuing_disputes_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/disputes", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.disputes.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/issuing/disputes", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_issuing_disputes_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -12690,7 +16724,7 @@ def test_issuing_disputes_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.disputes.list({"limit": 3}) + client.v1.issuing.disputes.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/issuing/disputes", @@ -12723,7 +16757,7 @@ async def test_issuing_disputes_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.disputes.list_async({"limit": 3}) + await client.v1.issuing.disputes.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/issuing/disputes", @@ -12731,6 +16765,26 @@ async def test_issuing_disputes_get_service_async( api_base="https://api.stripe.com", ) + def test_issuing_disputes_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/disputes/idp_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.disputes.retrieve("idp_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/issuing/disputes/idp_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_disputes_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -12753,7 +16807,7 @@ def test_issuing_disputes_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.disputes.retrieve("idp_xxxxxxxxxxxxx") + client.v1.issuing.disputes.retrieve("idp_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/issuing/disputes/idp_xxxxxxxxxxxxx", @@ -12785,7 +16839,7 @@ async def test_issuing_disputes_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.disputes.retrieve_async("idp_xxxxxxxxxxxxx") + await client.v1.issuing.disputes.retrieve_async("idp_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/issuing/disputes/idp_xxxxxxxxxxxxx", @@ -12793,6 +16847,37 @@ async def test_issuing_disputes_get_2_service_async( api_base="https://api.stripe.com", ) + def test_issuing_disputes_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/issuing/disputes", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.disputes.create( + { + "transaction": "ipi_xxxxxxxxxxxxx", + "evidence": { + "reason": "fraudulent", + "fraudulent": { + "explanation": "Purchase was unrecognized." + }, + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/issuing/disputes", + query_string="", + api_base="https://api.stripe.com", + post_data="transaction=ipi_xxxxxxxxxxxxx&evidence[reason]=fraudulent&evidence[fraudulent][explanation]=Purchase%20was%20unrecognized.", + ) + def test_issuing_disputes_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -12822,7 +16907,7 @@ def test_issuing_disputes_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.disputes.create( + client.v1.issuing.disputes.create( { "transaction": "ipi_xxxxxxxxxxxxx", "evidence": { @@ -12872,7 +16957,7 @@ async def test_issuing_disputes_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.disputes.create_async( + await client.v1.issuing.disputes.create_async( { "transaction": "ipi_xxxxxxxxxxxxx", "evidence": { @@ -12891,6 +16976,26 @@ async def test_issuing_disputes_post_service_async( post_data="transaction=ipi_xxxxxxxxxxxxx&evidence[reason]=fraudulent&evidence[fraudulent][explanation]=Purchase%20was%20unrecognized.", ) + def test_issuing_disputes_submit_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/issuing/disputes/idp_xxxxxxxxxxxxx/submit", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.disputes.submit("idp_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/issuing/disputes/idp_xxxxxxxxxxxxx/submit", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_disputes_submit_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -12913,7 +17018,7 @@ def test_issuing_disputes_submit_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.disputes.submit("idp_xxxxxxxxxxxxx") + client.v1.issuing.disputes.submit("idp_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/issuing/disputes/idp_xxxxxxxxxxxxx/submit", @@ -12945,7 +17050,7 @@ async def test_issuing_disputes_submit_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.disputes.submit_async("idp_xxxxxxxxxxxxx") + await client.v1.issuing.disputes.submit_async("idp_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/issuing/disputes/idp_xxxxxxxxxxxxx/submit", @@ -12953,6 +17058,26 @@ async def test_issuing_disputes_submit_post_service_async( api_base="https://api.stripe.com", ) + def test_issuing_personalization_designs_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/personalization_designs", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.personalization_designs.list() + http_client_mock.assert_requested( + "get", + path="/v1/issuing/personalization_designs", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_personalization_designs_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -12975,7 +17100,7 @@ def test_issuing_personalization_designs_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.personalization_designs.list() + client.v1.issuing.personalization_designs.list() http_client_mock.assert_requested( "get", path="/v1/issuing/personalization_designs", @@ -13007,7 +17132,7 @@ async def test_issuing_personalization_designs_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.personalization_designs.list_async() + await client.v1.issuing.personalization_designs.list_async() http_client_mock.assert_requested( "get", path="/v1/issuing/personalization_designs", @@ -13015,6 +17140,26 @@ async def test_issuing_personalization_designs_get_service_async( api_base="https://api.stripe.com", ) + def test_issuing_personalization_designs_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/personalization_designs/pd_xyz", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.personalization_designs.retrieve("pd_xyz") + http_client_mock.assert_requested( + "get", + path="/v1/issuing/personalization_designs/pd_xyz", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_personalization_designs_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -13037,7 +17182,7 @@ def test_issuing_personalization_designs_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.personalization_designs.retrieve("pd_xyz") + client.v1.issuing.personalization_designs.retrieve("pd_xyz") http_client_mock.assert_requested( "get", path="/v1/issuing/personalization_designs/pd_xyz", @@ -13069,7 +17214,9 @@ async def test_issuing_personalization_designs_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.personalization_designs.retrieve_async("pd_xyz") + await client.v1.issuing.personalization_designs.retrieve_async( + "pd_xyz" + ) http_client_mock.assert_requested( "get", path="/v1/issuing/personalization_designs/pd_xyz", @@ -13077,6 +17224,31 @@ async def test_issuing_personalization_designs_get_2_service_async( api_base="https://api.stripe.com", ) + def test_issuing_personalization_designs_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/issuing/personalization_designs", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.personalization_designs.create( + { + "physical_bundle": "pb_xyz", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/issuing/personalization_designs", + query_string="", + api_base="https://api.stripe.com", + post_data="physical_bundle=pb_xyz", + ) + def test_issuing_personalization_designs_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -13100,7 +17272,7 @@ def test_issuing_personalization_designs_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.personalization_designs.create( + client.v1.issuing.personalization_designs.create( { "physical_bundle": "pb_xyz", } @@ -13140,7 +17312,7 @@ async def test_issuing_personalization_designs_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.personalization_designs.create_async( + await client.v1.issuing.personalization_designs.create_async( { "physical_bundle": "pb_xyz", } @@ -13153,6 +17325,26 @@ async def test_issuing_personalization_designs_post_service_async( post_data="physical_bundle=pb_xyz", ) + def test_issuing_personalization_designs_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/issuing/personalization_designs/pd_xyz", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.personalization_designs.update("pd_xyz") + http_client_mock.assert_requested( + "post", + path="/v1/issuing/personalization_designs/pd_xyz", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_personalization_designs_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -13175,7 +17367,7 @@ def test_issuing_personalization_designs_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.personalization_designs.update("pd_xyz") + client.v1.issuing.personalization_designs.update("pd_xyz") http_client_mock.assert_requested( "post", path="/v1/issuing/personalization_designs/pd_xyz", @@ -13207,7 +17399,7 @@ async def test_issuing_personalization_designs_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.personalization_designs.update_async("pd_xyz") + await client.v1.issuing.personalization_designs.update_async("pd_xyz") http_client_mock.assert_requested( "post", path="/v1/issuing/personalization_designs/pd_xyz", @@ -13215,6 +17407,26 @@ async def test_issuing_personalization_designs_post_2_service_async( api_base="https://api.stripe.com", ) + def test_issuing_physical_bundles_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/physical_bundles", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.physical_bundles.list() + http_client_mock.assert_requested( + "get", + path="/v1/issuing/physical_bundles", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_physical_bundles_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -13237,7 +17449,7 @@ def test_issuing_physical_bundles_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.physical_bundles.list() + client.v1.issuing.physical_bundles.list() http_client_mock.assert_requested( "get", path="/v1/issuing/physical_bundles", @@ -13269,7 +17481,7 @@ async def test_issuing_physical_bundles_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.physical_bundles.list_async() + await client.v1.issuing.physical_bundles.list_async() http_client_mock.assert_requested( "get", path="/v1/issuing/physical_bundles", @@ -13277,6 +17489,26 @@ async def test_issuing_physical_bundles_get_service_async( api_base="https://api.stripe.com", ) + def test_issuing_physical_bundles_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/physical_bundles/pb_xyz", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.physical_bundles.retrieve("pb_xyz") + http_client_mock.assert_requested( + "get", + path="/v1/issuing/physical_bundles/pb_xyz", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_physical_bundles_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -13299,7 +17531,7 @@ def test_issuing_physical_bundles_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.physical_bundles.retrieve("pb_xyz") + client.v1.issuing.physical_bundles.retrieve("pb_xyz") http_client_mock.assert_requested( "get", path="/v1/issuing/physical_bundles/pb_xyz", @@ -13331,7 +17563,7 @@ async def test_issuing_physical_bundles_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.physical_bundles.retrieve_async("pb_xyz") + await client.v1.issuing.physical_bundles.retrieve_async("pb_xyz") http_client_mock.assert_requested( "get", path="/v1/issuing/physical_bundles/pb_xyz", @@ -13339,6 +17571,27 @@ async def test_issuing_physical_bundles_get_2_service_async( api_base="https://api.stripe.com", ) + def test_issuing_transactions_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/transactions", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.transactions.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/issuing/transactions", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_issuing_transactions_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -13362,7 +17615,7 @@ def test_issuing_transactions_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.transactions.list({"limit": 3}) + client.v1.issuing.transactions.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/issuing/transactions", @@ -13395,7 +17648,7 @@ async def test_issuing_transactions_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.transactions.list_async({"limit": 3}) + await client.v1.issuing.transactions.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/issuing/transactions", @@ -13403,6 +17656,26 @@ async def test_issuing_transactions_get_service_async( api_base="https://api.stripe.com", ) + def test_issuing_transactions_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.issuing.transactions.retrieve("ipi_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_issuing_transactions_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -13425,7 +17698,7 @@ def test_issuing_transactions_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.issuing.transactions.retrieve("ipi_xxxxxxxxxxxxx") + client.v1.issuing.transactions.retrieve("ipi_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", @@ -13457,7 +17730,9 @@ async def test_issuing_transactions_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.transactions.retrieve_async("ipi_xxxxxxxxxxxxx") + await client.v1.issuing.transactions.retrieve_async( + "ipi_xxxxxxxxxxxxx" + ) http_client_mock.assert_requested( "get", path="/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", @@ -13465,21 +17740,7 @@ async def test_issuing_transactions_get_2_service_async( api_base="https://api.stripe.com", ) - def test_issuing_transactions_post( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.issuing.Transaction.modify( - "ipi_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - http_client_mock.assert_requested( - "post", - path="/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", - query_string="", - post_data="metadata[order_id]=6735", - ) - - def test_issuing_transactions_post_service( + def test_issuing_transactions_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -13503,11 +17764,10 @@ def test_issuing_transactions_post_service( post_data="metadata[order_id]=6735", ) - @pytest.mark.anyio - async def test_issuing_transactions_post_async( + def test_issuing_transactions_post( self, http_client_mock: HTTPClientMock ) -> None: - await stripe.issuing.Transaction.modify_async( + stripe.issuing.Transaction.modify( "ipi_xxxxxxxxxxxxx", metadata={"order_id": "6735"}, ) @@ -13518,8 +17778,7 @@ async def test_issuing_transactions_post_async( post_data="metadata[order_id]=6735", ) - @pytest.mark.anyio - async def test_issuing_transactions_post_service_async( + def test_issuing_transactions_post_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -13531,7 +17790,7 @@ async def test_issuing_transactions_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.issuing.transactions.update_async( + client.v1.issuing.transactions.update( "ipi_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -13543,6 +17802,66 @@ async def test_issuing_transactions_post_service_async( post_data="metadata[order_id]=6735", ) + @pytest.mark.anyio + async def test_issuing_transactions_post_async( + self, http_client_mock: HTTPClientMock + ) -> None: + await stripe.issuing.Transaction.modify_async( + "ipi_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", + query_string="", + post_data="metadata[order_id]=6735", + ) + + @pytest.mark.anyio + async def test_issuing_transactions_post_service_async( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + await client.v1.issuing.transactions.update_async( + "ipi_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + + def test_mandates_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/mandates/mandate_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.mandates.retrieve("mandate_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/mandates/mandate_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_mandates_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Mandate.retrieve("mandate_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -13563,7 +17882,7 @@ def test_mandates_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.mandates.retrieve("mandate_xxxxxxxxxxxxx") + client.v1.mandates.retrieve("mandate_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/mandates/mandate_xxxxxxxxxxxxx", @@ -13595,7 +17914,7 @@ async def test_mandates_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.mandates.retrieve_async("mandate_xxxxxxxxxxxxx") + await client.v1.mandates.retrieve_async("mandate_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/mandates/mandate_xxxxxxxxxxxxx", @@ -13603,6 +17922,26 @@ async def test_mandates_get_service_async( api_base="https://api.stripe.com", ) + def test_payment_intents_apply_customer_balance_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/apply_customer_balance", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.apply_customer_balance("pi_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/payment_intents/pi_xxxxxxxxxxxxx/apply_customer_balance", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payment_intents_apply_customer_balance_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -13625,7 +17964,7 @@ def test_payment_intents_apply_customer_balance_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.apply_customer_balance("pi_xxxxxxxxxxxxx") + client.v1.payment_intents.apply_customer_balance("pi_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/payment_intents/pi_xxxxxxxxxxxxx/apply_customer_balance", @@ -13659,7 +17998,7 @@ async def test_payment_intents_apply_customer_balance_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.apply_customer_balance_async( + await client.v1.payment_intents.apply_customer_balance_async( "pi_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -13669,6 +18008,26 @@ async def test_payment_intents_apply_customer_balance_post_service_async( api_base="https://api.stripe.com", ) + def test_payment_intents_cancel_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.cancel("pi_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/payment_intents/pi_xxxxxxxxxxxxx/cancel", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payment_intents_cancel_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -13691,7 +18050,7 @@ def test_payment_intents_cancel_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.cancel("pi_xxxxxxxxxxxxx") + client.v1.payment_intents.cancel("pi_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/payment_intents/pi_xxxxxxxxxxxxx/cancel", @@ -13723,7 +18082,7 @@ async def test_payment_intents_cancel_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.cancel_async("pi_xxxxxxxxxxxxx") + await client.v1.payment_intents.cancel_async("pi_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/payment_intents/pi_xxxxxxxxxxxxx/cancel", @@ -13731,6 +18090,26 @@ async def test_payment_intents_cancel_post_service_async( api_base="https://api.stripe.com", ) + def test_payment_intents_capture_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/capture", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.capture("pi_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/payment_intents/pi_xxxxxxxxxxxxx/capture", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payment_intents_capture_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -13753,7 +18132,7 @@ def test_payment_intents_capture_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.capture("pi_xxxxxxxxxxxxx") + client.v1.payment_intents.capture("pi_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/payment_intents/pi_xxxxxxxxxxxxx/capture", @@ -13785,7 +18164,7 @@ async def test_payment_intents_capture_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.capture_async("pi_xxxxxxxxxxxxx") + await client.v1.payment_intents.capture_async("pi_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/payment_intents/pi_xxxxxxxxxxxxx/capture", @@ -13793,6 +18172,30 @@ async def test_payment_intents_capture_post_service_async( api_base="https://api.stripe.com", ) + def test_payment_intents_confirm_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/confirm", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.confirm( + "pi_xxxxxxxxxxxxx", + {"payment_method": "pm_card_visa"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_intents/pi_xxxxxxxxxxxxx/confirm", + query_string="", + api_base="https://api.stripe.com", + post_data="payment_method=pm_card_visa", + ) + def test_payment_intents_confirm_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -13819,7 +18222,7 @@ def test_payment_intents_confirm_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.confirm( + client.v1.payment_intents.confirm( "pi_xxxxxxxxxxxxx", {"payment_method": "pm_card_visa"}, ) @@ -13859,7 +18262,7 @@ async def test_payment_intents_confirm_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.confirm_async( + await client.v1.payment_intents.confirm_async( "pi_xxxxxxxxxxxxx", {"payment_method": "pm_card_visa"}, ) @@ -13871,6 +18274,27 @@ async def test_payment_intents_confirm_post_service_async( post_data="payment_method=pm_card_visa", ) + def test_payment_intents_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payment_intents", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/payment_intents", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_payment_intents_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -13894,7 +18318,7 @@ def test_payment_intents_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.list({"limit": 3}) + client.v1.payment_intents.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/payment_intents", @@ -13927,7 +18351,7 @@ async def test_payment_intents_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.list_async({"limit": 3}) + await client.v1.payment_intents.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/payment_intents", @@ -13935,6 +18359,26 @@ async def test_payment_intents_get_service_async( api_base="https://api.stripe.com", ) + def test_payment_intents_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payment_intents/pi_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.retrieve("pi_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/payment_intents/pi_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payment_intents_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -13957,7 +18401,7 @@ def test_payment_intents_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.retrieve("pi_xxxxxxxxxxxxx") + client.v1.payment_intents.retrieve("pi_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/payment_intents/pi_xxxxxxxxxxxxx", @@ -13989,7 +18433,7 @@ async def test_payment_intents_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.retrieve_async("pi_xxxxxxxxxxxxx") + await client.v1.payment_intents.retrieve_async("pi_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/payment_intents/pi_xxxxxxxxxxxxx", @@ -13997,6 +18441,30 @@ async def test_payment_intents_get_2_service_async( api_base="https://api.stripe.com", ) + def test_payment_intents_increment_authorization_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/increment_authorization", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.increment_authorization( + "pi_xxxxxxxxxxxxx", + {"amount": 2099}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_intents/pi_xxxxxxxxxxxxx/increment_authorization", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=2099", + ) + def test_payment_intents_increment_authorization_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -14023,7 +18491,7 @@ def test_payment_intents_increment_authorization_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.increment_authorization( + client.v1.payment_intents.increment_authorization( "pi_xxxxxxxxxxxxx", {"amount": 2099}, ) @@ -14063,7 +18531,7 @@ async def test_payment_intents_increment_authorization_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.increment_authorization_async( + await client.v1.payment_intents.increment_authorization_async( "pi_xxxxxxxxxxxxx", {"amount": 2099}, ) @@ -14075,6 +18543,33 @@ async def test_payment_intents_increment_authorization_post_service_async( post_data="amount=2099", ) + def test_payment_intents_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_intents", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.create( + { + "amount": 1099, + "currency": "eur", + "automatic_payment_methods": {"enabled": True}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_intents", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=1099¤cy=eur&automatic_payment_methods[enabled]=true", + ) + def test_payment_intents_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -14102,7 +18597,7 @@ def test_payment_intents_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.create( + client.v1.payment_intents.create( { "amount": 1099, "currency": "eur", @@ -14146,7 +18641,7 @@ async def test_payment_intents_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.create_async( + await client.v1.payment_intents.create_async( { "amount": 1099, "currency": "eur", @@ -14161,22 +18656,7 @@ async def test_payment_intents_post_service_async( post_data="amount=1099¤cy=eur&automatic_payment_methods[enabled]=true", ) - def test_payment_intents_post_2( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.PaymentIntent.create( - amount=2000, - currency="usd", - automatic_payment_methods={"enabled": True}, - ) - http_client_mock.assert_requested( - "post", - path="/v1/payment_intents", - query_string="", - post_data="amount=2000¤cy=usd&automatic_payment_methods[enabled]=true", - ) - - def test_payment_intents_post_2_service( + def test_payment_intents_post_2_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -14203,11 +18683,10 @@ def test_payment_intents_post_2_service( post_data="amount=2000¤cy=usd&automatic_payment_methods[enabled]=true", ) - @pytest.mark.anyio - async def test_payment_intents_post_2_async( + def test_payment_intents_post_2( self, http_client_mock: HTTPClientMock ) -> None: - await stripe.PaymentIntent.create_async( + stripe.PaymentIntent.create( amount=2000, currency="usd", automatic_payment_methods={"enabled": True}, @@ -14219,8 +18698,7 @@ async def test_payment_intents_post_2_async( post_data="amount=2000¤cy=usd&automatic_payment_methods[enabled]=true", ) - @pytest.mark.anyio - async def test_payment_intents_post_2_service_async( + def test_payment_intents_post_2_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -14232,7 +18710,7 @@ async def test_payment_intents_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.create_async( + client.v1.payment_intents.create( { "amount": 2000, "currency": "usd", @@ -14247,6 +18725,74 @@ async def test_payment_intents_post_2_service_async( post_data="amount=2000¤cy=usd&automatic_payment_methods[enabled]=true", ) + @pytest.mark.anyio + async def test_payment_intents_post_2_async( + self, http_client_mock: HTTPClientMock + ) -> None: + await stripe.PaymentIntent.create_async( + amount=2000, + currency="usd", + automatic_payment_methods={"enabled": True}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_intents", + query_string="", + post_data="amount=2000¤cy=usd&automatic_payment_methods[enabled]=true", + ) + + @pytest.mark.anyio + async def test_payment_intents_post_2_service_async( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_intents", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + await client.v1.payment_intents.create_async( + { + "amount": 2000, + "currency": "usd", + "automatic_payment_methods": {"enabled": True}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_intents", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=2000¤cy=usd&automatic_payment_methods[enabled]=true", + ) + + def test_payment_intents_post_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.update( + "pi_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_intents/pi_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_payment_intents_post_3( self, http_client_mock: HTTPClientMock ) -> None: @@ -14273,7 +18819,7 @@ def test_payment_intents_post_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.update( + client.v1.payment_intents.update( "pi_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -14313,7 +18859,7 @@ async def test_payment_intents_post_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.update_async( + await client.v1.payment_intents.update_async( "pi_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -14325,6 +18871,36 @@ async def test_payment_intents_post_3_service_async( post_data="metadata[order_id]=6735", ) + def test_payment_intents_post_4_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_intents", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.create( + { + "amount": 200, + "currency": "usd", + "payment_method_data": { + "type": "p24", + "p24": {"bank": "blik"}, + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_intents", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=200¤cy=usd&payment_method_data[type]=p24&payment_method_data[p24][bank]=blik", + ) + def test_payment_intents_post_4( self, http_client_mock: HTTPClientMock ) -> None: @@ -14352,7 +18928,7 @@ def test_payment_intents_post_4_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.create( + client.v1.payment_intents.create( { "amount": 200, "currency": "usd", @@ -14399,7 +18975,7 @@ async def test_payment_intents_post_4_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.create_async( + await client.v1.payment_intents.create_async( { "amount": 200, "currency": "usd", @@ -14417,6 +18993,31 @@ async def test_payment_intents_post_4_service_async( post_data="amount=200¤cy=usd&payment_method_data[type]=p24&payment_method_data[p24][bank]=blik", ) + def test_payment_intents_search_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payment_intents/search", + "query=status%3A%27succeeded%27%20AND%20metadata%5B%27order_id%27%5D%3A%276735%27", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.search( + { + "query": "status:'succeeded' AND metadata['order_id']:'6735'", + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/payment_intents/search", + query_string="query=status%3A%27succeeded%27%20AND%20metadata%5B%27order_id%27%5D%3A%276735%27", + api_base="https://api.stripe.com", + ) + def test_payment_intents_search_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -14442,7 +19043,7 @@ def test_payment_intents_search_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.search( + client.v1.payment_intents.search( { "query": "status:'succeeded' AND metadata['order_id']:'6735'", } @@ -14481,7 +19082,7 @@ async def test_payment_intents_search_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.search_async( + await client.v1.payment_intents.search_async( { "query": "status:'succeeded' AND metadata['order_id']:'6735'", } @@ -14493,6 +19094,26 @@ async def test_payment_intents_search_get_service_async( api_base="https://api.stripe.com", ) + def test_payment_intents_verify_microdeposits_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.verify_microdeposits("pi_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payment_intents_verify_microdeposits_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -14515,7 +19136,7 @@ def test_payment_intents_verify_microdeposits_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.verify_microdeposits("pi_xxxxxxxxxxxxx") + client.v1.payment_intents.verify_microdeposits("pi_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits", @@ -14549,7 +19170,7 @@ async def test_payment_intents_verify_microdeposits_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.verify_microdeposits_async( + await client.v1.payment_intents.verify_microdeposits_async( "pi_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -14559,6 +19180,30 @@ async def test_payment_intents_verify_microdeposits_post_service_async( api_base="https://api.stripe.com", ) + def test_payment_intents_verify_microdeposits_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_intents.verify_microdeposits( + "pi_xxxxxxxxxxxxx", + {"amounts": [32, 45]}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits", + query_string="", + api_base="https://api.stripe.com", + post_data="amounts[0]=32&amounts[1]=45", + ) + def test_payment_intents_verify_microdeposits_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -14585,7 +19230,7 @@ def test_payment_intents_verify_microdeposits_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_intents.verify_microdeposits( + client.v1.payment_intents.verify_microdeposits( "pi_xxxxxxxxxxxxx", {"amounts": [32, 45]}, ) @@ -14625,7 +19270,7 @@ async def test_payment_intents_verify_microdeposits_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_intents.verify_microdeposits_async( + await client.v1.payment_intents.verify_microdeposits_async( "pi_xxxxxxxxxxxxx", {"amounts": [32, 45]}, ) @@ -14637,6 +19282,26 @@ async def test_payment_intents_verify_microdeposits_post_2_service_async( post_data="amounts[0]=32&amounts[1]=45", ) + def test_payment_links_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payment_links/pl_xyz", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_links.retrieve("pl_xyz") + http_client_mock.assert_requested( + "get", + path="/v1/payment_links/pl_xyz", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payment_links_get(self, http_client_mock: HTTPClientMock) -> None: stripe.PaymentLink.retrieve("pl_xyz") http_client_mock.assert_requested( @@ -14657,7 +19322,7 @@ def test_payment_links_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_links.retrieve("pl_xyz") + client.v1.payment_links.retrieve("pl_xyz") http_client_mock.assert_requested( "get", path="/v1/payment_links/pl_xyz", @@ -14689,7 +19354,7 @@ async def test_payment_links_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_links.retrieve_async("pl_xyz") + await client.v1.payment_links.retrieve_async("pl_xyz") http_client_mock.assert_requested( "get", path="/v1/payment_links/pl_xyz", @@ -14697,6 +19362,27 @@ async def test_payment_links_get_service_async( api_base="https://api.stripe.com", ) + def test_payment_links_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payment_links", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_links.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/payment_links", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_payment_links_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -14720,7 +19406,7 @@ def test_payment_links_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_links.list({"limit": 3}) + client.v1.payment_links.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/payment_links", @@ -14753,7 +19439,7 @@ async def test_payment_links_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_links.list_async({"limit": 3}) + await client.v1.payment_links.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/payment_links", @@ -14761,6 +19447,26 @@ async def test_payment_links_get_2_service_async( api_base="https://api.stripe.com", ) + def test_payment_links_get_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payment_links/plink_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_links.retrieve("plink_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/payment_links/plink_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payment_links_get_3( self, http_client_mock: HTTPClientMock ) -> None: @@ -14783,7 +19489,7 @@ def test_payment_links_get_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_links.retrieve("plink_xxxxxxxxxxxxx") + client.v1.payment_links.retrieve("plink_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/payment_links/plink_xxxxxxxxxxxxx", @@ -14815,7 +19521,7 @@ async def test_payment_links_get_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_links.retrieve_async("plink_xxxxxxxxxxxxx") + await client.v1.payment_links.retrieve_async("plink_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/payment_links/plink_xxxxxxxxxxxxx", @@ -14823,6 +19529,26 @@ async def test_payment_links_get_3_service_async( api_base="https://api.stripe.com", ) + def test_payment_links_line_items_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payment_links/pl_xyz/line_items", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_links.line_items.list("pl_xyz") + http_client_mock.assert_requested( + "get", + path="/v1/payment_links/pl_xyz/line_items", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payment_links_line_items_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -14845,7 +19571,7 @@ def test_payment_links_line_items_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_links.line_items.list("pl_xyz") + client.v1.payment_links.line_items.list("pl_xyz") http_client_mock.assert_requested( "get", path="/v1/payment_links/pl_xyz/line_items", @@ -14877,7 +19603,7 @@ async def test_payment_links_line_items_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_links.line_items.list_async("pl_xyz") + await client.v1.payment_links.line_items.list_async("pl_xyz") http_client_mock.assert_requested( "get", path="/v1/payment_links/pl_xyz/line_items", @@ -14885,20 +19611,7 @@ async def test_payment_links_line_items_get_service_async( api_base="https://api.stripe.com", ) - def test_payment_links_post( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.PaymentLink.create( - line_items=[{"price": "price_xxxxxxxxxxxxx", "quantity": 1}], - ) - http_client_mock.assert_requested( - "post", - path="/v1/payment_links", - query_string="", - post_data="line_items[0][price]=price_xxxxxxxxxxxxx&line_items[0][quantity]=1", - ) - - def test_payment_links_post_service( + def test_payment_links_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -14925,6 +19638,46 @@ def test_payment_links_post_service( post_data="line_items[0][price]=price_xxxxxxxxxxxxx&line_items[0][quantity]=1", ) + def test_payment_links_post( + self, http_client_mock: HTTPClientMock + ) -> None: + stripe.PaymentLink.create( + line_items=[{"price": "price_xxxxxxxxxxxxx", "quantity": 1}], + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_links", + query_string="", + post_data="line_items[0][price]=price_xxxxxxxxxxxxx&line_items[0][quantity]=1", + ) + + def test_payment_links_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_links", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v1.payment_links.create( + { + "line_items": [ + {"price": "price_xxxxxxxxxxxxx", "quantity": 1} + ], + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_links", + query_string="", + api_base="https://api.stripe.com", + post_data="line_items[0][price]=price_xxxxxxxxxxxxx&line_items[0][quantity]=1", + ) + @pytest.mark.anyio async def test_payment_links_post_async( self, http_client_mock: HTTPClientMock @@ -14952,7 +19705,34 @@ async def test_payment_links_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_links.create_async( + await client.v1.payment_links.create_async( + { + "line_items": [ + {"price": "price_xxxxxxxxxxxxx", "quantity": 1} + ], + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_links", + query_string="", + api_base="https://api.stripe.com", + post_data="line_items[0][price]=price_xxxxxxxxxxxxx&line_items[0][quantity]=1", + ) + + def test_payment_links_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_links", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_links.create( { "line_items": [ {"price": "price_xxxxxxxxxxxxx", "quantity": 1} @@ -14992,7 +19772,7 @@ def test_payment_links_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_links.create( + client.v1.payment_links.create( { "line_items": [ {"price": "price_xxxxxxxxxxxxx", "quantity": 1} @@ -15034,7 +19814,7 @@ async def test_payment_links_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_links.create_async( + await client.v1.payment_links.create_async( { "line_items": [ {"price": "price_xxxxxxxxxxxxx", "quantity": 1} @@ -15049,6 +19829,30 @@ async def test_payment_links_post_2_service_async( post_data="line_items[0][price]=price_xxxxxxxxxxxxx&line_items[0][quantity]=1", ) + def test_payment_links_post_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_links/plink_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_links.update( + "plink_xxxxxxxxxxxxx", + {"active": False}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_links/plink_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="active=false", + ) + def test_payment_links_post_3( self, http_client_mock: HTTPClientMock ) -> None: @@ -15075,7 +19879,7 @@ def test_payment_links_post_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_links.update( + client.v1.payment_links.update( "plink_xxxxxxxxxxxxx", {"active": False}, ) @@ -15115,7 +19919,7 @@ async def test_payment_links_post_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_links.update_async( + await client.v1.payment_links.update_async( "plink_xxxxxxxxxxxxx", {"active": False}, ) @@ -15127,6 +19931,27 @@ async def test_payment_links_post_3_service_async( post_data="active=false", ) + def test_payment_method_configurations_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payment_method_configurations", + "application=foo", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_method_configurations.list({"application": "foo"}) + http_client_mock.assert_requested( + "get", + path="/v1/payment_method_configurations", + query_string="application=foo", + api_base="https://api.stripe.com", + ) + def test_payment_method_configurations_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -15150,7 +19975,7 @@ def test_payment_method_configurations_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_method_configurations.list({"application": "foo"}) + client.v1.payment_method_configurations.list({"application": "foo"}) http_client_mock.assert_requested( "get", path="/v1/payment_method_configurations", @@ -15183,7 +20008,7 @@ async def test_payment_method_configurations_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_method_configurations.list_async( + await client.v1.payment_method_configurations.list_async( { "application": "foo", } @@ -15195,6 +20020,26 @@ async def test_payment_method_configurations_get_service_async( api_base="https://api.stripe.com", ) + def test_payment_method_configurations_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payment_method_configurations/foo", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_method_configurations.retrieve("foo") + http_client_mock.assert_requested( + "get", + path="/v1/payment_method_configurations/foo", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payment_method_configurations_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -15217,7 +20062,7 @@ def test_payment_method_configurations_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_method_configurations.retrieve("foo") + client.v1.payment_method_configurations.retrieve("foo") http_client_mock.assert_requested( "get", path="/v1/payment_method_configurations/foo", @@ -15249,7 +20094,7 @@ async def test_payment_method_configurations_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_method_configurations.retrieve_async("foo") + await client.v1.payment_method_configurations.retrieve_async("foo") http_client_mock.assert_requested( "get", path="/v1/payment_method_configurations/foo", @@ -15257,6 +20102,32 @@ async def test_payment_method_configurations_get_2_service_async( api_base="https://api.stripe.com", ) + def test_payment_method_configurations_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_method_configurations", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_method_configurations.create( + { + "acss_debit": {"display_preference": {"preference": "none"}}, + "affirm": {"display_preference": {"preference": "none"}}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_method_configurations", + query_string="", + api_base="https://api.stripe.com", + post_data="acss_debit[display_preference][preference]=none&affirm[display_preference][preference]=none", + ) + def test_payment_method_configurations_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -15283,7 +20154,7 @@ def test_payment_method_configurations_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_method_configurations.create( + client.v1.payment_method_configurations.create( { "acss_debit": {"display_preference": {"preference": "none"}}, "affirm": {"display_preference": {"preference": "none"}}, @@ -15325,7 +20196,7 @@ async def test_payment_method_configurations_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_method_configurations.create_async( + await client.v1.payment_method_configurations.create_async( { "acss_debit": {"display_preference": {"preference": "none"}}, "affirm": {"display_preference": {"preference": "none"}}, @@ -15339,6 +20210,30 @@ async def test_payment_method_configurations_post_service_async( post_data="acss_debit[display_preference][preference]=none&affirm[display_preference][preference]=none", ) + def test_payment_method_configurations_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_method_configurations/foo", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_method_configurations.update( + "foo", + {"acss_debit": {"display_preference": {"preference": "on"}}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_method_configurations/foo", + query_string="", + api_base="https://api.stripe.com", + post_data="acss_debit[display_preference][preference]=on", + ) + def test_payment_method_configurations_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -15365,7 +20260,7 @@ def test_payment_method_configurations_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_method_configurations.update( + client.v1.payment_method_configurations.update( "foo", {"acss_debit": {"display_preference": {"preference": "on"}}}, ) @@ -15405,7 +20300,7 @@ async def test_payment_method_configurations_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_method_configurations.update_async( + await client.v1.payment_method_configurations.update_async( "foo", {"acss_debit": {"display_preference": {"preference": "on"}}}, ) @@ -15417,6 +20312,30 @@ async def test_payment_method_configurations_post_2_service_async( post_data="acss_debit[display_preference][preference]=on", ) + def test_payment_methods_attach_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_methods/pm_xxxxxxxxxxxxx/attach", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_methods.attach( + "pm_xxxxxxxxxxxxx", + {"customer": "cus_xxxxxxxxxxxxx"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_methods/pm_xxxxxxxxxxxxx/attach", + query_string="", + api_base="https://api.stripe.com", + post_data="customer=cus_xxxxxxxxxxxxx", + ) + def test_payment_methods_attach_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -15443,7 +20362,7 @@ def test_payment_methods_attach_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_methods.attach( + client.v1.payment_methods.attach( "pm_xxxxxxxxxxxxx", {"customer": "cus_xxxxxxxxxxxxx"}, ) @@ -15483,7 +20402,7 @@ async def test_payment_methods_attach_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_methods.attach_async( + await client.v1.payment_methods.attach_async( "pm_xxxxxxxxxxxxx", {"customer": "cus_xxxxxxxxxxxxx"}, ) @@ -15495,6 +20414,26 @@ async def test_payment_methods_attach_post_service_async( post_data="customer=cus_xxxxxxxxxxxxx", ) + def test_payment_methods_detach_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_methods/pm_xxxxxxxxxxxxx/detach", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_methods.detach("pm_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/payment_methods/pm_xxxxxxxxxxxxx/detach", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payment_methods_detach_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -15517,7 +20456,7 @@ def test_payment_methods_detach_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_methods.detach("pm_xxxxxxxxxxxxx") + client.v1.payment_methods.detach("pm_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/payment_methods/pm_xxxxxxxxxxxxx/detach", @@ -15549,7 +20488,7 @@ async def test_payment_methods_detach_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_methods.detach_async("pm_xxxxxxxxxxxxx") + await client.v1.payment_methods.detach_async("pm_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/payment_methods/pm_xxxxxxxxxxxxx/detach", @@ -15557,6 +20496,32 @@ async def test_payment_methods_detach_post_service_async( api_base="https://api.stripe.com", ) + def test_payment_methods_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payment_methods", + "customer=cus_xxxxxxxxxxxxx&type=card", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_methods.list( + { + "customer": "cus_xxxxxxxxxxxxx", + "type": "card", + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/payment_methods", + query_string="customer=cus_xxxxxxxxxxxxx&type=card", + api_base="https://api.stripe.com", + ) + def test_payment_methods_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -15583,7 +20548,7 @@ def test_payment_methods_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_methods.list( + client.v1.payment_methods.list( { "customer": "cus_xxxxxxxxxxxxx", "type": "card", @@ -15624,7 +20589,7 @@ async def test_payment_methods_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_methods.list_async( + await client.v1.payment_methods.list_async( { "customer": "cus_xxxxxxxxxxxxx", "type": "card", @@ -15637,6 +20602,26 @@ async def test_payment_methods_get_service_async( api_base="https://api.stripe.com", ) + def test_payment_methods_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payment_methods/pm_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_methods.retrieve("pm_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/payment_methods/pm_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payment_methods_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -15659,7 +20644,7 @@ def test_payment_methods_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_methods.retrieve("pm_xxxxxxxxxxxxx") + client.v1.payment_methods.retrieve("pm_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/payment_methods/pm_xxxxxxxxxxxxx", @@ -15691,7 +20676,7 @@ async def test_payment_methods_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_methods.retrieve_async("pm_xxxxxxxxxxxxx") + await client.v1.payment_methods.retrieve_async("pm_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/payment_methods/pm_xxxxxxxxxxxxx", @@ -15699,6 +20684,37 @@ async def test_payment_methods_get_2_service_async( api_base="https://api.stripe.com", ) + def test_payment_methods_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_methods", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_methods.create( + { + "type": "card", + "card": { + "number": "4242424242424242", + "exp_month": 8, + "exp_year": 2024, + "cvc": "314", + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_methods", + query_string="", + api_base="https://api.stripe.com", + post_data="type=card&card[number]=4242424242424242&card[exp_month]=8&card[exp_year]=2024&card[cvc]=314", + ) + def test_payment_methods_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -15730,7 +20746,7 @@ def test_payment_methods_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_methods.create( + client.v1.payment_methods.create( { "type": "card", "card": { @@ -15782,7 +20798,7 @@ async def test_payment_methods_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_methods.create_async( + await client.v1.payment_methods.create_async( { "type": "card", "card": { @@ -15801,6 +20817,30 @@ async def test_payment_methods_post_service_async( post_data="type=card&card[number]=4242424242424242&card[exp_month]=8&card[exp_year]=2024&card[cvc]=314", ) + def test_payment_methods_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payment_methods/pm_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payment_methods.update( + "pm_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/payment_methods/pm_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_payment_methods_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -15827,7 +20867,7 @@ def test_payment_methods_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payment_methods.update( + client.v1.payment_methods.update( "pm_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -15867,7 +20907,7 @@ async def test_payment_methods_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payment_methods.update_async( + await client.v1.payment_methods.update_async( "pm_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -15879,6 +20919,26 @@ async def test_payment_methods_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_payouts_cancel_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payouts/po_xxxxxxxxxxxxx/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payouts.cancel("po_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/payouts/po_xxxxxxxxxxxxx/cancel", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payouts_cancel_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -15901,7 +20961,7 @@ def test_payouts_cancel_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payouts.cancel("po_xxxxxxxxxxxxx") + client.v1.payouts.cancel("po_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/payouts/po_xxxxxxxxxxxxx/cancel", @@ -15933,7 +20993,7 @@ async def test_payouts_cancel_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payouts.cancel_async("po_xxxxxxxxxxxxx") + await client.v1.payouts.cancel_async("po_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/payouts/po_xxxxxxxxxxxxx/cancel", @@ -15941,6 +21001,27 @@ async def test_payouts_cancel_post_service_async( api_base="https://api.stripe.com", ) + def test_payouts_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payouts", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payouts.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/payouts", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_payouts_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Payout.list(limit=3) http_client_mock.assert_requested( @@ -15962,7 +21043,7 @@ def test_payouts_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payouts.list({"limit": 3}) + client.v1.payouts.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/payouts", @@ -15995,7 +21076,7 @@ async def test_payouts_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payouts.list_async({"limit": 3}) + await client.v1.payouts.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/payouts", @@ -16003,6 +21084,26 @@ async def test_payouts_get_service_async( api_base="https://api.stripe.com", ) + def test_payouts_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/payouts/po_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payouts.retrieve("po_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/payouts/po_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payouts_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Payout.retrieve("po_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -16023,7 +21124,7 @@ def test_payouts_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payouts.retrieve("po_xxxxxxxxxxxxx") + client.v1.payouts.retrieve("po_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/payouts/po_xxxxxxxxxxxxx", @@ -16055,7 +21156,7 @@ async def test_payouts_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payouts.retrieve_async("po_xxxxxxxxxxxxx") + await client.v1.payouts.retrieve_async("po_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/payouts/po_xxxxxxxxxxxxx", @@ -16063,6 +21164,27 @@ async def test_payouts_get_2_service_async( api_base="https://api.stripe.com", ) + def test_payouts_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payouts", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payouts.create({"amount": 1100, "currency": "usd"}) + http_client_mock.assert_requested( + "post", + path="/v1/payouts", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=1100¤cy=usd", + ) + def test_payouts_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Payout.create( amount=1100, @@ -16087,7 +21209,7 @@ def test_payouts_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payouts.create({"amount": 1100, "currency": "usd"}) + client.v1.payouts.create({"amount": 1100, "currency": "usd"}) http_client_mock.assert_requested( "post", path="/v1/payouts", @@ -16124,7 +21246,12 @@ async def test_payouts_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payouts.create_async({"amount": 1100, "currency": "usd"}) + await client.v1.payouts.create_async( + { + "amount": 1100, + "currency": "usd", + } + ) http_client_mock.assert_requested( "post", path="/v1/payouts", @@ -16133,6 +21260,30 @@ async def test_payouts_post_service_async( post_data="amount=1100¤cy=usd", ) + def test_payouts_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payouts/po_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payouts.update( + "po_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/payouts/po_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_payouts_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Payout.modify( "po_xxxxxxxxxxxxx", @@ -16157,7 +21308,7 @@ def test_payouts_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payouts.update( + client.v1.payouts.update( "po_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -16197,7 +21348,7 @@ async def test_payouts_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payouts.update_async( + await client.v1.payouts.update_async( "po_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -16209,6 +21360,26 @@ async def test_payouts_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_payouts_reverse_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/payouts/po_xxxxxxxxxxxxx/reverse", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.payouts.reverse("po_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/payouts/po_xxxxxxxxxxxxx/reverse", + query_string="", + api_base="https://api.stripe.com", + ) + def test_payouts_reverse_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -16231,7 +21402,7 @@ def test_payouts_reverse_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.payouts.reverse("po_xxxxxxxxxxxxx") + client.v1.payouts.reverse("po_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/payouts/po_xxxxxxxxxxxxx/reverse", @@ -16263,7 +21434,7 @@ async def test_payouts_reverse_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.payouts.reverse_async("po_xxxxxxxxxxxxx") + await client.v1.payouts.reverse_async("po_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/payouts/po_xxxxxxxxxxxxx/reverse", @@ -16271,6 +21442,26 @@ async def test_payouts_reverse_post_service_async( api_base="https://api.stripe.com", ) + def test_plans_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/plans/price_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.plans.delete("price_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/plans/price_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_plans_delete(self, http_client_mock: HTTPClientMock) -> None: stripe.Plan.delete("price_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -16291,7 +21482,7 @@ def test_plans_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.plans.delete("price_xxxxxxxxxxxxx") + client.v1.plans.delete("price_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/plans/price_xxxxxxxxxxxxx", @@ -16323,7 +21514,7 @@ async def test_plans_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.plans.delete_async("price_xxxxxxxxxxxxx") + await client.v1.plans.delete_async("price_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/plans/price_xxxxxxxxxxxxx", @@ -16331,6 +21522,27 @@ async def test_plans_delete_service_async( api_base="https://api.stripe.com", ) + def test_plans_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/plans", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.plans.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/plans", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_plans_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Plan.list(limit=3) http_client_mock.assert_requested( @@ -16350,7 +21562,7 @@ def test_plans_get_service(self, http_client_mock: HTTPClientMock) -> None: http_client=http_client_mock.get_mock_http_client(), ) - client.plans.list({"limit": 3}) + client.v1.plans.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/plans", @@ -16383,7 +21595,7 @@ async def test_plans_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.plans.list_async({"limit": 3}) + await client.v1.plans.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/plans", @@ -16391,6 +21603,26 @@ async def test_plans_get_service_async( api_base="https://api.stripe.com", ) + def test_plans_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/plans/price_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.plans.retrieve("price_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/plans/price_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_plans_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Plan.retrieve("price_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -16411,7 +21643,7 @@ def test_plans_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.plans.retrieve("price_xxxxxxxxxxxxx") + client.v1.plans.retrieve("price_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/plans/price_xxxxxxxxxxxxx", @@ -16443,7 +21675,7 @@ async def test_plans_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.plans.retrieve_async("price_xxxxxxxxxxxxx") + await client.v1.plans.retrieve_async("price_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/plans/price_xxxxxxxxxxxxx", @@ -16451,21 +21683,7 @@ async def test_plans_get_2_service_async( api_base="https://api.stripe.com", ) - def test_plans_post(self, http_client_mock: HTTPClientMock) -> None: - stripe.Plan.create( - amount=2000, - currency="usd", - interval="month", - product="prod_xxxxxxxxxxxxx", - ) - http_client_mock.assert_requested( - "post", - path="/v1/plans", - query_string="", - post_data="amount=2000¤cy=usd&interval=month&product=prod_xxxxxxxxxxxxx", - ) - - def test_plans_post_service( + def test_plans_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -16493,6 +21711,48 @@ def test_plans_post_service( post_data="amount=2000¤cy=usd&interval=month&product=prod_xxxxxxxxxxxxx", ) + def test_plans_post(self, http_client_mock: HTTPClientMock) -> None: + stripe.Plan.create( + amount=2000, + currency="usd", + interval="month", + product="prod_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "post", + path="/v1/plans", + query_string="", + post_data="amount=2000¤cy=usd&interval=month&product=prod_xxxxxxxxxxxxx", + ) + + def test_plans_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/plans", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v1.plans.create( + { + "amount": 2000, + "currency": "usd", + "interval": "month", + "product": "prod_xxxxxxxxxxxxx", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/plans", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=2000¤cy=usd&interval=month&product=prod_xxxxxxxxxxxxx", + ) + @pytest.mark.anyio async def test_plans_post_async( self, http_client_mock: HTTPClientMock @@ -16523,7 +21783,7 @@ async def test_plans_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.plans.create_async( + await client.v1.plans.create_async( { "amount": 2000, "currency": "usd", @@ -16539,6 +21799,34 @@ async def test_plans_post_service_async( post_data="amount=2000¤cy=usd&interval=month&product=prod_xxxxxxxxxxxxx", ) + def test_plans_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/plans", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.plans.create( + { + "amount": 2000, + "currency": "usd", + "interval": "month", + "product": {"name": "My product"}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/plans", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=2000¤cy=usd&interval=month&product[name]=My%20product", + ) + def test_plans_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Plan.create( amount=2000, @@ -16565,7 +21853,7 @@ def test_plans_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.plans.create( + client.v1.plans.create( { "amount": 2000, "currency": "usd", @@ -16611,7 +21899,7 @@ async def test_plans_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.plans.create_async( + await client.v1.plans.create_async( { "amount": 2000, "currency": "usd", @@ -16627,6 +21915,30 @@ async def test_plans_post_2_service_async( post_data="amount=2000¤cy=usd&interval=month&product[name]=My%20product", ) + def test_plans_post_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/plans/price_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.plans.update( + "price_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/plans/price_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_plans_post_3(self, http_client_mock: HTTPClientMock) -> None: stripe.Plan.modify( "price_xxxxxxxxxxxxx", @@ -16651,7 +21963,7 @@ def test_plans_post_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.plans.update( + client.v1.plans.update( "price_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -16691,7 +22003,7 @@ async def test_plans_post_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.plans.update_async( + await client.v1.plans.update_async( "price_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -16703,6 +22015,27 @@ async def test_plans_post_3_service_async( post_data="metadata[order_id]=6735", ) + def test_prices_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/prices", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.prices.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/prices", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_prices_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Price.list(limit=3) http_client_mock.assert_requested( @@ -16724,7 +22057,7 @@ def test_prices_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.prices.list({"limit": 3}) + client.v1.prices.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/prices", @@ -16757,7 +22090,7 @@ async def test_prices_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.prices.list_async({"limit": 3}) + await client.v1.prices.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/prices", @@ -16765,6 +22098,26 @@ async def test_prices_get_service_async( api_base="https://api.stripe.com", ) + def test_prices_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/prices/price_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.prices.retrieve("price_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/prices/price_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_prices_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Price.retrieve("price_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -16785,7 +22138,7 @@ def test_prices_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.prices.retrieve("price_xxxxxxxxxxxxx") + client.v1.prices.retrieve("price_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/prices/price_xxxxxxxxxxxxx", @@ -16817,7 +22170,7 @@ async def test_prices_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.prices.retrieve_async("price_xxxxxxxxxxxxx") + await client.v1.prices.retrieve_async("price_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/prices/price_xxxxxxxxxxxxx", @@ -16825,6 +22178,38 @@ async def test_prices_get_2_service_async( api_base="https://api.stripe.com", ) + def test_prices_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/prices", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.prices.create( + { + "unit_amount": 2000, + "currency": "usd", + "currency_options": { + "uah": {"unit_amount": 5000}, + "eur": {"unit_amount": 1800}, + }, + "recurring": {"interval": "month"}, + "product": "prod_xxxxxxxxxxxxx", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/prices", + query_string="", + api_base="https://api.stripe.com", + post_data="unit_amount=2000¤cy=usd¤cy_options[uah][unit_amount]=5000¤cy_options[eur][unit_amount]=1800&recurring[interval]=month&product=prod_xxxxxxxxxxxxx", + ) + def test_prices_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Price.create( unit_amount=2000, @@ -16855,7 +22240,7 @@ def test_prices_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.prices.create( + client.v1.prices.create( { "unit_amount": 2000, "currency": "usd", @@ -16909,7 +22294,7 @@ async def test_prices_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.prices.create_async( + await client.v1.prices.create_async( { "unit_amount": 2000, "currency": "usd", @@ -16929,6 +22314,34 @@ async def test_prices_post_service_async( post_data="unit_amount=2000¤cy=usd¤cy_options[uah][unit_amount]=5000¤cy_options[eur][unit_amount]=1800&recurring[interval]=month&product=prod_xxxxxxxxxxxxx", ) + def test_prices_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/prices", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.prices.create( + { + "unit_amount": 2000, + "currency": "usd", + "recurring": {"interval": "month"}, + "product": "prod_xxxxxxxxxxxxx", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/prices", + query_string="", + api_base="https://api.stripe.com", + post_data="unit_amount=2000¤cy=usd&recurring[interval]=month&product=prod_xxxxxxxxxxxxx", + ) + def test_prices_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Price.create( unit_amount=2000, @@ -16955,7 +22368,7 @@ def test_prices_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.prices.create( + client.v1.prices.create( { "unit_amount": 2000, "currency": "usd", @@ -17001,7 +22414,7 @@ async def test_prices_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.prices.create_async( + await client.v1.prices.create_async( { "unit_amount": 2000, "currency": "usd", @@ -17017,6 +22430,30 @@ async def test_prices_post_2_service_async( post_data="unit_amount=2000¤cy=usd&recurring[interval]=month&product=prod_xxxxxxxxxxxxx", ) + def test_prices_post_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/prices/price_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.prices.update( + "price_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/prices/price_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_prices_post_3(self, http_client_mock: HTTPClientMock) -> None: stripe.Price.modify( "price_xxxxxxxxxxxxx", @@ -17041,7 +22478,7 @@ def test_prices_post_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.prices.update( + client.v1.prices.update( "price_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -17081,7 +22518,7 @@ async def test_prices_post_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.prices.update_async( + await client.v1.prices.update_async( "price_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -17093,6 +22530,31 @@ async def test_prices_post_3_service_async( post_data="metadata[order_id]=6735", ) + def test_prices_search_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/prices/search", + "query=active%3A%27true%27%20AND%20metadata%5B%27order_id%27%5D%3A%276735%27", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.prices.search( + { + "query": "active:'true' AND metadata['order_id']:'6735'", + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/prices/search", + query_string="query=active%3A%27true%27%20AND%20metadata%5B%27order_id%27%5D%3A%276735%27", + api_base="https://api.stripe.com", + ) + def test_prices_search_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Price.search( query="active:'true' AND metadata['order_id']:'6735'", @@ -17116,7 +22578,7 @@ def test_prices_search_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.prices.search( + client.v1.prices.search( { "query": "active:'true' AND metadata['order_id']:'6735'", } @@ -17155,7 +22617,7 @@ async def test_prices_search_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.prices.search_async( + await client.v1.prices.search_async( { "query": "active:'true' AND metadata['order_id']:'6735'", } @@ -17167,6 +22629,26 @@ async def test_prices_search_get_service_async( api_base="https://api.stripe.com", ) + def test_products_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/products/prod_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.products.delete("prod_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/products/prod_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_products_delete(self, http_client_mock: HTTPClientMock) -> None: stripe.Product.delete("prod_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -17187,7 +22669,7 @@ def test_products_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.products.delete("prod_xxxxxxxxxxxxx") + client.v1.products.delete("prod_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/products/prod_xxxxxxxxxxxxx", @@ -17219,7 +22701,7 @@ async def test_products_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.products.delete_async("prod_xxxxxxxxxxxxx") + await client.v1.products.delete_async("prod_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/products/prod_xxxxxxxxxxxxx", @@ -17227,6 +22709,27 @@ async def test_products_delete_service_async( api_base="https://api.stripe.com", ) + def test_products_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/products", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.products.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/products", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_products_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Product.list(limit=3) http_client_mock.assert_requested( @@ -17248,7 +22751,7 @@ def test_products_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.products.list({"limit": 3}) + client.v1.products.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/products", @@ -17281,7 +22784,7 @@ async def test_products_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.products.list_async({"limit": 3}) + await client.v1.products.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/products", @@ -17289,6 +22792,26 @@ async def test_products_get_service_async( api_base="https://api.stripe.com", ) + def test_products_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/products/prod_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.products.retrieve("prod_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/products/prod_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_products_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Product.retrieve("prod_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -17309,7 +22832,7 @@ def test_products_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.products.retrieve("prod_xxxxxxxxxxxxx") + client.v1.products.retrieve("prod_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/products/prod_xxxxxxxxxxxxx", @@ -17341,7 +22864,7 @@ async def test_products_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.products.retrieve_async("prod_xxxxxxxxxxxxx") + await client.v1.products.retrieve_async("prod_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/products/prod_xxxxxxxxxxxxx", @@ -17349,6 +22872,27 @@ async def test_products_get_2_service_async( api_base="https://api.stripe.com", ) + def test_products_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/products", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.products.create({"name": "Gold Special"}) + http_client_mock.assert_requested( + "post", + path="/v1/products", + query_string="", + api_base="https://api.stripe.com", + post_data="name=Gold%20Special", + ) + def test_products_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Product.create(name="Gold Special") http_client_mock.assert_requested( @@ -17370,7 +22914,7 @@ def test_products_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.products.create({"name": "Gold Special"}) + client.v1.products.create({"name": "Gold Special"}) http_client_mock.assert_requested( "post", path="/v1/products", @@ -17404,7 +22948,7 @@ async def test_products_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.products.create_async({"name": "Gold Special"}) + await client.v1.products.create_async({"name": "Gold Special"}) http_client_mock.assert_requested( "post", path="/v1/products", @@ -17413,6 +22957,30 @@ async def test_products_post_service_async( post_data="name=Gold%20Special", ) + def test_products_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/products/prod_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.products.update( + "prod_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/products/prod_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_products_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Product.modify( "prod_xxxxxxxxxxxxx", @@ -17437,7 +23005,7 @@ def test_products_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.products.update( + client.v1.products.update( "prod_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -17477,7 +23045,7 @@ async def test_products_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.products.update_async( + await client.v1.products.update_async( "prod_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -17489,6 +23057,31 @@ async def test_products_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_products_search_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/products/search", + "query=active%3A%27true%27%20AND%20metadata%5B%27order_id%27%5D%3A%276735%27", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.products.search( + { + "query": "active:'true' AND metadata['order_id']:'6735'", + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/products/search", + query_string="query=active%3A%27true%27%20AND%20metadata%5B%27order_id%27%5D%3A%276735%27", + api_base="https://api.stripe.com", + ) + def test_products_search_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -17514,7 +23107,7 @@ def test_products_search_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.products.search( + client.v1.products.search( { "query": "active:'true' AND metadata['order_id']:'6735'", } @@ -17553,7 +23146,7 @@ async def test_products_search_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.products.search_async( + await client.v1.products.search_async( { "query": "active:'true' AND metadata['order_id']:'6735'", } @@ -17565,6 +23158,27 @@ async def test_products_search_get_service_async( api_base="https://api.stripe.com", ) + def test_promotion_codes_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/promotion_codes", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.promotion_codes.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/promotion_codes", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_promotion_codes_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -17588,7 +23202,7 @@ def test_promotion_codes_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.promotion_codes.list({"limit": 3}) + client.v1.promotion_codes.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/promotion_codes", @@ -17621,7 +23235,7 @@ async def test_promotion_codes_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.promotion_codes.list_async({"limit": 3}) + await client.v1.promotion_codes.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/promotion_codes", @@ -17629,6 +23243,26 @@ async def test_promotion_codes_get_service_async( api_base="https://api.stripe.com", ) + def test_promotion_codes_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/promotion_codes/promo_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.promotion_codes.retrieve("promo_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/promotion_codes/promo_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_promotion_codes_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -17651,7 +23285,7 @@ def test_promotion_codes_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.promotion_codes.retrieve("promo_xxxxxxxxxxxxx") + client.v1.promotion_codes.retrieve("promo_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/promotion_codes/promo_xxxxxxxxxxxxx", @@ -17683,7 +23317,7 @@ async def test_promotion_codes_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.promotion_codes.retrieve_async("promo_xxxxxxxxxxxxx") + await client.v1.promotion_codes.retrieve_async("promo_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/promotion_codes/promo_xxxxxxxxxxxxx", @@ -17691,6 +23325,27 @@ async def test_promotion_codes_get_2_service_async( api_base="https://api.stripe.com", ) + def test_promotion_codes_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/promotion_codes", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.promotion_codes.create({"coupon": "Z4OV52SU"}) + http_client_mock.assert_requested( + "post", + path="/v1/promotion_codes", + query_string="", + api_base="https://api.stripe.com", + post_data="coupon=Z4OV52SU", + ) + def test_promotion_codes_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -17714,7 +23369,7 @@ def test_promotion_codes_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.promotion_codes.create({"coupon": "Z4OV52SU"}) + client.v1.promotion_codes.create({"coupon": "Z4OV52SU"}) http_client_mock.assert_requested( "post", path="/v1/promotion_codes", @@ -17748,7 +23403,7 @@ async def test_promotion_codes_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.promotion_codes.create_async({"coupon": "Z4OV52SU"}) + await client.v1.promotion_codes.create_async({"coupon": "Z4OV52SU"}) http_client_mock.assert_requested( "post", path="/v1/promotion_codes", @@ -17757,6 +23412,30 @@ async def test_promotion_codes_post_service_async( post_data="coupon=Z4OV52SU", ) + def test_promotion_codes_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/promotion_codes/promo_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.promotion_codes.update( + "promo_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/promotion_codes/promo_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_promotion_codes_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -17783,7 +23462,7 @@ def test_promotion_codes_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.promotion_codes.update( + client.v1.promotion_codes.update( "promo_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -17823,7 +23502,7 @@ async def test_promotion_codes_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.promotion_codes.update_async( + await client.v1.promotion_codes.update_async( "promo_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -17835,6 +23514,26 @@ async def test_promotion_codes_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_quotes_accept_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/quotes/qt_xxxxxxxxxxxxx/accept", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.quotes.accept("qt_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/quotes/qt_xxxxxxxxxxxxx/accept", + query_string="", + api_base="https://api.stripe.com", + ) + def test_quotes_accept_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -17857,7 +23556,7 @@ def test_quotes_accept_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.quotes.accept("qt_xxxxxxxxxxxxx") + client.v1.quotes.accept("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/quotes/qt_xxxxxxxxxxxxx/accept", @@ -17889,7 +23588,7 @@ async def test_quotes_accept_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.quotes.accept_async("qt_xxxxxxxxxxxxx") + await client.v1.quotes.accept_async("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/quotes/qt_xxxxxxxxxxxxx/accept", @@ -17897,6 +23596,26 @@ async def test_quotes_accept_post_service_async( api_base="https://api.stripe.com", ) + def test_quotes_cancel_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/quotes/qt_xxxxxxxxxxxxx/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.quotes.cancel("qt_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/quotes/qt_xxxxxxxxxxxxx/cancel", + query_string="", + api_base="https://api.stripe.com", + ) + def test_quotes_cancel_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -17919,7 +23638,7 @@ def test_quotes_cancel_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.quotes.cancel("qt_xxxxxxxxxxxxx") + client.v1.quotes.cancel("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/quotes/qt_xxxxxxxxxxxxx/cancel", @@ -17951,7 +23670,7 @@ async def test_quotes_cancel_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.quotes.cancel_async("qt_xxxxxxxxxxxxx") + await client.v1.quotes.cancel_async("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/quotes/qt_xxxxxxxxxxxxx/cancel", @@ -17959,6 +23678,26 @@ async def test_quotes_cancel_post_service_async( api_base="https://api.stripe.com", ) + def test_quotes_finalize_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/quotes/qt_xxxxxxxxxxxxx/finalize", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.quotes.finalize_quote("qt_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/quotes/qt_xxxxxxxxxxxxx/finalize", + query_string="", + api_base="https://api.stripe.com", + ) + def test_quotes_finalize_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -17981,7 +23720,7 @@ def test_quotes_finalize_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.quotes.finalize_quote("qt_xxxxxxxxxxxxx") + client.v1.quotes.finalize_quote("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/quotes/qt_xxxxxxxxxxxxx/finalize", @@ -18013,7 +23752,7 @@ async def test_quotes_finalize_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.quotes.finalize_quote_async("qt_xxxxxxxxxxxxx") + await client.v1.quotes.finalize_quote_async("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/quotes/qt_xxxxxxxxxxxxx/finalize", @@ -18021,6 +23760,27 @@ async def test_quotes_finalize_post_service_async( api_base="https://api.stripe.com", ) + def test_quotes_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/quotes", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.quotes.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/quotes", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_quotes_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Quote.list(limit=3) http_client_mock.assert_requested( @@ -18042,7 +23802,7 @@ def test_quotes_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.quotes.list({"limit": 3}) + client.v1.quotes.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/quotes", @@ -18075,7 +23835,7 @@ async def test_quotes_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.quotes.list_async({"limit": 3}) + await client.v1.quotes.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/quotes", @@ -18083,6 +23843,26 @@ async def test_quotes_get_service_async( api_base="https://api.stripe.com", ) + def test_quotes_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/quotes/qt_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.quotes.retrieve("qt_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/quotes/qt_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_quotes_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Quote.retrieve("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -18103,7 +23883,7 @@ def test_quotes_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.quotes.retrieve("qt_xxxxxxxxxxxxx") + client.v1.quotes.retrieve("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/quotes/qt_xxxxxxxxxxxxx", @@ -18135,7 +23915,7 @@ async def test_quotes_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.quotes.retrieve_async("qt_xxxxxxxxxxxxx") + await client.v1.quotes.retrieve_async("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/quotes/qt_xxxxxxxxxxxxx", @@ -18143,6 +23923,26 @@ async def test_quotes_get_2_service_async( api_base="https://api.stripe.com", ) + def test_quotes_line_items_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/quotes/qt_xxxxxxxxxxxxx/line_items", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.quotes.line_items.list("qt_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/quotes/qt_xxxxxxxxxxxxx/line_items", + query_string="", + api_base="https://api.stripe.com", + ) + def test_quotes_line_items_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -18165,7 +23965,7 @@ def test_quotes_line_items_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.quotes.line_items.list("qt_xxxxxxxxxxxxx") + client.v1.quotes.line_items.list("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/quotes/qt_xxxxxxxxxxxxx/line_items", @@ -18197,7 +23997,7 @@ async def test_quotes_line_items_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.quotes.line_items.list_async("qt_xxxxxxxxxxxxx") + await client.v1.quotes.line_items.list_async("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/quotes/qt_xxxxxxxxxxxxx/line_items", @@ -18205,6 +24005,26 @@ async def test_quotes_line_items_get_service_async( api_base="https://api.stripe.com", ) + def test_quotes_pdf_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/quotes/qt_xxxxxxxxxxxxx/pdf", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.quotes.pdf("qt_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/quotes/qt_xxxxxxxxxxxxx/pdf", + query_string="", + api_base="https://files.stripe.com", + ) + def test_quotes_pdf_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Quote.pdf("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -18225,7 +24045,7 @@ def test_quotes_pdf_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.quotes.pdf("qt_xxxxxxxxxxxxx") + client.v1.quotes.pdf("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/quotes/qt_xxxxxxxxxxxxx/pdf", @@ -18257,7 +24077,7 @@ async def test_quotes_pdf_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.quotes.pdf_async("qt_xxxxxxxxxxxxx") + await client.v1.quotes.pdf_async("qt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/quotes/qt_xxxxxxxxxxxxx/pdf", @@ -18265,6 +24085,34 @@ async def test_quotes_pdf_get_service_async( api_base="https://files.stripe.com", ) + def test_quotes_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/quotes", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.quotes.create( + { + "customer": "cus_xxxxxxxxxxxxx", + "line_items": [ + {"price": "price_xxxxxxxxxxxxx", "quantity": 2} + ], + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/quotes", + query_string="", + api_base="https://api.stripe.com", + post_data="customer=cus_xxxxxxxxxxxxx&line_items[0][price]=price_xxxxxxxxxxxxx&line_items[0][quantity]=2", + ) + def test_quotes_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Quote.create( customer="cus_xxxxxxxxxxxxx", @@ -18289,7 +24137,7 @@ def test_quotes_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.quotes.create( + client.v1.quotes.create( { "customer": "cus_xxxxxxxxxxxxx", "line_items": [ @@ -18333,7 +24181,7 @@ async def test_quotes_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.quotes.create_async( + await client.v1.quotes.create_async( { "customer": "cus_xxxxxxxxxxxxx", "line_items": [ @@ -18349,6 +24197,30 @@ async def test_quotes_post_service_async( post_data="customer=cus_xxxxxxxxxxxxx&line_items[0][price]=price_xxxxxxxxxxxxx&line_items[0][quantity]=2", ) + def test_quotes_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/quotes/qt_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.quotes.update( + "qt_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/quotes/qt_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_quotes_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Quote.modify( "qt_xxxxxxxxxxxxx", @@ -18373,7 +24245,7 @@ def test_quotes_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.quotes.update( + client.v1.quotes.update( "qt_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -18413,7 +24285,7 @@ async def test_quotes_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.quotes.update_async( + await client.v1.quotes.update_async( "qt_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -18425,6 +24297,27 @@ async def test_quotes_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_radar_early_fraud_warnings_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/radar/early_fraud_warnings", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.radar.early_fraud_warnings.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/radar/early_fraud_warnings", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_radar_early_fraud_warnings_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -18448,7 +24341,7 @@ def test_radar_early_fraud_warnings_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.radar.early_fraud_warnings.list({"limit": 3}) + client.v1.radar.early_fraud_warnings.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/radar/early_fraud_warnings", @@ -18481,7 +24374,7 @@ async def test_radar_early_fraud_warnings_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.radar.early_fraud_warnings.list_async({"limit": 3}) + await client.v1.radar.early_fraud_warnings.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/radar/early_fraud_warnings", @@ -18489,6 +24382,26 @@ async def test_radar_early_fraud_warnings_get_service_async( api_base="https://api.stripe.com", ) + def test_radar_early_fraud_warnings_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/radar/early_fraud_warnings/issfr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.radar.early_fraud_warnings.retrieve("issfr_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/radar/early_fraud_warnings/issfr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_radar_early_fraud_warnings_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -18511,7 +24424,7 @@ def test_radar_early_fraud_warnings_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.radar.early_fraud_warnings.retrieve("issfr_xxxxxxxxxxxxx") + client.v1.radar.early_fraud_warnings.retrieve("issfr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/radar/early_fraud_warnings/issfr_xxxxxxxxxxxxx", @@ -18545,7 +24458,7 @@ async def test_radar_early_fraud_warnings_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.radar.early_fraud_warnings.retrieve_async( + await client.v1.radar.early_fraud_warnings.retrieve_async( "issfr_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -18555,6 +24468,26 @@ async def test_radar_early_fraud_warnings_get_2_service_async( api_base="https://api.stripe.com", ) + def test_radar_value_list_items_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.radar.value_list_items.delete("rsli_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_radar_value_list_items_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -18577,7 +24510,7 @@ def test_radar_value_list_items_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.radar.value_list_items.delete("rsli_xxxxxxxxxxxxx") + client.v1.radar.value_list_items.delete("rsli_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", @@ -18609,7 +24542,9 @@ async def test_radar_value_list_items_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.radar.value_list_items.delete_async("rsli_xxxxxxxxxxxxx") + await client.v1.radar.value_list_items.delete_async( + "rsli_xxxxxxxxxxxxx", + ) http_client_mock.assert_requested( "delete", path="/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", @@ -18617,6 +24552,32 @@ async def test_radar_value_list_items_delete_service_async( api_base="https://api.stripe.com", ) + def test_radar_value_list_items_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/radar/value_list_items", + "limit=3&value_list=rsl_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.radar.value_list_items.list( + { + "limit": 3, + "value_list": "rsl_xxxxxxxxxxxxx", + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/radar/value_list_items", + query_string="limit=3&value_list=rsl_xxxxxxxxxxxxx", + api_base="https://api.stripe.com", + ) + def test_radar_value_list_items_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -18643,7 +24604,7 @@ def test_radar_value_list_items_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.radar.value_list_items.list( + client.v1.radar.value_list_items.list( { "limit": 3, "value_list": "rsl_xxxxxxxxxxxxx", @@ -18684,7 +24645,7 @@ async def test_radar_value_list_items_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.radar.value_list_items.list_async( + await client.v1.radar.value_list_items.list_async( { "limit": 3, "value_list": "rsl_xxxxxxxxxxxxx", @@ -18697,6 +24658,26 @@ async def test_radar_value_list_items_get_service_async( api_base="https://api.stripe.com", ) + def test_radar_value_list_items_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.radar.value_list_items.retrieve("rsli_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_radar_value_list_items_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -18719,7 +24700,7 @@ def test_radar_value_list_items_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.radar.value_list_items.retrieve("rsli_xxxxxxxxxxxxx") + client.v1.radar.value_list_items.retrieve("rsli_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", @@ -18751,8 +24732,8 @@ async def test_radar_value_list_items_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.radar.value_list_items.retrieve_async( - "rsli_xxxxxxxxxxxxx" + await client.v1.radar.value_list_items.retrieve_async( + "rsli_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( "get", @@ -18761,21 +24742,7 @@ async def test_radar_value_list_items_get_2_service_async( api_base="https://api.stripe.com", ) - def test_radar_value_list_items_post( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.radar.ValueListItem.create( - value_list="rsl_xxxxxxxxxxxxx", - value="1.2.3.4", - ) - http_client_mock.assert_requested( - "post", - path="/v1/radar/value_list_items", - query_string="", - post_data="value_list=rsl_xxxxxxxxxxxxx&value=1.2.3.4", - ) - - def test_radar_value_list_items_post_service( + def test_radar_value_list_items_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -18801,11 +24768,10 @@ def test_radar_value_list_items_post_service( post_data="value_list=rsl_xxxxxxxxxxxxx&value=1.2.3.4", ) - @pytest.mark.anyio - async def test_radar_value_list_items_post_async( + def test_radar_value_list_items_post( self, http_client_mock: HTTPClientMock ) -> None: - await stripe.radar.ValueListItem.create_async( + stripe.radar.ValueListItem.create( value_list="rsl_xxxxxxxxxxxxx", value="1.2.3.4", ) @@ -18816,8 +24782,7 @@ async def test_radar_value_list_items_post_async( post_data="value_list=rsl_xxxxxxxxxxxxx&value=1.2.3.4", ) - @pytest.mark.anyio - async def test_radar_value_list_items_post_service_async( + def test_radar_value_list_items_post_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -18829,7 +24794,7 @@ async def test_radar_value_list_items_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.radar.value_list_items.create_async( + client.v1.radar.value_list_items.create( { "value_list": "rsl_xxxxxxxxxxxxx", "value": "1.2.3.4", @@ -18843,6 +24808,68 @@ async def test_radar_value_list_items_post_service_async( post_data="value_list=rsl_xxxxxxxxxxxxx&value=1.2.3.4", ) + @pytest.mark.anyio + async def test_radar_value_list_items_post_async( + self, http_client_mock: HTTPClientMock + ) -> None: + await stripe.radar.ValueListItem.create_async( + value_list="rsl_xxxxxxxxxxxxx", + value="1.2.3.4", + ) + http_client_mock.assert_requested( + "post", + path="/v1/radar/value_list_items", + query_string="", + post_data="value_list=rsl_xxxxxxxxxxxxx&value=1.2.3.4", + ) + + @pytest.mark.anyio + async def test_radar_value_list_items_post_service_async( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/radar/value_list_items", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + await client.v1.radar.value_list_items.create_async( + { + "value_list": "rsl_xxxxxxxxxxxxx", + "value": "1.2.3.4", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/radar/value_list_items", + query_string="", + api_base="https://api.stripe.com", + post_data="value_list=rsl_xxxxxxxxxxxxx&value=1.2.3.4", + ) + + def test_radar_value_lists_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.radar.value_lists.delete("rsl_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_radar_value_lists_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -18865,7 +24892,7 @@ def test_radar_value_lists_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.radar.value_lists.delete("rsl_xxxxxxxxxxxxx") + client.v1.radar.value_lists.delete("rsl_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", @@ -18897,7 +24924,7 @@ async def test_radar_value_lists_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.radar.value_lists.delete_async("rsl_xxxxxxxxxxxxx") + await client.v1.radar.value_lists.delete_async("rsl_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", @@ -18905,6 +24932,27 @@ async def test_radar_value_lists_delete_service_async( api_base="https://api.stripe.com", ) + def test_radar_value_lists_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/radar/value_lists", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.radar.value_lists.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/radar/value_lists", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_radar_value_lists_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -18928,7 +24976,7 @@ def test_radar_value_lists_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.radar.value_lists.list({"limit": 3}) + client.v1.radar.value_lists.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/radar/value_lists", @@ -18961,7 +25009,7 @@ async def test_radar_value_lists_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.radar.value_lists.list_async({"limit": 3}) + await client.v1.radar.value_lists.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/radar/value_lists", @@ -18969,6 +25017,26 @@ async def test_radar_value_lists_get_service_async( api_base="https://api.stripe.com", ) + def test_radar_value_lists_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.radar.value_lists.retrieve("rsl_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_radar_value_lists_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -18991,7 +25059,7 @@ def test_radar_value_lists_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.radar.value_lists.retrieve("rsl_xxxxxxxxxxxxx") + client.v1.radar.value_lists.retrieve("rsl_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", @@ -19023,7 +25091,7 @@ async def test_radar_value_lists_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.radar.value_lists.retrieve_async("rsl_xxxxxxxxxxxxx") + await client.v1.radar.value_lists.retrieve_async("rsl_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", @@ -19031,6 +25099,33 @@ async def test_radar_value_lists_get_2_service_async( api_base="https://api.stripe.com", ) + def test_radar_value_lists_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/radar/value_lists", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.radar.value_lists.create( + { + "alias": "custom_ip_xxxxxxxxxxxxx", + "name": "Custom IP Blocklist", + "item_type": "ip_address", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/radar/value_lists", + query_string="", + api_base="https://api.stripe.com", + post_data="alias=custom_ip_xxxxxxxxxxxxx&name=Custom%20IP%20Blocklist&item_type=ip_address", + ) + def test_radar_value_lists_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -19058,7 +25153,7 @@ def test_radar_value_lists_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.radar.value_lists.create( + client.v1.radar.value_lists.create( { "alias": "custom_ip_xxxxxxxxxxxxx", "name": "Custom IP Blocklist", @@ -19102,7 +25197,7 @@ async def test_radar_value_lists_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.radar.value_lists.create_async( + await client.v1.radar.value_lists.create_async( { "alias": "custom_ip_xxxxxxxxxxxxx", "name": "Custom IP Blocklist", @@ -19117,6 +25212,30 @@ async def test_radar_value_lists_post_service_async( post_data="alias=custom_ip_xxxxxxxxxxxxx&name=Custom%20IP%20Blocklist&item_type=ip_address", ) + def test_radar_value_lists_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.radar.value_lists.update( + "rsl_xxxxxxxxxxxxx", + {"name": "Updated IP Block List"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="name=Updated%20IP%20Block%20List", + ) + def test_radar_value_lists_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -19143,7 +25262,7 @@ def test_radar_value_lists_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.radar.value_lists.update( + client.v1.radar.value_lists.update( "rsl_xxxxxxxxxxxxx", {"name": "Updated IP Block List"}, ) @@ -19183,7 +25302,7 @@ async def test_radar_value_lists_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.radar.value_lists.update_async( + await client.v1.radar.value_lists.update_async( "rsl_xxxxxxxxxxxxx", {"name": "Updated IP Block List"}, ) @@ -19195,6 +25314,26 @@ async def test_radar_value_lists_post_2_service_async( post_data="name=Updated%20IP%20Block%20List", ) + def test_refunds_cancel_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/refunds/re_xxxxxxxxxxxxx/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.refunds.cancel("re_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/refunds/re_xxxxxxxxxxxxx/cancel", + query_string="", + api_base="https://api.stripe.com", + ) + def test_refunds_cancel_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -19217,7 +25356,7 @@ def test_refunds_cancel_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.refunds.cancel("re_xxxxxxxxxxxxx") + client.v1.refunds.cancel("re_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/refunds/re_xxxxxxxxxxxxx/cancel", @@ -19249,7 +25388,7 @@ async def test_refunds_cancel_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.refunds.cancel_async("re_xxxxxxxxxxxxx") + await client.v1.refunds.cancel_async("re_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/refunds/re_xxxxxxxxxxxxx/cancel", @@ -19257,6 +25396,27 @@ async def test_refunds_cancel_post_service_async( api_base="https://api.stripe.com", ) + def test_refunds_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/refunds", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.refunds.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/refunds", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_refunds_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Refund.list(limit=3) http_client_mock.assert_requested( @@ -19278,7 +25438,7 @@ def test_refunds_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.refunds.list({"limit": 3}) + client.v1.refunds.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/refunds", @@ -19311,7 +25471,7 @@ async def test_refunds_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.refunds.list_async({"limit": 3}) + await client.v1.refunds.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/refunds", @@ -19319,6 +25479,26 @@ async def test_refunds_get_service_async( api_base="https://api.stripe.com", ) + def test_refunds_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/refunds/re_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.refunds.retrieve("re_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/refunds/re_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_refunds_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Refund.retrieve("re_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -19339,7 +25519,7 @@ def test_refunds_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.refunds.retrieve("re_xxxxxxxxxxxxx") + client.v1.refunds.retrieve("re_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/refunds/re_xxxxxxxxxxxxx", @@ -19371,7 +25551,7 @@ async def test_refunds_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.refunds.retrieve_async("re_xxxxxxxxxxxxx") + await client.v1.refunds.retrieve_async("re_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/refunds/re_xxxxxxxxxxxxx", @@ -19379,6 +25559,27 @@ async def test_refunds_get_2_service_async( api_base="https://api.stripe.com", ) + def test_refunds_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/refunds", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.refunds.create({"charge": "ch_xxxxxxxxxxxxx"}) + http_client_mock.assert_requested( + "post", + path="/v1/refunds", + query_string="", + api_base="https://api.stripe.com", + post_data="charge=ch_xxxxxxxxxxxxx", + ) + def test_refunds_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Refund.create(charge="ch_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -19400,7 +25601,7 @@ def test_refunds_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.refunds.create({"charge": "ch_xxxxxxxxxxxxx"}) + client.v1.refunds.create({"charge": "ch_xxxxxxxxxxxxx"}) http_client_mock.assert_requested( "post", path="/v1/refunds", @@ -19434,7 +25635,7 @@ async def test_refunds_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.refunds.create_async({"charge": "ch_xxxxxxxxxxxxx"}) + await client.v1.refunds.create_async({"charge": "ch_xxxxxxxxxxxxx"}) http_client_mock.assert_requested( "post", path="/v1/refunds", @@ -19443,19 +25644,7 @@ async def test_refunds_post_service_async( post_data="charge=ch_xxxxxxxxxxxxx", ) - def test_refunds_post_2(self, http_client_mock: HTTPClientMock) -> None: - stripe.Refund.modify( - "re_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - http_client_mock.assert_requested( - "post", - path="/v1/refunds/re_xxxxxxxxxxxxx", - query_string="", - post_data="metadata[order_id]=6735", - ) - - def test_refunds_post_2_service( + def test_refunds_post_2_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -19479,11 +25668,8 @@ def test_refunds_post_2_service( post_data="metadata[order_id]=6735", ) - @pytest.mark.anyio - async def test_refunds_post_2_async( - self, http_client_mock: HTTPClientMock - ) -> None: - await stripe.Refund.modify_async( + def test_refunds_post_2(self, http_client_mock: HTTPClientMock) -> None: + stripe.Refund.modify( "re_xxxxxxxxxxxxx", metadata={"order_id": "6735"}, ) @@ -19494,8 +25680,7 @@ async def test_refunds_post_2_async( post_data="metadata[order_id]=6735", ) - @pytest.mark.anyio - async def test_refunds_post_2_service_async( + def test_refunds_post_2_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -19507,7 +25692,7 @@ async def test_refunds_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.refunds.update_async( + client.v1.refunds.update( "re_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -19519,6 +25704,67 @@ async def test_refunds_post_2_service_async( post_data="metadata[order_id]=6735", ) + @pytest.mark.anyio + async def test_refunds_post_2_async( + self, http_client_mock: HTTPClientMock + ) -> None: + await stripe.Refund.modify_async( + "re_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/refunds/re_xxxxxxxxxxxxx", + query_string="", + post_data="metadata[order_id]=6735", + ) + + @pytest.mark.anyio + async def test_refunds_post_2_service_async( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/refunds/re_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + await client.v1.refunds.update_async( + "re_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/refunds/re_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + + def test_reporting_report_runs_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/reporting/report_runs", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.reporting.report_runs.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/reporting/report_runs", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_reporting_report_runs_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -19542,7 +25788,7 @@ def test_reporting_report_runs_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.reporting.report_runs.list({"limit": 3}) + client.v1.reporting.report_runs.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/reporting/report_runs", @@ -19575,7 +25821,7 @@ async def test_reporting_report_runs_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.reporting.report_runs.list_async({"limit": 3}) + await client.v1.reporting.report_runs.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/reporting/report_runs", @@ -19583,6 +25829,26 @@ async def test_reporting_report_runs_get_service_async( api_base="https://api.stripe.com", ) + def test_reporting_report_runs_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/reporting/report_runs/frr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.reporting.report_runs.retrieve("frr_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/reporting/report_runs/frr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_reporting_report_runs_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -19605,7 +25871,7 @@ def test_reporting_report_runs_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.reporting.report_runs.retrieve("frr_xxxxxxxxxxxxx") + client.v1.reporting.report_runs.retrieve("frr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/reporting/report_runs/frr_xxxxxxxxxxxxx", @@ -19637,7 +25903,9 @@ async def test_reporting_report_runs_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.reporting.report_runs.retrieve_async("frr_xxxxxxxxxxxxx") + await client.v1.reporting.report_runs.retrieve_async( + "frr_xxxxxxxxxxxxx", + ) http_client_mock.assert_requested( "get", path="/v1/reporting/report_runs/frr_xxxxxxxxxxxxx", @@ -19645,6 +25913,35 @@ async def test_reporting_report_runs_get_2_service_async( api_base="https://api.stripe.com", ) + def test_reporting_report_runs_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/reporting/report_runs", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.reporting.report_runs.create( + { + "report_type": "balance.summary.1", + "parameters": { + "interval_start": 1522540800, + "interval_end": 1525132800, + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/reporting/report_runs", + query_string="", + api_base="https://api.stripe.com", + post_data="report_type=balance.summary.1¶meters[interval_start]=1522540800¶meters[interval_end]=1525132800", + ) + def test_reporting_report_runs_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -19674,7 +25971,7 @@ def test_reporting_report_runs_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.reporting.report_runs.create( + client.v1.reporting.report_runs.create( { "report_type": "balance.summary.1", "parameters": { @@ -19722,7 +26019,7 @@ async def test_reporting_report_runs_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.reporting.report_runs.create_async( + await client.v1.reporting.report_runs.create_async( { "report_type": "balance.summary.1", "parameters": { @@ -19739,6 +26036,26 @@ async def test_reporting_report_runs_post_service_async( post_data="report_type=balance.summary.1¶meters[interval_start]=1522540800¶meters[interval_end]=1525132800", ) + def test_reporting_report_types_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/reporting/report_types", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.reporting.report_types.list() + http_client_mock.assert_requested( + "get", + path="/v1/reporting/report_types", + query_string="", + api_base="https://api.stripe.com", + ) + def test_reporting_report_types_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -19761,7 +26078,7 @@ def test_reporting_report_types_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.reporting.report_types.list() + client.v1.reporting.report_types.list() http_client_mock.assert_requested( "get", path="/v1/reporting/report_types", @@ -19793,7 +26110,7 @@ async def test_reporting_report_types_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.reporting.report_types.list_async() + await client.v1.reporting.report_types.list_async() http_client_mock.assert_requested( "get", path="/v1/reporting/report_types", @@ -19801,6 +26118,26 @@ async def test_reporting_report_types_get_service_async( api_base="https://api.stripe.com", ) + def test_reporting_report_types_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/reporting/report_types/balance.summary.1", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.reporting.report_types.retrieve("balance.summary.1") + http_client_mock.assert_requested( + "get", + path="/v1/reporting/report_types/balance.summary.1", + query_string="", + api_base="https://api.stripe.com", + ) + def test_reporting_report_types_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -19823,7 +26160,7 @@ def test_reporting_report_types_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.reporting.report_types.retrieve("balance.summary.1") + client.v1.reporting.report_types.retrieve("balance.summary.1") http_client_mock.assert_requested( "get", path="/v1/reporting/report_types/balance.summary.1", @@ -19855,7 +26192,9 @@ async def test_reporting_report_types_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.reporting.report_types.retrieve_async("balance.summary.1") + await client.v1.reporting.report_types.retrieve_async( + "balance.summary.1", + ) http_client_mock.assert_requested( "get", path="/v1/reporting/report_types/balance.summary.1", @@ -19863,6 +26202,26 @@ async def test_reporting_report_types_get_2_service_async( api_base="https://api.stripe.com", ) + def test_reviews_approve_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/reviews/prv_xxxxxxxxxxxxx/approve", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.reviews.approve("prv_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/reviews/prv_xxxxxxxxxxxxx/approve", + query_string="", + api_base="https://api.stripe.com", + ) + def test_reviews_approve_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -19885,7 +26244,7 @@ def test_reviews_approve_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.reviews.approve("prv_xxxxxxxxxxxxx") + client.v1.reviews.approve("prv_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/reviews/prv_xxxxxxxxxxxxx/approve", @@ -19917,7 +26276,7 @@ async def test_reviews_approve_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.reviews.approve_async("prv_xxxxxxxxxxxxx") + await client.v1.reviews.approve_async("prv_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/reviews/prv_xxxxxxxxxxxxx/approve", @@ -19925,6 +26284,27 @@ async def test_reviews_approve_post_service_async( api_base="https://api.stripe.com", ) + def test_reviews_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/reviews", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.reviews.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/reviews", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_reviews_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Review.list(limit=3) http_client_mock.assert_requested( @@ -19946,7 +26326,7 @@ def test_reviews_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.reviews.list({"limit": 3}) + client.v1.reviews.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/reviews", @@ -19979,7 +26359,7 @@ async def test_reviews_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.reviews.list_async({"limit": 3}) + await client.v1.reviews.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/reviews", @@ -19987,6 +26367,26 @@ async def test_reviews_get_service_async( api_base="https://api.stripe.com", ) + def test_reviews_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/reviews/prv_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.reviews.retrieve("prv_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/reviews/prv_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_reviews_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Review.retrieve("prv_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -20007,7 +26407,7 @@ def test_reviews_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.reviews.retrieve("prv_xxxxxxxxxxxxx") + client.v1.reviews.retrieve("prv_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/reviews/prv_xxxxxxxxxxxxx", @@ -20039,7 +26439,7 @@ async def test_reviews_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.reviews.retrieve_async("prv_xxxxxxxxxxxxx") + await client.v1.reviews.retrieve_async("prv_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/reviews/prv_xxxxxxxxxxxxx", @@ -20047,6 +26447,27 @@ async def test_reviews_get_2_service_async( api_base="https://api.stripe.com", ) + def test_setup_attempts_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/setup_attempts", + "limit=3&setup_intent=si_xyz", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.setup_attempts.list({"limit": 3, "setup_intent": "si_xyz"}) + http_client_mock.assert_requested( + "get", + path="/v1/setup_attempts", + query_string="limit=3&setup_intent=si_xyz", + api_base="https://api.stripe.com", + ) + def test_setup_attempts_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -20073,7 +26494,7 @@ def test_setup_attempts_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.setup_attempts.list({"limit": 3, "setup_intent": "si_xyz"}) + client.v1.setup_attempts.list({"limit": 3, "setup_intent": "si_xyz"}) http_client_mock.assert_requested( "get", path="/v1/setup_attempts", @@ -20109,7 +26530,7 @@ async def test_setup_attempts_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.setup_attempts.list_async( + await client.v1.setup_attempts.list_async( { "limit": 3, "setup_intent": "si_xyz", @@ -20122,6 +26543,26 @@ async def test_setup_attempts_get_service_async( api_base="https://api.stripe.com", ) + def test_setup_intents_cancel_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.setup_intents.cancel("seti_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/setup_intents/seti_xxxxxxxxxxxxx/cancel", + query_string="", + api_base="https://api.stripe.com", + ) + def test_setup_intents_cancel_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -20144,7 +26585,7 @@ def test_setup_intents_cancel_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.setup_intents.cancel("seti_xxxxxxxxxxxxx") + client.v1.setup_intents.cancel("seti_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/setup_intents/seti_xxxxxxxxxxxxx/cancel", @@ -20176,7 +26617,7 @@ async def test_setup_intents_cancel_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.setup_intents.cancel_async("seti_xxxxxxxxxxxxx") + await client.v1.setup_intents.cancel_async("seti_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/setup_intents/seti_xxxxxxxxxxxxx/cancel", @@ -20184,21 +26625,7 @@ async def test_setup_intents_cancel_post_service_async( api_base="https://api.stripe.com", ) - def test_setup_intents_confirm_post( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.SetupIntent.confirm( - "seti_xxxxxxxxxxxxx", - payment_method="pm_card_visa", - ) - http_client_mock.assert_requested( - "post", - path="/v1/setup_intents/seti_xxxxxxxxxxxxx/confirm", - query_string="", - post_data="payment_method=pm_card_visa", - ) - - def test_setup_intents_confirm_post_service( + def test_setup_intents_confirm_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -20222,6 +26649,44 @@ def test_setup_intents_confirm_post_service( post_data="payment_method=pm_card_visa", ) + def test_setup_intents_confirm_post( + self, http_client_mock: HTTPClientMock + ) -> None: + stripe.SetupIntent.confirm( + "seti_xxxxxxxxxxxxx", + payment_method="pm_card_visa", + ) + http_client_mock.assert_requested( + "post", + path="/v1/setup_intents/seti_xxxxxxxxxxxxx/confirm", + query_string="", + post_data="payment_method=pm_card_visa", + ) + + def test_setup_intents_confirm_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx/confirm", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v1.setup_intents.confirm( + "seti_xxxxxxxxxxxxx", + {"payment_method": "pm_card_visa"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/setup_intents/seti_xxxxxxxxxxxxx/confirm", + query_string="", + api_base="https://api.stripe.com", + post_data="payment_method=pm_card_visa", + ) + @pytest.mark.anyio async def test_setup_intents_confirm_post_async( self, http_client_mock: HTTPClientMock @@ -20250,7 +26715,7 @@ async def test_setup_intents_confirm_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.setup_intents.confirm_async( + await client.v1.setup_intents.confirm_async( "seti_xxxxxxxxxxxxx", {"payment_method": "pm_card_visa"}, ) @@ -20262,6 +26727,27 @@ async def test_setup_intents_confirm_post_service_async( post_data="payment_method=pm_card_visa", ) + def test_setup_intents_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/setup_intents", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.setup_intents.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/setup_intents", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_setup_intents_get(self, http_client_mock: HTTPClientMock) -> None: stripe.SetupIntent.list(limit=3) http_client_mock.assert_requested( @@ -20283,7 +26769,7 @@ def test_setup_intents_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.setup_intents.list({"limit": 3}) + client.v1.setup_intents.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/setup_intents", @@ -20316,7 +26802,7 @@ async def test_setup_intents_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.setup_intents.list_async({"limit": 3}) + await client.v1.setup_intents.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/setup_intents", @@ -20324,6 +26810,26 @@ async def test_setup_intents_get_service_async( api_base="https://api.stripe.com", ) + def test_setup_intents_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/setup_intents/seti_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.setup_intents.retrieve("seti_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/setup_intents/seti_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_setup_intents_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -20346,7 +26852,7 @@ def test_setup_intents_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.setup_intents.retrieve("seti_xxxxxxxxxxxxx") + client.v1.setup_intents.retrieve("seti_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/setup_intents/seti_xxxxxxxxxxxxx", @@ -20378,7 +26884,7 @@ async def test_setup_intents_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.setup_intents.retrieve_async("seti_xxxxxxxxxxxxx") + await client.v1.setup_intents.retrieve_async("seti_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/setup_intents/seti_xxxxxxxxxxxxx", @@ -20386,6 +26892,27 @@ async def test_setup_intents_get_2_service_async( api_base="https://api.stripe.com", ) + def test_setup_intents_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/setup_intents", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.setup_intents.create({"payment_method_types": ["card"]}) + http_client_mock.assert_requested( + "post", + path="/v1/setup_intents", + query_string="", + api_base="https://api.stripe.com", + post_data="payment_method_types[0]=card", + ) + def test_setup_intents_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -20409,7 +26936,7 @@ def test_setup_intents_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.setup_intents.create({"payment_method_types": ["card"]}) + client.v1.setup_intents.create({"payment_method_types": ["card"]}) http_client_mock.assert_requested( "post", path="/v1/setup_intents", @@ -20443,7 +26970,7 @@ async def test_setup_intents_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.setup_intents.create_async( + await client.v1.setup_intents.create_async( { "payment_method_types": ["card"], } @@ -20456,6 +26983,30 @@ async def test_setup_intents_post_service_async( post_data="payment_method_types[0]=card", ) + def test_setup_intents_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.setup_intents.update( + "seti_xxxxxxxxxxxxx", + {"metadata": {"user_id": "3435453"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/setup_intents/seti_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[user_id]=3435453", + ) + def test_setup_intents_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -20482,7 +27033,7 @@ def test_setup_intents_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.setup_intents.update( + client.v1.setup_intents.update( "seti_xxxxxxxxxxxxx", {"metadata": {"user_id": "3435453"}}, ) @@ -20522,7 +27073,7 @@ async def test_setup_intents_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.setup_intents.update_async( + await client.v1.setup_intents.update_async( "seti_xxxxxxxxxxxxx", {"metadata": {"user_id": "3435453"}}, ) @@ -20534,6 +27085,26 @@ async def test_setup_intents_post_2_service_async( post_data="metadata[user_id]=3435453", ) + def test_setup_intents_verify_microdeposits_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.setup_intents.verify_microdeposits("seti_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits", + query_string="", + api_base="https://api.stripe.com", + ) + def test_setup_intents_verify_microdeposits_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -20556,7 +27127,7 @@ def test_setup_intents_verify_microdeposits_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.setup_intents.verify_microdeposits("seti_xxxxxxxxxxxxx") + client.v1.setup_intents.verify_microdeposits("seti_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits", @@ -20590,14 +27161,38 @@ async def test_setup_intents_verify_microdeposits_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.setup_intents.verify_microdeposits_async( + await client.v1.setup_intents.verify_microdeposits_async( + "seti_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "post", + path="/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_setup_intents_verify_microdeposits_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.setup_intents.verify_microdeposits( "seti_xxxxxxxxxxxxx", + {"amounts": [32, 45]}, ) http_client_mock.assert_requested( "post", path="/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits", query_string="", api_base="https://api.stripe.com", + post_data="amounts[0]=32&amounts[1]=45", ) def test_setup_intents_verify_microdeposits_post_2( @@ -20626,7 +27221,7 @@ def test_setup_intents_verify_microdeposits_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.setup_intents.verify_microdeposits( + client.v1.setup_intents.verify_microdeposits( "seti_xxxxxxxxxxxxx", {"amounts": [32, 45]}, ) @@ -20666,7 +27261,7 @@ async def test_setup_intents_verify_microdeposits_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.setup_intents.verify_microdeposits_async( + await client.v1.setup_intents.verify_microdeposits_async( "seti_xxxxxxxxxxxxx", {"amounts": [32, 45]}, ) @@ -20678,6 +27273,26 @@ async def test_setup_intents_verify_microdeposits_post_2_service_async( post_data="amounts[0]=32&amounts[1]=45", ) + def test_shipping_rates_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/shipping_rates", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.shipping_rates.list() + http_client_mock.assert_requested( + "get", + path="/v1/shipping_rates", + query_string="", + api_base="https://api.stripe.com", + ) + def test_shipping_rates_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -20700,7 +27315,7 @@ def test_shipping_rates_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.shipping_rates.list() + client.v1.shipping_rates.list() http_client_mock.assert_requested( "get", path="/v1/shipping_rates", @@ -20732,7 +27347,7 @@ async def test_shipping_rates_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.shipping_rates.list_async() + await client.v1.shipping_rates.list_async() http_client_mock.assert_requested( "get", path="/v1/shipping_rates", @@ -20740,6 +27355,27 @@ async def test_shipping_rates_get_service_async( api_base="https://api.stripe.com", ) + def test_shipping_rates_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/shipping_rates", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.shipping_rates.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/shipping_rates", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_shipping_rates_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -20763,7 +27399,7 @@ def test_shipping_rates_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.shipping_rates.list({"limit": 3}) + client.v1.shipping_rates.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/shipping_rates", @@ -20796,7 +27432,7 @@ async def test_shipping_rates_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.shipping_rates.list_async({"limit": 3}) + await client.v1.shipping_rates.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/shipping_rates", @@ -20804,6 +27440,26 @@ async def test_shipping_rates_get_2_service_async( api_base="https://api.stripe.com", ) + def test_shipping_rates_get_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/shipping_rates/shr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.shipping_rates.retrieve("shr_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/shipping_rates/shr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_shipping_rates_get_3( self, http_client_mock: HTTPClientMock ) -> None: @@ -20826,7 +27482,7 @@ def test_shipping_rates_get_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.shipping_rates.retrieve("shr_xxxxxxxxxxxxx") + client.v1.shipping_rates.retrieve("shr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/shipping_rates/shr_xxxxxxxxxxxxx", @@ -20858,7 +27514,7 @@ async def test_shipping_rates_get_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.shipping_rates.retrieve_async("shr_xxxxxxxxxxxxx") + await client.v1.shipping_rates.retrieve_async("shr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/shipping_rates/shr_xxxxxxxxxxxxx", @@ -20866,6 +27522,33 @@ async def test_shipping_rates_get_3_service_async( api_base="https://api.stripe.com", ) + def test_shipping_rates_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/shipping_rates", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.shipping_rates.create( + { + "display_name": "Sample Shipper", + "fixed_amount": {"currency": "usd", "amount": 400}, + "type": "fixed_amount", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/shipping_rates", + query_string="", + api_base="https://api.stripe.com", + post_data="display_name=Sample%20Shipper&fixed_amount[currency]=usd&fixed_amount[amount]=400&type=fixed_amount", + ) + def test_shipping_rates_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -20893,7 +27576,7 @@ def test_shipping_rates_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.shipping_rates.create( + client.v1.shipping_rates.create( { "display_name": "Sample Shipper", "fixed_amount": {"currency": "usd", "amount": 400}, @@ -20937,7 +27620,7 @@ async def test_shipping_rates_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.shipping_rates.create_async( + await client.v1.shipping_rates.create_async( { "display_name": "Sample Shipper", "fixed_amount": {"currency": "usd", "amount": 400}, @@ -20952,22 +27635,7 @@ async def test_shipping_rates_post_service_async( post_data="display_name=Sample%20Shipper&fixed_amount[currency]=usd&fixed_amount[amount]=400&type=fixed_amount", ) - def test_shipping_rates_post_2( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.ShippingRate.create( - display_name="Ground shipping", - type="fixed_amount", - fixed_amount={"amount": 500, "currency": "usd"}, - ) - http_client_mock.assert_requested( - "post", - path="/v1/shipping_rates", - query_string="", - post_data="display_name=Ground%20shipping&type=fixed_amount&fixed_amount[amount]=500&fixed_amount[currency]=usd", - ) - - def test_shipping_rates_post_2_service( + def test_shipping_rates_post_2_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -20994,6 +27662,48 @@ def test_shipping_rates_post_2_service( post_data="display_name=Ground%20shipping&type=fixed_amount&fixed_amount[amount]=500&fixed_amount[currency]=usd", ) + def test_shipping_rates_post_2( + self, http_client_mock: HTTPClientMock + ) -> None: + stripe.ShippingRate.create( + display_name="Ground shipping", + type="fixed_amount", + fixed_amount={"amount": 500, "currency": "usd"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/shipping_rates", + query_string="", + post_data="display_name=Ground%20shipping&type=fixed_amount&fixed_amount[amount]=500&fixed_amount[currency]=usd", + ) + + def test_shipping_rates_post_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/shipping_rates", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v1.shipping_rates.create( + { + "display_name": "Ground shipping", + "type": "fixed_amount", + "fixed_amount": {"amount": 500, "currency": "usd"}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/shipping_rates", + query_string="", + api_base="https://api.stripe.com", + post_data="display_name=Ground%20shipping&type=fixed_amount&fixed_amount[amount]=500&fixed_amount[currency]=usd", + ) + @pytest.mark.anyio async def test_shipping_rates_post_2_async( self, http_client_mock: HTTPClientMock @@ -21023,7 +27733,7 @@ async def test_shipping_rates_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.shipping_rates.create_async( + await client.v1.shipping_rates.create_async( { "display_name": "Ground shipping", "type": "fixed_amount", @@ -21038,6 +27748,30 @@ async def test_shipping_rates_post_2_service_async( post_data="display_name=Ground%20shipping&type=fixed_amount&fixed_amount[amount]=500&fixed_amount[currency]=usd", ) + def test_shipping_rates_post_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/shipping_rates/shr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.shipping_rates.update( + "shr_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/shipping_rates/shr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_shipping_rates_post_3( self, http_client_mock: HTTPClientMock ) -> None: @@ -21064,7 +27798,7 @@ def test_shipping_rates_post_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.shipping_rates.update( + client.v1.shipping_rates.update( "shr_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -21104,7 +27838,7 @@ async def test_shipping_rates_post_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.shipping_rates.update_async( + await client.v1.shipping_rates.update_async( "shr_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -21116,6 +27850,27 @@ async def test_shipping_rates_post_3_service_async( post_data="metadata[order_id]=6735", ) + def test_sigma_scheduled_query_runs_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/sigma/scheduled_query_runs", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.sigma.scheduled_query_runs.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/sigma/scheduled_query_runs", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_sigma_scheduled_query_runs_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -21139,7 +27894,7 @@ def test_sigma_scheduled_query_runs_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.sigma.scheduled_query_runs.list({"limit": 3}) + client.v1.sigma.scheduled_query_runs.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/sigma/scheduled_query_runs", @@ -21172,7 +27927,7 @@ async def test_sigma_scheduled_query_runs_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.sigma.scheduled_query_runs.list_async({"limit": 3}) + await client.v1.sigma.scheduled_query_runs.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/sigma/scheduled_query_runs", @@ -21180,6 +27935,26 @@ async def test_sigma_scheduled_query_runs_get_service_async( api_base="https://api.stripe.com", ) + def test_sigma_scheduled_query_runs_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/sigma/scheduled_query_runs/sqr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.sigma.scheduled_query_runs.retrieve("sqr_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/sigma/scheduled_query_runs/sqr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_sigma_scheduled_query_runs_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -21202,7 +27977,7 @@ def test_sigma_scheduled_query_runs_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.sigma.scheduled_query_runs.retrieve("sqr_xxxxxxxxxxxxx") + client.v1.sigma.scheduled_query_runs.retrieve("sqr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/sigma/scheduled_query_runs/sqr_xxxxxxxxxxxxx", @@ -21236,7 +28011,7 @@ async def test_sigma_scheduled_query_runs_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.sigma.scheduled_query_runs.retrieve_async( + await client.v1.sigma.scheduled_query_runs.retrieve_async( "sqr_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -21246,6 +28021,26 @@ async def test_sigma_scheduled_query_runs_get_2_service_async( api_base="https://api.stripe.com", ) + def test_sources_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/sources/src_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.sources.retrieve("src_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/sources/src_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_sources_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Source.retrieve("src_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -21266,7 +28061,7 @@ def test_sources_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.sources.retrieve("src_xxxxxxxxxxxxx") + client.v1.sources.retrieve("src_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/sources/src_xxxxxxxxxxxxx", @@ -21298,7 +28093,27 @@ async def test_sources_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.sources.retrieve_async("src_xxxxxxxxxxxxx") + await client.v1.sources.retrieve_async("src_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/sources/src_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_sources_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/sources/src_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.sources.retrieve("src_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/sources/src_xxxxxxxxxxxxx", @@ -21326,7 +28141,7 @@ def test_sources_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.sources.retrieve("src_xxxxxxxxxxxxx") + client.v1.sources.retrieve("src_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/sources/src_xxxxxxxxxxxxx", @@ -21358,7 +28173,7 @@ async def test_sources_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.sources.retrieve_async("src_xxxxxxxxxxxxx") + await client.v1.sources.retrieve_async("src_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/sources/src_xxxxxxxxxxxxx", @@ -21366,6 +28181,30 @@ async def test_sources_get_2_service_async( api_base="https://api.stripe.com", ) + def test_sources_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/sources/src_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.sources.update( + "src_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/sources/src_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_sources_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Source.modify( "src_xxxxxxxxxxxxx", @@ -21390,7 +28229,7 @@ def test_sources_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.sources.update( + client.v1.sources.update( "src_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -21430,7 +28269,7 @@ async def test_sources_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.sources.update_async( + await client.v1.sources.update_async( "src_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -21442,6 +28281,26 @@ async def test_sources_post_service_async( post_data="metadata[order_id]=6735", ) + def test_subscription_items_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/subscription_items/si_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscription_items.delete("si_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/subscription_items/si_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_subscription_items_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -21464,7 +28323,7 @@ def test_subscription_items_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscription_items.delete("si_xxxxxxxxxxxxx") + client.v1.subscription_items.delete("si_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/subscription_items/si_xxxxxxxxxxxxx", @@ -21496,7 +28355,7 @@ async def test_subscription_items_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscription_items.delete_async("si_xxxxxxxxxxxxx") + await client.v1.subscription_items.delete_async("si_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/subscription_items/si_xxxxxxxxxxxxx", @@ -21504,6 +28363,27 @@ async def test_subscription_items_delete_service_async( api_base="https://api.stripe.com", ) + def test_subscription_items_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/subscription_items", + "subscription=sub_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscription_items.list({"subscription": "sub_xxxxxxxxxxxxx"}) + http_client_mock.assert_requested( + "get", + path="/v1/subscription_items", + query_string="subscription=sub_xxxxxxxxxxxxx", + api_base="https://api.stripe.com", + ) + def test_subscription_items_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -21527,7 +28407,9 @@ def test_subscription_items_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscription_items.list({"subscription": "sub_xxxxxxxxxxxxx"}) + client.v1.subscription_items.list( + {"subscription": "sub_xxxxxxxxxxxxx"} + ) http_client_mock.assert_requested( "get", path="/v1/subscription_items", @@ -21562,7 +28444,7 @@ async def test_subscription_items_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscription_items.list_async( + await client.v1.subscription_items.list_async( { "subscription": "sub_xxxxxxxxxxxxx", } @@ -21574,6 +28456,26 @@ async def test_subscription_items_get_service_async( api_base="https://api.stripe.com", ) + def test_subscription_items_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/subscription_items/si_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscription_items.retrieve("si_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/subscription_items/si_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_subscription_items_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -21596,7 +28498,7 @@ def test_subscription_items_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscription_items.retrieve("si_xxxxxxxxxxxxx") + client.v1.subscription_items.retrieve("si_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/subscription_items/si_xxxxxxxxxxxxx", @@ -21628,7 +28530,7 @@ async def test_subscription_items_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscription_items.retrieve_async("si_xxxxxxxxxxxxx") + await client.v1.subscription_items.retrieve_async("si_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/subscription_items/si_xxxxxxxxxxxxx", @@ -21636,6 +28538,33 @@ async def test_subscription_items_get_2_service_async( api_base="https://api.stripe.com", ) + def test_subscription_items_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/subscription_items", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscription_items.create( + { + "subscription": "sub_xxxxxxxxxxxxx", + "price": "price_xxxxxxxxxxxxx", + "quantity": 2, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/subscription_items", + query_string="", + api_base="https://api.stripe.com", + post_data="subscription=sub_xxxxxxxxxxxxx&price=price_xxxxxxxxxxxxx&quantity=2", + ) + def test_subscription_items_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -21663,7 +28592,7 @@ def test_subscription_items_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscription_items.create( + client.v1.subscription_items.create( { "subscription": "sub_xxxxxxxxxxxxx", "price": "price_xxxxxxxxxxxxx", @@ -21707,7 +28636,7 @@ async def test_subscription_items_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscription_items.create_async( + await client.v1.subscription_items.create_async( { "subscription": "sub_xxxxxxxxxxxxx", "price": "price_xxxxxxxxxxxxx", @@ -21722,6 +28651,30 @@ async def test_subscription_items_post_service_async( post_data="subscription=sub_xxxxxxxxxxxxx&price=price_xxxxxxxxxxxxx&quantity=2", ) + def test_subscription_items_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/subscription_items/si_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscription_items.update( + "si_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/subscription_items/si_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_subscription_items_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -21748,7 +28701,7 @@ def test_subscription_items_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscription_items.update( + client.v1.subscription_items.update( "si_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -21788,7 +28741,7 @@ async def test_subscription_items_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscription_items.update_async( + await client.v1.subscription_items.update_async( "si_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -21800,6 +28753,26 @@ async def test_subscription_items_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_subscription_schedules_cancel_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscription_schedules.cancel("sub_sched_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/cancel", + query_string="", + api_base="https://api.stripe.com", + ) + def test_subscription_schedules_cancel_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -21822,7 +28795,7 @@ def test_subscription_schedules_cancel_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscription_schedules.cancel("sub_sched_xxxxxxxxxxxxx") + client.v1.subscription_schedules.cancel("sub_sched_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/cancel", @@ -21856,7 +28829,7 @@ async def test_subscription_schedules_cancel_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscription_schedules.cancel_async( + await client.v1.subscription_schedules.cancel_async( "sub_sched_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -21866,6 +28839,27 @@ async def test_subscription_schedules_cancel_post_service_async( api_base="https://api.stripe.com", ) + def test_subscription_schedules_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/subscription_schedules", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscription_schedules.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/subscription_schedules", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_subscription_schedules_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -21889,7 +28883,7 @@ def test_subscription_schedules_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscription_schedules.list({"limit": 3}) + client.v1.subscription_schedules.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/subscription_schedules", @@ -21922,7 +28916,7 @@ async def test_subscription_schedules_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscription_schedules.list_async({"limit": 3}) + await client.v1.subscription_schedules.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/subscription_schedules", @@ -21930,6 +28924,26 @@ async def test_subscription_schedules_get_service_async( api_base="https://api.stripe.com", ) + def test_subscription_schedules_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscription_schedules.retrieve("sub_sched_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_subscription_schedules_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -21952,7 +28966,7 @@ def test_subscription_schedules_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscription_schedules.retrieve("sub_sched_xxxxxxxxxxxxx") + client.v1.subscription_schedules.retrieve("sub_sched_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", @@ -21986,7 +29000,7 @@ async def test_subscription_schedules_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscription_schedules.retrieve_async( + await client.v1.subscription_schedules.retrieve_async( "sub_sched_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -21996,6 +29010,41 @@ async def test_subscription_schedules_get_2_service_async( api_base="https://api.stripe.com", ) + def test_subscription_schedules_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/subscription_schedules", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscription_schedules.create( + { + "customer": "cus_xxxxxxxxxxxxx", + "start_date": 1676070661, + "end_behavior": "release", + "phases": [ + { + "items": [ + {"price": "price_xxxxxxxxxxxxx", "quantity": 1} + ], + "iterations": 12, + }, + ], + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/subscription_schedules", + query_string="", + api_base="https://api.stripe.com", + post_data="customer=cus_xxxxxxxxxxxxx&start_date=1676070661&end_behavior=release&phases[0][items][0][price]=price_xxxxxxxxxxxxx&phases[0][items][0][quantity]=1&phases[0][iterations]=12", + ) + def test_subscription_schedules_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -22029,7 +29078,7 @@ def test_subscription_schedules_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscription_schedules.create( + client.v1.subscription_schedules.create( { "customer": "cus_xxxxxxxxxxxxx", "start_date": 1676070661, @@ -22087,7 +29136,7 @@ async def test_subscription_schedules_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscription_schedules.create_async( + await client.v1.subscription_schedules.create_async( { "customer": "cus_xxxxxxxxxxxxx", "start_date": 1676070661, @@ -22110,6 +29159,30 @@ async def test_subscription_schedules_post_service_async( post_data="customer=cus_xxxxxxxxxxxxx&start_date=1676070661&end_behavior=release&phases[0][items][0][price]=price_xxxxxxxxxxxxx&phases[0][items][0][quantity]=1&phases[0][iterations]=12", ) + def test_subscription_schedules_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscription_schedules.update( + "sub_sched_xxxxxxxxxxxxx", + {"end_behavior": "release"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="end_behavior=release", + ) + def test_subscription_schedules_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -22136,7 +29209,7 @@ def test_subscription_schedules_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscription_schedules.update( + client.v1.subscription_schedules.update( "sub_sched_xxxxxxxxxxxxx", {"end_behavior": "release"}, ) @@ -22176,7 +29249,7 @@ async def test_subscription_schedules_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscription_schedules.update_async( + await client.v1.subscription_schedules.update_async( "sub_sched_xxxxxxxxxxxxx", {"end_behavior": "release"}, ) @@ -22188,6 +29261,26 @@ async def test_subscription_schedules_post_2_service_async( post_data="end_behavior=release", ) + def test_subscription_schedules_release_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/release", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscription_schedules.release("sub_sched_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/release", + query_string="", + api_base="https://api.stripe.com", + ) + def test_subscription_schedules_release_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -22210,7 +29303,7 @@ def test_subscription_schedules_release_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscription_schedules.release("sub_sched_xxxxxxxxxxxxx") + client.v1.subscription_schedules.release("sub_sched_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/release", @@ -22244,7 +29337,7 @@ async def test_subscription_schedules_release_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscription_schedules.release_async( + await client.v1.subscription_schedules.release_async( "sub_sched_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -22254,6 +29347,26 @@ async def test_subscription_schedules_release_post_service_async( api_base="https://api.stripe.com", ) + def test_subscriptions_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/subscriptions/sub_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscriptions.cancel("sub_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/subscriptions/sub_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_subscriptions_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -22276,7 +29389,7 @@ def test_subscriptions_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscriptions.cancel("sub_xxxxxxxxxxxxx") + client.v1.subscriptions.cancel("sub_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/subscriptions/sub_xxxxxxxxxxxxx", @@ -22308,7 +29421,7 @@ async def test_subscriptions_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscriptions.cancel_async("sub_xxxxxxxxxxxxx") + await client.v1.subscriptions.cancel_async("sub_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/subscriptions/sub_xxxxxxxxxxxxx", @@ -22316,6 +29429,26 @@ async def test_subscriptions_delete_service_async( api_base="https://api.stripe.com", ) + def test_subscriptions_discount_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/subscriptions/sub_xyz/discount", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscriptions.delete_discount("sub_xyz") + http_client_mock.assert_requested( + "delete", + path="/v1/subscriptions/sub_xyz/discount", + query_string="", + api_base="https://api.stripe.com", + ) + def test_subscriptions_discount_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -22338,7 +29471,7 @@ def test_subscriptions_discount_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscriptions.delete_discount("sub_xyz") + client.v1.subscriptions.delete_discount("sub_xyz") http_client_mock.assert_requested( "delete", path="/v1/subscriptions/sub_xyz/discount", @@ -22370,7 +29503,7 @@ async def test_subscriptions_discount_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscriptions.delete_discount_async("sub_xyz") + await client.v1.subscriptions.delete_discount_async("sub_xyz") http_client_mock.assert_requested( "delete", path="/v1/subscriptions/sub_xyz/discount", @@ -22378,6 +29511,27 @@ async def test_subscriptions_discount_delete_service_async( api_base="https://api.stripe.com", ) + def test_subscriptions_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/subscriptions", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscriptions.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/subscriptions", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_subscriptions_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Subscription.list(limit=3) http_client_mock.assert_requested( @@ -22399,7 +29553,7 @@ def test_subscriptions_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscriptions.list({"limit": 3}) + client.v1.subscriptions.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/subscriptions", @@ -22432,7 +29586,7 @@ async def test_subscriptions_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscriptions.list_async({"limit": 3}) + await client.v1.subscriptions.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/subscriptions", @@ -22440,6 +29594,26 @@ async def test_subscriptions_get_service_async( api_base="https://api.stripe.com", ) + def test_subscriptions_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/subscriptions/sub_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscriptions.retrieve("sub_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/subscriptions/sub_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_subscriptions_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -22462,7 +29636,7 @@ def test_subscriptions_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscriptions.retrieve("sub_xxxxxxxxxxxxx") + client.v1.subscriptions.retrieve("sub_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/subscriptions/sub_xxxxxxxxxxxxx", @@ -22494,7 +29668,7 @@ async def test_subscriptions_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscriptions.retrieve_async("sub_xxxxxxxxxxxxx") + await client.v1.subscriptions.retrieve_async("sub_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/subscriptions/sub_xxxxxxxxxxxxx", @@ -22502,21 +29676,7 @@ async def test_subscriptions_get_2_service_async( api_base="https://api.stripe.com", ) - def test_subscriptions_post( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.Subscription.create( - customer="cus_xxxxxxxxxxxxx", - items=[{"price": "price_xxxxxxxxxxxxx"}], - ) - http_client_mock.assert_requested( - "post", - path="/v1/subscriptions", - query_string="", - post_data="customer=cus_xxxxxxxxxxxxx&items[0][price]=price_xxxxxxxxxxxxx", - ) - - def test_subscriptions_post_service( + def test_subscriptions_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -22542,6 +29702,46 @@ def test_subscriptions_post_service( post_data="customer=cus_xxxxxxxxxxxxx&items[0][price]=price_xxxxxxxxxxxxx", ) + def test_subscriptions_post( + self, http_client_mock: HTTPClientMock + ) -> None: + stripe.Subscription.create( + customer="cus_xxxxxxxxxxxxx", + items=[{"price": "price_xxxxxxxxxxxxx"}], + ) + http_client_mock.assert_requested( + "post", + path="/v1/subscriptions", + query_string="", + post_data="customer=cus_xxxxxxxxxxxxx&items[0][price]=price_xxxxxxxxxxxxx", + ) + + def test_subscriptions_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/subscriptions", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v1.subscriptions.create( + { + "customer": "cus_xxxxxxxxxxxxx", + "items": [{"price": "price_xxxxxxxxxxxxx"}], + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/subscriptions", + query_string="", + api_base="https://api.stripe.com", + post_data="customer=cus_xxxxxxxxxxxxx&items[0][price]=price_xxxxxxxxxxxxx", + ) + @pytest.mark.anyio async def test_subscriptions_post_async( self, http_client_mock: HTTPClientMock @@ -22570,7 +29770,7 @@ async def test_subscriptions_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscriptions.create_async( + await client.v1.subscriptions.create_async( { "customer": "cus_xxxxxxxxxxxxx", "items": [{"price": "price_xxxxxxxxxxxxx"}], @@ -22584,6 +29784,30 @@ async def test_subscriptions_post_service_async( post_data="customer=cus_xxxxxxxxxxxxx&items[0][price]=price_xxxxxxxxxxxxx", ) + def test_subscriptions_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/subscriptions/sub_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscriptions.update( + "sub_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/subscriptions/sub_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_subscriptions_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -22610,7 +29834,7 @@ def test_subscriptions_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscriptions.update( + client.v1.subscriptions.update( "sub_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -22650,7 +29874,7 @@ async def test_subscriptions_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscriptions.update_async( + await client.v1.subscriptions.update_async( "sub_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -22662,6 +29886,31 @@ async def test_subscriptions_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_subscriptions_search_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/subscriptions/search", + "query=status%3A%27active%27%20AND%20metadata%5B%27order_id%27%5D%3A%276735%27", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.subscriptions.search( + { + "query": "status:'active' AND metadata['order_id']:'6735'", + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/subscriptions/search", + query_string="query=status%3A%27active%27%20AND%20metadata%5B%27order_id%27%5D%3A%276735%27", + api_base="https://api.stripe.com", + ) + def test_subscriptions_search_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -22687,7 +29936,7 @@ def test_subscriptions_search_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscriptions.search( + client.v1.subscriptions.search( { "query": "status:'active' AND metadata['order_id']:'6735'", } @@ -22726,7 +29975,7 @@ async def test_subscriptions_search_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.subscriptions.search_async( + await client.v1.subscriptions.search_async( { "query": "status:'active' AND metadata['order_id']:'6735'", } @@ -22738,6 +29987,26 @@ async def test_subscriptions_search_get_service_async( api_base="https://api.stripe.com", ) + def test_tax_calculations_line_items_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/tax/calculations/xxx/line_items", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax.calculations.line_items.list("xxx") + http_client_mock.assert_requested( + "get", + path="/v1/tax/calculations/xxx/line_items", + query_string="", + api_base="https://api.stripe.com", + ) + def test_tax_calculations_line_items_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -22760,7 +30029,7 @@ def test_tax_calculations_line_items_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax.calculations.line_items.list("xxx") + client.v1.tax.calculations.line_items.list("xxx") http_client_mock.assert_requested( "get", path="/v1/tax/calculations/xxx/line_items", @@ -22792,7 +30061,7 @@ async def test_tax_calculations_line_items_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax.calculations.line_items.list_async("xxx") + await client.v1.tax.calculations.line_items.list_async("xxx") http_client_mock.assert_requested( "get", path="/v1/tax/calculations/xxx/line_items", @@ -22800,6 +30069,42 @@ async def test_tax_calculations_line_items_get_service_async( api_base="https://api.stripe.com", ) + def test_tax_calculations_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tax/calculations", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax.calculations.create( + { + "currency": "usd", + "line_items": [{"amount": 1000, "reference": "L1"}], + "customer_details": { + "address": { + "line1": "354 Oyster Point Blvd", + "city": "South San Francisco", + "state": "CA", + "postal_code": "94080", + "country": "US", + }, + "address_source": "shipping", + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/tax/calculations", + query_string="", + api_base="https://api.stripe.com", + post_data="currency=usd&line_items[0][amount]=1000&line_items[0][reference]=L1&customer_details[address][line1]=354%20Oyster%20Point%20Blvd&customer_details[address][city]=South%20San%20Francisco&customer_details[address][state]=CA&customer_details[address][postal_code]=94080&customer_details[address][country]=US&customer_details[address_source]=shipping", + ) + def test_tax_calculations_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -22836,7 +30141,7 @@ def test_tax_calculations_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax.calculations.create( + client.v1.tax.calculations.create( { "currency": "usd", "line_items": [{"amount": 1000, "reference": "L1"}], @@ -22898,7 +30203,7 @@ async def test_tax_calculations_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax.calculations.create_async( + await client.v1.tax.calculations.create_async( { "currency": "usd", "line_items": [{"amount": 1000, "reference": "L1"}], @@ -22922,6 +30227,27 @@ async def test_tax_calculations_post_service_async( post_data="currency=usd&line_items[0][amount]=1000&line_items[0][reference]=L1&customer_details[address][line1]=354%20Oyster%20Point%20Blvd&customer_details[address][city]=South%20San%20Francisco&customer_details[address][state]=CA&customer_details[address][postal_code]=94080&customer_details[address][country]=US&customer_details[address_source]=shipping", ) + def test_tax_codes_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/tax_codes", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax_codes.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/tax_codes", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_tax_codes_get(self, http_client_mock: HTTPClientMock) -> None: stripe.TaxCode.list(limit=3) http_client_mock.assert_requested( @@ -22943,7 +30269,7 @@ def test_tax_codes_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax_codes.list({"limit": 3}) + client.v1.tax_codes.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/tax_codes", @@ -22976,7 +30302,7 @@ async def test_tax_codes_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax_codes.list_async({"limit": 3}) + await client.v1.tax_codes.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/tax_codes", @@ -22984,6 +30310,26 @@ async def test_tax_codes_get_service_async( api_base="https://api.stripe.com", ) + def test_tax_codes_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/tax_codes/txcd_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax_codes.retrieve("txcd_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/tax_codes/txcd_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_tax_codes_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.TaxCode.retrieve("txcd_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -23004,7 +30350,7 @@ def test_tax_codes_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax_codes.retrieve("txcd_xxxxxxxxxxxxx") + client.v1.tax_codes.retrieve("txcd_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/tax_codes/txcd_xxxxxxxxxxxxx", @@ -23036,7 +30382,7 @@ async def test_tax_codes_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax_codes.retrieve_async("txcd_xxxxxxxxxxxxx") + await client.v1.tax_codes.retrieve_async("txcd_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/tax_codes/txcd_xxxxxxxxxxxxx", @@ -23044,6 +30390,26 @@ async def test_tax_codes_get_2_service_async( api_base="https://api.stripe.com", ) + def test_tax_ids_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/tax_ids/taxid_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax_ids.delete("taxid_123") + http_client_mock.assert_requested( + "delete", + path="/v1/tax_ids/taxid_123", + query_string="", + api_base="https://api.stripe.com", + ) + def test_tax_ids_delete(self, http_client_mock: HTTPClientMock) -> None: stripe.TaxId.delete("taxid_123") http_client_mock.assert_requested( @@ -23064,7 +30430,7 @@ def test_tax_ids_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax_ids.delete("taxid_123") + client.v1.tax_ids.delete("taxid_123") http_client_mock.assert_requested( "delete", path="/v1/tax_ids/taxid_123", @@ -23096,7 +30462,7 @@ async def test_tax_ids_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax_ids.delete_async("taxid_123") + await client.v1.tax_ids.delete_async("taxid_123") http_client_mock.assert_requested( "delete", path="/v1/tax_ids/taxid_123", @@ -23104,6 +30470,26 @@ async def test_tax_ids_delete_service_async( api_base="https://api.stripe.com", ) + def test_tax_ids_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/tax_ids", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax_ids.list() + http_client_mock.assert_requested( + "get", + path="/v1/tax_ids", + query_string="", + api_base="https://api.stripe.com", + ) + def test_tax_ids_get(self, http_client_mock: HTTPClientMock) -> None: stripe.TaxId.list() http_client_mock.assert_requested( @@ -23124,7 +30510,7 @@ def test_tax_ids_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax_ids.list() + client.v1.tax_ids.list() http_client_mock.assert_requested( "get", path="/v1/tax_ids", @@ -23156,7 +30542,7 @@ async def test_tax_ids_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax_ids.list_async() + await client.v1.tax_ids.list_async() http_client_mock.assert_requested( "get", path="/v1/tax_ids", @@ -23164,6 +30550,26 @@ async def test_tax_ids_get_service_async( api_base="https://api.stripe.com", ) + def test_tax_ids_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/tax_ids/taxid_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax_ids.retrieve("taxid_123") + http_client_mock.assert_requested( + "get", + path="/v1/tax_ids/taxid_123", + query_string="", + api_base="https://api.stripe.com", + ) + def test_tax_ids_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.TaxId.retrieve("taxid_123") http_client_mock.assert_requested( @@ -23184,7 +30590,7 @@ def test_tax_ids_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax_ids.retrieve("taxid_123") + client.v1.tax_ids.retrieve("taxid_123") http_client_mock.assert_requested( "get", path="/v1/tax_ids/taxid_123", @@ -23216,7 +30622,7 @@ async def test_tax_ids_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax_ids.retrieve_async("taxid_123") + await client.v1.tax_ids.retrieve_async("taxid_123") http_client_mock.assert_requested( "get", path="/v1/tax_ids/taxid_123", @@ -23224,6 +30630,27 @@ async def test_tax_ids_get_2_service_async( api_base="https://api.stripe.com", ) + def test_tax_ids_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tax_ids", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax_ids.create({"type": "eu_vat", "value": "123"}) + http_client_mock.assert_requested( + "post", + path="/v1/tax_ids", + query_string="", + api_base="https://api.stripe.com", + post_data="type=eu_vat&value=123", + ) + def test_tax_ids_post(self, http_client_mock: HTTPClientMock) -> None: stripe.TaxId.create( type="eu_vat", @@ -23248,7 +30675,7 @@ def test_tax_ids_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax_ids.create({"type": "eu_vat", "value": "123"}) + client.v1.tax_ids.create({"type": "eu_vat", "value": "123"}) http_client_mock.assert_requested( "post", path="/v1/tax_ids", @@ -23285,7 +30712,9 @@ async def test_tax_ids_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax_ids.create_async({"type": "eu_vat", "value": "123"}) + await client.v1.tax_ids.create_async( + {"type": "eu_vat", "value": "123"} + ) http_client_mock.assert_requested( "post", path="/v1/tax_ids", @@ -23294,6 +30723,27 @@ async def test_tax_ids_post_service_async( post_data="type=eu_vat&value=123", ) + def test_tax_rates_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/tax_rates", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax_rates.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/tax_rates", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_tax_rates_get(self, http_client_mock: HTTPClientMock) -> None: stripe.TaxRate.list(limit=3) http_client_mock.assert_requested( @@ -23315,7 +30765,7 @@ def test_tax_rates_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax_rates.list({"limit": 3}) + client.v1.tax_rates.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/tax_rates", @@ -23348,7 +30798,7 @@ async def test_tax_rates_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax_rates.list_async({"limit": 3}) + await client.v1.tax_rates.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/tax_rates", @@ -23356,6 +30806,26 @@ async def test_tax_rates_get_service_async( api_base="https://api.stripe.com", ) + def test_tax_rates_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/tax_rates/txr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax_rates.retrieve("txr_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/tax_rates/txr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_tax_rates_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.TaxRate.retrieve("txr_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -23376,7 +30846,7 @@ def test_tax_rates_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax_rates.retrieve("txr_xxxxxxxxxxxxx") + client.v1.tax_rates.retrieve("txr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/tax_rates/txr_xxxxxxxxxxxxx", @@ -23408,7 +30878,7 @@ async def test_tax_rates_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax_rates.retrieve_async("txr_xxxxxxxxxxxxx") + await client.v1.tax_rates.retrieve_async("txr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/tax_rates/txr_xxxxxxxxxxxxx", @@ -23416,6 +30886,35 @@ async def test_tax_rates_get_2_service_async( api_base="https://api.stripe.com", ) + def test_tax_rates_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tax_rates", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax_rates.create( + { + "display_name": "VAT", + "description": "VAT Germany", + "jurisdiction": "DE", + "percentage": 16, + "inclusive": False, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/tax_rates", + query_string="", + api_base="https://api.stripe.com", + post_data="display_name=VAT&description=VAT%20Germany&jurisdiction=DE&percentage=16&inclusive=false", + ) + def test_tax_rates_post(self, http_client_mock: HTTPClientMock) -> None: stripe.TaxRate.create( display_name="VAT", @@ -23443,7 +30942,7 @@ def test_tax_rates_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax_rates.create( + client.v1.tax_rates.create( { "display_name": "VAT", "description": "VAT Germany", @@ -23491,7 +30990,7 @@ async def test_tax_rates_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax_rates.create_async( + await client.v1.tax_rates.create_async( { "display_name": "VAT", "description": "VAT Germany", @@ -23508,6 +31007,30 @@ async def test_tax_rates_post_service_async( post_data="display_name=VAT&description=VAT%20Germany&jurisdiction=DE&percentage=16&inclusive=false", ) + def test_tax_rates_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tax_rates/txr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax_rates.update( + "txr_xxxxxxxxxxxxx", + {"active": False}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/tax_rates/txr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="active=false", + ) + def test_tax_rates_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.TaxRate.modify( "txr_xxxxxxxxxxxxx", @@ -23532,7 +31055,7 @@ def test_tax_rates_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax_rates.update( + client.v1.tax_rates.update( "txr_xxxxxxxxxxxxx", {"active": False}, ) @@ -23572,7 +31095,7 @@ async def test_tax_rates_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax_rates.update_async( + await client.v1.tax_rates.update_async( "txr_xxxxxxxxxxxxx", {"active": False}, ) @@ -23584,6 +31107,27 @@ async def test_tax_rates_post_2_service_async( post_data="active=false", ) + def test_tax_registrations_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/tax/registrations", + "status=all", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax.registrations.list({"status": "all"}) + http_client_mock.assert_requested( + "get", + path="/v1/tax/registrations", + query_string="status=all", + api_base="https://api.stripe.com", + ) + def test_tax_registrations_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -23607,7 +31151,7 @@ def test_tax_registrations_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax.registrations.list({"status": "all"}) + client.v1.tax.registrations.list({"status": "all"}) http_client_mock.assert_requested( "get", path="/v1/tax/registrations", @@ -23640,7 +31184,7 @@ async def test_tax_registrations_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax.registrations.list_async({"status": "all"}) + await client.v1.tax.registrations.list_async({"status": "all"}) http_client_mock.assert_requested( "get", path="/v1/tax/registrations", @@ -23648,6 +31192,33 @@ async def test_tax_registrations_get_service_async( api_base="https://api.stripe.com", ) + def test_tax_registrations_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tax/registrations", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax.registrations.create( + { + "country": "IE", + "country_options": {"ie": {"type": "oss_union"}}, + "active_from": "now", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/tax/registrations", + query_string="", + api_base="https://api.stripe.com", + post_data="country=IE&country_options[ie][type]=oss_union&active_from=now", + ) + def test_tax_registrations_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -23675,7 +31246,7 @@ def test_tax_registrations_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax.registrations.create( + client.v1.tax.registrations.create( { "country": "IE", "country_options": {"ie": {"type": "oss_union"}}, @@ -23719,7 +31290,7 @@ async def test_tax_registrations_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax.registrations.create_async( + await client.v1.tax.registrations.create_async( { "country": "IE", "country_options": {"ie": {"type": "oss_union"}}, @@ -23734,6 +31305,30 @@ async def test_tax_registrations_post_service_async( post_data="country=IE&country_options[ie][type]=oss_union&active_from=now", ) + def test_tax_registrations_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tax/registrations/taxreg_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax.registrations.update( + "taxreg_xxxxxxxxxxxxx", + {"expires_at": "now"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/tax/registrations/taxreg_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="expires_at=now", + ) + def test_tax_registrations_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -23760,7 +31355,7 @@ def test_tax_registrations_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax.registrations.update( + client.v1.tax.registrations.update( "taxreg_xxxxxxxxxxxxx", {"expires_at": "now"}, ) @@ -23800,7 +31395,7 @@ async def test_tax_registrations_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax.registrations.update_async( + await client.v1.tax.registrations.update_async( "taxreg_xxxxxxxxxxxxx", {"expires_at": "now"}, ) @@ -23812,6 +31407,26 @@ async def test_tax_registrations_post_2_service_async( post_data="expires_at=now", ) + def test_tax_settings_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/tax/settings", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax.settings.retrieve() + http_client_mock.assert_requested( + "get", + path="/v1/tax/settings", + query_string="", + api_base="https://api.stripe.com", + ) + def test_tax_settings_get(self, http_client_mock: HTTPClientMock) -> None: stripe.tax.Settings.retrieve() http_client_mock.assert_requested( @@ -23832,7 +31447,7 @@ def test_tax_settings_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax.settings.retrieve() + client.v1.tax.settings.retrieve() http_client_mock.assert_requested( "get", path="/v1/tax/settings", @@ -23864,7 +31479,7 @@ async def test_tax_settings_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax.settings.retrieve_async() + await client.v1.tax.settings.retrieve_async() http_client_mock.assert_requested( "get", path="/v1/tax/settings", @@ -23872,6 +31487,27 @@ async def test_tax_settings_get_service_async( api_base="https://api.stripe.com", ) + def test_tax_settings_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tax/settings", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax.settings.update({"defaults": {"tax_code": "txcd_10000000"}}) + http_client_mock.assert_requested( + "post", + path="/v1/tax/settings", + query_string="", + api_base="https://api.stripe.com", + post_data="defaults[tax_code]=txcd_10000000", + ) + def test_tax_settings_post(self, http_client_mock: HTTPClientMock) -> None: stripe.tax.Settings.modify(defaults={"tax_code": "txcd_10000000"}) http_client_mock.assert_requested( @@ -23893,7 +31529,11 @@ def test_tax_settings_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax.settings.update({"defaults": {"tax_code": "txcd_10000000"}}) + client.v1.tax.settings.update( + { + "defaults": {"tax_code": "txcd_10000000"}, + } + ) http_client_mock.assert_requested( "post", path="/v1/tax/settings", @@ -23929,7 +31569,7 @@ async def test_tax_settings_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax.settings.update_async( + await client.v1.tax.settings.update_async( { "defaults": {"tax_code": "txcd_10000000"}, } @@ -23942,6 +31582,32 @@ async def test_tax_settings_post_service_async( post_data="defaults[tax_code]=txcd_10000000", ) + def test_tax_transactions_create_from_calculation_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tax/transactions/create_from_calculation", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax.transactions.create_from_calculation( + { + "calculation": "xxx", + "reference": "yyy", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/tax/transactions/create_from_calculation", + query_string="", + api_base="https://api.stripe.com", + post_data="calculation=xxx&reference=yyy", + ) + def test_tax_transactions_create_from_calculation_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -23968,7 +31634,7 @@ def test_tax_transactions_create_from_calculation_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax.transactions.create_from_calculation( + client.v1.tax.transactions.create_from_calculation( { "calculation": "xxx", "reference": "yyy", @@ -24010,7 +31676,7 @@ async def test_tax_transactions_create_from_calculation_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax.transactions.create_from_calculation_async( + await client.v1.tax.transactions.create_from_calculation_async( { "calculation": "xxx", "reference": "yyy", @@ -24024,6 +31690,26 @@ async def test_tax_transactions_create_from_calculation_post_service_async( post_data="calculation=xxx&reference=yyy", ) + def test_terminal_configurations_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/terminal/configurations/uc_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.configurations.delete("uc_123") + http_client_mock.assert_requested( + "delete", + path="/v1/terminal/configurations/uc_123", + query_string="", + api_base="https://api.stripe.com", + ) + def test_terminal_configurations_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -24046,7 +31732,7 @@ def test_terminal_configurations_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.configurations.delete("uc_123") + client.v1.terminal.configurations.delete("uc_123") http_client_mock.assert_requested( "delete", path="/v1/terminal/configurations/uc_123", @@ -24078,7 +31764,7 @@ async def test_terminal_configurations_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.configurations.delete_async("uc_123") + await client.v1.terminal.configurations.delete_async("uc_123") http_client_mock.assert_requested( "delete", path="/v1/terminal/configurations/uc_123", @@ -24086,6 +31772,26 @@ async def test_terminal_configurations_delete_service_async( api_base="https://api.stripe.com", ) + def test_terminal_configurations_delete_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/terminal/configurations/tmc_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.configurations.delete("tmc_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/terminal/configurations/tmc_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_terminal_configurations_delete_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -24108,7 +31814,7 @@ def test_terminal_configurations_delete_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.configurations.delete("tmc_xxxxxxxxxxxxx") + client.v1.terminal.configurations.delete("tmc_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/terminal/configurations/tmc_xxxxxxxxxxxxx", @@ -24140,7 +31846,9 @@ async def test_terminal_configurations_delete_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.configurations.delete_async("tmc_xxxxxxxxxxxxx") + await client.v1.terminal.configurations.delete_async( + "tmc_xxxxxxxxxxxxx", + ) http_client_mock.assert_requested( "delete", path="/v1/terminal/configurations/tmc_xxxxxxxxxxxxx", @@ -24148,6 +31856,26 @@ async def test_terminal_configurations_delete_2_service_async( api_base="https://api.stripe.com", ) + def test_terminal_configurations_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/terminal/configurations", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.configurations.list() + http_client_mock.assert_requested( + "get", + path="/v1/terminal/configurations", + query_string="", + api_base="https://api.stripe.com", + ) + def test_terminal_configurations_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -24170,7 +31898,7 @@ def test_terminal_configurations_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.configurations.list() + client.v1.terminal.configurations.list() http_client_mock.assert_requested( "get", path="/v1/terminal/configurations", @@ -24202,7 +31930,7 @@ async def test_terminal_configurations_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.configurations.list_async() + await client.v1.terminal.configurations.list_async() http_client_mock.assert_requested( "get", path="/v1/terminal/configurations", @@ -24210,6 +31938,26 @@ async def test_terminal_configurations_get_service_async( api_base="https://api.stripe.com", ) + def test_terminal_configurations_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/terminal/configurations/uc_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.configurations.retrieve("uc_123") + http_client_mock.assert_requested( + "get", + path="/v1/terminal/configurations/uc_123", + query_string="", + api_base="https://api.stripe.com", + ) + def test_terminal_configurations_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -24232,7 +31980,7 @@ def test_terminal_configurations_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.configurations.retrieve("uc_123") + client.v1.terminal.configurations.retrieve("uc_123") http_client_mock.assert_requested( "get", path="/v1/terminal/configurations/uc_123", @@ -24264,7 +32012,7 @@ async def test_terminal_configurations_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.configurations.retrieve_async("uc_123") + await client.v1.terminal.configurations.retrieve_async("uc_123") http_client_mock.assert_requested( "get", path="/v1/terminal/configurations/uc_123", @@ -24272,6 +32020,27 @@ async def test_terminal_configurations_get_2_service_async( api_base="https://api.stripe.com", ) + def test_terminal_configurations_get_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/terminal/configurations", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.configurations.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/terminal/configurations", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_terminal_configurations_get_3( self, http_client_mock: HTTPClientMock ) -> None: @@ -24295,7 +32064,7 @@ def test_terminal_configurations_get_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.configurations.list({"limit": 3}) + client.v1.terminal.configurations.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/terminal/configurations", @@ -24328,7 +32097,7 @@ async def test_terminal_configurations_get_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.configurations.list_async({"limit": 3}) + await client.v1.terminal.configurations.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/terminal/configurations", @@ -24336,6 +32105,26 @@ async def test_terminal_configurations_get_3_service_async( api_base="https://api.stripe.com", ) + def test_terminal_configurations_get_4_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/terminal/configurations/tmc_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.configurations.retrieve("tmc_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/terminal/configurations/tmc_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_terminal_configurations_get_4( self, http_client_mock: HTTPClientMock ) -> None: @@ -24358,7 +32147,7 @@ def test_terminal_configurations_get_4_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.configurations.retrieve("tmc_xxxxxxxxxxxxx") + client.v1.terminal.configurations.retrieve("tmc_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/terminal/configurations/tmc_xxxxxxxxxxxxx", @@ -24390,8 +32179,8 @@ async def test_terminal_configurations_get_4_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.configurations.retrieve_async( - "tmc_xxxxxxxxxxxxx" + await client.v1.terminal.configurations.retrieve_async( + "tmc_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( "get", @@ -24400,6 +32189,26 @@ async def test_terminal_configurations_get_4_service_async( api_base="https://api.stripe.com", ) + def test_terminal_configurations_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/terminal/configurations", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.configurations.create() + http_client_mock.assert_requested( + "post", + path="/v1/terminal/configurations", + query_string="", + api_base="https://api.stripe.com", + ) + def test_terminal_configurations_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -24422,7 +32231,7 @@ def test_terminal_configurations_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.configurations.create() + client.v1.terminal.configurations.create() http_client_mock.assert_requested( "post", path="/v1/terminal/configurations", @@ -24454,7 +32263,7 @@ async def test_terminal_configurations_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.configurations.create_async() + await client.v1.terminal.configurations.create_async() http_client_mock.assert_requested( "post", path="/v1/terminal/configurations", @@ -24462,6 +32271,30 @@ async def test_terminal_configurations_post_service_async( api_base="https://api.stripe.com", ) + def test_terminal_configurations_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/terminal/configurations/uc_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.configurations.update( + "uc_123", + {"tipping": {"usd": {"fixed_amounts": [10]}}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/terminal/configurations/uc_123", + query_string="", + api_base="https://api.stripe.com", + post_data="tipping[usd][fixed_amounts][0]=10", + ) + def test_terminal_configurations_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -24488,7 +32321,7 @@ def test_terminal_configurations_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.configurations.update( + client.v1.terminal.configurations.update( "uc_123", {"tipping": {"usd": {"fixed_amounts": [10]}}}, ) @@ -24528,7 +32361,7 @@ async def test_terminal_configurations_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.configurations.update_async( + await client.v1.terminal.configurations.update_async( "uc_123", {"tipping": {"usd": {"fixed_amounts": [10]}}}, ) @@ -24540,6 +32373,31 @@ async def test_terminal_configurations_post_2_service_async( post_data="tipping[usd][fixed_amounts][0]=10", ) + def test_terminal_configurations_post_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/terminal/configurations", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.configurations.create( + { + "bbpos_wisepos_e": {"splashscreen": "file_xxxxxxxxxxxxx"}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/terminal/configurations", + query_string="", + api_base="https://api.stripe.com", + post_data="bbpos_wisepos_e[splashscreen]=file_xxxxxxxxxxxxx", + ) + def test_terminal_configurations_post_3( self, http_client_mock: HTTPClientMock ) -> None: @@ -24565,7 +32423,7 @@ def test_terminal_configurations_post_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.configurations.create( + client.v1.terminal.configurations.create( { "bbpos_wisepos_e": {"splashscreen": "file_xxxxxxxxxxxxx"}, } @@ -24605,7 +32463,7 @@ async def test_terminal_configurations_post_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.configurations.create_async( + await client.v1.terminal.configurations.create_async( { "bbpos_wisepos_e": {"splashscreen": "file_xxxxxxxxxxxxx"}, } @@ -24618,6 +32476,30 @@ async def test_terminal_configurations_post_3_service_async( post_data="bbpos_wisepos_e[splashscreen]=file_xxxxxxxxxxxxx", ) + def test_terminal_configurations_post_4_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/terminal/configurations/tmc_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.configurations.update( + "tmc_xxxxxxxxxxxxx", + {"bbpos_wisepos_e": {"splashscreen": "file_xxxxxxxxxxxxx"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/terminal/configurations/tmc_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="bbpos_wisepos_e[splashscreen]=file_xxxxxxxxxxxxx", + ) + def test_terminal_configurations_post_4( self, http_client_mock: HTTPClientMock ) -> None: @@ -24644,7 +32526,7 @@ def test_terminal_configurations_post_4_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.configurations.update( + client.v1.terminal.configurations.update( "tmc_xxxxxxxxxxxxx", {"bbpos_wisepos_e": {"splashscreen": "file_xxxxxxxxxxxxx"}}, ) @@ -24684,7 +32566,7 @@ async def test_terminal_configurations_post_4_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.configurations.update_async( + await client.v1.terminal.configurations.update_async( "tmc_xxxxxxxxxxxxx", {"bbpos_wisepos_e": {"splashscreen": "file_xxxxxxxxxxxxx"}}, ) @@ -24696,6 +32578,26 @@ async def test_terminal_configurations_post_4_service_async( post_data="bbpos_wisepos_e[splashscreen]=file_xxxxxxxxxxxxx", ) + def test_terminal_connection_tokens_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/terminal/connection_tokens", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.connection_tokens.create() + http_client_mock.assert_requested( + "post", + path="/v1/terminal/connection_tokens", + query_string="", + api_base="https://api.stripe.com", + ) + def test_terminal_connection_tokens_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -24718,7 +32620,7 @@ def test_terminal_connection_tokens_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.connection_tokens.create() + client.v1.terminal.connection_tokens.create() http_client_mock.assert_requested( "post", path="/v1/terminal/connection_tokens", @@ -24750,7 +32652,7 @@ async def test_terminal_connection_tokens_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.connection_tokens.create_async() + await client.v1.terminal.connection_tokens.create_async() http_client_mock.assert_requested( "post", path="/v1/terminal/connection_tokens", @@ -24758,6 +32660,26 @@ async def test_terminal_connection_tokens_post_service_async( api_base="https://api.stripe.com", ) + def test_terminal_locations_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/terminal/locations/tml_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.locations.delete("tml_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/terminal/locations/tml_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_terminal_locations_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -24780,7 +32702,7 @@ def test_terminal_locations_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.locations.delete("tml_xxxxxxxxxxxxx") + client.v1.terminal.locations.delete("tml_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/terminal/locations/tml_xxxxxxxxxxxxx", @@ -24812,7 +32734,7 @@ async def test_terminal_locations_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.locations.delete_async("tml_xxxxxxxxxxxxx") + await client.v1.terminal.locations.delete_async("tml_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/terminal/locations/tml_xxxxxxxxxxxxx", @@ -24820,6 +32742,27 @@ async def test_terminal_locations_delete_service_async( api_base="https://api.stripe.com", ) + def test_terminal_locations_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/terminal/locations", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.locations.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/terminal/locations", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_terminal_locations_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -24843,7 +32786,7 @@ def test_terminal_locations_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.locations.list({"limit": 3}) + client.v1.terminal.locations.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/terminal/locations", @@ -24876,7 +32819,7 @@ async def test_terminal_locations_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.locations.list_async({"limit": 3}) + await client.v1.terminal.locations.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/terminal/locations", @@ -24884,6 +32827,26 @@ async def test_terminal_locations_get_service_async( api_base="https://api.stripe.com", ) + def test_terminal_locations_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/terminal/locations/tml_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.locations.retrieve("tml_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/terminal/locations/tml_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_terminal_locations_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -24906,7 +32869,7 @@ def test_terminal_locations_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.locations.retrieve("tml_xxxxxxxxxxxxx") + client.v1.terminal.locations.retrieve("tml_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/terminal/locations/tml_xxxxxxxxxxxxx", @@ -24938,7 +32901,7 @@ async def test_terminal_locations_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.locations.retrieve_async("tml_xxxxxxxxxxxxx") + await client.v1.terminal.locations.retrieve_async("tml_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/terminal/locations/tml_xxxxxxxxxxxxx", @@ -24946,6 +32909,38 @@ async def test_terminal_locations_get_2_service_async( api_base="https://api.stripe.com", ) + def test_terminal_locations_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/terminal/locations", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.locations.create( + { + "display_name": "My First Store", + "address": { + "line1": "1234 Main Street", + "city": "San Francisco", + "postal_code": "94111", + "state": "CA", + "country": "US", + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/terminal/locations", + query_string="", + api_base="https://api.stripe.com", + post_data="display_name=My%20First%20Store&address[line1]=1234%20Main%20Street&address[city]=San%20Francisco&address[postal_code]=94111&address[state]=CA&address[country]=US", + ) + def test_terminal_locations_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -24978,7 +32973,7 @@ def test_terminal_locations_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.locations.create( + client.v1.terminal.locations.create( { "display_name": "My First Store", "address": { @@ -25032,7 +33027,7 @@ async def test_terminal_locations_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.locations.create_async( + await client.v1.terminal.locations.create_async( { "display_name": "My First Store", "address": { @@ -25052,6 +33047,30 @@ async def test_terminal_locations_post_service_async( post_data="display_name=My%20First%20Store&address[line1]=1234%20Main%20Street&address[city]=San%20Francisco&address[postal_code]=94111&address[state]=CA&address[country]=US", ) + def test_terminal_locations_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/terminal/locations/tml_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.locations.update( + "tml_xxxxxxxxxxxxx", + {"display_name": "My First Store"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/terminal/locations/tml_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="display_name=My%20First%20Store", + ) + def test_terminal_locations_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -25078,7 +33097,7 @@ def test_terminal_locations_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.locations.update( + client.v1.terminal.locations.update( "tml_xxxxxxxxxxxxx", {"display_name": "My First Store"}, ) @@ -25118,7 +33137,7 @@ async def test_terminal_locations_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.locations.update_async( + await client.v1.terminal.locations.update_async( "tml_xxxxxxxxxxxxx", {"display_name": "My First Store"}, ) @@ -25130,6 +33149,26 @@ async def test_terminal_locations_post_2_service_async( post_data="display_name=My%20First%20Store", ) + def test_terminal_readers_cancel_action_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/terminal/readers/tmr_xxxxxxxxxxxxx/cancel_action", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.readers.cancel_action("tmr_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx/cancel_action", + query_string="", + api_base="https://api.stripe.com", + ) + def test_terminal_readers_cancel_action_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -25152,7 +33191,7 @@ def test_terminal_readers_cancel_action_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.readers.cancel_action("tmr_xxxxxxxxxxxxx") + client.v1.terminal.readers.cancel_action("tmr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx/cancel_action", @@ -25184,7 +33223,9 @@ async def test_terminal_readers_cancel_action_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.readers.cancel_action_async("tmr_xxxxxxxxxxxxx") + await client.v1.terminal.readers.cancel_action_async( + "tmr_xxxxxxxxxxxxx", + ) http_client_mock.assert_requested( "post", path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx/cancel_action", @@ -25192,6 +33233,26 @@ async def test_terminal_readers_cancel_action_post_service_async( api_base="https://api.stripe.com", ) + def test_terminal_readers_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/terminal/readers/tmr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.readers.delete("tmr_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_terminal_readers_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -25214,7 +33275,7 @@ def test_terminal_readers_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.readers.delete("tmr_xxxxxxxxxxxxx") + client.v1.terminal.readers.delete("tmr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx", @@ -25246,7 +33307,7 @@ async def test_terminal_readers_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.readers.delete_async("tmr_xxxxxxxxxxxxx") + await client.v1.terminal.readers.delete_async("tmr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx", @@ -25254,6 +33315,27 @@ async def test_terminal_readers_delete_service_async( api_base="https://api.stripe.com", ) + def test_terminal_readers_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/terminal/readers", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.readers.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/terminal/readers", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_terminal_readers_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -25277,7 +33359,7 @@ def test_terminal_readers_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.readers.list({"limit": 3}) + client.v1.terminal.readers.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/terminal/readers", @@ -25310,7 +33392,7 @@ async def test_terminal_readers_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.readers.list_async({"limit": 3}) + await client.v1.terminal.readers.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/terminal/readers", @@ -25318,6 +33400,26 @@ async def test_terminal_readers_get_service_async( api_base="https://api.stripe.com", ) + def test_terminal_readers_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/terminal/readers/tmr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.readers.retrieve("tmr_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_terminal_readers_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -25340,7 +33442,7 @@ def test_terminal_readers_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.readers.retrieve("tmr_xxxxxxxxxxxxx") + client.v1.terminal.readers.retrieve("tmr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx", @@ -25372,7 +33474,7 @@ async def test_terminal_readers_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.readers.retrieve_async("tmr_xxxxxxxxxxxxx") + await client.v1.terminal.readers.retrieve_async("tmr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx", @@ -25380,6 +33482,33 @@ async def test_terminal_readers_get_2_service_async( api_base="https://api.stripe.com", ) + def test_terminal_readers_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/terminal/readers", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.readers.create( + { + "registration_code": "puppies-plug-could", + "label": "Blue Rabbit", + "location": "tml_1234", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/terminal/readers", + query_string="", + api_base="https://api.stripe.com", + post_data="registration_code=puppies-plug-could&label=Blue%20Rabbit&location=tml_1234", + ) + def test_terminal_readers_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -25407,7 +33536,7 @@ def test_terminal_readers_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.readers.create( + client.v1.terminal.readers.create( { "registration_code": "puppies-plug-could", "label": "Blue Rabbit", @@ -25451,7 +33580,7 @@ async def test_terminal_readers_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.readers.create_async( + await client.v1.terminal.readers.create_async( { "registration_code": "puppies-plug-could", "label": "Blue Rabbit", @@ -25466,6 +33595,30 @@ async def test_terminal_readers_post_service_async( post_data="registration_code=puppies-plug-could&label=Blue%20Rabbit&location=tml_1234", ) + def test_terminal_readers_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/terminal/readers/tmr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.readers.update( + "tmr_xxxxxxxxxxxxx", + {"label": "Blue Rabbit"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="label=Blue%20Rabbit", + ) + def test_terminal_readers_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -25492,7 +33645,7 @@ def test_terminal_readers_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.readers.update( + client.v1.terminal.readers.update( "tmr_xxxxxxxxxxxxx", {"label": "Blue Rabbit"}, ) @@ -25532,7 +33685,7 @@ async def test_terminal_readers_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.readers.update_async( + await client.v1.terminal.readers.update_async( "tmr_xxxxxxxxxxxxx", {"label": "Blue Rabbit"}, ) @@ -25544,6 +33697,30 @@ async def test_terminal_readers_post_2_service_async( post_data="label=Blue%20Rabbit", ) + def test_terminal_readers_process_payment_intent_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_payment_intent", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.terminal.readers.process_payment_intent( + "tmr_xxxxxxxxxxxxx", + {"payment_intent": "pi_xxxxxxxxxxxxx"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_payment_intent", + query_string="", + api_base="https://api.stripe.com", + post_data="payment_intent=pi_xxxxxxxxxxxxx", + ) + def test_terminal_readers_process_payment_intent_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -25570,7 +33747,7 @@ def test_terminal_readers_process_payment_intent_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.readers.process_payment_intent( + client.v1.terminal.readers.process_payment_intent( "tmr_xxxxxxxxxxxxx", {"payment_intent": "pi_xxxxxxxxxxxxx"}, ) @@ -25610,7 +33787,7 @@ async def test_terminal_readers_process_payment_intent_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.readers.process_payment_intent_async( + await client.v1.terminal.readers.process_payment_intent_async( "tmr_xxxxxxxxxxxxx", {"payment_intent": "pi_xxxxxxxxxxxxx"}, ) @@ -25622,22 +33799,7 @@ async def test_terminal_readers_process_payment_intent_post_service_async( post_data="payment_intent=pi_xxxxxxxxxxxxx", ) - def test_terminal_readers_process_setup_intent_post( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.terminal.Reader.process_setup_intent( - "tmr_xxxxxxxxxxxxx", - setup_intent="seti_xxxxxxxxxxxxx", - allow_redisplay="always", - ) - http_client_mock.assert_requested( - "post", - path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent", - query_string="", - post_data="setup_intent=seti_xxxxxxxxxxxxx&allow_redisplay=always", - ) - - def test_terminal_readers_process_setup_intent_post_service( + def test_terminal_readers_process_setup_intent_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -25664,11 +33826,10 @@ def test_terminal_readers_process_setup_intent_post_service( post_data="setup_intent=seti_xxxxxxxxxxxxx&allow_redisplay=always", ) - @pytest.mark.anyio - async def test_terminal_readers_process_setup_intent_post_async( + def test_terminal_readers_process_setup_intent_post( self, http_client_mock: HTTPClientMock ) -> None: - await stripe.terminal.Reader.process_setup_intent_async( + stripe.terminal.Reader.process_setup_intent( "tmr_xxxxxxxxxxxxx", setup_intent="seti_xxxxxxxxxxxxx", allow_redisplay="always", @@ -25680,8 +33841,7 @@ async def test_terminal_readers_process_setup_intent_post_async( post_data="setup_intent=seti_xxxxxxxxxxxxx&allow_redisplay=always", ) - @pytest.mark.anyio - async def test_terminal_readers_process_setup_intent_post_service_async( + def test_terminal_readers_process_setup_intent_post_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -25693,7 +33853,7 @@ async def test_terminal_readers_process_setup_intent_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.terminal.readers.process_setup_intent_async( + client.v1.terminal.readers.process_setup_intent( "tmr_xxxxxxxxxxxxx", { "setup_intent": "seti_xxxxxxxxxxxxx", @@ -25708,6 +33868,74 @@ async def test_terminal_readers_process_setup_intent_post_service_async( post_data="setup_intent=seti_xxxxxxxxxxxxx&allow_redisplay=always", ) + @pytest.mark.anyio + async def test_terminal_readers_process_setup_intent_post_async( + self, http_client_mock: HTTPClientMock + ) -> None: + await stripe.terminal.Reader.process_setup_intent_async( + "tmr_xxxxxxxxxxxxx", + setup_intent="seti_xxxxxxxxxxxxx", + allow_redisplay="always", + ) + http_client_mock.assert_requested( + "post", + path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent", + query_string="", + post_data="setup_intent=seti_xxxxxxxxxxxxx&allow_redisplay=always", + ) + + @pytest.mark.anyio + async def test_terminal_readers_process_setup_intent_post_service_async( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + await client.v1.terminal.readers.process_setup_intent_async( + "tmr_xxxxxxxxxxxxx", + { + "setup_intent": "seti_xxxxxxxxxxxxx", + "allow_redisplay": "always", + }, + ) + http_client_mock.assert_requested( + "post", + path="/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent", + query_string="", + api_base="https://api.stripe.com", + post_data="setup_intent=seti_xxxxxxxxxxxxx&allow_redisplay=always", + ) + + def test_test_helpers_customers_fund_cash_balance_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/customers/cus_123/fund_cash_balance", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.customers.fund_cash_balance( + "cus_123", + {"amount": 30, "currency": "eur"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/customers/cus_123/fund_cash_balance", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=30¤cy=eur", + ) + def test_test_helpers_customers_fund_cash_balance_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -25735,7 +33963,7 @@ def test_test_helpers_customers_fund_cash_balance_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.customers.fund_cash_balance( + client.v1.test_helpers.customers.fund_cash_balance( "cus_123", {"amount": 30, "currency": "eur"}, ) @@ -25776,7 +34004,7 @@ async def test_test_helpers_customers_fund_cash_balance_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.customers.fund_cash_balance_async( + await client.v1.test_helpers.customers.fund_cash_balance_async( "cus_123", {"amount": 30, "currency": "eur"}, ) @@ -25788,6 +34016,67 @@ async def test_test_helpers_customers_fund_cash_balance_post_service_async( post_data="amount=30¤cy=eur", ) + def test_test_helpers_issuing_authorizations_capture_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/authorizations/example_authorization/capture", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.authorizations.capture( + "example_authorization", + { + "capture_amount": 100, + "close_authorization": True, + "purchase_details": { + "flight": { + "departure_at": 1633651200, + "passenger_name": "John Doe", + "refundable": True, + "segments": [ + { + "arrival_airport_code": "SFO", + "carrier": "Delta", + "departure_airport_code": "LAX", + "flight_number": "DL100", + "service_class": "Economy", + "stopover_allowed": True, + }, + ], + "travel_agency": "Orbitz", + }, + "fuel": { + "type": "diesel", + "unit": "liter", + "unit_cost_decimal": "3.5", + "quantity_decimal": "10", + }, + "lodging": {"check_in_at": 1633651200, "nights": 2}, + "receipt": [ + { + "description": "Room charge", + "quantity": "1", + "total": 200, + "unit_cost": 200, + }, + ], + "reference": "foo", + }, + }, + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/authorizations/example_authorization/capture", + query_string="", + api_base="https://api.stripe.com", + post_data="capture_amount=100&close_authorization=true&purchase_details[flight][departure_at]=1633651200&purchase_details[flight][passenger_name]=John%20Doe&purchase_details[flight][refundable]=true&purchase_details[flight][segments][0][arrival_airport_code]=SFO&purchase_details[flight][segments][0][carrier]=Delta&purchase_details[flight][segments][0][departure_airport_code]=LAX&purchase_details[flight][segments][0][flight_number]=DL100&purchase_details[flight][segments][0][service_class]=Economy&purchase_details[flight][segments][0][stopover_allowed]=true&purchase_details[flight][travel_agency]=Orbitz&purchase_details[fuel][type]=diesel&purchase_details[fuel][unit]=liter&purchase_details[fuel][unit_cost_decimal]=3.5&purchase_details[fuel][quantity_decimal]=10&purchase_details[lodging][check_in_at]=1633651200&purchase_details[lodging][nights]=2&purchase_details[receipt][0][description]=Room%20charge&purchase_details[receipt][0][quantity]=1&purchase_details[receipt][0][total]=200&purchase_details[receipt][0][unit_cost]=200&purchase_details[reference]=foo", + ) + def test_test_helpers_issuing_authorizations_capture_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -25849,7 +34138,7 @@ def test_test_helpers_issuing_authorizations_capture_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.authorizations.capture( + client.v1.test_helpers.issuing.authorizations.capture( "example_authorization", { "capture_amount": 100, @@ -25961,7 +34250,7 @@ async def test_test_helpers_issuing_authorizations_capture_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.authorizations.capture_async( + await client.v1.test_helpers.issuing.authorizations.capture_async( "example_authorization", { "capture_amount": 100, @@ -26010,6 +34299,28 @@ async def test_test_helpers_issuing_authorizations_capture_post_service_async( post_data="capture_amount=100&close_authorization=true&purchase_details[flight][departure_at]=1633651200&purchase_details[flight][passenger_name]=John%20Doe&purchase_details[flight][refundable]=true&purchase_details[flight][segments][0][arrival_airport_code]=SFO&purchase_details[flight][segments][0][carrier]=Delta&purchase_details[flight][segments][0][departure_airport_code]=LAX&purchase_details[flight][segments][0][flight_number]=DL100&purchase_details[flight][segments][0][service_class]=Economy&purchase_details[flight][segments][0][stopover_allowed]=true&purchase_details[flight][travel_agency]=Orbitz&purchase_details[fuel][type]=diesel&purchase_details[fuel][unit]=liter&purchase_details[fuel][unit_cost_decimal]=3.5&purchase_details[fuel][quantity_decimal]=10&purchase_details[lodging][check_in_at]=1633651200&purchase_details[lodging][nights]=2&purchase_details[receipt][0][description]=Room%20charge&purchase_details[receipt][0][quantity]=1&purchase_details[receipt][0][total]=200&purchase_details[receipt][0][unit_cost]=200&purchase_details[reference]=foo", ) + def test_test_helpers_issuing_authorizations_expire_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/authorizations/example_authorization/expire", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.authorizations.expire( + "example_authorization", + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/authorizations/example_authorization/expire", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_issuing_authorizations_expire_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -26034,7 +34345,7 @@ def test_test_helpers_issuing_authorizations_expire_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.authorizations.expire( + client.v1.test_helpers.issuing.authorizations.expire( "example_authorization", ) http_client_mock.assert_requested( @@ -26070,7 +34381,7 @@ async def test_test_helpers_issuing_authorizations_expire_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.authorizations.expire_async( + await client.v1.test_helpers.issuing.authorizations.expire_async( "example_authorization", ) http_client_mock.assert_requested( @@ -26080,6 +34391,30 @@ async def test_test_helpers_issuing_authorizations_expire_post_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_issuing_authorizations_increment_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/authorizations/example_authorization/increment", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.authorizations.increment( + "example_authorization", + {"increment_amount": 50, "is_amount_controllable": True}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/authorizations/example_authorization/increment", + query_string="", + api_base="https://api.stripe.com", + post_data="increment_amount=50&is_amount_controllable=true", + ) + def test_test_helpers_issuing_authorizations_increment_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -26107,7 +34442,7 @@ def test_test_helpers_issuing_authorizations_increment_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.authorizations.increment( + client.v1.test_helpers.issuing.authorizations.increment( "example_authorization", {"increment_amount": 50, "is_amount_controllable": True}, ) @@ -26148,7 +34483,7 @@ async def test_test_helpers_issuing_authorizations_increment_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.authorizations.increment_async( + await client.v1.test_helpers.issuing.authorizations.increment_async( "example_authorization", {"increment_amount": 50, "is_amount_controllable": True}, ) @@ -26160,6 +34495,54 @@ async def test_test_helpers_issuing_authorizations_increment_post_service_async( post_data="increment_amount=50&is_amount_controllable=true", ) + def test_test_helpers_issuing_authorizations_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/authorizations", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.authorizations.create( + { + "amount": 100, + "amount_details": {"atm_fee": 10, "cashback_amount": 5}, + "authorization_method": "chip", + "card": "foo", + "currency": "usd", + "is_amount_controllable": True, + "merchant_data": { + "category": "ac_refrigeration_repair", + "city": "foo", + "country": "bar", + "name": "foo", + "network_id": "bar", + "postal_code": "foo", + "state": "bar", + "terminal_id": "foo", + }, + "network_data": {"acquiring_institution_id": "foo"}, + "verification_data": { + "address_line1_check": "mismatch", + "address_postal_code_check": "match", + "cvc_check": "match", + "expiry_check": "mismatch", + }, + "wallet": "apple_pay", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/authorizations", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=100&amount_details[atm_fee]=10&amount_details[cashback_amount]=5&authorization_method=chip&card=foo¤cy=usd&is_amount_controllable=true&merchant_data[category]=ac_refrigeration_repair&merchant_data[city]=foo&merchant_data[country]=bar&merchant_data[name]=foo&merchant_data[network_id]=bar&merchant_data[postal_code]=foo&merchant_data[state]=bar&merchant_data[terminal_id]=foo&network_data[acquiring_institution_id]=foo&verification_data[address_line1_check]=mismatch&verification_data[address_postal_code_check]=match&verification_data[cvc_check]=match&verification_data[expiry_check]=mismatch&wallet=apple_pay", + ) + def test_test_helpers_issuing_authorizations_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -26208,7 +34591,7 @@ def test_test_helpers_issuing_authorizations_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.authorizations.create( + client.v1.test_helpers.issuing.authorizations.create( { "amount": 100, "amount_details": {"atm_fee": 10, "cashback_amount": 5}, @@ -26294,7 +34677,7 @@ async def test_test_helpers_issuing_authorizations_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.authorizations.create_async( + await client.v1.test_helpers.issuing.authorizations.create_async( { "amount": 100, "amount_details": {"atm_fee": 10, "cashback_amount": 5}, @@ -26330,6 +34713,30 @@ async def test_test_helpers_issuing_authorizations_post_service_async( post_data="amount=100&amount_details[atm_fee]=10&amount_details[cashback_amount]=5&authorization_method=chip&card=foo¤cy=usd&is_amount_controllable=true&merchant_data[category]=ac_refrigeration_repair&merchant_data[city]=foo&merchant_data[country]=bar&merchant_data[name]=foo&merchant_data[network_id]=bar&merchant_data[postal_code]=foo&merchant_data[state]=bar&merchant_data[terminal_id]=foo&network_data[acquiring_institution_id]=foo&verification_data[address_line1_check]=mismatch&verification_data[address_postal_code_check]=match&verification_data[cvc_check]=match&verification_data[expiry_check]=mismatch&wallet=apple_pay", ) + def test_test_helpers_issuing_authorizations_reverse_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/authorizations/example_authorization/reverse", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.authorizations.reverse( + "example_authorization", + {"reverse_amount": 20}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/authorizations/example_authorization/reverse", + query_string="", + api_base="https://api.stripe.com", + post_data="reverse_amount=20", + ) + def test_test_helpers_issuing_authorizations_reverse_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -26356,7 +34763,7 @@ def test_test_helpers_issuing_authorizations_reverse_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.authorizations.reverse( + client.v1.test_helpers.issuing.authorizations.reverse( "example_authorization", {"reverse_amount": 20}, ) @@ -26396,7 +34803,7 @@ async def test_test_helpers_issuing_authorizations_reverse_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.authorizations.reverse_async( + await client.v1.test_helpers.issuing.authorizations.reverse_async( "example_authorization", {"reverse_amount": 20}, ) @@ -26408,6 +34815,26 @@ async def test_test_helpers_issuing_authorizations_reverse_post_service_async( post_data="reverse_amount=20", ) + def test_test_helpers_issuing_cards_shipping_deliver_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/cards/card_123/shipping/deliver", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.cards.deliver_card("card_123") + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/cards/card_123/shipping/deliver", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_issuing_cards_shipping_deliver_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -26430,7 +34857,7 @@ def test_test_helpers_issuing_cards_shipping_deliver_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.cards.deliver_card("card_123") + client.v1.test_helpers.issuing.cards.deliver_card("card_123") http_client_mock.assert_requested( "post", path="/v1/test_helpers/issuing/cards/card_123/shipping/deliver", @@ -26462,7 +34889,9 @@ async def test_test_helpers_issuing_cards_shipping_deliver_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.cards.deliver_card_async("card_123") + await client.v1.test_helpers.issuing.cards.deliver_card_async( + "card_123", + ) http_client_mock.assert_requested( "post", path="/v1/test_helpers/issuing/cards/card_123/shipping/deliver", @@ -26470,6 +34899,26 @@ async def test_test_helpers_issuing_cards_shipping_deliver_post_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_issuing_cards_shipping_fail_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/cards/card_123/shipping/fail", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.cards.fail_card("card_123") + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/cards/card_123/shipping/fail", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_issuing_cards_shipping_fail_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -26492,7 +34941,7 @@ def test_test_helpers_issuing_cards_shipping_fail_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.cards.fail_card("card_123") + client.v1.test_helpers.issuing.cards.fail_card("card_123") http_client_mock.assert_requested( "post", path="/v1/test_helpers/issuing/cards/card_123/shipping/fail", @@ -26524,7 +34973,7 @@ async def test_test_helpers_issuing_cards_shipping_fail_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.cards.fail_card_async("card_123") + await client.v1.test_helpers.issuing.cards.fail_card_async("card_123") http_client_mock.assert_requested( "post", path="/v1/test_helpers/issuing/cards/card_123/shipping/fail", @@ -26532,6 +34981,26 @@ async def test_test_helpers_issuing_cards_shipping_fail_post_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_issuing_cards_shipping_return_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/cards/card_123/shipping/return", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.cards.return_card("card_123") + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/cards/card_123/shipping/return", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_issuing_cards_shipping_return_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -26554,7 +35023,7 @@ def test_test_helpers_issuing_cards_shipping_return_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.cards.return_card("card_123") + client.v1.test_helpers.issuing.cards.return_card("card_123") http_client_mock.assert_requested( "post", path="/v1/test_helpers/issuing/cards/card_123/shipping/return", @@ -26586,7 +35055,9 @@ async def test_test_helpers_issuing_cards_shipping_return_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.cards.return_card_async("card_123") + await client.v1.test_helpers.issuing.cards.return_card_async( + "card_123" + ) http_client_mock.assert_requested( "post", path="/v1/test_helpers/issuing/cards/card_123/shipping/return", @@ -26594,6 +35065,26 @@ async def test_test_helpers_issuing_cards_shipping_return_post_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_issuing_cards_shipping_ship_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/cards/card_123/shipping/ship", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.cards.ship_card("card_123") + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/cards/card_123/shipping/ship", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_issuing_cards_shipping_ship_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -26616,7 +35107,7 @@ def test_test_helpers_issuing_cards_shipping_ship_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.cards.ship_card("card_123") + client.v1.test_helpers.issuing.cards.ship_card("card_123") http_client_mock.assert_requested( "post", path="/v1/test_helpers/issuing/cards/card_123/shipping/ship", @@ -26648,7 +35139,7 @@ async def test_test_helpers_issuing_cards_shipping_ship_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.cards.ship_card_async("card_123") + await client.v1.test_helpers.issuing.cards.ship_card_async("card_123") http_client_mock.assert_requested( "post", path="/v1/test_helpers/issuing/cards/card_123/shipping/ship", @@ -26656,6 +35147,26 @@ async def test_test_helpers_issuing_cards_shipping_ship_post_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_issuing_personalization_designs_activate_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/personalization_designs/pd_xyz/activate", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.personalization_designs.activate("pd_xyz") + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/personalization_designs/pd_xyz/activate", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_issuing_personalization_designs_activate_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -26678,7 +35189,9 @@ def test_test_helpers_issuing_personalization_designs_activate_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.personalization_designs.activate("pd_xyz") + client.v1.test_helpers.issuing.personalization_designs.activate( + "pd_xyz", + ) http_client_mock.assert_requested( "post", path="/v1/test_helpers/issuing/personalization_designs/pd_xyz/activate", @@ -26712,10 +35225,8 @@ async def test_test_helpers_issuing_personalization_designs_activate_post_servic http_client=http_client_mock.get_mock_http_client(), ) - await ( - client.test_helpers.issuing.personalization_designs.activate_async( - "pd_xyz" - ) + await client.v1.test_helpers.issuing.personalization_designs.activate_async( + "pd_xyz" ) http_client_mock.assert_requested( "post", @@ -26724,6 +35235,28 @@ async def test_test_helpers_issuing_personalization_designs_activate_post_servic api_base="https://api.stripe.com", ) + def test_test_helpers_issuing_personalization_designs_deactivate_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/personalization_designs/pd_xyz/deactivate", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.personalization_designs.deactivate( + "pd_xyz" + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/personalization_designs/pd_xyz/deactivate", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_issuing_personalization_designs_deactivate_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -26746,8 +35279,8 @@ def test_test_helpers_issuing_personalization_designs_deactivate_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.personalization_designs.deactivate( - "pd_xyz" + client.v1.test_helpers.issuing.personalization_designs.deactivate( + "pd_xyz", ) http_client_mock.assert_requested( "post", @@ -26784,7 +35317,7 @@ async def test_test_helpers_issuing_personalization_designs_deactivate_post_serv http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.personalization_designs.deactivate_async( + await client.v1.test_helpers.issuing.personalization_designs.deactivate_async( "pd_xyz" ) http_client_mock.assert_requested( @@ -26794,6 +35327,30 @@ async def test_test_helpers_issuing_personalization_designs_deactivate_post_serv api_base="https://api.stripe.com", ) + def test_test_helpers_issuing_personalization_designs_reject_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/personalization_designs/pd_xyz/reject", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.personalization_designs.reject( + "pd_xyz", + {"rejection_reasons": {"card_logo": ["geographic_location"]}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/personalization_designs/pd_xyz/reject", + query_string="", + api_base="https://api.stripe.com", + post_data="rejection_reasons[card_logo][0]=geographic_location", + ) + def test_test_helpers_issuing_personalization_designs_reject_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -26820,7 +35377,7 @@ def test_test_helpers_issuing_personalization_designs_reject_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.personalization_designs.reject( + client.v1.test_helpers.issuing.personalization_designs.reject( "pd_xyz", {"rejection_reasons": {"card_logo": ["geographic_location"]}}, ) @@ -26860,7 +35417,7 @@ async def test_test_helpers_issuing_personalization_designs_reject_post_service_ http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.personalization_designs.reject_async( + await client.v1.test_helpers.issuing.personalization_designs.reject_async( "pd_xyz", {"rejection_reasons": {"card_logo": ["geographic_location"]}}, ) @@ -26872,6 +35429,77 @@ async def test_test_helpers_issuing_personalization_designs_reject_post_service_ post_data="rejection_reasons[card_logo][0]=geographic_location", ) + def test_test_helpers_issuing_transactions_create_force_capture_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/transactions/create_force_capture", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.transactions.create_force_capture( + { + "amount": 100, + "card": "foo", + "currency": "usd", + "merchant_data": { + "category": "ac_refrigeration_repair", + "city": "foo", + "country": "US", + "name": "foo", + "network_id": "bar", + "postal_code": "10001", + "state": "NY", + "terminal_id": "foo", + }, + "purchase_details": { + "flight": { + "departure_at": 1633651200, + "passenger_name": "John Doe", + "refundable": True, + "segments": [ + { + "arrival_airport_code": "SFO", + "carrier": "Delta", + "departure_airport_code": "LAX", + "flight_number": "DL100", + "service_class": "Economy", + "stopover_allowed": True, + }, + ], + "travel_agency": "Orbitz", + }, + "fuel": { + "type": "diesel", + "unit": "liter", + "unit_cost_decimal": "3.5", + "quantity_decimal": "10", + }, + "lodging": {"check_in_at": 1533651200, "nights": 2}, + "receipt": [ + { + "description": "Room charge", + "quantity": "1", + "total": 200, + "unit_cost": 200, + }, + ], + "reference": "foo", + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/transactions/create_force_capture", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=100&card=foo¤cy=usd&merchant_data[category]=ac_refrigeration_repair&merchant_data[city]=foo&merchant_data[country]=US&merchant_data[name]=foo&merchant_data[network_id]=bar&merchant_data[postal_code]=10001&merchant_data[state]=NY&merchant_data[terminal_id]=foo&purchase_details[flight][departure_at]=1633651200&purchase_details[flight][passenger_name]=John%20Doe&purchase_details[flight][refundable]=true&purchase_details[flight][segments][0][arrival_airport_code]=SFO&purchase_details[flight][segments][0][carrier]=Delta&purchase_details[flight][segments][0][departure_airport_code]=LAX&purchase_details[flight][segments][0][flight_number]=DL100&purchase_details[flight][segments][0][service_class]=Economy&purchase_details[flight][segments][0][stopover_allowed]=true&purchase_details[flight][travel_agency]=Orbitz&purchase_details[fuel][type]=diesel&purchase_details[fuel][unit]=liter&purchase_details[fuel][unit_cost_decimal]=3.5&purchase_details[fuel][quantity_decimal]=10&purchase_details[lodging][check_in_at]=1533651200&purchase_details[lodging][nights]=2&purchase_details[receipt][0][description]=Room%20charge&purchase_details[receipt][0][quantity]=1&purchase_details[receipt][0][total]=200&purchase_details[receipt][0][unit_cost]=200&purchase_details[reference]=foo", + ) + def test_test_helpers_issuing_transactions_create_force_capture_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -26943,7 +35571,7 @@ def test_test_helpers_issuing_transactions_create_force_capture_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.transactions.create_force_capture( + client.v1.test_helpers.issuing.transactions.create_force_capture( { "amount": 100, "card": "foo", @@ -27077,7 +35705,7 @@ async def test_test_helpers_issuing_transactions_create_force_capture_post_servi http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.transactions.create_force_capture_async( + await client.v1.test_helpers.issuing.transactions.create_force_capture_async( { "amount": 100, "card": "foo", @@ -27136,66 +35764,7 @@ async def test_test_helpers_issuing_transactions_create_force_capture_post_servi post_data="amount=100&card=foo¤cy=usd&merchant_data[category]=ac_refrigeration_repair&merchant_data[city]=foo&merchant_data[country]=US&merchant_data[name]=foo&merchant_data[network_id]=bar&merchant_data[postal_code]=10001&merchant_data[state]=NY&merchant_data[terminal_id]=foo&purchase_details[flight][departure_at]=1633651200&purchase_details[flight][passenger_name]=John%20Doe&purchase_details[flight][refundable]=true&purchase_details[flight][segments][0][arrival_airport_code]=SFO&purchase_details[flight][segments][0][carrier]=Delta&purchase_details[flight][segments][0][departure_airport_code]=LAX&purchase_details[flight][segments][0][flight_number]=DL100&purchase_details[flight][segments][0][service_class]=Economy&purchase_details[flight][segments][0][stopover_allowed]=true&purchase_details[flight][travel_agency]=Orbitz&purchase_details[fuel][type]=diesel&purchase_details[fuel][unit]=liter&purchase_details[fuel][unit_cost_decimal]=3.5&purchase_details[fuel][quantity_decimal]=10&purchase_details[lodging][check_in_at]=1533651200&purchase_details[lodging][nights]=2&purchase_details[receipt][0][description]=Room%20charge&purchase_details[receipt][0][quantity]=1&purchase_details[receipt][0][total]=200&purchase_details[receipt][0][unit_cost]=200&purchase_details[reference]=foo", ) - def test_test_helpers_issuing_transactions_create_unlinked_refund_post( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.issuing.Transaction.TestHelpers.create_unlinked_refund( - amount=100, - card="foo", - currency="usd", - merchant_data={ - "category": "ac_refrigeration_repair", - "city": "foo", - "country": "bar", - "name": "foo", - "network_id": "bar", - "postal_code": "foo", - "state": "bar", - "terminal_id": "foo", - }, - purchase_details={ - "flight": { - "departure_at": 1533651200, - "passenger_name": "John Doe", - "refundable": True, - "segments": [ - { - "arrival_airport_code": "SFO", - "carrier": "Delta", - "departure_airport_code": "LAX", - "flight_number": "DL100", - "service_class": "Economy", - "stopover_allowed": True, - }, - ], - "travel_agency": "Orbitz", - }, - "fuel": { - "type": "diesel", - "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", - }, - "lodging": {"check_in_at": 1533651200, "nights": 2}, - "receipt": [ - { - "description": "Room charge", - "quantity": "1", - "total": 200, - "unit_cost": 200, - }, - ], - "reference": "foo", - }, - ) - http_client_mock.assert_requested( - "post", - path="/v1/test_helpers/issuing/transactions/create_unlinked_refund", - query_string="", - post_data="amount=100&card=foo¤cy=usd&merchant_data[category]=ac_refrigeration_repair&merchant_data[city]=foo&merchant_data[country]=bar&merchant_data[name]=foo&merchant_data[network_id]=bar&merchant_data[postal_code]=foo&merchant_data[state]=bar&merchant_data[terminal_id]=foo&purchase_details[flight][departure_at]=1533651200&purchase_details[flight][passenger_name]=John%20Doe&purchase_details[flight][refundable]=true&purchase_details[flight][segments][0][arrival_airport_code]=SFO&purchase_details[flight][segments][0][carrier]=Delta&purchase_details[flight][segments][0][departure_airport_code]=LAX&purchase_details[flight][segments][0][flight_number]=DL100&purchase_details[flight][segments][0][service_class]=Economy&purchase_details[flight][segments][0][stopover_allowed]=true&purchase_details[flight][travel_agency]=Orbitz&purchase_details[fuel][type]=diesel&purchase_details[fuel][unit]=liter&purchase_details[fuel][unit_cost_decimal]=3.5&purchase_details[fuel][quantity_decimal]=10&purchase_details[lodging][check_in_at]=1533651200&purchase_details[lodging][nights]=2&purchase_details[receipt][0][description]=Room%20charge&purchase_details[receipt][0][quantity]=1&purchase_details[receipt][0][total]=200&purchase_details[receipt][0][unit_cost]=200&purchase_details[reference]=foo", - ) - - def test_test_helpers_issuing_transactions_create_unlinked_refund_post_service( + def test_test_helpers_issuing_transactions_create_unlinked_refund_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -27266,6 +35835,136 @@ def test_test_helpers_issuing_transactions_create_unlinked_refund_post_service( post_data="amount=100&card=foo¤cy=usd&merchant_data[category]=ac_refrigeration_repair&merchant_data[city]=foo&merchant_data[country]=bar&merchant_data[name]=foo&merchant_data[network_id]=bar&merchant_data[postal_code]=foo&merchant_data[state]=bar&merchant_data[terminal_id]=foo&purchase_details[flight][departure_at]=1533651200&purchase_details[flight][passenger_name]=John%20Doe&purchase_details[flight][refundable]=true&purchase_details[flight][segments][0][arrival_airport_code]=SFO&purchase_details[flight][segments][0][carrier]=Delta&purchase_details[flight][segments][0][departure_airport_code]=LAX&purchase_details[flight][segments][0][flight_number]=DL100&purchase_details[flight][segments][0][service_class]=Economy&purchase_details[flight][segments][0][stopover_allowed]=true&purchase_details[flight][travel_agency]=Orbitz&purchase_details[fuel][type]=diesel&purchase_details[fuel][unit]=liter&purchase_details[fuel][unit_cost_decimal]=3.5&purchase_details[fuel][quantity_decimal]=10&purchase_details[lodging][check_in_at]=1533651200&purchase_details[lodging][nights]=2&purchase_details[receipt][0][description]=Room%20charge&purchase_details[receipt][0][quantity]=1&purchase_details[receipt][0][total]=200&purchase_details[receipt][0][unit_cost]=200&purchase_details[reference]=foo", ) + def test_test_helpers_issuing_transactions_create_unlinked_refund_post( + self, http_client_mock: HTTPClientMock + ) -> None: + stripe.issuing.Transaction.TestHelpers.create_unlinked_refund( + amount=100, + card="foo", + currency="usd", + merchant_data={ + "category": "ac_refrigeration_repair", + "city": "foo", + "country": "bar", + "name": "foo", + "network_id": "bar", + "postal_code": "foo", + "state": "bar", + "terminal_id": "foo", + }, + purchase_details={ + "flight": { + "departure_at": 1533651200, + "passenger_name": "John Doe", + "refundable": True, + "segments": [ + { + "arrival_airport_code": "SFO", + "carrier": "Delta", + "departure_airport_code": "LAX", + "flight_number": "DL100", + "service_class": "Economy", + "stopover_allowed": True, + }, + ], + "travel_agency": "Orbitz", + }, + "fuel": { + "type": "diesel", + "unit": "liter", + "unit_cost_decimal": "3.5", + "quantity_decimal": "10", + }, + "lodging": {"check_in_at": 1533651200, "nights": 2}, + "receipt": [ + { + "description": "Room charge", + "quantity": "1", + "total": 200, + "unit_cost": 200, + }, + ], + "reference": "foo", + }, + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/transactions/create_unlinked_refund", + query_string="", + post_data="amount=100&card=foo¤cy=usd&merchant_data[category]=ac_refrigeration_repair&merchant_data[city]=foo&merchant_data[country]=bar&merchant_data[name]=foo&merchant_data[network_id]=bar&merchant_data[postal_code]=foo&merchant_data[state]=bar&merchant_data[terminal_id]=foo&purchase_details[flight][departure_at]=1533651200&purchase_details[flight][passenger_name]=John%20Doe&purchase_details[flight][refundable]=true&purchase_details[flight][segments][0][arrival_airport_code]=SFO&purchase_details[flight][segments][0][carrier]=Delta&purchase_details[flight][segments][0][departure_airport_code]=LAX&purchase_details[flight][segments][0][flight_number]=DL100&purchase_details[flight][segments][0][service_class]=Economy&purchase_details[flight][segments][0][stopover_allowed]=true&purchase_details[flight][travel_agency]=Orbitz&purchase_details[fuel][type]=diesel&purchase_details[fuel][unit]=liter&purchase_details[fuel][unit_cost_decimal]=3.5&purchase_details[fuel][quantity_decimal]=10&purchase_details[lodging][check_in_at]=1533651200&purchase_details[lodging][nights]=2&purchase_details[receipt][0][description]=Room%20charge&purchase_details[receipt][0][quantity]=1&purchase_details[receipt][0][total]=200&purchase_details[receipt][0][unit_cost]=200&purchase_details[reference]=foo", + ) + + def test_test_helpers_issuing_transactions_create_unlinked_refund_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/transactions/create_unlinked_refund", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v1.test_helpers.issuing.transactions.create_unlinked_refund( + { + "amount": 100, + "card": "foo", + "currency": "usd", + "merchant_data": { + "category": "ac_refrigeration_repair", + "city": "foo", + "country": "bar", + "name": "foo", + "network_id": "bar", + "postal_code": "foo", + "state": "bar", + "terminal_id": "foo", + }, + "purchase_details": { + "flight": { + "departure_at": 1533651200, + "passenger_name": "John Doe", + "refundable": True, + "segments": [ + { + "arrival_airport_code": "SFO", + "carrier": "Delta", + "departure_airport_code": "LAX", + "flight_number": "DL100", + "service_class": "Economy", + "stopover_allowed": True, + }, + ], + "travel_agency": "Orbitz", + }, + "fuel": { + "type": "diesel", + "unit": "liter", + "unit_cost_decimal": "3.5", + "quantity_decimal": "10", + }, + "lodging": {"check_in_at": 1533651200, "nights": 2}, + "receipt": [ + { + "description": "Room charge", + "quantity": "1", + "total": 200, + "unit_cost": 200, + }, + ], + "reference": "foo", + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/transactions/create_unlinked_refund", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=100&card=foo¤cy=usd&merchant_data[category]=ac_refrigeration_repair&merchant_data[city]=foo&merchant_data[country]=bar&merchant_data[name]=foo&merchant_data[network_id]=bar&merchant_data[postal_code]=foo&merchant_data[state]=bar&merchant_data[terminal_id]=foo&purchase_details[flight][departure_at]=1533651200&purchase_details[flight][passenger_name]=John%20Doe&purchase_details[flight][refundable]=true&purchase_details[flight][segments][0][arrival_airport_code]=SFO&purchase_details[flight][segments][0][carrier]=Delta&purchase_details[flight][segments][0][departure_airport_code]=LAX&purchase_details[flight][segments][0][flight_number]=DL100&purchase_details[flight][segments][0][service_class]=Economy&purchase_details[flight][segments][0][stopover_allowed]=true&purchase_details[flight][travel_agency]=Orbitz&purchase_details[fuel][type]=diesel&purchase_details[fuel][unit]=liter&purchase_details[fuel][unit_cost_decimal]=3.5&purchase_details[fuel][quantity_decimal]=10&purchase_details[lodging][check_in_at]=1533651200&purchase_details[lodging][nights]=2&purchase_details[receipt][0][description]=Room%20charge&purchase_details[receipt][0][quantity]=1&purchase_details[receipt][0][total]=200&purchase_details[receipt][0][unit_cost]=200&purchase_details[reference]=foo", + ) + @pytest.mark.anyio async def test_test_helpers_issuing_transactions_create_unlinked_refund_post_async( self, http_client_mock: HTTPClientMock @@ -27339,7 +36038,7 @@ async def test_test_helpers_issuing_transactions_create_unlinked_refund_post_ser http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.transactions.create_unlinked_refund_async( + await client.v1.test_helpers.issuing.transactions.create_unlinked_refund_async( { "amount": 100, "card": "foo", @@ -27398,6 +36097,30 @@ async def test_test_helpers_issuing_transactions_create_unlinked_refund_post_ser post_data="amount=100&card=foo¤cy=usd&merchant_data[category]=ac_refrigeration_repair&merchant_data[city]=foo&merchant_data[country]=bar&merchant_data[name]=foo&merchant_data[network_id]=bar&merchant_data[postal_code]=foo&merchant_data[state]=bar&merchant_data[terminal_id]=foo&purchase_details[flight][departure_at]=1533651200&purchase_details[flight][passenger_name]=John%20Doe&purchase_details[flight][refundable]=true&purchase_details[flight][segments][0][arrival_airport_code]=SFO&purchase_details[flight][segments][0][carrier]=Delta&purchase_details[flight][segments][0][departure_airport_code]=LAX&purchase_details[flight][segments][0][flight_number]=DL100&purchase_details[flight][segments][0][service_class]=Economy&purchase_details[flight][segments][0][stopover_allowed]=true&purchase_details[flight][travel_agency]=Orbitz&purchase_details[fuel][type]=diesel&purchase_details[fuel][unit]=liter&purchase_details[fuel][unit_cost_decimal]=3.5&purchase_details[fuel][quantity_decimal]=10&purchase_details[lodging][check_in_at]=1533651200&purchase_details[lodging][nights]=2&purchase_details[receipt][0][description]=Room%20charge&purchase_details[receipt][0][quantity]=1&purchase_details[receipt][0][total]=200&purchase_details[receipt][0][unit_cost]=200&purchase_details[reference]=foo", ) + def test_test_helpers_issuing_transactions_refund_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/issuing/transactions/example_transaction/refund", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.issuing.transactions.refund( + "example_transaction", + {"refund_amount": 50}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/issuing/transactions/example_transaction/refund", + query_string="", + api_base="https://api.stripe.com", + post_data="refund_amount=50", + ) + def test_test_helpers_issuing_transactions_refund_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -27424,7 +36147,7 @@ def test_test_helpers_issuing_transactions_refund_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.transactions.refund( + client.v1.test_helpers.issuing.transactions.refund( "example_transaction", {"refund_amount": 50}, ) @@ -27464,7 +36187,7 @@ async def test_test_helpers_issuing_transactions_refund_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.transactions.refund_async( + await client.v1.test_helpers.issuing.transactions.refund_async( "example_transaction", {"refund_amount": 50}, ) @@ -27476,6 +36199,26 @@ async def test_test_helpers_issuing_transactions_refund_post_service_async( post_data="refund_amount=50", ) + def test_test_helpers_refunds_expire_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/refunds/re_123/expire", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.refunds.expire("re_123") + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/refunds/re_123/expire", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_refunds_expire_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -27498,7 +36241,7 @@ def test_test_helpers_refunds_expire_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.refunds.expire("re_123") + client.v1.test_helpers.refunds.expire("re_123") http_client_mock.assert_requested( "post", path="/v1/test_helpers/refunds/re_123/expire", @@ -27530,7 +36273,7 @@ async def test_test_helpers_refunds_expire_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.refunds.expire_async("re_123") + await client.v1.test_helpers.refunds.expire_async("re_123") http_client_mock.assert_requested( "post", path="/v1/test_helpers/refunds/re_123/expire", @@ -27538,6 +36281,30 @@ async def test_test_helpers_refunds_expire_post_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_test_clocks_advance_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/test_clocks/clock_xyz/advance", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.test_clocks.advance( + "clock_xyz", + {"frozen_time": 142}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/test_clocks/clock_xyz/advance", + query_string="", + api_base="https://api.stripe.com", + post_data="frozen_time=142", + ) + def test_test_helpers_test_clocks_advance_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -27564,7 +36331,7 @@ def test_test_helpers_test_clocks_advance_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.test_clocks.advance( + client.v1.test_helpers.test_clocks.advance( "clock_xyz", {"frozen_time": 142}, ) @@ -27604,7 +36371,7 @@ async def test_test_helpers_test_clocks_advance_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.test_clocks.advance_async( + await client.v1.test_helpers.test_clocks.advance_async( "clock_xyz", {"frozen_time": 142}, ) @@ -27616,6 +36383,30 @@ async def test_test_helpers_test_clocks_advance_post_service_async( post_data="frozen_time=142", ) + def test_test_helpers_test_clocks_advance_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx/advance", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.test_clocks.advance( + "clock_xxxxxxxxxxxxx", + {"frozen_time": 1675552261}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx/advance", + query_string="", + api_base="https://api.stripe.com", + post_data="frozen_time=1675552261", + ) + def test_test_helpers_test_clocks_advance_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -27642,7 +36433,7 @@ def test_test_helpers_test_clocks_advance_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.test_clocks.advance( + client.v1.test_helpers.test_clocks.advance( "clock_xxxxxxxxxxxxx", {"frozen_time": 1675552261}, ) @@ -27682,7 +36473,7 @@ async def test_test_helpers_test_clocks_advance_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.test_clocks.advance_async( + await client.v1.test_helpers.test_clocks.advance_async( "clock_xxxxxxxxxxxxx", {"frozen_time": 1675552261}, ) @@ -27694,6 +36485,26 @@ async def test_test_helpers_test_clocks_advance_post_2_service_async( post_data="frozen_time=1675552261", ) + def test_test_helpers_test_clocks_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/test_helpers/test_clocks/clock_xyz", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.test_clocks.delete("clock_xyz") + http_client_mock.assert_requested( + "delete", + path="/v1/test_helpers/test_clocks/clock_xyz", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_test_clocks_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -27716,7 +36527,7 @@ def test_test_helpers_test_clocks_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.test_clocks.delete("clock_xyz") + client.v1.test_helpers.test_clocks.delete("clock_xyz") http_client_mock.assert_requested( "delete", path="/v1/test_helpers/test_clocks/clock_xyz", @@ -27748,7 +36559,7 @@ async def test_test_helpers_test_clocks_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.test_clocks.delete_async("clock_xyz") + await client.v1.test_helpers.test_clocks.delete_async("clock_xyz") http_client_mock.assert_requested( "delete", path="/v1/test_helpers/test_clocks/clock_xyz", @@ -27756,6 +36567,26 @@ async def test_test_helpers_test_clocks_delete_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_test_clocks_delete_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.test_clocks.delete("clock_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_test_clocks_delete_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -27778,7 +36609,7 @@ def test_test_helpers_test_clocks_delete_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.test_clocks.delete("clock_xxxxxxxxxxxxx") + client.v1.test_helpers.test_clocks.delete("clock_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx", @@ -27810,7 +36641,7 @@ async def test_test_helpers_test_clocks_delete_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.test_clocks.delete_async( + await client.v1.test_helpers.test_clocks.delete_async( "clock_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -27820,6 +36651,26 @@ async def test_test_helpers_test_clocks_delete_2_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_test_clocks_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/test_helpers/test_clocks", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.test_clocks.list() + http_client_mock.assert_requested( + "get", + path="/v1/test_helpers/test_clocks", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_test_clocks_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -27842,7 +36693,7 @@ def test_test_helpers_test_clocks_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.test_clocks.list() + client.v1.test_helpers.test_clocks.list() http_client_mock.assert_requested( "get", path="/v1/test_helpers/test_clocks", @@ -27874,7 +36725,7 @@ async def test_test_helpers_test_clocks_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.test_clocks.list_async() + await client.v1.test_helpers.test_clocks.list_async() http_client_mock.assert_requested( "get", path="/v1/test_helpers/test_clocks", @@ -27882,6 +36733,26 @@ async def test_test_helpers_test_clocks_get_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_test_clocks_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/test_helpers/test_clocks/clock_xyz", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.test_clocks.retrieve("clock_xyz") + http_client_mock.assert_requested( + "get", + path="/v1/test_helpers/test_clocks/clock_xyz", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_test_clocks_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -27904,7 +36775,7 @@ def test_test_helpers_test_clocks_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.test_clocks.retrieve("clock_xyz") + client.v1.test_helpers.test_clocks.retrieve("clock_xyz") http_client_mock.assert_requested( "get", path="/v1/test_helpers/test_clocks/clock_xyz", @@ -27936,7 +36807,7 @@ async def test_test_helpers_test_clocks_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.test_clocks.retrieve_async("clock_xyz") + await client.v1.test_helpers.test_clocks.retrieve_async("clock_xyz") http_client_mock.assert_requested( "get", path="/v1/test_helpers/test_clocks/clock_xyz", @@ -27944,6 +36815,27 @@ async def test_test_helpers_test_clocks_get_2_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_test_clocks_get_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/test_helpers/test_clocks", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.test_clocks.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/test_helpers/test_clocks", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_test_helpers_test_clocks_get_3( self, http_client_mock: HTTPClientMock ) -> None: @@ -27967,7 +36859,7 @@ def test_test_helpers_test_clocks_get_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.test_clocks.list({"limit": 3}) + client.v1.test_helpers.test_clocks.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/test_helpers/test_clocks", @@ -28000,7 +36892,7 @@ async def test_test_helpers_test_clocks_get_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.test_clocks.list_async({"limit": 3}) + await client.v1.test_helpers.test_clocks.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/test_helpers/test_clocks", @@ -28008,6 +36900,26 @@ async def test_test_helpers_test_clocks_get_3_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_test_clocks_get_4_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.test_clocks.retrieve("clock_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_test_clocks_get_4( self, http_client_mock: HTTPClientMock ) -> None: @@ -28030,7 +36942,7 @@ def test_test_helpers_test_clocks_get_4_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.test_clocks.retrieve("clock_xxxxxxxxxxxxx") + client.v1.test_helpers.test_clocks.retrieve("clock_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx", @@ -28064,7 +36976,7 @@ async def test_test_helpers_test_clocks_get_4_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.test_clocks.retrieve_async( + await client.v1.test_helpers.test_clocks.retrieve_async( "clock_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -28074,6 +36986,32 @@ async def test_test_helpers_test_clocks_get_4_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_test_clocks_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/test_clocks", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.test_clocks.create( + { + "frozen_time": 123, + "name": "cogsworth", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/test_clocks", + query_string="", + api_base="https://api.stripe.com", + post_data="frozen_time=123&name=cogsworth", + ) + def test_test_helpers_test_clocks_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -28100,7 +37038,7 @@ def test_test_helpers_test_clocks_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.test_clocks.create( + client.v1.test_helpers.test_clocks.create( { "frozen_time": 123, "name": "cogsworth", @@ -28142,7 +37080,7 @@ async def test_test_helpers_test_clocks_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.test_clocks.create_async( + await client.v1.test_helpers.test_clocks.create_async( { "frozen_time": 123, "name": "cogsworth", @@ -28156,6 +37094,27 @@ async def test_test_helpers_test_clocks_post_service_async( post_data="frozen_time=123&name=cogsworth", ) + def test_test_helpers_test_clocks_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/test_clocks", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.test_clocks.create({"frozen_time": 1577836800}) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/test_clocks", + query_string="", + api_base="https://api.stripe.com", + post_data="frozen_time=1577836800", + ) + def test_test_helpers_test_clocks_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -28179,7 +37138,7 @@ def test_test_helpers_test_clocks_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.test_clocks.create({"frozen_time": 1577836800}) + client.v1.test_helpers.test_clocks.create({"frozen_time": 1577836800}) http_client_mock.assert_requested( "post", path="/v1/test_helpers/test_clocks", @@ -28215,7 +37174,7 @@ async def test_test_helpers_test_clocks_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.test_clocks.create_async( + await client.v1.test_helpers.test_clocks.create_async( { "frozen_time": 1577836800, } @@ -28228,6 +37187,30 @@ async def test_test_helpers_test_clocks_post_2_service_async( post_data="frozen_time=1577836800", ) + def test_test_helpers_treasury_inbound_transfers_fail_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/treasury/inbound_transfers/ibt_123/fail", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.treasury.inbound_transfers.fail( + "ibt_123", + {"failure_details": {"code": "account_closed"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/treasury/inbound_transfers/ibt_123/fail", + query_string="", + api_base="https://api.stripe.com", + post_data="failure_details[code]=account_closed", + ) + def test_test_helpers_treasury_inbound_transfers_fail_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -28254,7 +37237,7 @@ def test_test_helpers_treasury_inbound_transfers_fail_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.treasury.inbound_transfers.fail( + client.v1.test_helpers.treasury.inbound_transfers.fail( "ibt_123", {"failure_details": {"code": "account_closed"}}, ) @@ -28294,7 +37277,7 @@ async def test_test_helpers_treasury_inbound_transfers_fail_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.treasury.inbound_transfers.fail_async( + await client.v1.test_helpers.treasury.inbound_transfers.fail_async( "ibt_123", {"failure_details": {"code": "account_closed"}}, ) @@ -28306,6 +37289,28 @@ async def test_test_helpers_treasury_inbound_transfers_fail_post_service_async( post_data="failure_details[code]=account_closed", ) + def test_test_helpers_treasury_inbound_transfers_return_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/treasury/inbound_transfers/ibt_123/return", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.treasury.inbound_transfers.return_inbound_transfer( + "ibt_123", + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/treasury/inbound_transfers/ibt_123/return", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_treasury_inbound_transfers_return_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -28330,8 +37335,8 @@ def test_test_helpers_treasury_inbound_transfers_return_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.treasury.inbound_transfers.return_inbound_transfer( - "ibt_123", + client.v1.test_helpers.treasury.inbound_transfers.return_inbound_transfer( + "ibt_123" ) http_client_mock.assert_requested( "post", @@ -28366,7 +37371,7 @@ async def test_test_helpers_treasury_inbound_transfers_return_post_service_async http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.treasury.inbound_transfers.return_inbound_transfer_async( + await client.v1.test_helpers.treasury.inbound_transfers.return_inbound_transfer_async( "ibt_123" ) http_client_mock.assert_requested( @@ -28376,6 +37381,26 @@ async def test_test_helpers_treasury_inbound_transfers_return_post_service_async api_base="https://api.stripe.com", ) + def test_test_helpers_treasury_inbound_transfers_succeed_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/treasury/inbound_transfers/ibt_123/succeed", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.treasury.inbound_transfers.succeed("ibt_123") + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/treasury/inbound_transfers/ibt_123/succeed", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_treasury_inbound_transfers_succeed_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -28398,7 +37423,7 @@ def test_test_helpers_treasury_inbound_transfers_succeed_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.treasury.inbound_transfers.succeed("ibt_123") + client.v1.test_helpers.treasury.inbound_transfers.succeed("ibt_123") http_client_mock.assert_requested( "post", path="/v1/test_helpers/treasury/inbound_transfers/ibt_123/succeed", @@ -28432,7 +37457,7 @@ async def test_test_helpers_treasury_inbound_transfers_succeed_post_service_asyn http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.treasury.inbound_transfers.succeed_async( + await client.v1.test_helpers.treasury.inbound_transfers.succeed_async( "ibt_123", ) http_client_mock.assert_requested( @@ -28442,6 +37467,26 @@ async def test_test_helpers_treasury_inbound_transfers_succeed_post_service_asyn api_base="https://api.stripe.com", ) + def test_test_helpers_treasury_outbound_transfers_fail_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/treasury/outbound_transfers/obt_123/fail", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.treasury.outbound_transfers.fail("obt_123") + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/treasury/outbound_transfers/obt_123/fail", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_treasury_outbound_transfers_fail_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -28464,7 +37509,7 @@ def test_test_helpers_treasury_outbound_transfers_fail_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.treasury.outbound_transfers.fail("obt_123") + client.v1.test_helpers.treasury.outbound_transfers.fail("obt_123") http_client_mock.assert_requested( "post", path="/v1/test_helpers/treasury/outbound_transfers/obt_123/fail", @@ -28498,7 +37543,7 @@ async def test_test_helpers_treasury_outbound_transfers_fail_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.treasury.outbound_transfers.fail_async( + await client.v1.test_helpers.treasury.outbound_transfers.fail_async( "obt_123", ) http_client_mock.assert_requested( @@ -28508,6 +37553,26 @@ async def test_test_helpers_treasury_outbound_transfers_fail_post_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_treasury_outbound_transfers_post_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/treasury/outbound_transfers/obt_123/post", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.treasury.outbound_transfers.post("obt_123") + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/treasury/outbound_transfers/obt_123/post", + query_string="", + api_base="https://api.stripe.com", + ) + def test_test_helpers_treasury_outbound_transfers_post_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -28530,7 +37595,7 @@ def test_test_helpers_treasury_outbound_transfers_post_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.treasury.outbound_transfers.post("obt_123") + client.v1.test_helpers.treasury.outbound_transfers.post("obt_123") http_client_mock.assert_requested( "post", path="/v1/test_helpers/treasury/outbound_transfers/obt_123/post", @@ -28564,7 +37629,7 @@ async def test_test_helpers_treasury_outbound_transfers_post_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.treasury.outbound_transfers.post_async( + await client.v1.test_helpers.treasury.outbound_transfers.post_async( "obt_123", ) http_client_mock.assert_requested( @@ -28574,6 +37639,30 @@ async def test_test_helpers_treasury_outbound_transfers_post_post_service_async( api_base="https://api.stripe.com", ) + def test_test_helpers_treasury_outbound_transfers_return_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/treasury/outbound_transfers/obt_123/return", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.treasury.outbound_transfers.return_outbound_transfer( + "obt_123", + {"returned_details": {"code": "account_closed"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/treasury/outbound_transfers/obt_123/return", + query_string="", + api_base="https://api.stripe.com", + post_data="returned_details[code]=account_closed", + ) + def test_test_helpers_treasury_outbound_transfers_return_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -28600,7 +37689,7 @@ def test_test_helpers_treasury_outbound_transfers_return_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.treasury.outbound_transfers.return_outbound_transfer( + client.v1.test_helpers.treasury.outbound_transfers.return_outbound_transfer( "obt_123", {"returned_details": {"code": "account_closed"}}, ) @@ -28640,7 +37729,7 @@ async def test_test_helpers_treasury_outbound_transfers_return_post_service_asyn http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.treasury.outbound_transfers.return_outbound_transfer_async( + await client.v1.test_helpers.treasury.outbound_transfers.return_outbound_transfer_async( "obt_123", {"returned_details": {"code": "account_closed"}}, ) @@ -28652,6 +37741,34 @@ async def test_test_helpers_treasury_outbound_transfers_return_post_service_asyn post_data="returned_details[code]=account_closed", ) + def test_test_helpers_treasury_received_credits_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/treasury/received_credits", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.treasury.received_credits.create( + { + "financial_account": "fa_123", + "network": "ach", + "amount": 1234, + "currency": "usd", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/treasury/received_credits", + query_string="", + api_base="https://api.stripe.com", + post_data="financial_account=fa_123&network=ach&amount=1234¤cy=usd", + ) + def test_test_helpers_treasury_received_credits_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -28680,7 +37797,7 @@ def test_test_helpers_treasury_received_credits_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.treasury.received_credits.create( + client.v1.test_helpers.treasury.received_credits.create( { "financial_account": "fa_123", "network": "ach", @@ -28726,7 +37843,7 @@ async def test_test_helpers_treasury_received_credits_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.treasury.received_credits.create_async( + await client.v1.test_helpers.treasury.received_credits.create_async( { "financial_account": "fa_123", "network": "ach", @@ -28742,6 +37859,34 @@ async def test_test_helpers_treasury_received_credits_post_service_async( post_data="financial_account=fa_123&network=ach&amount=1234¤cy=usd", ) + def test_test_helpers_treasury_received_debits_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/test_helpers/treasury/received_debits", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.test_helpers.treasury.received_debits.create( + { + "financial_account": "fa_123", + "network": "ach", + "amount": 1234, + "currency": "usd", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/test_helpers/treasury/received_debits", + query_string="", + api_base="https://api.stripe.com", + post_data="financial_account=fa_123&network=ach&amount=1234¤cy=usd", + ) + def test_test_helpers_treasury_received_debits_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -28770,7 +37915,7 @@ def test_test_helpers_treasury_received_debits_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.treasury.received_debits.create( + client.v1.test_helpers.treasury.received_debits.create( { "financial_account": "fa_123", "network": "ach", @@ -28816,7 +37961,7 @@ async def test_test_helpers_treasury_received_debits_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.treasury.received_debits.create_async( + await client.v1.test_helpers.treasury.received_debits.create_async( { "financial_account": "fa_123", "network": "ach", @@ -28832,6 +37977,26 @@ async def test_test_helpers_treasury_received_debits_post_service_async( post_data="financial_account=fa_123&network=ach&amount=1234¤cy=usd", ) + def test_tokens_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/tokens/tok_xxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tokens.retrieve("tok_xxxx") + http_client_mock.assert_requested( + "get", + path="/v1/tokens/tok_xxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_tokens_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Token.retrieve("tok_xxxx") http_client_mock.assert_requested( @@ -28852,7 +38017,7 @@ def test_tokens_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tokens.retrieve("tok_xxxx") + client.v1.tokens.retrieve("tok_xxxx") http_client_mock.assert_requested( "get", path="/v1/tokens/tok_xxxx", @@ -28884,7 +38049,7 @@ async def test_tokens_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tokens.retrieve_async("tok_xxxx") + await client.v1.tokens.retrieve_async("tok_xxxx") http_client_mock.assert_requested( "get", path="/v1/tokens/tok_xxxx", @@ -28892,6 +38057,36 @@ async def test_tokens_get_service_async( api_base="https://api.stripe.com", ) + def test_tokens_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tokens", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tokens.create( + { + "card": { + "number": "4242424242424242", + "exp_month": "5", + "exp_year": "2023", + "cvc": "314", + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/tokens", + query_string="", + api_base="https://api.stripe.com", + post_data="card[number]=4242424242424242&card[exp_month]=5&card[exp_year]=2023&card[cvc]=314", + ) + def test_tokens_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Token.create( card={ @@ -28920,7 +38115,7 @@ def test_tokens_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tokens.create( + client.v1.tokens.create( { "card": { "number": "4242424242424242", @@ -28970,7 +38165,7 @@ async def test_tokens_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tokens.create_async( + await client.v1.tokens.create_async( { "card": { "number": "4242424242424242", @@ -28988,6 +38183,38 @@ async def test_tokens_post_service_async( post_data="card[number]=4242424242424242&card[exp_month]=5&card[exp_year]=2023&card[cvc]=314", ) + def test_tokens_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tokens", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tokens.create( + { + "bank_account": { + "country": "US", + "currency": "usd", + "account_holder_name": "Jenny Rosen", + "account_holder_type": "individual", + "routing_number": "110000000", + "account_number": "000123456789", + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/tokens", + query_string="", + api_base="https://api.stripe.com", + post_data="bank_account[country]=US&bank_account[currency]=usd&bank_account[account_holder_name]=Jenny%20Rosen&bank_account[account_holder_type]=individual&bank_account[routing_number]=110000000&bank_account[account_number]=000123456789", + ) + def test_tokens_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Token.create( bank_account={ @@ -29018,7 +38245,7 @@ def test_tokens_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tokens.create( + client.v1.tokens.create( { "bank_account": { "country": "US", @@ -29072,7 +38299,7 @@ async def test_tokens_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tokens.create_async( + await client.v1.tokens.create_async( { "bank_account": { "country": "US", @@ -29092,6 +38319,27 @@ async def test_tokens_post_2_service_async( post_data="bank_account[country]=US&bank_account[currency]=usd&bank_account[account_holder_name]=Jenny%20Rosen&bank_account[account_holder_type]=individual&bank_account[routing_number]=110000000&bank_account[account_number]=000123456789", ) + def test_tokens_post_3_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tokens", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tokens.create({"pii": {"id_number": "000000000"}}) + http_client_mock.assert_requested( + "post", + path="/v1/tokens", + query_string="", + api_base="https://api.stripe.com", + post_data="pii[id_number]=000000000", + ) + def test_tokens_post_3(self, http_client_mock: HTTPClientMock) -> None: stripe.Token.create(pii={"id_number": "000000000"}) http_client_mock.assert_requested( @@ -29113,7 +38361,7 @@ def test_tokens_post_3_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tokens.create({"pii": {"id_number": "000000000"}}) + client.v1.tokens.create({"pii": {"id_number": "000000000"}}) http_client_mock.assert_requested( "post", path="/v1/tokens", @@ -29147,7 +38395,9 @@ async def test_tokens_post_3_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tokens.create_async({"pii": {"id_number": "000000000"}}) + await client.v1.tokens.create_async( + {"pii": {"id_number": "000000000"}} + ) http_client_mock.assert_requested( "post", path="/v1/tokens", @@ -29156,6 +38406,34 @@ async def test_tokens_post_3_service_async( post_data="pii[id_number]=000000000", ) + def test_tokens_post_4_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tokens", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tokens.create( + { + "account": { + "individual": {"first_name": "Jane", "last_name": "Doe"}, + "tos_shown_and_accepted": True, + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/tokens", + query_string="", + api_base="https://api.stripe.com", + post_data="account[individual][first_name]=Jane&account[individual][last_name]=Doe&account[tos_shown_and_accepted]=true", + ) + def test_tokens_post_4(self, http_client_mock: HTTPClientMock) -> None: stripe.Token.create( account={ @@ -29182,7 +38460,7 @@ def test_tokens_post_4_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tokens.create( + client.v1.tokens.create( { "account": { "individual": {"first_name": "Jane", "last_name": "Doe"}, @@ -29228,7 +38506,7 @@ async def test_tokens_post_4_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tokens.create_async( + await client.v1.tokens.create_async( { "account": { "individual": {"first_name": "Jane", "last_name": "Doe"}, @@ -29244,6 +38522,35 @@ async def test_tokens_post_4_service_async( post_data="account[individual][first_name]=Jane&account[individual][last_name]=Doe&account[tos_shown_and_accepted]=true", ) + def test_tokens_post_5_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tokens", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tokens.create( + { + "person": { + "first_name": "Jane", + "last_name": "Doe", + "relationship": {"owner": True}, + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/tokens", + query_string="", + api_base="https://api.stripe.com", + post_data="person[first_name]=Jane&person[last_name]=Doe&person[relationship][owner]=true", + ) + def test_tokens_post_5(self, http_client_mock: HTTPClientMock) -> None: stripe.Token.create( person={ @@ -29271,7 +38578,7 @@ def test_tokens_post_5_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tokens.create( + client.v1.tokens.create( { "person": { "first_name": "Jane", @@ -29319,7 +38626,7 @@ async def test_tokens_post_5_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tokens.create_async( + await client.v1.tokens.create_async( { "person": { "first_name": "Jane", @@ -29336,6 +38643,27 @@ async def test_tokens_post_5_service_async( post_data="person[first_name]=Jane&person[last_name]=Doe&person[relationship][owner]=true", ) + def test_tokens_post_6_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/tokens", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tokens.create({"cvc_update": {"cvc": "123"}}) + http_client_mock.assert_requested( + "post", + path="/v1/tokens", + query_string="", + api_base="https://api.stripe.com", + post_data="cvc_update[cvc]=123", + ) + def test_tokens_post_6(self, http_client_mock: HTTPClientMock) -> None: stripe.Token.create(cvc_update={"cvc": "123"}) http_client_mock.assert_requested( @@ -29357,7 +38685,7 @@ def test_tokens_post_6_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tokens.create({"cvc_update": {"cvc": "123"}}) + client.v1.tokens.create({"cvc_update": {"cvc": "123"}}) http_client_mock.assert_requested( "post", path="/v1/tokens", @@ -29391,7 +38719,7 @@ async def test_tokens_post_6_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tokens.create_async({"cvc_update": {"cvc": "123"}}) + await client.v1.tokens.create_async({"cvc_update": {"cvc": "123"}}) http_client_mock.assert_requested( "post", path="/v1/tokens", @@ -29400,6 +38728,26 @@ async def test_tokens_post_6_service_async( post_data="cvc_update[cvc]=123", ) + def test_topups_cancel_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/topups/tu_xxxxxxxxxxxxx/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.topups.cancel("tu_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/topups/tu_xxxxxxxxxxxxx/cancel", + query_string="", + api_base="https://api.stripe.com", + ) + def test_topups_cancel_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -29422,7 +38770,7 @@ def test_topups_cancel_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.topups.cancel("tu_xxxxxxxxxxxxx") + client.v1.topups.cancel("tu_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/topups/tu_xxxxxxxxxxxxx/cancel", @@ -29454,7 +38802,7 @@ async def test_topups_cancel_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.topups.cancel_async("tu_xxxxxxxxxxxxx") + await client.v1.topups.cancel_async("tu_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/topups/tu_xxxxxxxxxxxxx/cancel", @@ -29462,6 +38810,27 @@ async def test_topups_cancel_post_service_async( api_base="https://api.stripe.com", ) + def test_topups_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/topups", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.topups.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/topups", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_topups_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Topup.list(limit=3) http_client_mock.assert_requested( @@ -29483,7 +38852,7 @@ def test_topups_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.topups.list({"limit": 3}) + client.v1.topups.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/topups", @@ -29516,7 +38885,7 @@ async def test_topups_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.topups.list_async({"limit": 3}) + await client.v1.topups.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/topups", @@ -29524,6 +38893,26 @@ async def test_topups_get_service_async( api_base="https://api.stripe.com", ) + def test_topups_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/topups/tu_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.topups.retrieve("tu_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/topups/tu_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_topups_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Topup.retrieve("tu_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -29544,7 +38933,7 @@ def test_topups_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.topups.retrieve("tu_xxxxxxxxxxxxx") + client.v1.topups.retrieve("tu_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/topups/tu_xxxxxxxxxxxxx", @@ -29576,7 +38965,7 @@ async def test_topups_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.topups.retrieve_async("tu_xxxxxxxxxxxxx") + await client.v1.topups.retrieve_async("tu_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/topups/tu_xxxxxxxxxxxxx", @@ -29584,6 +38973,34 @@ async def test_topups_get_2_service_async( api_base="https://api.stripe.com", ) + def test_topups_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/topups", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.topups.create( + { + "amount": 2000, + "currency": "usd", + "description": "Top-up for Jenny Rosen", + "statement_descriptor": "Top-up", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/topups", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=2000¤cy=usd&description=Top-up%20for%20Jenny%20Rosen&statement_descriptor=Top-up", + ) + def test_topups_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Topup.create( amount=2000, @@ -29610,7 +39027,7 @@ def test_topups_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.topups.create( + client.v1.topups.create( { "amount": 2000, "currency": "usd", @@ -29656,7 +39073,7 @@ async def test_topups_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.topups.create_async( + await client.v1.topups.create_async( { "amount": 2000, "currency": "usd", @@ -29672,6 +39089,30 @@ async def test_topups_post_service_async( post_data="amount=2000¤cy=usd&description=Top-up%20for%20Jenny%20Rosen&statement_descriptor=Top-up", ) + def test_topups_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/topups/tu_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.topups.update( + "tu_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/topups/tu_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_topups_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Topup.modify( "tu_xxxxxxxxxxxxx", @@ -29696,7 +39137,7 @@ def test_topups_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.topups.update( + client.v1.topups.update( "tu_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -29736,7 +39177,7 @@ async def test_topups_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.topups.update_async( + await client.v1.topups.update_async( "tu_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -29748,6 +39189,27 @@ async def test_topups_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_transfers_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/transfers", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.transfers.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/transfers", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_transfers_get(self, http_client_mock: HTTPClientMock) -> None: stripe.Transfer.list(limit=3) http_client_mock.assert_requested( @@ -29769,7 +39231,7 @@ def test_transfers_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.transfers.list({"limit": 3}) + client.v1.transfers.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/transfers", @@ -29802,7 +39264,7 @@ async def test_transfers_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.transfers.list_async({"limit": 3}) + await client.v1.transfers.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/transfers", @@ -29810,6 +39272,26 @@ async def test_transfers_get_service_async( api_base="https://api.stripe.com", ) + def test_transfers_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/transfers/tr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.transfers.retrieve("tr_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/transfers/tr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_transfers_get_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Transfer.retrieve("tr_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -29830,7 +39312,7 @@ def test_transfers_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.transfers.retrieve("tr_xxxxxxxxxxxxx") + client.v1.transfers.retrieve("tr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/transfers/tr_xxxxxxxxxxxxx", @@ -29862,7 +39344,7 @@ async def test_transfers_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.transfers.retrieve_async("tr_xxxxxxxxxxxxx") + await client.v1.transfers.retrieve_async("tr_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/transfers/tr_xxxxxxxxxxxxx", @@ -29870,6 +39352,34 @@ async def test_transfers_get_2_service_async( api_base="https://api.stripe.com", ) + def test_transfers_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/transfers", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.transfers.create( + { + "amount": 400, + "currency": "usd", + "destination": "acct_xxxxxxxxxxxxx", + "transfer_group": "ORDER_95", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/transfers", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=400¤cy=usd&destination=acct_xxxxxxxxxxxxx&transfer_group=ORDER_95", + ) + def test_transfers_post(self, http_client_mock: HTTPClientMock) -> None: stripe.Transfer.create( amount=400, @@ -29896,7 +39406,7 @@ def test_transfers_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.transfers.create( + client.v1.transfers.create( { "amount": 400, "currency": "usd", @@ -29942,7 +39452,7 @@ async def test_transfers_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.transfers.create_async( + await client.v1.transfers.create_async( { "amount": 400, "currency": "usd", @@ -29958,6 +39468,30 @@ async def test_transfers_post_service_async( post_data="amount=400¤cy=usd&destination=acct_xxxxxxxxxxxxx&transfer_group=ORDER_95", ) + def test_transfers_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/transfers/tr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.transfers.update( + "tr_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/transfers/tr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_transfers_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Transfer.modify( "tr_xxxxxxxxxxxxx", @@ -29982,7 +39516,7 @@ def test_transfers_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.transfers.update( + client.v1.transfers.update( "tr_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -30022,7 +39556,7 @@ async def test_transfers_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.transfers.update_async( + await client.v1.transfers.update_async( "tr_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -30034,6 +39568,30 @@ async def test_transfers_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_transfers_reversals_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/transfers/tr_xxxxxxxxxxxxx/reversals", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.transfers.reversals.list( + "tr_xxxxxxxxxxxxx", + {"limit": 3}, + ) + http_client_mock.assert_requested( + "get", + path="/v1/transfers/tr_xxxxxxxxxxxxx/reversals", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_transfers_reversals_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -30060,7 +39618,7 @@ def test_transfers_reversals_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.transfers.reversals.list( + client.v1.transfers.reversals.list( "tr_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -30099,7 +39657,7 @@ async def test_transfers_reversals_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.transfers.reversals.list_async( + await client.v1.transfers.reversals.list_async( "tr_xxxxxxxxxxxxx", {"limit": 3}, ) @@ -30110,6 +39668,29 @@ async def test_transfers_reversals_get_service_async( api_base="https://api.stripe.com", ) + def test_transfers_reversals_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.transfers.reversals.retrieve( + "tr_xxxxxxxxxxxxx", + "trr_xxxxxxxxxxxxx", + ) + http_client_mock.assert_requested( + "get", + path="/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_transfers_reversals_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -30135,7 +39716,7 @@ def test_transfers_reversals_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.transfers.reversals.retrieve( + client.v1.transfers.reversals.retrieve( "tr_xxxxxxxxxxxxx", "trr_xxxxxxxxxxxxx", ) @@ -30173,7 +39754,7 @@ async def test_transfers_reversals_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.transfers.reversals.retrieve_async( + await client.v1.transfers.reversals.retrieve_async( "tr_xxxxxxxxxxxxx", "trr_xxxxxxxxxxxxx", ) @@ -30184,6 +39765,30 @@ async def test_transfers_reversals_get_2_service_async( api_base="https://api.stripe.com", ) + def test_transfers_reversals_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/transfers/tr_xxxxxxxxxxxxx/reversals", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.transfers.reversals.create( + "tr_xxxxxxxxxxxxx", + {"amount": 100}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/transfers/tr_xxxxxxxxxxxxx/reversals", + query_string="", + api_base="https://api.stripe.com", + post_data="amount=100", + ) + def test_transfers_reversals_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -30210,7 +39815,7 @@ def test_transfers_reversals_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.transfers.reversals.create( + client.v1.transfers.reversals.create( "tr_xxxxxxxxxxxxx", {"amount": 100}, ) @@ -30250,7 +39855,7 @@ async def test_transfers_reversals_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.transfers.reversals.create_async( + await client.v1.transfers.reversals.create_async( "tr_xxxxxxxxxxxxx", {"amount": 100}, ) @@ -30262,6 +39867,31 @@ async def test_transfers_reversals_post_service_async( post_data="amount=100", ) + def test_transfers_reversals_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.transfers.reversals.update( + "tr_xxxxxxxxxxxxx", + "trr_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_transfers_reversals_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -30289,7 +39919,7 @@ def test_transfers_reversals_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.transfers.reversals.update( + client.v1.transfers.reversals.update( "tr_xxxxxxxxxxxxx", "trr_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -30331,7 +39961,7 @@ async def test_transfers_reversals_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.transfers.reversals.update_async( + await client.v1.transfers.reversals.update_async( "tr_xxxxxxxxxxxxx", "trr_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, @@ -30344,6 +39974,32 @@ async def test_transfers_reversals_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_treasury_credit_reversals_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/credit_reversals", + "financial_account=fa_xxxxxxxxxxxxx&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.credit_reversals.list( + { + "financial_account": "fa_xxxxxxxxxxxxx", + "limit": 3, + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/treasury/credit_reversals", + query_string="financial_account=fa_xxxxxxxxxxxxx&limit=3", + api_base="https://api.stripe.com", + ) + def test_treasury_credit_reversals_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -30370,7 +40026,7 @@ def test_treasury_credit_reversals_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.credit_reversals.list( + client.v1.treasury.credit_reversals.list( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -30411,7 +40067,7 @@ async def test_treasury_credit_reversals_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.credit_reversals.list_async( + await client.v1.treasury.credit_reversals.list_async( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -30424,6 +40080,26 @@ async def test_treasury_credit_reversals_get_service_async( api_base="https://api.stripe.com", ) + def test_treasury_credit_reversals_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/credit_reversals/credrev_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.credit_reversals.retrieve("credrev_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/treasury/credit_reversals/credrev_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_credit_reversals_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -30446,7 +40122,7 @@ def test_treasury_credit_reversals_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.credit_reversals.retrieve("credrev_xxxxxxxxxxxxx") + client.v1.treasury.credit_reversals.retrieve("credrev_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/treasury/credit_reversals/credrev_xxxxxxxxxxxxx", @@ -30480,7 +40156,7 @@ async def test_treasury_credit_reversals_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.credit_reversals.retrieve_async( + await client.v1.treasury.credit_reversals.retrieve_async( "credrev_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -30490,6 +40166,31 @@ async def test_treasury_credit_reversals_get_2_service_async( api_base="https://api.stripe.com", ) + def test_treasury_credit_reversals_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/treasury/credit_reversals", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.credit_reversals.create( + { + "received_credit": "rc_xxxxxxxxxxxxx", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/treasury/credit_reversals", + query_string="", + api_base="https://api.stripe.com", + post_data="received_credit=rc_xxxxxxxxxxxxx", + ) + def test_treasury_credit_reversals_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -30515,7 +40216,7 @@ def test_treasury_credit_reversals_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.credit_reversals.create( + client.v1.treasury.credit_reversals.create( { "received_credit": "rc_xxxxxxxxxxxxx", } @@ -30555,7 +40256,7 @@ async def test_treasury_credit_reversals_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.credit_reversals.create_async( + await client.v1.treasury.credit_reversals.create_async( { "received_credit": "rc_xxxxxxxxxxxxx", } @@ -30568,6 +40269,32 @@ async def test_treasury_credit_reversals_post_service_async( post_data="received_credit=rc_xxxxxxxxxxxxx", ) + def test_treasury_debit_reversals_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/debit_reversals", + "financial_account=fa_xxxxxxxxxxxxx&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.debit_reversals.list( + { + "financial_account": "fa_xxxxxxxxxxxxx", + "limit": 3, + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/treasury/debit_reversals", + query_string="financial_account=fa_xxxxxxxxxxxxx&limit=3", + api_base="https://api.stripe.com", + ) + def test_treasury_debit_reversals_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -30594,7 +40321,7 @@ def test_treasury_debit_reversals_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.debit_reversals.list( + client.v1.treasury.debit_reversals.list( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -30635,7 +40362,7 @@ async def test_treasury_debit_reversals_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.debit_reversals.list_async( + await client.v1.treasury.debit_reversals.list_async( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -30648,6 +40375,26 @@ async def test_treasury_debit_reversals_get_service_async( api_base="https://api.stripe.com", ) + def test_treasury_debit_reversals_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/debit_reversals/debrev_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.debit_reversals.retrieve("debrev_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/treasury/debit_reversals/debrev_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_debit_reversals_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -30670,7 +40417,7 @@ def test_treasury_debit_reversals_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.debit_reversals.retrieve("debrev_xxxxxxxxxxxxx") + client.v1.treasury.debit_reversals.retrieve("debrev_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/treasury/debit_reversals/debrev_xxxxxxxxxxxxx", @@ -30704,7 +40451,7 @@ async def test_treasury_debit_reversals_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.debit_reversals.retrieve_async( + await client.v1.treasury.debit_reversals.retrieve_async( "debrev_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -30714,6 +40461,31 @@ async def test_treasury_debit_reversals_get_2_service_async( api_base="https://api.stripe.com", ) + def test_treasury_debit_reversals_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/treasury/debit_reversals", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.debit_reversals.create( + { + "received_debit": "rd_xxxxxxxxxxxxx", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/treasury/debit_reversals", + query_string="", + api_base="https://api.stripe.com", + post_data="received_debit=rd_xxxxxxxxxxxxx", + ) + def test_treasury_debit_reversals_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -30737,7 +40509,7 @@ def test_treasury_debit_reversals_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.debit_reversals.create( + client.v1.treasury.debit_reversals.create( { "received_debit": "rd_xxxxxxxxxxxxx", } @@ -30777,7 +40549,7 @@ async def test_treasury_debit_reversals_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.debit_reversals.create_async( + await client.v1.treasury.debit_reversals.create_async( { "received_debit": "rd_xxxxxxxxxxxxx", } @@ -30790,6 +40562,28 @@ async def test_treasury_debit_reversals_post_service_async( post_data="received_debit=rd_xxxxxxxxxxxxx", ) + def test_treasury_financial_accounts_features_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx/features", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.financial_accounts.features.retrieve( + "fa_xxxxxxxxxxxxx" + ) + http_client_mock.assert_requested( + "get", + path="/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx/features", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_financial_accounts_features_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -30812,8 +40606,8 @@ def test_treasury_financial_accounts_features_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.financial_accounts.features.retrieve( - "fa_xxxxxxxxxxxxx" + client.v1.treasury.financial_accounts.features.retrieve( + "fa_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( "get", @@ -30848,7 +40642,7 @@ async def test_treasury_financial_accounts_features_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.financial_accounts.features.retrieve_async( + await client.v1.treasury.financial_accounts.features.retrieve_async( "fa_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -30858,6 +40652,27 @@ async def test_treasury_financial_accounts_features_get_service_async( api_base="https://api.stripe.com", ) + def test_treasury_financial_accounts_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/financial_accounts", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.financial_accounts.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/treasury/financial_accounts", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_treasury_financial_accounts_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -30881,7 +40696,7 @@ def test_treasury_financial_accounts_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.financial_accounts.list({"limit": 3}) + client.v1.treasury.financial_accounts.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/treasury/financial_accounts", @@ -30914,7 +40729,7 @@ async def test_treasury_financial_accounts_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.financial_accounts.list_async({"limit": 3}) + await client.v1.treasury.financial_accounts.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/treasury/financial_accounts", @@ -30922,6 +40737,26 @@ async def test_treasury_financial_accounts_get_service_async( api_base="https://api.stripe.com", ) + def test_treasury_financial_accounts_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.financial_accounts.retrieve("fa_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_financial_accounts_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -30944,7 +40779,7 @@ def test_treasury_financial_accounts_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.financial_accounts.retrieve("fa_xxxxxxxxxxxxx") + client.v1.treasury.financial_accounts.retrieve("fa_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx", @@ -30978,7 +40813,7 @@ async def test_treasury_financial_accounts_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.financial_accounts.retrieve_async( + await client.v1.treasury.financial_accounts.retrieve_async( "fa_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -30988,6 +40823,32 @@ async def test_treasury_financial_accounts_get_2_service_async( api_base="https://api.stripe.com", ) + def test_treasury_financial_accounts_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/treasury/financial_accounts", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.financial_accounts.create( + { + "supported_currencies": ["usd"], + "features": {}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/treasury/financial_accounts", + query_string="", + api_base="https://api.stripe.com", + post_data="supported_currencies[0]=usd", + ) + def test_treasury_financial_accounts_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -31014,7 +40875,7 @@ def test_treasury_financial_accounts_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.financial_accounts.create( + client.v1.treasury.financial_accounts.create( { "supported_currencies": ["usd"], "features": {}, @@ -31056,7 +40917,7 @@ async def test_treasury_financial_accounts_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.financial_accounts.create_async( + await client.v1.treasury.financial_accounts.create_async( { "supported_currencies": ["usd"], "features": {}, @@ -31070,6 +40931,30 @@ async def test_treasury_financial_accounts_post_service_async( post_data="supported_currencies[0]=usd", ) + def test_treasury_financial_accounts_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.financial_accounts.update( + "fa_xxxxxxxxxxxxx", + {"metadata": {"order_id": "6735"}}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="metadata[order_id]=6735", + ) + def test_treasury_financial_accounts_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -31096,7 +40981,7 @@ def test_treasury_financial_accounts_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.financial_accounts.update( + client.v1.treasury.financial_accounts.update( "fa_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -31136,7 +41021,7 @@ async def test_treasury_financial_accounts_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.financial_accounts.update_async( + await client.v1.treasury.financial_accounts.update_async( "fa_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -31148,6 +41033,26 @@ async def test_treasury_financial_accounts_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_treasury_inbound_transfers_cancel_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.inbound_transfers.cancel("ibt_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx/cancel", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_inbound_transfers_cancel_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -31170,7 +41075,7 @@ def test_treasury_inbound_transfers_cancel_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.inbound_transfers.cancel("ibt_xxxxxxxxxxxxx") + client.v1.treasury.inbound_transfers.cancel("ibt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx/cancel", @@ -31202,7 +41107,7 @@ async def test_treasury_inbound_transfers_cancel_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.inbound_transfers.cancel_async( + await client.v1.treasury.inbound_transfers.cancel_async( "ibt_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -31212,6 +41117,32 @@ async def test_treasury_inbound_transfers_cancel_post_service_async( api_base="https://api.stripe.com", ) + def test_treasury_inbound_transfers_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/inbound_transfers", + "financial_account=fa_xxxxxxxxxxxxx&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.inbound_transfers.list( + { + "financial_account": "fa_xxxxxxxxxxxxx", + "limit": 3, + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/treasury/inbound_transfers", + query_string="financial_account=fa_xxxxxxxxxxxxx&limit=3", + api_base="https://api.stripe.com", + ) + def test_treasury_inbound_transfers_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -31238,7 +41169,7 @@ def test_treasury_inbound_transfers_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.inbound_transfers.list( + client.v1.treasury.inbound_transfers.list( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -31279,7 +41210,7 @@ async def test_treasury_inbound_transfers_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.inbound_transfers.list_async( + await client.v1.treasury.inbound_transfers.list_async( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -31292,6 +41223,26 @@ async def test_treasury_inbound_transfers_get_service_async( api_base="https://api.stripe.com", ) + def test_treasury_inbound_transfers_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.inbound_transfers.retrieve("ibt_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_inbound_transfers_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -31314,7 +41265,7 @@ def test_treasury_inbound_transfers_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.inbound_transfers.retrieve("ibt_xxxxxxxxxxxxx") + client.v1.treasury.inbound_transfers.retrieve("ibt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx", @@ -31348,7 +41299,7 @@ async def test_treasury_inbound_transfers_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.inbound_transfers.retrieve_async( + await client.v1.treasury.inbound_transfers.retrieve_async( "ibt_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -31358,6 +41309,35 @@ async def test_treasury_inbound_transfers_get_2_service_async( api_base="https://api.stripe.com", ) + def test_treasury_inbound_transfers_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/treasury/inbound_transfers", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.inbound_transfers.create( + { + "financial_account": "fa_xxxxxxxxxxxxx", + "amount": 10000, + "currency": "usd", + "origin_payment_method": "pm_xxxxxxxxxxxxx", + "description": "InboundTransfer from my bank account", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/treasury/inbound_transfers", + query_string="", + api_base="https://api.stripe.com", + post_data="financial_account=fa_xxxxxxxxxxxxx&amount=10000¤cy=usd&origin_payment_method=pm_xxxxxxxxxxxxx&description=InboundTransfer%20from%20my%20bank%20account", + ) + def test_treasury_inbound_transfers_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -31387,7 +41367,7 @@ def test_treasury_inbound_transfers_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.inbound_transfers.create( + client.v1.treasury.inbound_transfers.create( { "financial_account": "fa_xxxxxxxxxxxxx", "amount": 10000, @@ -31435,7 +41415,7 @@ async def test_treasury_inbound_transfers_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.inbound_transfers.create_async( + await client.v1.treasury.inbound_transfers.create_async( { "financial_account": "fa_xxxxxxxxxxxxx", "amount": 10000, @@ -31452,6 +41432,26 @@ async def test_treasury_inbound_transfers_post_service_async( post_data="financial_account=fa_xxxxxxxxxxxxx&amount=10000¤cy=usd&origin_payment_method=pm_xxxxxxxxxxxxx&description=InboundTransfer%20from%20my%20bank%20account", ) + def test_treasury_outbound_payments_cancel_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/treasury/outbound_payments/bot_xxxxxxxxxxxxx/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.outbound_payments.cancel("bot_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/treasury/outbound_payments/bot_xxxxxxxxxxxxx/cancel", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_outbound_payments_cancel_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -31474,7 +41474,7 @@ def test_treasury_outbound_payments_cancel_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.outbound_payments.cancel("bot_xxxxxxxxxxxxx") + client.v1.treasury.outbound_payments.cancel("bot_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/treasury/outbound_payments/bot_xxxxxxxxxxxxx/cancel", @@ -31506,7 +41506,7 @@ async def test_treasury_outbound_payments_cancel_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.outbound_payments.cancel_async( + await client.v1.treasury.outbound_payments.cancel_async( "bot_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -31516,6 +41516,32 @@ async def test_treasury_outbound_payments_cancel_post_service_async( api_base="https://api.stripe.com", ) + def test_treasury_outbound_payments_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/outbound_payments", + "financial_account=fa_xxxxxxxxxxxxx&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.outbound_payments.list( + { + "financial_account": "fa_xxxxxxxxxxxxx", + "limit": 3, + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/treasury/outbound_payments", + query_string="financial_account=fa_xxxxxxxxxxxxx&limit=3", + api_base="https://api.stripe.com", + ) + def test_treasury_outbound_payments_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -31542,7 +41568,7 @@ def test_treasury_outbound_payments_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.outbound_payments.list( + client.v1.treasury.outbound_payments.list( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -31583,7 +41609,7 @@ async def test_treasury_outbound_payments_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.outbound_payments.list_async( + await client.v1.treasury.outbound_payments.list_async( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -31596,6 +41622,26 @@ async def test_treasury_outbound_payments_get_service_async( api_base="https://api.stripe.com", ) + def test_treasury_outbound_payments_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/outbound_payments/bot_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.outbound_payments.retrieve("bot_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/treasury/outbound_payments/bot_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_outbound_payments_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -31618,7 +41664,7 @@ def test_treasury_outbound_payments_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.outbound_payments.retrieve("bot_xxxxxxxxxxxxx") + client.v1.treasury.outbound_payments.retrieve("bot_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/treasury/outbound_payments/bot_xxxxxxxxxxxxx", @@ -31652,7 +41698,7 @@ async def test_treasury_outbound_payments_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.outbound_payments.retrieve_async( + await client.v1.treasury.outbound_payments.retrieve_async( "bot_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -31662,6 +41708,36 @@ async def test_treasury_outbound_payments_get_2_service_async( api_base="https://api.stripe.com", ) + def test_treasury_outbound_payments_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/treasury/outbound_payments", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.outbound_payments.create( + { + "financial_account": "fa_xxxxxxxxxxxxx", + "amount": 10000, + "currency": "usd", + "customer": "cus_xxxxxxxxxxxxx", + "destination_payment_method": "pm_xxxxxxxxxxxxx", + "description": "OutboundPayment to a 3rd party", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/treasury/outbound_payments", + query_string="", + api_base="https://api.stripe.com", + post_data="financial_account=fa_xxxxxxxxxxxxx&amount=10000¤cy=usd&customer=cus_xxxxxxxxxxxxx&destination_payment_method=pm_xxxxxxxxxxxxx&description=OutboundPayment%20to%20a%203rd%20party", + ) + def test_treasury_outbound_payments_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -31692,7 +41768,7 @@ def test_treasury_outbound_payments_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.outbound_payments.create( + client.v1.treasury.outbound_payments.create( { "financial_account": "fa_xxxxxxxxxxxxx", "amount": 10000, @@ -31742,7 +41818,7 @@ async def test_treasury_outbound_payments_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.outbound_payments.create_async( + await client.v1.treasury.outbound_payments.create_async( { "financial_account": "fa_xxxxxxxxxxxxx", "amount": 10000, @@ -31760,6 +41836,26 @@ async def test_treasury_outbound_payments_post_service_async( post_data="financial_account=fa_xxxxxxxxxxxxx&amount=10000¤cy=usd&customer=cus_xxxxxxxxxxxxx&destination_payment_method=pm_xxxxxxxxxxxxx&description=OutboundPayment%20to%20a%203rd%20party", ) + def test_treasury_outbound_transfers_cancel_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.outbound_transfers.cancel("obt_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "post", + path="/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx/cancel", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_outbound_transfers_cancel_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -31782,7 +41878,7 @@ def test_treasury_outbound_transfers_cancel_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.outbound_transfers.cancel("obt_xxxxxxxxxxxxx") + client.v1.treasury.outbound_transfers.cancel("obt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "post", path="/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx/cancel", @@ -31816,7 +41912,7 @@ async def test_treasury_outbound_transfers_cancel_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.outbound_transfers.cancel_async( + await client.v1.treasury.outbound_transfers.cancel_async( "obt_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -31826,6 +41922,32 @@ async def test_treasury_outbound_transfers_cancel_post_service_async( api_base="https://api.stripe.com", ) + def test_treasury_outbound_transfers_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/outbound_transfers", + "financial_account=fa_xxxxxxxxxxxxx&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.outbound_transfers.list( + { + "financial_account": "fa_xxxxxxxxxxxxx", + "limit": 3, + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/treasury/outbound_transfers", + query_string="financial_account=fa_xxxxxxxxxxxxx&limit=3", + api_base="https://api.stripe.com", + ) + def test_treasury_outbound_transfers_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -31852,7 +41974,7 @@ def test_treasury_outbound_transfers_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.outbound_transfers.list( + client.v1.treasury.outbound_transfers.list( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -31893,7 +42015,7 @@ async def test_treasury_outbound_transfers_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.outbound_transfers.list_async( + await client.v1.treasury.outbound_transfers.list_async( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -31906,6 +42028,26 @@ async def test_treasury_outbound_transfers_get_service_async( api_base="https://api.stripe.com", ) + def test_treasury_outbound_transfers_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.outbound_transfers.retrieve("obt_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_outbound_transfers_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -31928,7 +42070,7 @@ def test_treasury_outbound_transfers_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.outbound_transfers.retrieve("obt_xxxxxxxxxxxxx") + client.v1.treasury.outbound_transfers.retrieve("obt_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx", @@ -31962,7 +42104,7 @@ async def test_treasury_outbound_transfers_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.outbound_transfers.retrieve_async( + await client.v1.treasury.outbound_transfers.retrieve_async( "obt_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -31972,6 +42114,35 @@ async def test_treasury_outbound_transfers_get_2_service_async( api_base="https://api.stripe.com", ) + def test_treasury_outbound_transfers_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/treasury/outbound_transfers", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.outbound_transfers.create( + { + "financial_account": "fa_xxxxxxxxxxxxx", + "destination_payment_method": "pm_xxxxxxxxxxxxx", + "amount": 500, + "currency": "usd", + "description": "OutboundTransfer to my external bank account", + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/treasury/outbound_transfers", + query_string="", + api_base="https://api.stripe.com", + post_data="financial_account=fa_xxxxxxxxxxxxx&destination_payment_method=pm_xxxxxxxxxxxxx&amount=500¤cy=usd&description=OutboundTransfer%20to%20my%20external%20bank%20account", + ) + def test_treasury_outbound_transfers_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -32001,7 +42172,7 @@ def test_treasury_outbound_transfers_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.outbound_transfers.create( + client.v1.treasury.outbound_transfers.create( { "financial_account": "fa_xxxxxxxxxxxxx", "destination_payment_method": "pm_xxxxxxxxxxxxx", @@ -32049,7 +42220,7 @@ async def test_treasury_outbound_transfers_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.outbound_transfers.create_async( + await client.v1.treasury.outbound_transfers.create_async( { "financial_account": "fa_xxxxxxxxxxxxx", "destination_payment_method": "pm_xxxxxxxxxxxxx", @@ -32066,6 +42237,32 @@ async def test_treasury_outbound_transfers_post_service_async( post_data="financial_account=fa_xxxxxxxxxxxxx&destination_payment_method=pm_xxxxxxxxxxxxx&amount=500¤cy=usd&description=OutboundTransfer%20to%20my%20external%20bank%20account", ) + def test_treasury_received_credits_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/received_credits", + "financial_account=fa_xxxxxxxxxxxxx&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.received_credits.list( + { + "financial_account": "fa_xxxxxxxxxxxxx", + "limit": 3, + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/treasury/received_credits", + query_string="financial_account=fa_xxxxxxxxxxxxx&limit=3", + api_base="https://api.stripe.com", + ) + def test_treasury_received_credits_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -32092,7 +42289,7 @@ def test_treasury_received_credits_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.received_credits.list( + client.v1.treasury.received_credits.list( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -32133,7 +42330,7 @@ async def test_treasury_received_credits_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.received_credits.list_async( + await client.v1.treasury.received_credits.list_async( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -32146,6 +42343,26 @@ async def test_treasury_received_credits_get_service_async( api_base="https://api.stripe.com", ) + def test_treasury_received_credits_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/received_credits/rc_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.received_credits.retrieve("rc_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/treasury/received_credits/rc_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_received_credits_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -32168,7 +42385,7 @@ def test_treasury_received_credits_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.received_credits.retrieve("rc_xxxxxxxxxxxxx") + client.v1.treasury.received_credits.retrieve("rc_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/treasury/received_credits/rc_xxxxxxxxxxxxx", @@ -32200,7 +42417,7 @@ async def test_treasury_received_credits_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.received_credits.retrieve_async( + await client.v1.treasury.received_credits.retrieve_async( "rc_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -32210,6 +42427,32 @@ async def test_treasury_received_credits_get_2_service_async( api_base="https://api.stripe.com", ) + def test_treasury_received_debits_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/received_debits", + "financial_account=fa_xxxxxxxxxxxxx&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.received_debits.list( + { + "financial_account": "fa_xxxxxxxxxxxxx", + "limit": 3, + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/treasury/received_debits", + query_string="financial_account=fa_xxxxxxxxxxxxx&limit=3", + api_base="https://api.stripe.com", + ) + def test_treasury_received_debits_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -32236,7 +42479,7 @@ def test_treasury_received_debits_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.received_debits.list( + client.v1.treasury.received_debits.list( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -32277,7 +42520,7 @@ async def test_treasury_received_debits_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.received_debits.list_async( + await client.v1.treasury.received_debits.list_async( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -32290,6 +42533,26 @@ async def test_treasury_received_debits_get_service_async( api_base="https://api.stripe.com", ) + def test_treasury_received_debits_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/received_debits/rd_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.received_debits.retrieve("rd_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/treasury/received_debits/rd_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_received_debits_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -32312,7 +42575,7 @@ def test_treasury_received_debits_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.received_debits.retrieve("rd_xxxxxxxxxxxxx") + client.v1.treasury.received_debits.retrieve("rd_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/treasury/received_debits/rd_xxxxxxxxxxxxx", @@ -32344,8 +42607,8 @@ async def test_treasury_received_debits_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.received_debits.retrieve_async( - "rd_xxxxxxxxxxxxx" + await client.v1.treasury.received_debits.retrieve_async( + "rd_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( "get", @@ -32354,6 +42617,32 @@ async def test_treasury_received_debits_get_2_service_async( api_base="https://api.stripe.com", ) + def test_treasury_transaction_entries_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/transaction_entries", + "financial_account=fa_xxxxxxxxxxxxx&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.transaction_entries.list( + { + "financial_account": "fa_xxxxxxxxxxxxx", + "limit": 3, + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/treasury/transaction_entries", + query_string="financial_account=fa_xxxxxxxxxxxxx&limit=3", + api_base="https://api.stripe.com", + ) + def test_treasury_transaction_entries_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -32380,7 +42669,7 @@ def test_treasury_transaction_entries_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.transaction_entries.list( + client.v1.treasury.transaction_entries.list( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -32421,7 +42710,7 @@ async def test_treasury_transaction_entries_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.transaction_entries.list_async( + await client.v1.treasury.transaction_entries.list_async( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -32434,6 +42723,26 @@ async def test_treasury_transaction_entries_get_service_async( api_base="https://api.stripe.com", ) + def test_treasury_transaction_entries_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/transaction_entries/trxne_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.transaction_entries.retrieve("trxne_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/treasury/transaction_entries/trxne_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_transaction_entries_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -32456,7 +42765,7 @@ def test_treasury_transaction_entries_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.transaction_entries.retrieve("trxne_xxxxxxxxxxxxx") + client.v1.treasury.transaction_entries.retrieve("trxne_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/treasury/transaction_entries/trxne_xxxxxxxxxxxxx", @@ -32490,7 +42799,7 @@ async def test_treasury_transaction_entries_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.transaction_entries.retrieve_async( + await client.v1.treasury.transaction_entries.retrieve_async( "trxne_xxxxxxxxxxxxx", ) http_client_mock.assert_requested( @@ -32500,6 +42809,32 @@ async def test_treasury_transaction_entries_get_2_service_async( api_base="https://api.stripe.com", ) + def test_treasury_transactions_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/transactions", + "financial_account=fa_xxxxxxxxxxxxx&limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.transactions.list( + { + "financial_account": "fa_xxxxxxxxxxxxx", + "limit": 3, + } + ) + http_client_mock.assert_requested( + "get", + path="/v1/treasury/transactions", + query_string="financial_account=fa_xxxxxxxxxxxxx&limit=3", + api_base="https://api.stripe.com", + ) + def test_treasury_transactions_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -32526,7 +42861,7 @@ def test_treasury_transactions_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.transactions.list( + client.v1.treasury.transactions.list( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -32567,7 +42902,7 @@ async def test_treasury_transactions_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.transactions.list_async( + await client.v1.treasury.transactions.list_async( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -32580,6 +42915,26 @@ async def test_treasury_transactions_get_service_async( api_base="https://api.stripe.com", ) + def test_treasury_transactions_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/treasury/transactions/trxn_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.treasury.transactions.retrieve("trxn_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/treasury/transactions/trxn_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_treasury_transactions_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -32602,7 +42957,7 @@ def test_treasury_transactions_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.treasury.transactions.retrieve("trxn_xxxxxxxxxxxxx") + client.v1.treasury.transactions.retrieve("trxn_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/treasury/transactions/trxn_xxxxxxxxxxxxx", @@ -32634,7 +42989,9 @@ async def test_treasury_transactions_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.treasury.transactions.retrieve_async("trxn_xxxxxxxxxxxxx") + await client.v1.treasury.transactions.retrieve_async( + "trxn_xxxxxxxxxxxxx", + ) http_client_mock.assert_requested( "get", path="/v1/treasury/transactions/trxn_xxxxxxxxxxxxx", @@ -32642,6 +42999,26 @@ async def test_treasury_transactions_get_2_service_async( api_base="https://api.stripe.com", ) + def test_webhook_endpoints_delete_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.webhook_endpoints.delete("we_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "delete", + path="/v1/webhook_endpoints/we_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_webhook_endpoints_delete( self, http_client_mock: HTTPClientMock ) -> None: @@ -32664,7 +43041,7 @@ def test_webhook_endpoints_delete_service( http_client=http_client_mock.get_mock_http_client(), ) - client.webhook_endpoints.delete("we_xxxxxxxxxxxxx") + client.v1.webhook_endpoints.delete("we_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/webhook_endpoints/we_xxxxxxxxxxxxx", @@ -32696,7 +43073,7 @@ async def test_webhook_endpoints_delete_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.webhook_endpoints.delete_async("we_xxxxxxxxxxxxx") + await client.v1.webhook_endpoints.delete_async("we_xxxxxxxxxxxxx") http_client_mock.assert_requested( "delete", path="/v1/webhook_endpoints/we_xxxxxxxxxxxxx", @@ -32704,6 +43081,27 @@ async def test_webhook_endpoints_delete_service_async( api_base="https://api.stripe.com", ) + def test_webhook_endpoints_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/webhook_endpoints", + "limit=3", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.webhook_endpoints.list({"limit": 3}) + http_client_mock.assert_requested( + "get", + path="/v1/webhook_endpoints", + query_string="limit=3", + api_base="https://api.stripe.com", + ) + def test_webhook_endpoints_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -32727,7 +43125,7 @@ def test_webhook_endpoints_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.webhook_endpoints.list({"limit": 3}) + client.v1.webhook_endpoints.list({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/webhook_endpoints", @@ -32760,7 +43158,7 @@ async def test_webhook_endpoints_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.webhook_endpoints.list_async({"limit": 3}) + await client.v1.webhook_endpoints.list_async({"limit": 3}) http_client_mock.assert_requested( "get", path="/v1/webhook_endpoints", @@ -32768,6 +43166,26 @@ async def test_webhook_endpoints_get_service_async( api_base="https://api.stripe.com", ) + def test_webhook_endpoints_get_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.webhook_endpoints.retrieve("we_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/webhook_endpoints/we_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + ) + def test_webhook_endpoints_get_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -32790,7 +43208,7 @@ def test_webhook_endpoints_get_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.webhook_endpoints.retrieve("we_xxxxxxxxxxxxx") + client.v1.webhook_endpoints.retrieve("we_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/webhook_endpoints/we_xxxxxxxxxxxxx", @@ -32822,7 +43240,7 @@ async def test_webhook_endpoints_get_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.webhook_endpoints.retrieve_async("we_xxxxxxxxxxxxx") + await client.v1.webhook_endpoints.retrieve_async("we_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/webhook_endpoints/we_xxxxxxxxxxxxx", @@ -32830,6 +43248,32 @@ async def test_webhook_endpoints_get_2_service_async( api_base="https://api.stripe.com", ) + def test_webhook_endpoints_post_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/webhook_endpoints", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.webhook_endpoints.create( + { + "url": "https://example.com/my/webhook/endpoint", + "enabled_events": ["charge.failed", "charge.succeeded"], + } + ) + http_client_mock.assert_requested( + "post", + path="/v1/webhook_endpoints", + query_string="", + api_base="https://api.stripe.com", + post_data="url=https%3A%2F%2Fexample.com%2Fmy%2Fwebhook%2Fendpoint&enabled_events[0]=charge.failed&enabled_events[1]=charge.succeeded", + ) + def test_webhook_endpoints_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -32856,7 +43300,7 @@ def test_webhook_endpoints_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.webhook_endpoints.create( + client.v1.webhook_endpoints.create( { "url": "https://example.com/my/webhook/endpoint", "enabled_events": ["charge.failed", "charge.succeeded"], @@ -32898,7 +43342,7 @@ async def test_webhook_endpoints_post_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.webhook_endpoints.create_async( + await client.v1.webhook_endpoints.create_async( { "url": "https://example.com/my/webhook/endpoint", "enabled_events": ["charge.failed", "charge.succeeded"], @@ -32912,6 +43356,30 @@ async def test_webhook_endpoints_post_service_async( post_data="url=https%3A%2F%2Fexample.com%2Fmy%2Fwebhook%2Fendpoint&enabled_events[0]=charge.failed&enabled_events[1]=charge.succeeded", ) + def test_webhook_endpoints_post_2_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.webhook_endpoints.update( + "we_xxxxxxxxxxxxx", + {"url": "https://example.com/new_endpoint"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/webhook_endpoints/we_xxxxxxxxxxxxx", + query_string="", + api_base="https://api.stripe.com", + post_data="url=https%3A%2F%2Fexample.com%2Fnew_endpoint", + ) + def test_webhook_endpoints_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -32938,7 +43406,7 @@ def test_webhook_endpoints_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.webhook_endpoints.update( + client.v1.webhook_endpoints.update( "we_xxxxxxxxxxxxx", {"url": "https://example.com/new_endpoint"}, ) @@ -32978,7 +43446,7 @@ async def test_webhook_endpoints_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.webhook_endpoints.update_async( + await client.v1.webhook_endpoints.update_async( "we_xxxxxxxxxxxxx", {"url": "https://example.com/new_endpoint"}, ) @@ -33058,7 +43526,7 @@ def test_v2_billing_meter_event_stream_post_service( { "event_name": "event_name", "identifier": "identifier", - "payload": {"undefined": "payload"}, + "payload": {"key": "payload"}, "timestamp": "1970-01-01T15:18:46.294Z", }, ], @@ -33069,7 +43537,7 @@ def test_v2_billing_meter_event_stream_post_service( path="/v2/billing/meter_event_stream", query_string="", api_base="https://meter-events.stripe.com", - post_data='{"events":[{"event_name":"event_name","identifier":"identifier","payload":{"undefined":"payload"},"timestamp":"1970-01-01T15:18:46.294Z"}]}', + post_data='{"events":[{"event_name":"event_name","identifier":"identifier","payload":{"key":"payload"},"timestamp":"1970-01-01T15:18:46.294Z"}]}', is_json=True, ) @@ -33088,7 +43556,7 @@ def test_v2_billing_meter_event_post_service( client.v2.billing.meter_events.create( { "event_name": "event_name", - "payload": {"undefined": "payload"}, + "payload": {"key": "payload"}, } ) http_client_mock.assert_requested( @@ -33096,7 +43564,7 @@ def test_v2_billing_meter_event_post_service( path="/v2/billing/meter_events", query_string="", api_base="https://api.stripe.com", - post_data='{"event_name":"event_name","payload":{"undefined":"payload"}}', + post_data='{"event_name":"event_name","payload":{"key":"payload"}}', is_json=True, ) @@ -33338,7 +43806,7 @@ def test_temporary_session_expired_error_service( "events": [ { "event_name": "event_name", - "payload": {"undefined": "payload"}, + "payload": {"key": "payload"}, }, ], } @@ -33350,6 +43818,6 @@ def test_temporary_session_expired_error_service( path="/v2/billing/meter_event_stream", query_string="", api_base="https://meter-events.stripe.com", - post_data='{"events":[{"event_name":"event_name","payload":{"undefined":"payload"}}]}', + post_data='{"events":[{"event_name":"event_name","payload":{"key":"payload"}}]}', is_json=True, ) From 8a97915d94fec0764107024e89de61cccf47b83c Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 25 Aug 2025 17:53:31 +0000 Subject: [PATCH 30/31] Update generated code for v1932 and 2025-08-27.preview --- stripe/_customer_service.py | 8 +- stripe/_quote_service.py | 10 +- stripe/_stripe_client.py | 88 +++---- stripe/_v1_services.py | 8 +- stripe/v2/_billing_service.py | 2 +- stripe/v2/_core_service.py | 4 +- stripe/v2/_money_management_service.py | 4 +- tests/test_generated_examples.py | 350 ++++++++++++------------- 8 files changed, 237 insertions(+), 237 deletions(-) diff --git a/stripe/_customer_service.py b/stripe/_customer_service.py index 356cbb89e..0f4d52415 100644 --- a/stripe/_customer_service.py +++ b/stripe/_customer_service.py @@ -31,19 +31,19 @@ class CustomerService(StripeService): def __init__(self, requestor): super().__init__(requestor) - self.cash_balance = CustomerCashBalanceService(self._requestor) self.balance_transactions = CustomerBalanceTransactionService( self._requestor, ) + self.cash_balance = CustomerCashBalanceService(self._requestor) self.cash_balance_transactions = CustomerCashBalanceTransactionService( self._requestor, ) - self.payment_sources = CustomerPaymentSourceService(self._requestor) - self.tax_ids = CustomerTaxIdService(self._requestor) - self.payment_methods = CustomerPaymentMethodService(self._requestor) self.funding_instructions = CustomerFundingInstructionsService( self._requestor, ) + self.payment_methods = CustomerPaymentMethodService(self._requestor) + self.payment_sources = CustomerPaymentSourceService(self._requestor) + self.tax_ids = CustomerTaxIdService(self._requestor) class CreateParams(TypedDict): address: NotRequired["Literal['']|CustomerService.CreateParamsAddress"] diff --git a/stripe/_quote_service.py b/stripe/_quote_service.py index 6aa519357..c7d861b3a 100644 --- a/stripe/_quote_service.py +++ b/stripe/_quote_service.py @@ -22,16 +22,16 @@ class QuoteService(StripeService): def __init__(self, requestor): super().__init__(requestor) - self.preview_invoices = QuotePreviewInvoiceService(self._requestor) - self.preview_subscription_schedules = ( - QuotePreviewSubscriptionScheduleService( + self.computed_upfront_line_items = ( + QuoteComputedUpfrontLineItemsService( self._requestor, ) ) self.lines = QuoteLineService(self._requestor) self.line_items = QuoteLineItemService(self._requestor) - self.computed_upfront_line_items = ( - QuoteComputedUpfrontLineItemsService( + self.preview_invoices = QuotePreviewInvoiceService(self._requestor) + self.preview_subscription_schedules = ( + QuotePreviewSubscriptionScheduleService( self._requestor, ) ) diff --git a/stripe/_stripe_client.py b/stripe/_stripe_client.py index 9d8691aec..721ef20c9 100644 --- a/stripe/_stripe_client.py +++ b/stripe/_stripe_client.py @@ -54,7 +54,6 @@ from stripe._checkout_service import CheckoutService from stripe._climate_service import ClimateService from stripe._confirmation_token_service import ConfirmationTokenService -from stripe._test_helpers_service import TestHelpersService from stripe._country_spec_service import CountrySpecService from stripe._coupon_service import CouponService from stripe._credit_note_service import CreditNoteService @@ -65,6 +64,7 @@ from stripe._ephemeral_key_service import EphemeralKeyService from stripe._event_service import EventService from stripe._exchange_rate_service import ExchangeRateService +from stripe._external_account_service import ExternalAccountService from stripe._file_service import FileService from stripe._file_link_service import FileLinkService from stripe._financial_connections_service import FinancialConnectionsService @@ -72,11 +72,11 @@ from stripe._fx_quote_service import FxQuoteService from stripe._identity_service import IdentityService from stripe._invoice_service import InvoiceService +from stripe._invoice_item_service import InvoiceItemService from stripe._invoice_payment_service import InvoicePaymentService from stripe._invoice_rendering_template_service import ( InvoiceRenderingTemplateService, ) -from stripe._invoice_item_service import InvoiceItemService from stripe._issuing_service import IssuingService from stripe._mandate_service import MandateService from stripe._margin_service import MarginService @@ -101,10 +101,10 @@ from stripe._refund_service import RefundService from stripe._reporting_service import ReportingService from stripe._review_service import ReviewService -from stripe._sigma_service import SigmaService from stripe._setup_attempt_service import SetupAttemptService from stripe._setup_intent_service import SetupIntentService from stripe._shipping_rate_service import ShippingRateService +from stripe._sigma_service import SigmaService from stripe._source_service import SourceService from stripe._subscription_service import SubscriptionService from stripe._subscription_item_service import SubscriptionItemService @@ -114,12 +114,12 @@ from stripe._tax_id_service import TaxIdService from stripe._tax_rate_service import TaxRateService from stripe._terminal_service import TerminalService +from stripe._test_helpers_service import TestHelpersService from stripe._token_service import TokenService from stripe._topup_service import TopupService from stripe._transfer_service import TransferService from stripe._treasury_service import TreasuryService from stripe._webhook_endpoint_service import WebhookEndpointService -from stripe._external_account_service import ExternalAccountService # services: The end of the section generated from our OpenAPI spec @@ -475,16 +475,6 @@ def confirmation_tokens(self) -> ConfirmationTokenService: """ return self.v1.confirmation_tokens - @property - def test_helpers(self) -> TestHelpersService: - """ - Deprecation Warning: - StripeClient.test_helpers will be deprecated in the next major release. - All functionality under it has been copied over to StripeClient.v1.test_helpers. - See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. - """ - return self.v1.test_helpers - @property def country_specs(self) -> CountrySpecService: """ @@ -585,6 +575,16 @@ def exchange_rates(self) -> ExchangeRateService: """ return self.v1.exchange_rates + @property + def external_accounts(self) -> ExternalAccountService: + """ + Deprecation Warning: + StripeClient.external_accounts will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.external_accounts. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.external_accounts + @property def files(self) -> FileService: """ @@ -655,6 +655,16 @@ def invoices(self) -> InvoiceService: """ return self.v1.invoices + @property + def invoice_items(self) -> InvoiceItemService: + """ + Deprecation Warning: + StripeClient.invoice_items will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.invoice_items. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.invoice_items + @property def invoice_payments(self) -> InvoicePaymentService: """ @@ -675,16 +685,6 @@ def invoice_rendering_templates(self) -> InvoiceRenderingTemplateService: """ return self.v1.invoice_rendering_templates - @property - def invoice_items(self) -> InvoiceItemService: - """ - Deprecation Warning: - StripeClient.invoice_items will be deprecated in the next major release. - All functionality under it has been copied over to StripeClient.v1.invoice_items. - See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. - """ - return self.v1.invoice_items - @property def issuing(self) -> IssuingService: """ @@ -907,16 +907,6 @@ def reviews(self) -> ReviewService: """ return self.v1.reviews - @property - def sigma(self) -> SigmaService: - """ - Deprecation Warning: - StripeClient.sigma will be deprecated in the next major release. - All functionality under it has been copied over to StripeClient.v1.sigma. - See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. - """ - return self.v1.sigma - @property def setup_attempts(self) -> SetupAttemptService: """ @@ -947,6 +937,16 @@ def shipping_rates(self) -> ShippingRateService: """ return self.v1.shipping_rates + @property + def sigma(self) -> SigmaService: + """ + Deprecation Warning: + StripeClient.sigma will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.sigma. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.sigma + @property def sources(self) -> SourceService: """ @@ -1037,6 +1037,16 @@ def terminal(self) -> TerminalService: """ return self.v1.terminal + @property + def test_helpers(self) -> TestHelpersService: + """ + Deprecation Warning: + StripeClient.test_helpers will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.test_helpers. + See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. + """ + return self.v1.test_helpers + @property def tokens(self) -> TokenService: """ @@ -1087,14 +1097,4 @@ def webhook_endpoints(self) -> WebhookEndpointService: """ return self.v1.webhook_endpoints - @property - def external_accounts(self) -> ExternalAccountService: - """ - Deprecation Warning: - StripeClient.external_accounts will be deprecated in the next major release. - All functionality under it has been copied over to StripeClient.v1.external_accounts. - See [migration guide](https://github.com/stripe/stripe-python/wiki/v1-namespace-in-StripeClient) for more on this and tips on migrating to the new v1 namespace. - """ - return self.v1.external_accounts - # deprecated v1 services: The end of the section generated from our OpenAPI spec diff --git a/stripe/_v1_services.py b/stripe/_v1_services.py index 3d987f6d7..f517ddfee 100644 --- a/stripe/_v1_services.py +++ b/stripe/_v1_services.py @@ -106,7 +106,6 @@ def __init__(self, requestor): self.checkout = CheckoutService(self._requestor) self.climate = ClimateService(self._requestor) self.confirmation_tokens = ConfirmationTokenService(self._requestor) - self.test_helpers = TestHelpersService(self._requestor) self.country_specs = CountrySpecService(self._requestor) self.coupons = CouponService(self._requestor) self.credit_notes = CreditNoteService(self._requestor) @@ -117,6 +116,7 @@ def __init__(self, requestor): self.ephemeral_keys = EphemeralKeyService(self._requestor) self.events = EventService(self._requestor) self.exchange_rates = ExchangeRateService(self._requestor) + self.external_accounts = ExternalAccountService(self._requestor) self.files = FileService(self._requestor) self.file_links = FileLinkService(self._requestor) self.financial_connections = FinancialConnectionsService( @@ -126,11 +126,11 @@ def __init__(self, requestor): self.fx_quotes = FxQuoteService(self._requestor) self.identity = IdentityService(self._requestor) self.invoices = InvoiceService(self._requestor) + self.invoice_items = InvoiceItemService(self._requestor) self.invoice_payments = InvoicePaymentService(self._requestor) self.invoice_rendering_templates = InvoiceRenderingTemplateService( self._requestor, ) - self.invoice_items = InvoiceItemService(self._requestor) self.issuing = IssuingService(self._requestor) self.mandates = MandateService(self._requestor) self.margins = MarginService(self._requestor) @@ -159,10 +159,10 @@ def __init__(self, requestor): self.refunds = RefundService(self._requestor) self.reporting = ReportingService(self._requestor) self.reviews = ReviewService(self._requestor) - self.sigma = SigmaService(self._requestor) self.setup_attempts = SetupAttemptService(self._requestor) self.setup_intents = SetupIntentService(self._requestor) self.shipping_rates = ShippingRateService(self._requestor) + self.sigma = SigmaService(self._requestor) self.sources = SourceService(self._requestor) self.subscriptions = SubscriptionService(self._requestor) self.subscription_items = SubscriptionItemService(self._requestor) @@ -174,9 +174,9 @@ def __init__(self, requestor): self.tax_ids = TaxIdService(self._requestor) self.tax_rates = TaxRateService(self._requestor) self.terminal = TerminalService(self._requestor) + self.test_helpers = TestHelpersService(self._requestor) self.tokens = TokenService(self._requestor) self.topups = TopupService(self._requestor) self.transfers = TransferService(self._requestor) self.treasury = TreasuryService(self._requestor) self.webhook_endpoints = WebhookEndpointService(self._requestor) - self.external_accounts = ExternalAccountService(self._requestor) diff --git a/stripe/v2/_billing_service.py b/stripe/v2/_billing_service.py index 3ba51acf7..19c202f90 100644 --- a/stripe/v2/_billing_service.py +++ b/stripe/v2/_billing_service.py @@ -16,9 +16,9 @@ class BillingService(StripeService): def __init__(self, requestor): super().__init__(requestor) + self.meter_events = MeterEventService(self._requestor) self.meter_event_adjustments = MeterEventAdjustmentService( self._requestor, ) self.meter_event_session = MeterEventSessionService(self._requestor) self.meter_event_stream = MeterEventStreamService(self._requestor) - self.meter_events = MeterEventService(self._requestor) diff --git a/stripe/v2/_core_service.py b/stripe/v2/_core_service.py index ea877a8a7..90095aaf8 100644 --- a/stripe/v2/_core_service.py +++ b/stripe/v2/_core_service.py @@ -11,8 +11,8 @@ class CoreService(StripeService): def __init__(self, requestor): super().__init__(requestor) - self.account_links = AccountLinkService(self._requestor) self.accounts = AccountService(self._requestor) - self.event_destinations = EventDestinationService(self._requestor) + self.account_links = AccountLinkService(self._requestor) self.events = EventService(self._requestor) + self.event_destinations = EventDestinationService(self._requestor) self.vault = VaultService(self._requestor) diff --git a/stripe/v2/_money_management_service.py b/stripe/v2/_money_management_service.py index 645a23015..114364b8d 100644 --- a/stripe/v2/_money_management_service.py +++ b/stripe/v2/_money_management_service.py @@ -48,10 +48,10 @@ def __init__(self, requestor): self.financial_accounts = FinancialAccountService(self._requestor) self.financial_addresses = FinancialAddressService(self._requestor) self.inbound_transfers = InboundTransferService(self._requestor) + self.outbound_payments = OutboundPaymentService(self._requestor) self.outbound_payment_quotes = OutboundPaymentQuoteService( self._requestor, ) - self.outbound_payments = OutboundPaymentService(self._requestor) self.outbound_setup_intents = OutboundSetupIntentService( self._requestor, ) @@ -64,5 +64,5 @@ def __init__(self, requestor): ) self.received_credits = ReceivedCreditService(self._requestor) self.received_debits = ReceivedDebitService(self._requestor) - self.transaction_entries = TransactionEntryService(self._requestor) self.transactions = TransactionService(self._requestor) + self.transaction_entries = TransactionEntryService(self._requestor) diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index 91d0845ed..4084254f7 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -43635,6 +43635,33 @@ async def test_webhook_endpoints_post_2_service_async( post_data="url=https%3A%2F%2Fexample.com%2Fnew_endpoint", ) + def test_v2_billing_meter_event_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/billing/meter_events", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.meter_events.create( + { + "event_name": "event_name", + "payload": {"key": "payload"}, + } + ) + http_client_mock.assert_requested( + "post", + path="/v2/billing/meter_events", + query_string="", + api_base="https://api.stripe.com", + post_data='{"event_name":"event_name","payload":{"key":"payload"}}', + is_json=True, + ) + def test_v2_billing_meter_event_adjustment_post_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -43718,80 +43745,6 @@ def test_v2_billing_meter_event_stream_post_service( is_json=True, ) - def test_v2_billing_meter_event_post_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "post", - "/v2/billing/meter_events", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.billing.meter_events.create( - { - "event_name": "event_name", - "payload": {"key": "payload"}, - } - ) - http_client_mock.assert_requested( - "post", - path="/v2/billing/meter_events", - query_string="", - api_base="https://api.stripe.com", - post_data='{"event_name":"event_name","payload":{"key":"payload"}}', - is_json=True, - ) - - def test_v2_core_account_link_post_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "post", - "/v2/core/account_links", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.core.account_links.create( - { - "account": "account", - "use_case": { - "type": "account_onboarding", - "account_onboarding": { - "collection_options": { - "fields": "eventually_due", - "future_requirements": "include", - }, - "configurations": ["storer"], - "refresh_url": "refresh_url", - "return_url": "return_url", - }, - "account_update": { - "collection_options": { - "fields": "eventually_due", - "future_requirements": "include", - }, - "configurations": ["storer"], - "refresh_url": "refresh_url", - "return_url": "return_url", - }, - }, - } - ) - http_client_mock.assert_requested( - "post", - path="/v2/core/account_links", - query_string="", - api_base="https://api.stripe.com", - post_data='{"account":"account","use_case":{"type":"account_onboarding","account_onboarding":{"collection_options":{"fields":"eventually_due","future_requirements":"include"},"configurations":["storer"],"refresh_url":"refresh_url","return_url":"return_url"},"account_update":{"collection_options":{"fields":"eventually_due","future_requirements":"include"},"configurations":["storer"],"refresh_url":"refresh_url","return_url":"return_url"}}}', - is_json=True, - ) - def test_v2_core_account_get_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -44011,6 +43964,94 @@ def test_v2_core_accounts_person_post_2_service( is_json=True, ) + def test_v2_core_account_link_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/core/account_links", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.account_links.create( + { + "account": "account", + "use_case": { + "type": "account_onboarding", + "account_onboarding": { + "collection_options": { + "fields": "eventually_due", + "future_requirements": "include", + }, + "configurations": ["storer"], + "refresh_url": "refresh_url", + "return_url": "return_url", + }, + "account_update": { + "collection_options": { + "fields": "eventually_due", + "future_requirements": "include", + }, + "configurations": ["storer"], + "refresh_url": "refresh_url", + "return_url": "return_url", + }, + }, + } + ) + http_client_mock.assert_requested( + "post", + path="/v2/core/account_links", + query_string="", + api_base="https://api.stripe.com", + post_data='{"account":"account","use_case":{"type":"account_onboarding","account_onboarding":{"collection_options":{"fields":"eventually_due","future_requirements":"include"},"configurations":["storer"],"refresh_url":"refresh_url","return_url":"return_url"},"account_update":{"collection_options":{"fields":"eventually_due","future_requirements":"include"},"configurations":["storer"],"refresh_url":"refresh_url","return_url":"return_url"}}}', + is_json=True, + ) + + def test_v2_core_event_get_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/core/events", + "object_id=object_id", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.events.list({"object_id": "object_id"}) + http_client_mock.assert_requested( + "get", + path="/v2/core/events", + query_string="object_id=object_id", + api_base="https://api.stripe.com", + ) + + def test_v2_core_event_get_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/core/events/id_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.events.retrieve("id_123") + http_client_mock.assert_requested( + "get", + path="/v2/core/events/id_123", + query_string="", + api_base="https://api.stripe.com", + ) + def test_v2_core_event_destination_get_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -44188,47 +44229,6 @@ def test_v2_core_event_destination_post_5_service( is_json=True, ) - def test_v2_core_event_get_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "get", - "/v2/core/events", - "object_id=object_id", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.core.events.list({"object_id": "object_id"}) - http_client_mock.assert_requested( - "get", - path="/v2/core/events", - query_string="object_id=object_id", - api_base="https://api.stripe.com", - ) - - def test_v2_core_event_get_2_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "get", - "/v2/core/events/id_123", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.core.events.retrieve("id_123") - http_client_mock.assert_requested( - "get", - path="/v2/core/events/id_123", - query_string="", - api_base="https://api.stripe.com", - ) - def test_v2_core_vault_gb_bank_account_post_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -44705,19 +44705,39 @@ def test_v2_money_management_inbound_transfer_get_2_service( api_base="https://api.stripe.com", ) - def test_v2_money_management_outbound_payment_quote_post_service( + def test_v2_money_management_outbound_payment_get_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/money_management/outbound_payments", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.money_management.outbound_payments.list() + http_client_mock.assert_requested( + "get", + path="/v2/money_management/outbound_payments", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_v2_money_management_outbound_payment_post_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "post", - "/v2/money_management/outbound_payment_quotes", + "/v2/money_management/outbound_payments", ) client = StripeClient( "sk_test_123", http_client=http_client_mock.get_mock_http_client(), ) - client.v2.money_management.outbound_payment_quotes.create( + client.v2.money_management.outbound_payments.create( { "amount": {"currency": "USD", "value": 96}, "from": { @@ -44733,66 +44753,68 @@ def test_v2_money_management_outbound_payment_quote_post_service( ) http_client_mock.assert_requested( "post", - path="/v2/money_management/outbound_payment_quotes", + path="/v2/money_management/outbound_payments", query_string="", api_base="https://api.stripe.com", post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"currency":"usd","payout_method":"payout_method","recipient":"recipient"}}', is_json=True, ) - def test_v2_money_management_outbound_payment_quote_get_service( + def test_v2_money_management_outbound_payment_get_2_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "get", - "/v2/money_management/outbound_payment_quotes/id_123", + "/v2/money_management/outbound_payments/id_123", ) client = StripeClient( "sk_test_123", http_client=http_client_mock.get_mock_http_client(), ) - client.v2.money_management.outbound_payment_quotes.retrieve("id_123") + client.v2.money_management.outbound_payments.retrieve("id_123") http_client_mock.assert_requested( "get", - path="/v2/money_management/outbound_payment_quotes/id_123", + path="/v2/money_management/outbound_payments/id_123", query_string="", api_base="https://api.stripe.com", ) - def test_v2_money_management_outbound_payment_get_service( + def test_v2_money_management_outbound_payment_post_2_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( - "get", - "/v2/money_management/outbound_payments", + "post", + "/v2/money_management/outbound_payments/id_123/cancel", ) client = StripeClient( "sk_test_123", http_client=http_client_mock.get_mock_http_client(), ) - client.v2.money_management.outbound_payments.list() + client.v2.money_management.outbound_payments.cancel("id_123") http_client_mock.assert_requested( - "get", - path="/v2/money_management/outbound_payments", + "post", + path="/v2/money_management/outbound_payments/id_123/cancel", query_string="", api_base="https://api.stripe.com", + post_data="{}", + is_json=True, ) - def test_v2_money_management_outbound_payment_post_service( + def test_v2_money_management_outbound_payment_quote_post_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "post", - "/v2/money_management/outbound_payments", + "/v2/money_management/outbound_payment_quotes", ) client = StripeClient( "sk_test_123", http_client=http_client_mock.get_mock_http_client(), ) - client.v2.money_management.outbound_payments.create( + client.v2.money_management.outbound_payment_quotes.create( { "amount": {"currency": "USD", "value": 96}, "from": { @@ -44808,53 +44830,31 @@ def test_v2_money_management_outbound_payment_post_service( ) http_client_mock.assert_requested( "post", - path="/v2/money_management/outbound_payments", + path="/v2/money_management/outbound_payment_quotes", query_string="", api_base="https://api.stripe.com", post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"currency":"usd","payout_method":"payout_method","recipient":"recipient"}}', is_json=True, ) - def test_v2_money_management_outbound_payment_get_2_service( + def test_v2_money_management_outbound_payment_quote_get_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "get", - "/v2/money_management/outbound_payments/id_123", + "/v2/money_management/outbound_payment_quotes/id_123", ) client = StripeClient( "sk_test_123", http_client=http_client_mock.get_mock_http_client(), ) - client.v2.money_management.outbound_payments.retrieve("id_123") + client.v2.money_management.outbound_payment_quotes.retrieve("id_123") http_client_mock.assert_requested( "get", - path="/v2/money_management/outbound_payments/id_123", - query_string="", - api_base="https://api.stripe.com", - ) - - def test_v2_money_management_outbound_payment_post_2_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "post", - "/v2/money_management/outbound_payments/id_123/cancel", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.money_management.outbound_payments.cancel("id_123") - http_client_mock.assert_requested( - "post", - path="/v2/money_management/outbound_payments/id_123/cancel", + path="/v2/money_management/outbound_payment_quotes/id_123", query_string="", api_base="https://api.stripe.com", - post_data="{}", - is_json=True, ) def test_v2_money_management_outbound_setup_intent_get_service( @@ -45240,82 +45240,82 @@ def test_v2_money_management_received_debit_get_2_service( api_base="https://api.stripe.com", ) - def test_v2_money_management_transaction_entry_get_service( + def test_v2_money_management_transaction_get_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "get", - "/v2/money_management/transaction_entries", + "/v2/money_management/transactions", ) client = StripeClient( "sk_test_123", http_client=http_client_mock.get_mock_http_client(), ) - client.v2.money_management.transaction_entries.list() + client.v2.money_management.transactions.list() http_client_mock.assert_requested( "get", - path="/v2/money_management/transaction_entries", + path="/v2/money_management/transactions", query_string="", api_base="https://api.stripe.com", ) - def test_v2_money_management_transaction_entry_get_2_service( + def test_v2_money_management_transaction_get_2_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "get", - "/v2/money_management/transaction_entries/id_123", + "/v2/money_management/transactions/id_123", ) client = StripeClient( "sk_test_123", http_client=http_client_mock.get_mock_http_client(), ) - client.v2.money_management.transaction_entries.retrieve("id_123") + client.v2.money_management.transactions.retrieve("id_123") http_client_mock.assert_requested( "get", - path="/v2/money_management/transaction_entries/id_123", + path="/v2/money_management/transactions/id_123", query_string="", api_base="https://api.stripe.com", ) - def test_v2_money_management_transaction_get_service( + def test_v2_money_management_transaction_entry_get_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "get", - "/v2/money_management/transactions", + "/v2/money_management/transaction_entries", ) client = StripeClient( "sk_test_123", http_client=http_client_mock.get_mock_http_client(), ) - client.v2.money_management.transactions.list() + client.v2.money_management.transaction_entries.list() http_client_mock.assert_requested( "get", - path="/v2/money_management/transactions", + path="/v2/money_management/transaction_entries", query_string="", api_base="https://api.stripe.com", ) - def test_v2_money_management_transaction_get_2_service( + def test_v2_money_management_transaction_entry_get_2_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "get", - "/v2/money_management/transactions/id_123", + "/v2/money_management/transaction_entries/id_123", ) client = StripeClient( "sk_test_123", http_client=http_client_mock.get_mock_http_client(), ) - client.v2.money_management.transactions.retrieve("id_123") + client.v2.money_management.transaction_entries.retrieve("id_123") http_client_mock.assert_requested( "get", - path="/v2/money_management/transactions/id_123", + path="/v2/money_management/transaction_entries/id_123", query_string="", api_base="https://api.stripe.com", ) From 98ce25a6b2fccbeb429698c317aac13b9b7fca65 Mon Sep 17 00:00:00 2001 From: David Brownman <109395161+xavdid-stripe@users.noreply.github.com> Date: Tue, 26 Aug 2025 17:50:51 -0700 Subject: [PATCH 31/31] Import available http libraries more efficiently (#1553) * replace import stragety, fix some tests [skip ci] * wip fixing tests [skip ci] * [claude] fix tests * formatting * test cleanup * tests are fast * final cleanup * remove comment * remove accidential files * tweak import logic --- justfile | 3 +- stripe/_http_client.py | 259 +++---- tests/test_http_client.py | 1340 +++++++++++++++++++------------------ 3 files changed, 830 insertions(+), 772 deletions(-) diff --git a/justfile b/justfile index de11777b3..75aab0649 100644 --- a/justfile +++ b/justfile @@ -10,9 +10,10 @@ _default: just --list --unsorted # ⭐ run all unit tests +[positional-arguments] test *args: install-test-deps # configured in pyproject.toml - pytest {{ args }} + pytest "$@" # ⭐ check for potential mistakes lint: install-dev-deps diff --git a/stripe/_http_client.py b/stripe/_http_client.py index b5421424f..2636874bc 100644 --- a/stripe/_http_client.py +++ b/stripe/_http_client.py @@ -1,5 +1,4 @@ from io import BytesIO -import sys import textwrap import email import time @@ -32,6 +31,7 @@ AsyncIterable, ) from typing_extensions import ( + TYPE_CHECKING, Literal, NoReturn, TypedDict, @@ -39,78 +39,25 @@ Never, ) +if TYPE_CHECKING: + from urllib.parse import ParseResult -# The precedence of HTTP libraries is -# - Urlfetch (this is provided by Google App Engine, so if it's present you probably want it) -# - Requests (popular library, the top priority for all environments outside Google App Engine, but not always present) -# - Pycurl (another library, not always present, not as preferred as Requests but at least it verifies SSL certs) -# - urllib2 with a warning (basically always present, fallback if needed) -try: - import urllib.request as urllibrequest - import urllib.error as urlliberror -except ImportError: - # Try to load in urllib2, but don't sweat it if it's not available. - pass - -try: - import pycurl # pyright: ignore -except ImportError: - pycurl = None - -try: - import httpx - import anyio - from httpx import Timeout as HTTPXTimeout - from httpx import Client as HTTPXClientType -except ImportError: - httpx = None - anyio = None - -try: - import aiohttp - from aiohttp import ClientTimeout as AIOHTTPTimeout - from aiohttp import StreamReader as AIOHTTPStreamReader -except ImportError: - aiohttp = None - -try: - import requests - from requests import Session as RequestsSession -except ImportError: - requests = None -else: try: - # Require version 0.8.8, but don't want to depend on distutils - version: str - version = requests.__version__ - major: int - minor: int - patch: int - major, minor, patch = [int(i) for i in version.split(".")] - except Exception: - # Probably some new-fangled version, so it should support verify + from requests import Session as RequestsSession + except ImportError: pass - else: - if (major, minor, patch) < (0, 8, 8): - sys.stderr.write( - "Warning: the Stripe library requires that your Python " - '"requests" library be newer than version 0.8.8, but your ' - '"requests" library is version %s. Stripe will fall back to ' - "an alternate HTTP library so everything should work. We " - 'recommend upgrading your "requests" library. If you have any ' - "questions, please contact support@stripe.com. (HINT: running " - '"pip install -U requests" should upgrade your requests ' - "library to the latest version.)" % (version,) - ) - requests = None -try: - from google.appengine.api import urlfetch # pyright: ignore -except ImportError: - urlfetch = None + try: + from httpx import Timeout as HTTPXTimeout + from httpx import Client as HTTPXClientType + except ImportError: + pass -# proxy support for the pycurl client -from urllib.parse import urlparse, ParseResult + try: + from aiohttp import ClientTimeout as AIOHTTPTimeout + from aiohttp import StreamReader as AIOHTTPStreamReader + except ImportError: + pass def _now_ms(): @@ -118,27 +65,61 @@ def _now_ms(): def new_default_http_client(*args: Any, **kwargs: Any) -> "HTTPClient": - if urlfetch: - impl = UrlFetchClient - elif requests: - impl = RequestsClient - elif pycurl: - impl = PycurlClient + """ + This method creates and returns a new HTTPClient based on what libraries are available. It uses the following precedence rules: + + 1. Urlfetch (this is provided by Google App Engine, so if it's present you probably want it) + 2. Requests (popular library, the top priority for all environments outside Google App Engine, but not always present) + 3. Pycurl (another library, not always present, not as preferred as Requests but at least it verifies SSL certs) + 4. urllib with a warning (basically always present, a reasonable final default) + + For performance, it only imports what it's actually going to use. But, it re-calculates every time its called, so probably save its result instead of calling it multiple times. + """ + try: + from google.appengine.api import urlfetch # type: ignore # noqa: F401 + except ImportError: + pass + else: + return UrlFetchClient(*args, **kwargs) + + try: + import requests # noqa: F401 + except ImportError: + pass + else: + return RequestsClient(*args, **kwargs) + + try: + import pycurl # type: ignore # noqa: F401 + except ImportError: + pass else: - impl = Urllib2Client + return PycurlClient(*args, **kwargs) - return impl(*args, **kwargs) + return Urllib2Client(*args, **kwargs) def new_http_client_async_fallback(*args: Any, **kwargs: Any) -> "HTTPClient": - if httpx: - impl = HTTPXClient - elif aiohttp: - impl = AIOHTTPClient + """ + Similar to `new_default_http_client` above, this returns a client that can handle async HTTP requests, if available. + """ + + try: + import httpx # noqa: F401 + import anyio # noqa: F401 + except ImportError: + pass + else: + return HTTPXClient(*args, **kwargs) + + try: + import aiohttp # noqa: F401 + except ImportError: + pass else: - impl = NoImportFoundAsyncClient + return AIOHTTPClient(*args, **kwargs) - return impl(*args, **kwargs) + return NoImportFoundAsyncClient(*args, **kwargs) class HTTPClient(object): @@ -159,6 +140,7 @@ def __init__( verify_ssl_certs: bool = True, proxy: Optional[Union[str, _Proxy]] = None, async_fallback_client: Optional["HTTPClient"] = None, + _lib=None, # used for internal unit testing ): self._verify_ssl_certs = verify_ssl_certs if proxy: @@ -600,6 +582,7 @@ def __init__( verify_ssl_certs: bool = True, proxy: Optional[Union[str, HTTPClient._Proxy]] = None, async_fallback_client: Optional[HTTPClient] = None, + _lib=None, # used for internal unit testing **kwargs, ): super(RequestsClient, self).__init__( @@ -610,8 +593,12 @@ def __init__( self._session = session self._timeout = timeout - assert requests is not None - self.requests = requests + if _lib is None: + import requests + + _lib = requests + + self.requests = _lib def request( self, @@ -785,6 +772,7 @@ def __init__( proxy: Optional[HTTPClient._Proxy] = None, deadline: int = 55, async_fallback_client: Optional[HTTPClient] = None, + _lib=None, # used for internal unit testing ): super(UrlFetchClient, self).__init__( verify_ssl_certs=verify_ssl_certs, @@ -806,8 +794,12 @@ def __init__( # to 55 seconds to allow for a slow Stripe self._deadline = deadline - assert urlfetch is not None - self.urlfetch = urlfetch + if _lib is None: + from google.appengine.api import urlfetch # pyright: ignore + + _lib = urlfetch + + self.urlfetch = _lib def request( self, method: str, url: str, headers: Mapping[str, str], post_data=None @@ -904,14 +896,14 @@ def close(self): class _Proxy(TypedDict): - http: Optional[ParseResult] - https: Optional[ParseResult] + http: Optional["ParseResult"] + https: Optional["ParseResult"] class PycurlClient(HTTPClient): class _ParsedProxy(TypedDict, total=False): - http: Optional[ParseResult] - https: Optional[ParseResult] + http: Optional["ParseResult"] + https: Optional["ParseResult"] name = "pycurl" _parsed_proxy: Optional[_ParsedProxy] @@ -921,6 +913,7 @@ def __init__( verify_ssl_certs: bool = True, proxy: Optional[HTTPClient._Proxy] = None, async_fallback_client: Optional[HTTPClient] = None, + _lib=None, # used for internal unit testing ): super(PycurlClient, self).__init__( verify_ssl_certs=verify_ssl_certs, @@ -928,15 +921,21 @@ def __init__( async_fallback_client=async_fallback_client, ) - assert pycurl is not None - self.pycurl = pycurl + if _lib is None: + import pycurl # pyright: ignore[reportMissingModuleSource] + + _lib = pycurl + + self.pycurl = _lib # Initialize this within the object so that we can reuse connections. - self._curl = pycurl.Curl() + self._curl = _lib.Curl() self._parsed_proxy = {} # need to urlparse the proxy, since PyCurl # consumes the proxy url in small pieces if self._proxy: + from urllib.parse import urlparse + proxy_ = self._proxy for scheme, value in proxy_.items(): # In general, TypedDict.items() gives you (key: str, value: object) @@ -1091,7 +1090,7 @@ def _handle_request_error(self, e: Exception) -> NoReturn: msg = textwrap.fill(msg) + "\n\n(Network error: " + e.args[1] + ")" raise APIConnectionError(msg, should_retry=should_retry) from e - def _get_proxy(self, url) -> Optional[ParseResult]: + def _get_proxy(self, url) -> Optional["ParseResult"]: if self._parsed_proxy: proxy = self._parsed_proxy scheme = url.split(":")[0] if url else None @@ -1103,6 +1102,7 @@ def close(self): pass +# todo(major): rename this, urllib2 isn't called that anymore class Urllib2Client(HTTPClient): name = "urllib.request" @@ -1111,21 +1111,33 @@ def __init__( verify_ssl_certs: bool = True, proxy: Optional[HTTPClient._Proxy] = None, async_fallback_client: Optional[HTTPClient] = None, + _lib=None, # used for internal unit testing ): super(Urllib2Client, self).__init__( verify_ssl_certs=verify_ssl_certs, proxy=proxy, async_fallback_client=async_fallback_client, ) + + if _lib is None: + import urllib.request as urllibrequest + + _lib = urllibrequest + self.urllibrequest = _lib + + import urllib.error as urlliberror + + self.urlliberror = urlliberror + # prepare and cache proxy tied opener here self._opener = None if self._proxy: # We have to cast _Proxy to Dict[str, str] because pyright is not smart enough to # realize that all the value types are str. - proxy_handler = urllibrequest.ProxyHandler( + proxy_handler = self.urllibrequest.ProxyHandler( cast(Dict[str, str], self._proxy) ) - self._opener = urllibrequest.build_opener(proxy_handler) + self._opener = self.urllibrequest.build_opener(proxy_handler) def request( self, method: str, url: str, headers: Mapping[str, str], post_data=None @@ -1172,7 +1184,7 @@ def _request_internal( if isinstance(post_data, str): post_data = post_data.encode("utf-8") - req = urllibrequest.Request( + req = self.urllibrequest.Request( url, post_data, cast(MutableMapping[str, str], headers) ) @@ -1185,7 +1197,7 @@ def _request_internal( response = ( self._opener.open(req) if self._opener - else urllibrequest.urlopen(req) + else self.urllibrequest.urlopen(req) ) if is_streaming: @@ -1195,11 +1207,11 @@ def _request_internal( rcode = response.code headers = dict(response.info()) - except urlliberror.HTTPError as e: + except self.urlliberror.HTTPError as e: rcode = e.code rcontent = e.read() headers = dict(e.info()) - except (urlliberror.URLError, ValueError) as e: + except (self.urlliberror.URLError, ValueError) as e: self._handle_request_error(e) lh = dict((k.lower(), v) for k, v in iter(dict(headers).items())) return rcontent, rcode, lh @@ -1225,21 +1237,19 @@ def __init__( self, timeout: Optional[Union[float, "HTTPXTimeout"]] = 80, allow_sync_methods=False, + _lib=None, # used for internal unit testing **kwargs, ): super(HTTPXClient, self).__init__(**kwargs) - if httpx is None: - raise ImportError( - "Unexpected: tried to initialize HTTPXClient but the httpx module is not present." - ) + if _lib is None: + import httpx - if anyio is None: - raise ImportError( - "Unexpected: tried to initialize HTTPXClient but the anyio module is not present." - ) + _lib = httpx + self.httpx = _lib + + import anyio - self.httpx = httpx self.anyio = anyio kwargs = {} @@ -1250,10 +1260,10 @@ def __init__( else: kwargs["verify"] = False - self._client_async = httpx.AsyncClient(**kwargs) + self._client_async = self.httpx.AsyncClient(**kwargs) self._client = None if allow_sync_methods: - self._client = httpx.Client(**kwargs) + self._client = self.httpx.Client(**kwargs) self._timeout = timeout def sleep_async(self, secs): @@ -1385,33 +1395,40 @@ class AIOHTTPClient(HTTPClient): name = "aiohttp" def __init__( - self, timeout: Optional[Union[float, "AIOHTTPTimeout"]] = 80, **kwargs + self, + timeout: Optional[Union[float, "AIOHTTPTimeout"]] = 80, + _lib=None, # used for internal unit testing + **kwargs, ): super(AIOHTTPClient, self).__init__(**kwargs) - if aiohttp is None: - raise ImportError( - "Unexpected: tried to initialize AIOHTTPClient but the aiohttp module is not present." - ) + if _lib is None: + import aiohttp + + _lib = aiohttp + + self.aiohttp = _lib self._timeout = timeout self._cached_session = None @property def _session(self): - assert aiohttp is not None - if self._cached_session is None: kwargs = {} if self._verify_ssl_certs: ssl_context = ssl.create_default_context( cafile=stripe.ca_bundle_path ) - kwargs["connector"] = aiohttp.TCPConnector(ssl=ssl_context) + kwargs["connector"] = self.aiohttp.TCPConnector( + ssl=ssl_context + ) else: - kwargs["connector"] = aiohttp.TCPConnector(verify_ssl=False) + kwargs["connector"] = self.aiohttp.TCPConnector( + verify_ssl=False + ) - self._cached_session = aiohttp.ClientSession(**kwargs) + self._cached_session = self.aiohttp.ClientSession(**kwargs) return self._cached_session diff --git a/tests/test_http_client.py b/tests/test_http_client.py index f37427cc4..93e32df55 100644 --- a/tests/test_http_client.py +++ b/tests/test_http_client.py @@ -1,102 +1,135 @@ import base64 -from typing import Any, List -from typing_extensions import Type -from unittest.mock import call -import pytest import json import sys +from typing import Any, Callable, Dict, List, Optional +from unittest.mock import MagicMock, Mock, call, patch + +import pytest +from typing_extensions import Type if sys.version_info >= (3, 8): from unittest.mock import AsyncMock else: from mock import AsyncMock +from contextlib import contextmanager + +import urllib3 + import stripe -from stripe import _http_client +from stripe import APIConnectionError, _http_client, _util from stripe._encode import _api_encode -from stripe import APIConnectionError -import urllib3 -from stripe import _util +from stripe._http_client import ( + AIOHTTPClient, + HTTPXClient, + NoImportFoundAsyncClient, + PycurlClient, + RequestsClient, +) +from stripe._http_client import ( + UrlFetchClient as AppEngineClient, +) +from stripe._http_client import ( + Urllib2Client as BuiltinClient, +) VALID_API_METHODS = ("get", "post", "delete") -class StripeClientTestCase(object): - REQUEST_LIBRARIES = [ - ("urlfetch", "stripe._http_client.urlfetch"), - ("requests", "stripe._http_client.requests"), - ("pycurl", "stripe._http_client.pycurl"), - ("urllib.request", "stripe._http_client.urllibrequest"), - ("httpx", "stripe._http_client.httpx"), - ("aiohttp", "stripe._http_client.aiohttp"), - ] - - @pytest.fixture - def request_mocks(self, mocker): - request_mocks = {} - for lib, mockpath in self.REQUEST_LIBRARIES: - request_mocks[lib] = mocker.patch(mockpath) - return request_mocks - - -class TestNewDefaultHttpClient(StripeClientTestCase): - def check_default(self, none_libs, expected): - for lib in none_libs: - setattr(_http_client, lib, None) - - inst = _http_client.new_default_http_client() - - assert isinstance(inst, expected) - - def test_new_default_http_client_urlfetch(self, request_mocks): - self.check_default((), _http_client.UrlFetchClient) - - def test_new_default_http_client_requests(self, request_mocks): - self.check_default(("urlfetch",), _http_client.RequestsClient) - - def test_new_default_http_client_pycurl(self, request_mocks): - self.check_default(("urlfetch", "requests"), _http_client.PycurlClient) +@pytest.fixture +def mocked_request_lib(): + return MagicMock() - def test_new_default_http_client_urllib2(self, request_mocks): - self.check_default( - ("urlfetch", "requests", "pycurl"), - _http_client.Urllib2Client, - ) +SUPPORTED_LIBS = frozenset( + ("google.appengine.api", "requests", "pycurl", "httpx", "aiohttp", "anyio") +) -class TestNewHttpClientAsyncFallback(StripeClientTestCase): - def check_default(self, none_libs, expected): - for lib in none_libs: - setattr(_http_client, lib, None) - inst = _http_client.new_http_client_async_fallback() +@pytest.fixture +def mock_import(): + """ + A pytest fixture that simulates a specific set of libraries being available. Right now it hardcodes information about our `SUPPORTED_LIBS`, but we could make it more general. - assert isinstance(inst, expected) + usage: + with patch("builtins.__import__") as mocked_import_fn: + mocked_import_fn.side_effect = mock_import(['a', 'b', 'c']) - def test_new_http_client_async_fallback_httpx(self, request_mocks): - self.check_default((), _http_client.HTTPXClient) + # assuming SUPPORTED_LIBS is a,b,c + import a # works (MagicMock if `a` isn't installed for real) + import d # importError + import pytest # is a regular import, only works if pytest is actually installed + """ + orig_import = __import__ + + def create_mocked_import(available_libs: List[str]): + def _mocked_import(name, *args): + """ + emulate packages being missing by throwing early if they're not supposed to be here. + """ + if name in SUPPORTED_LIBS and name not in available_libs: + raise ImportError() + + try: + # if it's not supposed to be missing, try and import it for real + return orig_import(name, *args) + except ImportError: + # we don't have some of our 3rd party options (like the GAE module) available, but the import needs to succeed + return MagicMock() + + return _mocked_import + + return create_mocked_import + + +class TestImports: + @pytest.mark.parametrize( + ["available_libs", "expected"], + [ + [["google.appengine.api"], AppEngineClient], + [["google.appengine.api", "requests"], AppEngineClient], + [["requests"], RequestsClient], + [["requests", "pycurl"], RequestsClient], + [["pycurl"], PycurlClient], + [[], BuiltinClient], + ], + ) + def test_default_httpclient_from_imports( + self, available_libs, expected, mock_import + ): + with patch("builtins.__import__") as mocked_import_fn: + mocked_import_fn.side_effect = mock_import(available_libs) + + client = _http_client.new_default_http_client() + assert isinstance(client, expected) + + @pytest.mark.parametrize( + ["available_libs", "expected"], + [ + # needs both httpx and anyio + [["httpx"], NoImportFoundAsyncClient], + [["anyio"], NoImportFoundAsyncClient], + [["httpx", "anyio"], HTTPXClient], + # having only one required lib means we proceed + [["anyio", "aiohttp"], AIOHTTPClient], + [["aiohttp"], AIOHTTPClient], + [[], NoImportFoundAsyncClient], + ], + ) + def test_default_async_httpclient_from_imports( + self, available_libs, expected, mock_import + ): + with patch("builtins.__import__") as mocked_import_fn: + mocked_import_fn.side_effect = mock_import(available_libs) - def test_new_http_client_async_fallback_aiohttp(self, request_mocks): - self.check_default( - (("httpx"),), - _http_client.AIOHTTPClient, - ) + client = _http_client.new_http_client_async_fallback() + assert isinstance(client, expected) - def test_new_http_client_async_fallback_no_import_found( - self, request_mocks - ): - self.check_default( - ( - ("httpx"), - ("aiohttp"), - ), - _http_client.NoImportFoundAsyncClient, - ) +MakeReqFunc = Callable[[str, str, Dict[str, str], Optional[str]], Any] -class TestRetrySleepTimeDefaultHttpClient(StripeClientTestCase): - from contextlib import contextmanager +class TestRetrySleepTimeDefaultHttpClient: def assert_sleep_times( self, client: _http_client.HTTPClient, expected: List[float] ): @@ -180,7 +213,7 @@ def test_jitter_has_randomness_but_within_range(self): assert all(0.5 <= val <= 1 for val in jittered_ones) -class TestRetryConditionsDefaultHttpClient(StripeClientTestCase): +class TestRetryConditionsDefaultHttpClient: def test_should_retry_on_codes(self): one_xx = list(range(100, 104)) two_xx = list(range(200, 209)) @@ -222,7 +255,7 @@ def test_should_retry_on_codes(self): def test_should_retry_on_error(self, mocker): client = _http_client.new_default_http_client() - api_connection_error = mocker.Mock() + api_connection_error = Mock() api_connection_error.should_retry = True assert ( @@ -279,7 +312,7 @@ def test_should_retry_on_stripe_should_retry_false(self, mocker): def test_should_retry_on_num_retries(self, mocker): client = _http_client.new_default_http_client() max_test_retries = 10 - api_connection_error = mocker.Mock() + api_connection_error = Mock() api_connection_error.should_retry = True assert ( @@ -302,7 +335,7 @@ def test_should_retry_on_num_retries(self, mocker): ) -class TestHTTPClient(object): +class TestHTTPClient: @pytest.fixture(autouse=True) def setup_stripe(self): orig_attrs = {"enable_telemetry": stripe.enable_telemetry} @@ -339,38 +372,150 @@ class TestClient(_http_client.HTTPClient): assert telemetry["last_request_metrics"]["request_id"] == "req_123" -class ClientTestBase(object): +class ClientTestBase: REQUEST_CLIENT: Type[_http_client.HTTPClient] + valid_url = "https://api.stripe.com/foo" + # only some clients support proxies + PROXY = None + # certain test classes depend on re-initializing the client because they've modified the mocked lib before it goes in + ALWAYS_INIT_CLIENT = False + # allow customizing client creation + CLIENT_KWARGS = None @pytest.fixture - def request_mock(self, request_mocks): - return request_mocks[self.REQUEST_CLIENT.name] + def make_client(self, mocked_request_lib): + def _make_client(**kwargs): + client = self.REQUEST_CLIENT( + verify_ssl_certs=True, + proxy=self.PROXY, + _lib=mocked_request_lib, + **kwargs, + ) + # speed up all retries + client._sleep_time_seconds = ( + lambda num_retries, response=None: 0.0001 + ) + return client - @property - def valid_url(self, path="/foo"): - return "https://api.stripe.com%s" % (path,) + return _make_client - def make_request(self, method, url, headers, post_data): - client = self.REQUEST_CLIENT(verify_ssl_certs=True) - return client.request_with_retries(method, url, headers, post_data) + @pytest.fixture + def client(self, make_client): + return make_client() - def make_request_stream(self, method, url, headers, post_data): - client = self.REQUEST_CLIENT(verify_ssl_certs=True) - return client.request_stream_with_retries( - method, url, headers, post_data - ) + @pytest.fixture + def make_request(self, make_client, client) -> MakeReqFunc: + def _make_request( + method, + url, + headers, + post_data, + client_kwargs=None, + max_retries=None, + ): + # reuse the fixture client, if possible + if client_kwargs or self.CLIENT_KWARGS or self.ALWAYS_INIT_CLIENT: + local_client = make_client( + **{ + **(self.CLIENT_KWARGS or {}), + **(client_kwargs or {}), + } + ) + else: + local_client = client + + return local_client.request_with_retries( + method, + url, + headers, + post_data, + max_network_retries=max_retries, + ) - def make_request_async(self, method, url, headers, post_data): - client = self.REQUEST_CLIENT(verify_ssl_certs=True) - return client.request_with_retries_async( - method, url, headers, post_data - ) + return _make_request - async def make_request_stream_async(self, method, url, headers, post_data): - client = self.REQUEST_CLIENT(verify_ssl_certs=True) - return await client.request_stream_with_retries_async( - method, url, headers, post_data - ) + @pytest.fixture + def make_streamed_request(self, make_client, client) -> MakeReqFunc: + def _make_request_stream( + method, + url, + headers, + post_data, + client_kwargs=None, + max_retries=None, + ): + if client_kwargs or self.CLIENT_KWARGS or self.ALWAYS_INIT_CLIENT: + local_client = make_client( + **(client_kwargs or self.CLIENT_KWARGS or {}) + ) + else: + local_client = client + + return local_client.request_stream_with_retries( + method, + url, + headers, + post_data, + max_network_retries=max_retries, + ) + + return _make_request_stream + + @pytest.fixture + def make_async_request(self, make_client, client) -> MakeReqFunc: + def _make_request_async( + method, + url, + headers, + post_data, + client_kwargs=None, + max_retries=None, + ): + if client_kwargs or self.CLIENT_KWARGS or self.ALWAYS_INIT_CLIENT: + local_client = make_client( + **(client_kwargs or {}), + **(self.CLIENT_KWARGS or {}), + ) + else: + local_client = client + + return local_client.request_with_retries_async( + method, + url, + headers, + post_data, + max_network_retries=max_retries, + ) + + return _make_request_async + + @pytest.fixture + def make_async_stream_request(self, make_client, client) -> MakeReqFunc: + async def _make_request_stream_async( + method, + url, + headers, + post_data, + client_kwargs=None, + max_retries=None, + ): + if client_kwargs or self.CLIENT_KWARGS or self.ALWAYS_INIT_CLIENT: + local_client = make_client( + **(client_kwargs or {}), + **(self.CLIENT_KWARGS or {}), + ) + else: + local_client = client + + return await local_client.request_stream_with_retries_async( + method, + url, + headers, + post_data, + max_network_retries=max_retries, + ) + + return _make_request_stream_async @pytest.fixture def mock_response(self): @@ -401,31 +546,37 @@ def check_call( return check_call - def test_request(self, request_mock, mock_response, check_call): - mock_response(request_mock, '{"foo": "baz"}', 200) + def test_request( + self, + mocked_request_lib, + make_request: MakeReqFunc, + mock_response, + check_call, + ): + mock_response(mocked_request_lib, '{"foo": "baz"}', 200) for method in VALID_API_METHODS: abs_url = self.valid_url data = "" if method != "post": - abs_url = "%s?%s" % (abs_url, data) + abs_url = f"{abs_url}?{data}" data = None headers = {"my-header": "header val"} - body, code, _ = self.make_request(method, abs_url, headers, data) + body, code, _ = make_request(method, abs_url, headers, data) assert code == 200 assert body == '{"foo": "baz"}' - check_call(request_mock, method, abs_url, data, headers) + check_call(mocked_request_lib, method, abs_url, data, headers) def test_request_stream( - self, mocker, request_mock, mock_response, check_call + self, mocked_request_lib, make_streamed_request, mock_response ): for method in VALID_API_METHODS: - mock_response(request_mock, "some streamed content", 200) + mock_response(mocked_request_lib, "some streamed content", 200) abs_url = self.valid_url data = "" @@ -436,7 +587,7 @@ def test_request_stream( headers = {"my-header": "header val"} - stream, code, _ = self.make_request_stream( + stream, code, _ = make_streamed_request( method, abs_url, headers, data ) @@ -456,12 +607,10 @@ def test_request_stream( assert body_content == "some streamed content" - mocker.resetall() - - def test_exception(self, request_mock, mock_error): - mock_error(request_mock) + def test_exception(self, mocked_request_lib, mock_error, make_request): + mock_error(mocked_request_lib) with pytest.raises(APIConnectionError): - self.make_request("get", self.valid_url, {}, None) + make_request("get", self.valid_url, {}, None, mocked_request_lib) class RequestsVerify(object): @@ -469,19 +618,20 @@ def __eq__(self, other): return other and other.endswith("stripe/data/ca-certificates.crt") -class TestRequestsClient(StripeClientTestCase, ClientTestBase): +class TestRequestsClient(ClientTestBase): REQUEST_CLIENT: Type[_http_client.RequestsClient] = ( _http_client.RequestsClient ) + PROXY = "http://slap/" @pytest.fixture - def session(self, mocker, request_mocks): - return mocker.MagicMock() + def session(self): + return MagicMock() @pytest.fixture - def mock_response(self, mocker, session): - def mock_response(mock, body, code): - result = mocker.Mock() + def mock_response(self, session): + def _mock_response(mock, body, code): + result = Mock() result.content = body result.status_code = code result.headers = {} @@ -491,28 +641,25 @@ def mock_response(mock, body, code): status=code, ) - session.request = mocker.MagicMock(return_value=result) - mock.Session = mocker.MagicMock(return_value=session) + session.request = MagicMock(return_value=result) + mock.Session = MagicMock(return_value=session) - return mock_response + return _mock_response @pytest.fixture - def mock_error(self, mocker, session): - def mock_error(mock): + def mock_error(self, session): + def _mock_error(mock): # The first kind of request exceptions we catch mock.exceptions.SSLError = Exception session.request.side_effect = mock.exceptions.SSLError() - mock.Session = mocker.MagicMock(return_value=session) + mock.Session = MagicMock(return_value=session) - return mock_error + return _mock_error - # Note that unlike other modules, we don't use the "mock" argument here - # because we need to run the request call against the internal mock - # session. @pytest.fixture def check_call(self, session): - def check_call( - mock, + def _check_call( + _, method, url, post_data, @@ -537,51 +684,41 @@ def check_call( calls = [call(*pargs, **kwargs) for _ in range(times)] session.request.assert_has_calls(calls) - return check_call - - def make_request(self, method, url, headers, post_data, timeout=80): - client = self.REQUEST_CLIENT( - verify_ssl_certs=True, timeout=timeout, proxy="http://slap/" - ) - return client.request_with_retries(method, url, headers, post_data) + return _check_call - def make_request_stream(self, method, url, headers, post_data, timeout=80): - client = self.REQUEST_CLIENT( - verify_ssl_certs=True, timeout=timeout, proxy="http://slap/" - ) - return client.request_stream_with_retries( - method, url, headers, post_data - ) - - def test_timeout(self, request_mock, mock_response, check_call): + def test_timeout( + self, mocked_request_lib, mock_response, check_call, make_request + ): headers = {"my-header": "header val"} data = "" - mock_response(request_mock, '{"foo": "baz"}', 200) - self.make_request("POST", self.valid_url, headers, data, timeout=5) + mock_response(mocked_request_lib, '{"foo": "baz"}', 200) + make_request( + "POST", self.valid_url, headers, data, client_kwargs={"timeout": 5} + ) check_call(None, "POST", self.valid_url, data, headers, timeout=5) def test_request_stream_forwards_stream_param( - self, mocker, request_mock, mock_response, check_call + self, + mocked_request_lib, + mock_response, + check_call, + make_streamed_request: MakeReqFunc, ): - mock_response(request_mock, "some streamed content", 200) - self.make_request_stream("GET", self.valid_url, {}, None) + mock_response(mocked_request_lib, "some streamed content", 200) + make_streamed_request("GET", self.valid_url, {}, None) - check_call( - None, - "GET", - self.valid_url, - None, - {}, - is_streaming=True, - ) + check_call(None, "GET", self.valid_url, None, {}, is_streaming=True) class TestRequestClientRetryBehavior(TestRequestsClient): + PROXY = "http://slap/" + max_retries = 3 + @pytest.fixture - def response(self, mocker): + def response(self): def response(code=200, headers={}): - result = mocker.Mock() + result = Mock() result.content = "{}" result.status_code = code result.headers = headers @@ -596,22 +733,28 @@ def response(code=200, headers={}): return response @pytest.fixture - def mock_retry(self, mocker, session, request_mock): - def mock_retry(retry_error_num=0, no_retry_error_num=0, responses=[]): + def mock_retry(self, session, mocked_request_lib): + def _mock_retry( + retry_error_num=0, no_retry_error_num=0, responses=None + ): + if responses is None: + responses = [] # Mocking classes of exception we catch. Any group of exceptions # with the same inheritance pattern will work request_root_error_class = Exception - request_mock.exceptions.RequestException = request_root_error_class + mocked_request_lib.exceptions.RequestException = ( + request_root_error_class + ) no_retry_parent_class = LookupError no_retry_child_class = KeyError - request_mock.exceptions.SSLError = no_retry_parent_class + mocked_request_lib.exceptions.SSLError = no_retry_parent_class no_retry_errors = [no_retry_child_class()] * no_retry_error_num retry_parent_class = EnvironmentError retry_child_class = IOError - request_mock.exceptions.Timeout = retry_parent_class - request_mock.exceptions.ConnectionError = retry_parent_class + mocked_request_lib.exceptions.Timeout = retry_parent_class + mocked_request_lib.exceptions.ConnectionError = retry_parent_class retry_errors = [retry_child_class()] * retry_error_num # Include mock responses as possible side-effects @@ -620,16 +763,16 @@ def mock_retry(retry_error_num=0, no_retry_error_num=0, responses=[]): retry_errors + no_retry_errors + responses ) - request_mock.Session = mocker.MagicMock(return_value=session) - return request_mock + mocked_request_lib.Session = MagicMock(return_value=session) + return mocked_request_lib - return mock_retry + return _mock_retry @pytest.fixture def check_call_numbers(self, check_call): valid_url = self.valid_url - def check_call_numbers(times, is_streaming=False): + def _check_call_numbers(times, is_streaming=False): check_call( None, "GET", @@ -640,114 +783,130 @@ def check_call_numbers(times, is_streaming=False): is_streaming=is_streaming, ) - return check_call_numbers - - def max_retries(self): - return 3 - - def make_client(self): - client = self.REQUEST_CLIENT( - verify_ssl_certs=True, timeout=80, proxy="http://slap/" - ) - # Override sleep time to speed up tests - client._sleep_time_seconds = lambda num_retries, response=None: 0.0001 - # Override configured max retries - return client - - def make_request(self, *args, **kwargs): - client = self.make_client() - return client.request_with_retries( - "GET", self.valid_url, {}, None, self.max_retries() - ) - - def make_request_stream(self, *args, **kwargs): - client = self.make_client() - return client.request_stream_with_retries( - "GET", self.valid_url, {}, None, self.max_retries() - ) + return _check_call_numbers def test_retry_error_until_response( - self, mock_retry, response, check_call_numbers + self, mock_retry, response, check_call_numbers, make_request ): mock_retry(retry_error_num=1, responses=[response(code=202)]) - _, code, _ = self.make_request() + _, code, _ = make_request( + "GET", self.valid_url, {}, None, max_retries=self.max_retries + ) assert code == 202 check_call_numbers(2) def test_retry_error_until_exceeded( - self, mock_retry, response, check_call_numbers + self, mock_retry, check_call_numbers, make_request ): - mock_retry(retry_error_num=self.max_retries()) + mock_retry(retry_error_num=self.max_retries) with pytest.raises(APIConnectionError): - self.make_request() + make_request( + "GET", self.valid_url, {}, None, max_retries=self.max_retries + ) - check_call_numbers(self.max_retries()) + check_call_numbers(self.max_retries) - def test_no_retry_error(self, mock_retry, response, check_call_numbers): - mock_retry(no_retry_error_num=self.max_retries()) + def test_no_retry_error( + self, mock_retry, check_call_numbers, make_request + ): + mock_retry(no_retry_error_num=self.max_retries) with pytest.raises(APIConnectionError): - self.make_request() + make_request( + "GET", self.valid_url, {}, None, max_retries=self.max_retries + ) check_call_numbers(1) - def test_retry_codes(self, mock_retry, response, check_call_numbers): + def test_retry_codes( + self, mock_retry, response, check_call_numbers, make_request + ): mock_retry(responses=[response(code=409), response(code=202)]) - _, code, _ = self.make_request() + _, code, _ = make_request( + "GET", self.valid_url, {}, None, max_retries=self.max_retries + ) assert code == 202 check_call_numbers(2) def test_retry_codes_until_exceeded( - self, mock_retry, response, check_call_numbers + self, mock_retry, response, check_call_numbers, make_request ): - mock_retry(responses=[response(code=409)] * (self.max_retries() + 1)) - _, code, _ = self.make_request() + mock_retry(responses=[response(code=409)] * (self.max_retries + 1)) + _, code, _ = make_request( + "GET", self.valid_url, {}, None, max_retries=self.max_retries + ) assert code == 409 - check_call_numbers(self.max_retries() + 1) + check_call_numbers(self.max_retries + 1) def test_retry_request_stream_error_until_response( - self, mock_retry, response, check_call_numbers + self, + mock_retry, + response, + check_call_numbers, + make_streamed_request, ): mock_retry(retry_error_num=1, responses=[response(code=202)]) - _, code, _ = self.make_request_stream() + _, code, _ = make_streamed_request( + "GET", self.valid_url, {}, None, max_retries=self.max_retries + ) assert code == 202 check_call_numbers(2, is_streaming=True) def test_retry_request_stream_error_until_exceeded( - self, mock_retry, response, check_call_numbers + self, + mock_retry, + check_call_numbers, + make_streamed_request, ): - mock_retry(retry_error_num=self.max_retries()) + mock_retry(retry_error_num=self.max_retries) with pytest.raises(APIConnectionError): - self.make_request_stream() + make_streamed_request( + "GET", self.valid_url, {}, None, max_retries=self.max_retries + ) - check_call_numbers(self.max_retries(), is_streaming=True) + check_call_numbers(self.max_retries, is_streaming=True) def test_no_retry_request_stream_error( - self, mock_retry, response, check_call_numbers + self, + mock_retry, + check_call_numbers, + make_streamed_request, ): - mock_retry(no_retry_error_num=self.max_retries()) + mock_retry(no_retry_error_num=self.max_retries) with pytest.raises(APIConnectionError): - self.make_request_stream() + make_streamed_request( + "GET", self.valid_url, {}, None, max_retries=self.max_retries + ) check_call_numbers(1, is_streaming=True) def test_retry_request_stream_codes( - self, mock_retry, response, check_call_numbers + self, + mock_retry, + response, + check_call_numbers, + make_streamed_request, ): mock_retry(responses=[response(code=409), response(code=202)]) - _, code, _ = self.make_request_stream() + _, code, _ = make_streamed_request( + "GET", self.valid_url, {}, None, max_retries=self.max_retries + ) assert code == 202 check_call_numbers(2, is_streaming=True) def test_retry_request_stream_codes_until_exceeded( - self, mock_retry, response, check_call_numbers + self, + mock_retry, + response, + check_call_numbers, + make_streamed_request, ): - mock_retry(responses=[response(code=409)] * (self.max_retries() + 1)) - _, code, _ = self.make_request_stream() + mock_retry(responses=[response(code=409)] * (self.max_retries + 1)) + _, code, _ = make_streamed_request( + "GET", self.valid_url, {}, None, max_retries=self.max_retries + ) assert code == 409 - check_call_numbers(self.max_retries() + 1, is_streaming=True) + check_call_numbers(self.max_retries + 1, is_streaming=True) @pytest.fixture - def connection_error(self, session): - client = self.REQUEST_CLIENT() - + def connection_error(self, client): def connection_error(given_exception): with pytest.raises(APIConnectionError) as error: client._handle_request_error(given_exception) @@ -758,12 +917,12 @@ def connection_error(given_exception): def test_handle_request_error_should_retry( self, connection_error, mock_retry ): - request_mock = mock_retry() + mocked_lib = mock_retry() - error = connection_error(request_mock.exceptions.Timeout()) + error = connection_error(mocked_lib.exceptions.Timeout()) assert error.should_retry - error = connection_error(request_mock.exceptions.ConnectionError()) + error = connection_error(mocked_lib.exceptions.ConnectionError()) assert error.should_retry def test_handle_request_error_should_not_retry( @@ -785,28 +944,28 @@ def test_handle_request_error_should_not_retry( assert "configuration issue locally" in error.user_message # Skip inherited basic requests client tests - def test_request(self, request_mock, mock_response, check_call): + def test_request(self): pass - def test_exception(self, request_mock, mock_error): + def test_exception(self): pass - def test_timeout(self, request_mock, mock_response, check_call): + def test_timeout(self): pass -class TestUrlFetchClient(StripeClientTestCase, ClientTestBase): +class TestUrlFetchClient(ClientTestBase): REQUEST_CLIENT = _http_client.UrlFetchClient @pytest.fixture - def mock_response(self, mocker): - def mock_response(mock, body, code): - result = mocker.Mock() + def mock_response(self): + def mock_response(mocked_lib, body, code): + result = Mock() result.content = body result.status_code = code result.headers = {} - mock.fetch = mocker.Mock(return_value=result) + mocked_lib.fetch = Mock(return_value=result) return result return mock_response @@ -836,49 +995,32 @@ def check_call( return check_call -class TestUrllib2Client(StripeClientTestCase, ClientTestBase): +class TestUrllib2Client(ClientTestBase): REQUEST_CLIENT: Type[_http_client.Urllib2Client] = ( _http_client.Urllib2Client ) + USE_PROXY = False request_object: Any - def make_client(self, proxy): - self.client = self.REQUEST_CLIENT(verify_ssl_certs=True, proxy=proxy) - self.proxy = proxy - - def make_request(self, method, url, headers, post_data, proxy=None): - self.make_client(proxy) - return self.client.request_with_retries( - method, url, headers, post_data - ) - - def make_request_stream(self, method, url, headers, post_data, proxy=None): - self.make_client(proxy) - return self.client.request_stream_with_retries( - method, url, headers, post_data - ) - @pytest.fixture - def mock_response(self, mocker): - def mock_response(mock, body, code): - response = mocker.Mock() - response.read = mocker.MagicMock(return_value=body) + def mock_response(self): + def mock_response(mocked_lib, body, code): + response = Mock() + response.read = MagicMock(return_value=body) response.code = code - response.info = mocker.Mock(return_value={}) - - self.request_object = mocker.Mock() - mock.Request = mocker.Mock(return_value=self.request_object) + response.info = Mock(return_value={}) - mock.urlopen = mocker.Mock(return_value=response) + self.request_object = Mock() + mocked_lib.Request = Mock(return_value=self.request_object) - opener = mocker.Mock() - opener.open = mocker.Mock(return_value=response) - mock.build_opener = mocker.Mock(return_value=opener) - mock.build_opener.open = opener.open - mock.ProxyHandler = mocker.Mock(return_value=opener) + opener = Mock() + opener.open = Mock(return_value=response) + mocked_lib.build_opener = Mock(return_value=opener) + mocked_lib.build_opener.open = opener.open + mocked_lib.ProxyHandler = Mock(return_value=opener) - mock.urlopen = mocker.Mock(return_value=response) + mocked_lib.urlopen = Mock(return_value=response) return mock_response @@ -892,94 +1034,57 @@ def mock_error(mock): return mock_error @pytest.fixture - def check_call(self): - def check_call( - mock, method, url, post_data, headers, is_streaming=False + def check_call(self, client): + def _check_call( + mocked_lib, + method, + url, + post_data, + headers, + is_streaming=False, ): if isinstance(post_data, str): post_data = post_data.encode("utf-8") - mock.Request.assert_called_with(url, post_data, headers) - - if self.client._proxy: - assert isinstance(self.client._proxy, dict) - mock.ProxyHandler.assert_called_with(self.client._proxy) - mock.build_opener.open.assert_called_with(self.request_object) - assert not mock.urlopen.called + mocked_lib.Request.assert_called_with(url, post_data, headers) - if not self.client._proxy: - mock.urlopen.assert_called_with(self.request_object) - assert not mock.build_opener.called - assert not mock.build_opener.open.called + if client._proxy: + assert isinstance(client._proxy, dict) + mocked_lib.ProxyHandler.assert_called_with(client._proxy) + mocked_lib.build_opener.open.assert_called_with( + self.request_object + ) + assert not mocked_lib.urlopen.called + else: + mocked_lib.urlopen.assert_called_with(self.request_object) + assert not mocked_lib.build_opener.called + assert not mocked_lib.build_opener.open.called - return check_call + return _check_call class TestUrllib2ClientHttpsProxy(TestUrllib2Client): - def make_request(self, method, url, headers, post_data, proxy=None): - return super(TestUrllib2ClientHttpsProxy, self).make_request( - method, - url, - headers, - post_data, - {"http": "http://slap/", "https": "http://slap/"}, - ) - - def make_request_stream(self, method, url, headers, post_data, proxy=None): - return super(TestUrllib2ClientHttpsProxy, self).make_request_stream( - method, - url, - headers, - post_data, - {"http": "http://slap/", "https": "http://slap/"}, - ) - - -class TestUrllib2ClientHttpProxy(TestUrllib2Client): - def make_request(self, method, url, headers, post_data, proxy=None): - return super(TestUrllib2ClientHttpProxy, self).make_request( - method, url, headers, post_data, "http://slap/" - ) - - def make_request_stream(self, method, url, headers, post_data, proxy=None): - return super(TestUrllib2ClientHttpProxy, self).make_request_stream( - method, url, headers, post_data, "http://slap/" - ) + USE_PROXY = True + ALWAYS_INIT_CLIENT = True -class TestPycurlClient(StripeClientTestCase, ClientTestBase): +class TestPycurlClient(ClientTestBase): REQUEST_CLIENT: Type[_http_client.PycurlClient] = _http_client.PycurlClient - - def make_client(self, proxy): - self.client = self.REQUEST_CLIENT(verify_ssl_certs=True, proxy=proxy) - self.proxy = proxy - - def make_request(self, method, url, headers, post_data, proxy=None): - self.make_client(proxy) - return self.client.request_with_retries( - method, url, headers, post_data - ) - - def make_request_stream(self, method, url, headers, post_data, proxy=None): - self.make_client(proxy) - return self.client.request_stream_with_retries( - method, url, headers, post_data - ) + ALWAYS_INIT_CLIENT = True @pytest.fixture - def curl_mock(self, mocker): - return mocker.Mock() + def curl_mock(self): + return Mock() @pytest.fixture - def request_mock(self, mocker, request_mocks, curl_mock): - lib_mock = request_mocks[self.REQUEST_CLIENT.name] - lib_mock.Curl = mocker.Mock(return_value=curl_mock) + def request_mock(self, mocker, mocked_request_lib, curl_mock): + mocked_request_lib.Curl = Mock(return_value=curl_mock) return curl_mock @pytest.fixture def bio_mock(self, mocker): bio_patcher = mocker.patch("stripe.util.io.BytesIO") - bio_mock = mocker.Mock() + bio_mock = Mock() bio_patcher.return_value = bio_mock return bio_mock @@ -990,40 +1095,52 @@ def mock_response(mock, body, code): return_value=body.encode("utf-8") ) bio_mock.read = mocker.MagicMock(return_value=body.encode("utf-8")) - mock.getinfo.return_value = code + # Set up the getinfo method on the curl instance + curl_instance = mock.Curl() + curl_instance.getinfo = mocker.MagicMock(return_value=code) return mock_response @pytest.fixture def mock_error(self): - def mock_error(mock): + def _mock_error(mock): class FakeException(BaseException): @property def args(self): return ("foo", "bar") - _http_client.pycurl.error = FakeException - mock.perform.side_effect = _http_client.pycurl.error + # Set the pycurl.error class on the mocked lib + mock.error = FakeException + # Create a curl mock that will raise the exception on perform() + curl_instance = MagicMock() + curl_instance.perform.side_effect = FakeException() + mock.Curl.return_value = curl_instance - return mock_error + return _mock_error @pytest.fixture - def check_call(self, request_mocks): - def check_call( - mock, method, url, post_data, headers, is_streaming=False + def check_call(self, client): + def _check_call( + mocked_lib, method, url, post_data, headers, is_streaming=False ): - lib_mock = request_mocks[self.REQUEST_CLIENT.name] + # The mock parameter should be the curl instance, but it's being passed the mocked_request_lib + # Get the actual curl mock instance + curl_mock = mocked_lib.Curl() - if self.client._proxy: - proxy = self.client._get_proxy(url) + if client._proxy: + proxy = client._get_proxy(url) assert proxy is not None if proxy.hostname: - mock.setopt.assert_any_call(lib_mock.PROXY, proxy.hostname) + curl_mock.setopt.assert_any_call( + mocked_lib.PROXY, proxy.hostname + ) if proxy.port: - mock.setopt.assert_any_call(lib_mock.PROXYPORT, proxy.port) + curl_mock.setopt.assert_any_call( + mocked_lib.PROXYPORT, proxy.port + ) if proxy.username or proxy.password: - mock.setopt.assert_any_call( - lib_mock.PROXYUSERPWD, + curl_mock.setopt.assert_any_call( + mocked_lib.PROXYUSERPWD, "%s:%s" % (proxy.username, proxy.password), ) @@ -1031,65 +1148,32 @@ def check_call( # _every_ call to setopt, but check a few of them to make sure the # right thing is happening. Keep an eye specifically on conditional # statements where things are more likely to go wrong. - - mock.setopt.assert_any_call(lib_mock.NOSIGNAL, 1) - mock.setopt.assert_any_call(lib_mock.URL, url) + curl_mock.setopt.assert_any_call(mocked_lib.NOSIGNAL, 1) + curl_mock.setopt.assert_any_call(mocked_lib.URL, url) if method == "get": - mock.setopt.assert_any_call(lib_mock.HTTPGET, 1) + curl_mock.setopt.assert_any_call(mocked_lib.HTTPGET, 1) elif method == "post": - mock.setopt.assert_any_call(lib_mock.POST, 1) + curl_mock.setopt.assert_any_call(mocked_lib.POST, 1) else: - mock.setopt.assert_any_call( - lib_mock.CUSTOMREQUEST, method.upper() + curl_mock.setopt.assert_any_call( + mocked_lib.CUSTOMREQUEST, method.upper() ) - mock.perform.assert_any_call() + curl_mock.perform.assert_any_call() - return check_call + return _check_call class TestPycurlClientHttpProxy(TestPycurlClient): - def make_request(self, method, url, headers, post_data, proxy=None): - return super(TestPycurlClientHttpProxy, self).make_request( - method, - url, - headers, - post_data, - "http://user:withPwd@slap:8888/", - ) - - def make_request_stream(self, method, url, headers, post_data, proxy=None): - return super(TestPycurlClientHttpProxy, self).make_request_stream( - method, - url, - headers, - post_data, - "http://user:withPwd@slap:8888/", - ) + PROXY = "http://user:withPwd@slap:8888/" class TestPycurlClientHttpsProxy(TestPycurlClient): - def make_request(self, method, url, headers, post_data, proxy=None): - return super(TestPycurlClientHttpsProxy, self).make_request( - method, - url, - headers, - post_data, - {"http": "http://slap:8888/", "https": "http://slap2:444/"}, - ) + PROXY = {"http": "http://slap:8888/", "https": "http://slap2:444/"} - def make_request_stream(self, method, url, headers, post_data, proxy=None): - return super(TestPycurlClientHttpsProxy, self).make_request_stream( - method, - url, - headers, - post_data, - {"http": "http://slap:8888/", "https": "http://slap2:444/"}, - ) - -class TestAPIEncode(StripeClientTestCase): +class TestAPIEncode: def test_encode_dict(self): body = {"foo": {"dob": {"month": 1}, "name": "bat"}} @@ -1115,13 +1199,29 @@ def test_encode_v2_array(self): assert ("foo[name]", "bat") in values -class TestHTTPXClient(StripeClientTestCase, ClientTestBase): +class TestHTTPXClient(ClientTestBase): REQUEST_CLIENT: Type[_http_client.HTTPXClient] = _http_client.HTTPXClient + PROXY = "http://slap/" + # ALWAYS_INIT_CLIENT= True + CLIENT_KWARGS = {"allow_sync_methods": True} @pytest.fixture - def mock_response(self, mocker, request_mock): - def mock_response(mock, body={}, code=200): - result = mocker.Mock() + def request_mock(self, mocked_request_lib): + # Set up the httpx library mock structure + async_client_instance = Mock() + sync_client_instance = Mock() + + mocked_request_lib.AsyncClient = Mock( + return_value=async_client_instance + ) + mocked_request_lib.Client = Mock(return_value=sync_client_instance) + + return mocked_request_lib + + @pytest.fixture + def mock_response(self, request_mock): + def _mock_response(mock, body={}, code=200): + result = Mock() result.content = body async def aiter_bytes(): @@ -1144,28 +1244,28 @@ async def do_stream(*args, **kwargs): async_mock = AsyncMock(side_effect=do_buffered) async_mock_stream = AsyncMock(side_effect=do_stream) - request_mock.Client().send = mocker.Mock(return_value=result) - request_mock.Client().request = mocker.Mock(return_value=result) + request_mock.Client().send = Mock(return_value=result) + request_mock.Client().request = Mock(return_value=result) request_mock.AsyncClient().send = async_mock_stream request_mock.AsyncClient().request = async_mock return result - return mock_response + return _mock_response @pytest.fixture def mock_error(self, mocker, request_mock): - def mock_error(mock): + def _mock_error(mock): # The first kind of request exceptions we catch mock.exceptions.SSLError = Exception request_mock.AsyncClient().request.side_effect = ( mock.exceptions.SSLError() ) - return mock_error + return _mock_error @pytest.fixture def check_call(self, request_mock, mocker): - def check_call( + def _check_call( mock, method, url, @@ -1190,11 +1290,11 @@ def check_call( calls = [mocker.call(*args, **kwargs) for _ in range(times)] request_mock.Client().request.assert_has_calls(calls) - return check_call + return _check_call @pytest.fixture def check_call_async(self, request_mock, mocker): - def check_call_async( + def _check_call_async( mock, method, url, @@ -1219,51 +1319,11 @@ def check_call_async( calls = [mocker.call(*args, **kwargs) for _ in range(times)] request_mock.AsyncClient().request.assert_has_calls(calls) - return check_call_async - - def make_request(self, method, url, headers, post_data, timeout=80): - client = self.REQUEST_CLIENT( - verify_ssl_certs=True, - proxy="http://slap/", - timeout=timeout, - allow_sync_methods=True, - ) - return client.request_with_retries(method, url, headers, post_data) - - def make_request_stream(self, method, url, headers, post_data, timeout=80): - client = self.REQUEST_CLIENT( - verify_ssl_certs=True, - proxy="http://slap/", - timeout=timeout, - allow_sync_methods=True, - ) - return client.request_stream_with_retries( - method, url, headers, post_data - ) - - async def make_request_async( - self, method, url, headers, post_data, timeout=80 - ): - client = self.REQUEST_CLIENT( - verify_ssl_certs=True, proxy="http://slap/", timeout=timeout - ) - return await client.request_with_retries_async( - method, url, headers, post_data - ) - - async def make_request_stream_async( - self, method, url, headers, post_data, timeout=80 - ): - client = self.REQUEST_CLIENT( - verify_ssl_certs=True, proxy="http://slap/" - ) - return await client.request_stream_with_retries_async( - method, url, headers, post_data - ) + return _check_call_async @pytest.mark.anyio async def test_request_async( - self, request_mock, mock_response, check_call_async + self, request_mock, mock_response, check_call_async, make_async_request ): mock_response(request_mock, '{"foo": "baz"}', 200) @@ -1276,7 +1336,7 @@ async def test_request_async( data = {} headers = {"my-header": "header val"} - body, code, _ = await self.make_request_async( + body, code, _ = await make_async_request( method, abs_url, headers, data ) assert code == 200 @@ -1286,7 +1346,12 @@ async def test_request_async( @pytest.mark.anyio async def test_request_stream_async( - self, mocker, request_mock, mock_response, check_call + self, + mocker, + request_mock, + mock_response, + check_call, + make_async_stream_request, ): for method in VALID_API_METHODS: mock_response(request_mock, "some streamed content", 200) @@ -1300,7 +1365,7 @@ async def test_request_stream_async( headers = {"my-header": "header val"} - stream, code, _ = await self.make_request_stream_async( + stream, code, _ = await make_async_stream_request( method, abs_url, headers, data ) @@ -1317,17 +1382,21 @@ async def test_request_stream_async( mocker.resetall() @pytest.mark.anyio - async def test_exception(self, request_mock, mock_error): + async def test_exception( + self, request_mock, mock_error, make_async_request + ): mock_error(request_mock) with pytest.raises(stripe.APIConnectionError): - await self.make_request_async("get", self.valid_url, {}, None) + await make_async_request("get", self.valid_url, {}, None) @pytest.mark.anyio - def test_timeout(self, request_mock, mock_response, check_call): + def test_timeout( + self, request_mock, mock_response, check_call, make_request + ): headers = {"my-header": "header val"} data = {} mock_response(request_mock, '{"foo": "baz"}', 200) - self.make_request("POST", self.valid_url, headers, data, timeout=5) + make_request("POST", self.valid_url, headers, data, {"timeout": 5}) check_call( request_mock, "POST", self.valid_url, data, headers, timeout=5 @@ -1335,13 +1404,13 @@ def test_timeout(self, request_mock, mock_response, check_call): @pytest.mark.anyio async def test_timeout_async( - self, request_mock, mock_response, check_call_async + self, request_mock, mock_response, check_call_async, make_async_request ): headers = {"my-header": "header val"} data = {} mock_response(request_mock, '{"foo": "baz"}', 200) - await self.make_request_async( - "POST", self.valid_url, headers, data, timeout=5 + await make_async_request( + "POST", self.valid_url, headers, data, {"timeout": 5} ) check_call_async( @@ -1349,20 +1418,20 @@ async def test_timeout_async( ) @pytest.mark.anyio - async def test_request_stream_forwards_stream_param( - self, mocker, request_mock, mock_response, check_call - ): + async def test_request_stream_forwards_stream_param(self): # TODO pass def test_allow_sync_methods(self, request_mock, mock_response): - client = self.REQUEST_CLIENT() + client = self.REQUEST_CLIENT(_lib=request_mock) assert client._client is None with pytest.raises(RuntimeError): client.request("GET", "http://foo", {}) with pytest.raises(RuntimeError): client.request_stream("GET", "http://foo", {}) - client = self.REQUEST_CLIENT(allow_sync_methods=True) + client = self.REQUEST_CLIENT( + allow_sync_methods=True, _lib=request_mock + ) assert client._client is not None mock_response(request_mock, '{"foo": "baz"}', 200) client.request("GET", "http://foo", {}) @@ -1372,46 +1441,54 @@ def test_allow_sync_methods(self, request_mock, mock_response): class TestHTTPXClientRetryBehavior(TestHTTPXClient): responses = None + max_retries = 3 + ALWAYS_INIT_CLIENT = True @pytest.fixture - def mock_retry(self, mocker, request_mock): - def mock_retry( + def mock_retry(self, mocked_request_lib): + def _mock_retry( retry_error_num=0, no_retry_error_num=0, responses=None ): + # Store the mocked request lib for use in make_client + if responses is None: responses = [] # Mocking classes of exception we catch. Any group of exceptions # with the same inheritance pattern will work request_root_error_class = Exception - request_mock.exceptions.RequestException = request_root_error_class + mocked_request_lib.exceptions.RequestException = ( + request_root_error_class + ) no_retry_parent_class = LookupError no_retry_child_class = KeyError - request_mock.exceptions.SSLError = no_retry_parent_class + mocked_request_lib.exceptions.SSLError = no_retry_parent_class no_retry_errors = [no_retry_child_class()] * no_retry_error_num retry_parent_class = EnvironmentError retry_child_class = IOError - request_mock.exceptions.Timeout = retry_parent_class - request_mock.exceptions.ConnectionError = retry_parent_class + mocked_request_lib.exceptions.Timeout = retry_parent_class + mocked_request_lib.exceptions.ConnectionError = retry_parent_class retry_errors = [retry_child_class()] * retry_error_num # Include mock responses as possible side-effects # to simulate returning proper results after some exceptions results = retry_errors + no_retry_errors + responses - request_mock.AsyncClient().request = AsyncMock(side_effect=results) + mocked_request_lib.AsyncClient().request = AsyncMock( + side_effect=results + ) self.responses = results - return request_mock + return mocked_request_lib - return mock_retry + return _mock_retry @pytest.fixture def check_call_numbers(self, check_call_async): valid_url = self.valid_url - def check_call_numbers(times, is_streaming=False): + def _check_call_numbers(times, is_streaming=False): check_call_async( None, "GET", @@ -1422,43 +1499,16 @@ def check_call_numbers(times, is_streaming=False): is_streaming=is_streaming, ) - return check_call_numbers - - def max_retries(self): - return 3 + return _check_call_numbers - def make_client(self, **kwargs): - client = self.REQUEST_CLIENT( - verify_ssl_certs=True, timeout=80, proxy="http://slap/", **kwargs - ) - # Override sleep time to speed up tests - client._sleep_time_seconds = lambda num_retries, response=None: 0.0001 - # Override configured max retries - return client - - def make_request(self, *args, **kwargs): - client = self.make_client(allow_sync_methods=True) - return client.request_with_retries( - "GET", self.valid_url, {}, None, self.max_retries() - ) - - def make_request_stream(self, *args, **kwargs): - client = self.make_client(allow_sync_methods=True) - return client.request_stream_with_retries( - "GET", self.valid_url, {}, None, self.max_retries() - ) - - async def make_request_async(self, *args, **kwargs): - client = self.make_client() - return await client.request_with_retries_async( - "GET", self.valid_url, {}, None, self.max_retries() - ) + @pytest.fixture + def make_async_request_with_args(self, make_async_request): + async def _make_async_request(): + return await make_async_request( + "GET", self.valid_url, {}, None, max_retries=self.max_retries + ) - async def make_request_stream_async(self, *args, **kwargs): - client = self.make_client() - return await client.request_stream_with_retries_async( - "GET", self.valid_url, {}, None, self.max_retries() - ) + return _make_async_request @pytest.mark.anyio async def test_retry_error_until_response( @@ -1467,38 +1517,42 @@ async def test_retry_error_until_response( mock_response, check_call_numbers, request_mock, - mocker, + make_async_request_with_args, ): mock_retry( retry_error_num=1, responses=[mock_response(request_mock, code=202)], ) - _, code, _ = await self.make_request_async() + _, code, _ = await make_async_request_with_args() assert code == 202 check_call_numbers(2) @pytest.mark.anyio async def test_retry_error_until_exceeded( - self, mock_retry, mock_response, check_call_numbers + self, mock_retry, make_async_request_with_args, check_call_numbers ): - mock_retry(retry_error_num=self.max_retries()) + mock_retry(retry_error_num=3) with pytest.raises(stripe.APIConnectionError): - await self.make_request_async() - - check_call_numbers(self.max_retries()) + await make_async_request_with_args() + check_call_numbers(self.max_retries) @pytest.mark.anyio async def test_no_retry_error( - self, mock_retry, mock_response, check_call_numbers + self, mock_retry, make_async_request_with_args, check_call_numbers ): - mock_retry(no_retry_error_num=self.max_retries()) + mock_retry(no_retry_error_num=self.max_retries) with pytest.raises(stripe.APIConnectionError): - await self.make_request_async() + await make_async_request_with_args() check_call_numbers(1) @pytest.mark.anyio async def test_retry_codes( - self, mock_retry, mock_response, request_mock, check_call_numbers + self, + mock_retry, + mock_response, + make_async_request_with_args, + request_mock, + check_call_numbers, ): mock_retry( responses=[ @@ -1506,32 +1560,35 @@ async def test_retry_codes( mock_response(request_mock, code=202), ] ) - _, code, _ = await self.make_request_async() + _, code, _ = await make_async_request_with_args() assert code == 202 check_call_numbers(2) @pytest.mark.anyio async def test_retry_codes_until_exceeded( - self, mock_retry, mock_response, request_mock, check_call_numbers + self, + mock_retry, + mock_response, + make_async_request_with_args, + request_mock, + check_call_numbers, ): mock_retry( responses=[mock_response(request_mock, code=409)] - * (self.max_retries() + 1) + * (self.max_retries + 1) ) - _, code, _ = await self.make_request_async() + _, code, _ = await make_async_request_with_args() assert code == 409 - check_call_numbers(self.max_retries() + 1) + check_call_numbers(self.max_retries + 1) @pytest.fixture - def connection_error(self): - client = self.REQUEST_CLIENT() - - def connection_error(given_exception): + def connection_error(self, client): + def _connection_error(given_exception): with pytest.raises(stripe.APIConnectionError) as error: client._handle_request_error(given_exception) return error.value - return connection_error + return _connection_error def test_handle_request_error_should_retry( self, connection_error, mock_retry @@ -1558,13 +1615,14 @@ def test_timeout_async(self): pass -class TestAIOHTTPClient(StripeClientTestCase, ClientTestBase): +class TestAIOHTTPClient(ClientTestBase): REQUEST_CLIENT: Type[_http_client.AIOHTTPClient] = ( _http_client.AIOHTTPClient ) + PROXY = "http://slap/" @pytest.fixture - def mock_response(self, mocker, request_mock): + def mock_response(self, mocker, mocked_request_lib): def mock_response(mock, body={}, code=200): class Content: def __aiter__(self): @@ -1588,7 +1646,7 @@ def __init__(self): result = Result() - request_mock.ClientSession().request = AsyncMock( + mocked_request_lib.ClientSession().request = AsyncMock( return_value=result ) return result @@ -1596,18 +1654,18 @@ def __init__(self): return mock_response @pytest.fixture - def mock_error(self, mocker, request_mock): + def mock_error(self, mocker, mocked_request_lib): def mock_error(mock): # The first kind of request exceptions we catch mock.exceptions.SSLError = Exception - request_mock.ClientSession().request.side_effect = ( + mocked_request_lib.ClientSession().request.side_effect = ( mock.exceptions.SSLError() ) return mock_error @pytest.fixture - def check_call(self, request_mock, mocker): + def check_call(self, mocked_request_lib, mocker): def check_call( mock, method, @@ -1631,14 +1689,13 @@ def check_call( kwargs["stream"] = True calls = [mocker.call(*args, **kwargs) for _ in range(times)] - request_mock.ClientSession().request.assert_has_calls(calls) + mocked_request_lib.ClientSession().request.assert_has_calls(calls) return check_call @pytest.fixture - def check_call_async(self, request_mock, mocker): + def check_call_async(self, mocked_request_lib, mocker): def check_call_async( - mock, method, url, post_data, @@ -1657,33 +1714,10 @@ def check_call_async( } calls = [mocker.call(*args, **kwargs) for _ in range(times)] - request_mock.ClientSession().request.assert_has_calls(calls) + mocked_request_lib.ClientSession().request.assert_has_calls(calls) return check_call_async - def make_request(self, method, url, headers, post_data, timeout=80): - pass - - async def make_request_async( - self, method, url, headers, post_data, timeout=80 - ): - client = self.REQUEST_CLIENT( - verify_ssl_certs=True, proxy="http://slap/", timeout=timeout - ) - return await client.request_with_retries_async( - method, url, headers, post_data - ) - - async def make_request_stream_async( - self, method, url, headers, post_data, timeout=80 - ): - client = self.REQUEST_CLIENT( - verify_ssl_certs=True, proxy="http://slap/" - ) - return await client.request_stream_with_retries_async( - method, url, headers, post_data - ) - def test_request(self): pass @@ -1693,9 +1727,13 @@ def test_request_stream(self): @pytest.mark.parametrize("anyio_backend", ["asyncio"]) @pytest.mark.anyio async def test_request_async( - self, request_mock, mock_response, check_call_async + self, + mocked_request_lib, + mock_response, + check_call_async, + make_async_request, ): - mock_response(request_mock, '{"foo": "baz"}', 200) + mock_response(mocked_request_lib, '{"foo": "baz"}', 200) for method in VALID_API_METHODS: abs_url = self.valid_url @@ -1706,21 +1744,24 @@ async def test_request_async( data = {} headers = {"my-header": "header val"} - body, code, _ = await self.make_request_async( + body, code, _ = await make_async_request( method, abs_url, headers, data ) assert code == 200 assert body == '{"foo": "baz"}' - check_call_async(request_mock, method, abs_url, data, headers) + check_call_async(method, abs_url, data, headers) @pytest.mark.parametrize("anyio_backend", ["asyncio"]) @pytest.mark.anyio async def test_request_stream_async( - self, mocker, request_mock, mock_response, check_call + self, + mocked_request_lib, + mock_response, + make_async_stream_request, ): for method in VALID_API_METHODS: - mock_response(request_mock, "some streamed content", 200) + mock_response(mocked_request_lib, "some streamed content", 200) abs_url = self.valid_url data = "" @@ -1731,7 +1772,7 @@ async def test_request_stream_async( headers = {"my-header": "header val"} - stream, code, _ = await self.make_request_stream_async( + stream, code, _ = await make_async_stream_request( method, abs_url, headers, data ) @@ -1745,81 +1786,92 @@ async def test_request_stream_async( assert body_content == "some streamed content" - mocker.resetall() - @pytest.mark.parametrize("anyio_backend", ["asyncio"]) @pytest.mark.anyio - async def test_exception(self, request_mock, mock_error): - mock_error(request_mock) + async def test_exception( + self, mocked_request_lib, mock_error, make_async_request + ): + mock_error(mocked_request_lib) with pytest.raises(stripe.APIConnectionError): - await self.make_request_async("get", self.valid_url, {}, None) + await make_async_request("get", self.valid_url, {}, None) - def test_timeout( - self, request_mock, mock_response, check_call, anyio_backend - ): + def test_timeout(self): pass @pytest.mark.parametrize("anyio_backend", ["asyncio"]) @pytest.mark.anyio async def test_timeout_async( - self, request_mock, mock_response, check_call_async + self, + mocked_request_lib, + mock_response, + check_call_async, + make_async_request, ): headers = {"my-header": "header val"} data = {} - mock_response(request_mock, '{"foo": "baz"}', 200) - await self.make_request_async( - "POST", self.valid_url, headers, data, timeout=5 + mock_response(mocked_request_lib, '{"foo": "baz"}', 200) + await make_async_request( + "POST", self.valid_url, headers, data, client_kwargs={"timeout": 5} ) check_call_async( - request_mock, "POST", self.valid_url, data, headers, timeout=5 + "POST", + self.valid_url, + data, + headers, + timeout=5, ) @pytest.mark.parametrize("anyio_backend", ["asyncio"]) @pytest.mark.anyio - async def test_request_stream_forwards_stream_param( - self, mocker, request_mock, mock_response, check_call - ): + async def test_request_stream_forwards_stream_param(self): # TODO pass class TestAIOHTTPClientRetryBehavior(TestAIOHTTPClient): responses = None + _mocked_request_lib = None + max_retries = 3 @pytest.fixture - def mock_retry(self, mocker, request_mock): + def mock_retry(self, mocked_request_lib): def mock_retry( retry_error_num=0, no_retry_error_num=0, responses=None ): + # Store the mocked request lib for use in make_client + self._mocked_request_lib = mocked_request_lib + if responses is None: responses = [] # Mocking classes of exception we catch. Any group of exceptions # with the same inheritance pattern will work request_root_error_class = Exception - request_mock.exceptions.RequestException = request_root_error_class + mocked_request_lib.exceptions.RequestException = ( + request_root_error_class + ) no_retry_parent_class = LookupError no_retry_child_class = KeyError - request_mock.exceptions.SSLError = no_retry_parent_class + mocked_request_lib.exceptions.SSLError = no_retry_parent_class no_retry_errors = [no_retry_child_class()] * no_retry_error_num retry_parent_class = EnvironmentError retry_child_class = IOError - request_mock.exceptions.Timeout = retry_parent_class - request_mock.exceptions.ConnectionError = retry_parent_class + mocked_request_lib.exceptions.Timeout = retry_parent_class + mocked_request_lib.exceptions.ConnectionError = retry_parent_class retry_errors = [retry_child_class()] * retry_error_num # Include mock responses as possible side-effects # to simulate returning proper results after some exceptions results = retry_errors + no_retry_errors + responses - request_mock.ClientSession().request = AsyncMock( + mocked_request_lib.ClientSession().request = AsyncMock( side_effect=results ) self.responses = results - return request_mock + return mocked_request_lib return mock_retry @@ -1829,7 +1881,6 @@ def check_call_numbers(self, check_call_async): def check_call_numbers(times, is_streaming=False): check_call_async( - None, "GET", valid_url, None, @@ -1840,35 +1891,14 @@ def check_call_numbers(times, is_streaming=False): return check_call_numbers - def max_retries(self): - return 3 - - def make_client(self): - client = self.REQUEST_CLIENT( - verify_ssl_certs=True, timeout=80, proxy="http://slap/" - ) - # Override sleep time to speed up tests - client._sleep_time_seconds = lambda num_retries, response=None: 0.0001 - # Override configured max retries - return client - - def make_request(self, *args, **kwargs): - pass - - def make_request_stream(self, *args, **kwargs): - pass - - async def make_request_async(self, *args, **kwargs): - client = self.make_client() - return await client.request_with_retries_async( - "GET", self.valid_url, {}, None, self.max_retries() - ) + @pytest.fixture + def make_async_request_with_args(self, make_async_request): + async def _make_async_request(): + return await make_async_request( + "GET", self.valid_url, {}, None, max_retries=self.max_retries + ) - async def make_request_stream_async(self, *args, **kwargs): - client = self.make_client() - return await client.request_stream_with_retries_async( - "GET", self.valid_url, {}, None, self.max_retries() - ) + return _make_async_request @pytest.mark.parametrize("anyio_backend", ["asyncio"]) @pytest.mark.anyio @@ -1877,65 +1907,75 @@ async def test_retry_error_until_response( mock_retry, mock_response, check_call_numbers, - request_mock, - mocker, + mocked_request_lib, + make_async_request_with_args, ): mock_retry( retry_error_num=1, - responses=[mock_response(request_mock, code=202)], + responses=[mock_response(mocked_request_lib, code=202)], ) - _, code, _ = await self.make_request_async() + _, code, _ = await make_async_request_with_args() assert code == 202 check_call_numbers(2) @pytest.mark.parametrize("anyio_backend", ["asyncio"]) @pytest.mark.anyio async def test_retry_error_until_exceeded( - self, mock_retry, mock_response, check_call_numbers + self, mock_retry, check_call_numbers, make_async_request_with_args ): - mock_retry(retry_error_num=self.max_retries()) + mock_retry(retry_error_num=self.max_retries) with pytest.raises(stripe.APIConnectionError): - await self.make_request_async() + await make_async_request_with_args() - check_call_numbers(self.max_retries()) + check_call_numbers(self.max_retries) @pytest.mark.parametrize("anyio_backend", ["asyncio"]) @pytest.mark.anyio async def test_no_retry_error( - self, mock_retry, mock_response, check_call_numbers + self, mock_retry, check_call_numbers, make_async_request_with_args ): - mock_retry(no_retry_error_num=self.max_retries()) + mock_retry(no_retry_error_num=self.max_retries) with pytest.raises(stripe.APIConnectionError): - await self.make_request_async() + await make_async_request_with_args() check_call_numbers(1) @pytest.mark.parametrize("anyio_backend", ["asyncio"]) @pytest.mark.anyio async def test_retry_codes( - self, mock_retry, mock_response, request_mock, check_call_numbers + self, + mock_retry, + mock_response, + mocked_request_lib, + check_call_numbers, + make_async_request_with_args, ): mock_retry( responses=[ - mock_response(request_mock, code=409), - mock_response(request_mock, code=202), + mock_response(mocked_request_lib, code=409), + mock_response(mocked_request_lib, code=202), ] ) - _, code, _ = await self.make_request_async() + _, code, _ = await make_async_request_with_args() assert code == 202 check_call_numbers(2) @pytest.mark.parametrize("anyio_backend", ["asyncio"]) @pytest.mark.anyio async def test_retry_codes_until_exceeded( - self, mock_retry, mock_response, request_mock, check_call_numbers + self, + mock_retry, + mock_response, + mocked_request_lib, + check_call_numbers, + make_async_request_with_args, ): mock_retry( - responses=[mock_response(request_mock, code=409)] - * (self.max_retries() + 1) + responses=[mock_response(mocked_request_lib, code=409)] + * (self.max_retries + 1) ) - _, code, _ = await self.make_request_async() + _, code, _ = await make_async_request_with_args() assert code == 409 - check_call_numbers(self.max_retries() + 1) + check_call_numbers(self.max_retries + 1) def connection_error(self, client, given_exception): with pytest.raises(stripe.APIConnectionError) as error: @@ -1948,15 +1988,15 @@ async def test_handle_request_error_should_retry( self, mock_retry, anyio_backend ): client = self.REQUEST_CLIENT() - request_mock = mock_retry() + mocked_request_lib = mock_retry() error = self.connection_error( - client, request_mock.exceptions.Timeout() + client, mocked_request_lib.exceptions.Timeout() ) assert error.should_retry error = self.connection_error( - client, request_mock.exceptions.ConnectionError() + client, mocked_request_lib.exceptions.ConnectionError() ) assert error.should_retry