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/CHANGELOG.md b/CHANGELOG.md index f1b71f586..f9ad8eb98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,31 @@ This release changes the pinned API version to `2025-07-30.preview`. * Remove support for thin event `V2CoreAccountLinkCompletedEvent` * Remove support for thin event `V2OffSessionPaymentRequiresCaptureEvent` with related object `v2.payments.OffSessionPayment` +## 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.4.0b2 - 2025-07-09 * [#1536](https://github.com/stripe/stripe-python/pull/1536) Pull in V2 FinancialAccount changes for June release * Add support for `close` and `create` methods on resource `v2.money_management.FinancialAccount` @@ -86,6 +111,8 @@ This release changes the pinned API version to `2025-06-30.preview`. * Remove support for error code `outbound_payment_recipient_email_does_not_exist` on `RecipientNotNotifiableError` ## 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` @@ -121,9 +148,6 @@ This release changes the pinned API version to `2025-06-30.preview`. * 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.3.0b2 - 2025-06-26 * [#1531](https://github.com/stripe/stripe-python/pull/1531) Pull in OffSessionPayment changes for the May release diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index c219699e3..6598803dc 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1868 +v1932 \ No newline at end of file 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/__init__.py b/stripe/__init__.py index 83deb255a..7cbb4d082 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -667,6 +667,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/_account.py b/stripe/_account.py index d4b63dc5b..53d05b814 100644 --- a/stripe/_account.py +++ b/stripe/_account.py @@ -642,7 +642,7 @@ class Verification(StripeObject): class Document(StripeObject): back: Optional[ExpandableField["File"]] """ - The back of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. + The back of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. Note that `additional_verification` files are [not downloadable](https://docs.stripe.com/file-upload#uploading-a-file). """ details: Optional[str] """ @@ -654,7 +654,7 @@ class Document(StripeObject): """ front: Optional[ExpandableField["File"]] """ - The front of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. + The front of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. Note that `additional_verification` files are [not downloadable](https://docs.stripe.com/file-upload#uploading-a-file). """ document: Document diff --git a/stripe/_account_session.py b/stripe/_account_session.py index ebd755e3d..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 @@ -367,6 +378,28 @@ 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 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 @@ -432,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] @@ -447,6 +481,8 @@ class Features(StripeObject): payment_details: PaymentDetails payment_disputes: PaymentDisputes payments: Payments + payout_details: PayoutDetails + payout_reconciliation_report: PayoutReconciliationReport payouts: Payouts payouts_list: PayoutsList tax_registrations: TaxRegistrations @@ -454,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, @@ -469,6 +506,8 @@ class Features(StripeObject): "payment_details": PaymentDetails, "payment_disputes": PaymentDisputes, "payments": Payments, + "payout_details": PayoutDetails, + "payout_reconciliation_report": PayoutReconciliationReport, "payouts": Payouts, "payouts_list": PayoutsList, "tax_registrations": TaxRegistrations, @@ -514,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. @@ -618,6 +663,18 @@ 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. + """ + 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. @@ -745,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 """ @@ -788,7 +860,7 @@ class CreateParamsComponentsCapitalFinancing(TypedDict): "AccountSession.CreateParamsComponentsCapitalFinancingFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsCapitalFinancingApplication(TypedDict): @@ -800,7 +872,7 @@ class CreateParamsComponentsCapitalFinancingApplication(TypedDict): "AccountSession.CreateParamsComponentsCapitalFinancingApplicationFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsCapitalFinancingApplicationFeatures(TypedDict): @@ -818,7 +890,7 @@ class CreateParamsComponentsCapitalFinancingPromotion(TypedDict): "AccountSession.CreateParamsComponentsCapitalFinancingPromotionFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsCapitalFinancingPromotionFeatures(TypedDict): @@ -833,7 +905,7 @@ class CreateParamsComponentsCapitalOverview(TypedDict): "AccountSession.CreateParamsComponentsCapitalOverviewFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsCapitalOverviewFeatures(TypedDict): @@ -878,7 +950,7 @@ class CreateParamsComponentsDocuments(TypedDict): "AccountSession.CreateParamsComponentsDocumentsFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsDocumentsFeatures(TypedDict): @@ -893,7 +965,7 @@ class CreateParamsComponentsExportTaxTransactions(TypedDict): "AccountSession.CreateParamsComponentsExportTaxTransactionsFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsExportTaxTransactionsFeatures(TypedDict): @@ -1126,7 +1198,7 @@ class CreateParamsComponentsPaymentMethodSettings(TypedDict): "AccountSession.CreateParamsComponentsPaymentMethodSettingsFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsPaymentMethodSettingsFeatures(TypedDict): @@ -1162,6 +1234,36 @@ 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 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 """ @@ -1205,7 +1307,7 @@ class CreateParamsComponentsPayoutsList(TypedDict): "AccountSession.CreateParamsComponentsPayoutsListFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsPayoutsListFeatures(TypedDict): @@ -1220,7 +1322,7 @@ class CreateParamsComponentsProductTaxCodeSelector(TypedDict): "AccountSession.CreateParamsComponentsProductTaxCodeSelectorFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsProductTaxCodeSelectorFeatures(TypedDict): @@ -1250,7 +1352,7 @@ class CreateParamsComponentsReportingChart(TypedDict): "AccountSession.CreateParamsComponentsReportingChartFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsReportingChartFeatures(TypedDict): @@ -1265,7 +1367,7 @@ class CreateParamsComponentsTaxRegistrations(TypedDict): "AccountSession.CreateParamsComponentsTaxRegistrationsFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsTaxRegistrationsFeatures(TypedDict): @@ -1280,7 +1382,7 @@ class CreateParamsComponentsTaxSettings(TypedDict): "AccountSession.CreateParamsComponentsTaxSettingsFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsTaxSettingsFeatures(TypedDict): @@ -1295,7 +1397,7 @@ class CreateParamsComponentsTaxThresholdMonitoring(TypedDict): "AccountSession.CreateParamsComponentsTaxThresholdMonitoringFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsTaxThresholdMonitoringFeatures(TypedDict): diff --git a/stripe/_account_session_service.py b/stripe/_account_session_service.py index b09ad5429..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" ] @@ -155,6 +161,18 @@ 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. + """ + 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" ] @@ -284,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 """ @@ -327,7 +360,7 @@ class CreateParamsComponentsCapitalFinancing(TypedDict): "AccountSessionService.CreateParamsComponentsCapitalFinancingFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsCapitalFinancingApplication(TypedDict): @@ -339,7 +372,7 @@ class CreateParamsComponentsCapitalFinancingApplication(TypedDict): "AccountSessionService.CreateParamsComponentsCapitalFinancingApplicationFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsCapitalFinancingApplicationFeatures(TypedDict): @@ -357,7 +390,7 @@ class CreateParamsComponentsCapitalFinancingPromotion(TypedDict): "AccountSessionService.CreateParamsComponentsCapitalFinancingPromotionFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsCapitalFinancingPromotionFeatures(TypedDict): @@ -372,7 +405,7 @@ class CreateParamsComponentsCapitalOverview(TypedDict): "AccountSessionService.CreateParamsComponentsCapitalOverviewFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsCapitalOverviewFeatures(TypedDict): @@ -417,7 +450,7 @@ class CreateParamsComponentsDocuments(TypedDict): "AccountSessionService.CreateParamsComponentsDocumentsFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsDocumentsFeatures(TypedDict): @@ -432,7 +465,7 @@ class CreateParamsComponentsExportTaxTransactions(TypedDict): "AccountSessionService.CreateParamsComponentsExportTaxTransactionsFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsExportTaxTransactionsFeatures(TypedDict): @@ -665,7 +698,7 @@ class CreateParamsComponentsPaymentMethodSettings(TypedDict): "AccountSessionService.CreateParamsComponentsPaymentMethodSettingsFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsPaymentMethodSettingsFeatures(TypedDict): @@ -701,6 +734,36 @@ 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 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 """ @@ -744,7 +807,7 @@ class CreateParamsComponentsPayoutsList(TypedDict): "AccountSessionService.CreateParamsComponentsPayoutsListFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsPayoutsListFeatures(TypedDict): @@ -759,7 +822,7 @@ class CreateParamsComponentsProductTaxCodeSelector(TypedDict): "AccountSessionService.CreateParamsComponentsProductTaxCodeSelectorFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsProductTaxCodeSelectorFeatures(TypedDict): @@ -789,7 +852,7 @@ class CreateParamsComponentsReportingChart(TypedDict): "AccountSessionService.CreateParamsComponentsReportingChartFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsReportingChartFeatures(TypedDict): @@ -804,7 +867,7 @@ class CreateParamsComponentsTaxRegistrations(TypedDict): "AccountSessionService.CreateParamsComponentsTaxRegistrationsFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsTaxRegistrationsFeatures(TypedDict): @@ -819,7 +882,7 @@ class CreateParamsComponentsTaxSettings(TypedDict): "AccountSessionService.CreateParamsComponentsTaxSettingsFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsTaxSettingsFeatures(TypedDict): @@ -834,7 +897,7 @@ class CreateParamsComponentsTaxThresholdMonitoring(TypedDict): "AccountSessionService.CreateParamsComponentsTaxThresholdMonitoringFeatures" ] """ - The list of features enabled in the embedded component. + An empty list, because this embedded component has no features. """ class CreateParamsComponentsTaxThresholdMonitoringFeatures(TypedDict): 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/_api_version.py b/stripe/_api_version.py index 34623c597..7fc0ae7cc 100644 --- a/stripe/_api_version.py +++ b/stripe/_api_version.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec class _ApiVersion: - CURRENT = "2025-07-30.preview" + CURRENT = "2025-08-27.preview" 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" 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: """ diff --git a/stripe/_charge.py b/stripe/_charge.py index 829619d62..46b1ca40d 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 2, 3, or 4 digit 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] """ @@ -174,7 +174,7 @@ class Rule(StripeObject): """ reason: Optional[str] """ - An enumerated value providing a more detailed explanation of the outcome's `type`. Charges blocked by Radar's default block rule have the value `highest_risk_level`. Charges placed in review by Radar's default review rule have the value `elevated_risk_level`. Charges authorized, blocked, or placed in review by custom rules have the value `rule`. See [understanding declines](https://stripe.com/docs/declines) for more details. + An enumerated value providing a more detailed explanation of the outcome's `type`. Charges blocked by Radar's default block rule have the value `highest_risk_level`. Charges placed in review by Radar's default review rule have the value `elevated_risk_level`. Charges blocked because the payment is unlikely to be authorized have the value `low_probability_of_authorization`. Charges authorized, blocked, or placed in review by custom rules have the value `rule`. See [understanding declines](https://stripe.com/docs/declines) for more details. """ risk_level: Optional[str] """ @@ -308,7 +308,18 @@ class Alipay(StripeObject): """ class Alma(StripeObject): - pass + class Installments(StripeObject): + count: int + """ + The number of installments. + """ + + installments: Optional[Installments] + transaction_id: Optional[str] + """ + The Alma transaction ID associated with this payment. + """ + _inner_class_types = {"installments": Installments} class AmazonPay(StripeObject): class Funding(StripeObject): @@ -350,6 +361,10 @@ class Card(StripeObject): _inner_class_types = {"card": Card} funding: Optional[Funding] + transaction_id: Optional[str] + """ + The Amazon Pay transaction ID associated with this payment. + """ _inner_class_types = {"funding": Funding} class AuBecsDebit(StripeObject): @@ -425,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] @@ -1442,6 +1460,10 @@ class KakaoPay(StripeObject): """ A unique identifier for the buyer as determined by the local payment processor. """ + transaction_id: Optional[str] + """ + The Kakao Pay transaction ID associated with this payment. + """ class Klarna(StripeObject): class PayerDetails(StripeObject): @@ -1526,6 +1548,10 @@ class KrCard(StripeObject): """ The last four digits of the card. This may not be present for American Express cards. """ + transaction_id: Optional[str] + """ + The Korean Card transaction ID associated with this payment. + """ class Link(StripeObject): country: Optional[str] @@ -1581,6 +1607,10 @@ class NaverPay(StripeObject): """ A unique identifier for the buyer as determined by the local payment processor. """ + transaction_id: Optional[str] + """ + The Naver Pay transaction ID associated with this payment. + """ class NzBankAccount(StripeObject): account_holder_name: Optional[str] @@ -1667,8 +1697,20 @@ class Payco(StripeObject): """ A unique identifier for the buyer as determined by the local payment processor. """ + transaction_id: Optional[str] + """ + The Payco transaction ID associated with this payment. + """ 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 @@ -1818,6 +1860,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] @@ -1871,6 +1917,10 @@ class Card(StripeObject): _inner_class_types = {"card": Card} funding: Optional[Funding] + transaction_id: Optional[str] + """ + The Revolut Pay transaction ID associated with this payment. + """ _inner_class_types = {"funding": Funding} class SamsungPay(StripeObject): @@ -1878,9 +1928,16 @@ class SamsungPay(StripeObject): """ A unique identifier for the buyer as determined by the local payment processor. """ + transaction_id: Optional[str] + """ + The Samsung Pay transaction ID associated with this payment. + """ 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/_credit_note.py b/stripe/_credit_note.py index 8044d6640..23c69be7c 100644 --- a/stripe/_credit_note.py +++ b/stripe/_credit_note.py @@ -320,7 +320,7 @@ class CreateParamsRefund(TypedDict): """ refund: NotRequired[str] """ - ID of an existing refund to link this credit note to. + ID of an existing refund to link this credit note to. Required when `type` is `refund`. """ class CreateParamsShippingCost(TypedDict): @@ -551,7 +551,7 @@ class PreviewLinesParamsRefund(TypedDict): """ refund: NotRequired[str] """ - ID of an existing refund to link this credit note to. + ID of an existing refund to link this credit note to. Required when `type` is `refund`. """ class PreviewLinesParamsShippingCost(TypedDict): @@ -686,7 +686,7 @@ class PreviewParamsRefund(TypedDict): """ refund: NotRequired[str] """ - ID of an existing refund to link this credit note to. + ID of an existing refund to link this credit note to. Required when `type` is `refund`. """ class PreviewParamsShippingCost(TypedDict): diff --git a/stripe/_credit_note_preview_lines_service.py b/stripe/_credit_note_preview_lines_service.py index e897ed45f..7d35b2e3c 100644 --- a/stripe/_credit_note_preview_lines_service.py +++ b/stripe/_credit_note_preview_lines_service.py @@ -153,7 +153,7 @@ class ListParamsRefund(TypedDict): """ refund: NotRequired[str] """ - ID of an existing refund to link this credit note to. + ID of an existing refund to link this credit note to. Required when `type` is `refund`. """ class ListParamsShippingCost(TypedDict): diff --git a/stripe/_credit_note_service.py b/stripe/_credit_note_service.py index ab87ed277..e78cbe294 100644 --- a/stripe/_credit_note_service.py +++ b/stripe/_credit_note_service.py @@ -147,7 +147,7 @@ class CreateParamsRefund(TypedDict): """ refund: NotRequired[str] """ - ID of an existing refund to link this credit note to. + ID of an existing refund to link this credit note to. Required when `type` is `refund`. """ class CreateParamsShippingCost(TypedDict): @@ -336,7 +336,7 @@ class PreviewParamsRefund(TypedDict): """ refund: NotRequired[str] """ - ID of an existing refund to link this credit note to. + ID of an existing refund to link this credit note to. Required when `type` is `refund`. """ class PreviewParamsShippingCost(TypedDict): 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/_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 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/_file.py b/stripe/_file.py index 4566d2347..87bf9cdc4 100644 --- a/stripe/_file.py +++ b/stripe/_file.py @@ -54,6 +54,7 @@ class CreateParams(RequestOptions): "issuing_regulatory_reporting", "pci_document", "tax_document_user_upload", + "terminal_android_apk", "terminal_reader_splashscreen", ] """ @@ -63,7 +64,7 @@ class CreateParams(RequestOptions): class CreateParamsFileLinkData(TypedDict): create: bool """ - Set this to `true` to create a file link for the newly created file. Creating a link is only possible when the file's `purpose` is one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `issuing_regulatory_reporting`, `pci_document`, `tax_document_user_upload`, or `terminal_reader_splashscreen`. + Set this to `true` to create a file link for the newly created file. Creating a link is only possible when the file's `purpose` is one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `issuing_regulatory_reporting`, `pci_document`, `tax_document_user_upload`, `terminal_android_apk`, or `terminal_reader_splashscreen`. """ expires_at: NotRequired[int] """ @@ -109,6 +110,7 @@ class ListParams(RequestOptions): "selfie", "sigma_scheduled_query", "tax_document_user_upload", + "terminal_android_apk", "terminal_reader_splashscreen", ] ] @@ -185,6 +187,7 @@ class RetrieveParams(RequestOptions): "selfie", "sigma_scheduled_query", "tax_document_user_upload", + "terminal_android_apk", "terminal_reader_splashscreen", ] """ diff --git a/stripe/_file_link.py b/stripe/_file_link.py index 824af7dce..b1e5a103d 100644 --- a/stripe/_file_link.py +++ b/stripe/_file_link.py @@ -44,7 +44,7 @@ class CreateParams(RequestOptions): """ file: str """ - The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `financial_account_statement`, `identity_document_downloadable`, `issuing_regulatory_reporting`, `pci_document`, `selfie`, `sigma_scheduled_query`, `tax_document_user_upload`, or `terminal_reader_splashscreen`. + The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `financial_account_statement`, `identity_document_downloadable`, `issuing_regulatory_reporting`, `pci_document`, `selfie`, `sigma_scheduled_query`, `tax_document_user_upload`, `terminal_android_apk`, or `terminal_reader_splashscreen`. """ metadata: NotRequired["Literal['']|Dict[str, str]"] """ diff --git a/stripe/_file_link_service.py b/stripe/_file_link_service.py index 6b9fca0af..68bc57134 100644 --- a/stripe/_file_link_service.py +++ b/stripe/_file_link_service.py @@ -21,7 +21,7 @@ class CreateParams(TypedDict): """ file: str """ - The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `financial_account_statement`, `identity_document_downloadable`, `issuing_regulatory_reporting`, `pci_document`, `selfie`, `sigma_scheduled_query`, `tax_document_user_upload`, or `terminal_reader_splashscreen`. + The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `financial_account_statement`, `identity_document_downloadable`, `issuing_regulatory_reporting`, `pci_document`, `selfie`, `sigma_scheduled_query`, `tax_document_user_upload`, `terminal_android_apk`, or `terminal_reader_splashscreen`. """ metadata: NotRequired["Literal['']|Dict[str, str]"] """ diff --git a/stripe/_file_service.py b/stripe/_file_service.py index 2bc972f96..3054f04e0 100644 --- a/stripe/_file_service.py +++ b/stripe/_file_service.py @@ -34,6 +34,7 @@ class CreateParams(TypedDict): "issuing_regulatory_reporting", "pci_document", "tax_document_user_upload", + "terminal_android_apk", "terminal_reader_splashscreen", ] """ @@ -43,7 +44,7 @@ class CreateParams(TypedDict): class CreateParamsFileLinkData(TypedDict): create: bool """ - Set this to `true` to create a file link for the newly created file. Creating a link is only possible when the file's `purpose` is one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `issuing_regulatory_reporting`, `pci_document`, `tax_document_user_upload`, or `terminal_reader_splashscreen`. + Set this to `true` to create a file link for the newly created file. Creating a link is only possible when the file's `purpose` is one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `issuing_regulatory_reporting`, `pci_document`, `tax_document_user_upload`, `terminal_android_apk`, or `terminal_reader_splashscreen`. """ expires_at: NotRequired[int] """ @@ -89,6 +90,7 @@ class ListParams(TypedDict): "selfie", "sigma_scheduled_query", "tax_document_user_upload", + "terminal_android_apk", "terminal_reader_splashscreen", ] ] 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/stripe/_invoice.py b/stripe/_invoice.py index 4d2f7dd81..b9aabd667 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", @@ -480,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", @@ -623,7 +625,7 @@ class LastFinalizationError(StripeObject): """ network_decline_code: Optional[str] """ - For card errors resulting from a card issuer decline, a brand specific 2, 3, or 4 digit code which indicates the reason the authorization failed. + For payments declined by the network, an alphanumeric code which indicates the reason the payment failed. """ param: Optional[str] """ @@ -3600,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. @@ -3671,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_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/_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/_mandate.py b/stripe/_mandate.py index 288bd567f..f2ba85c22 100644 --- a/stripe/_mandate.py +++ b/stripe/_mandate.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec -from stripe._api_resource import APIResource from stripe._expandable_field import ExpandableField +from stripe._list_object import ListObject +from stripe._listable_api_resource import ListableAPIResource from stripe._request_options import RequestOptions from stripe._stripe_object import StripeObject from typing import ClassVar, List, Optional @@ -11,7 +12,7 @@ from stripe._payment_method import PaymentMethod -class Mandate(APIResource["Mandate"]): +class Mandate(ListableAPIResource["Mandate"]): """ A Mandate is a record of the permission that your customer gives you to debit their payment method. """ @@ -45,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): @@ -199,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 @@ -232,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 @@ -254,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, @@ -269,6 +309,33 @@ class SingleUse(StripeObject): The currency of the payment on a single use mandate. """ + class ListParams(RequestOptions): + ending_before: NotRequired[str] + """ + A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + """ + expand: NotRequired[List[str]] + """ + 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. + """ + on_behalf_of: NotRequired[str] + """ + The Stripe account ID that the mandates are intended for. Learn more about the [use case for connected accounts payments](https://stripe.com/docs/payments/connected-accounts). + """ + payment_method: str + starting_after: NotRequired[str] + """ + A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + """ + status: Literal["active", "inactive", "pending"] + """ + The status of the mandates to retrieve. Status indicates whether or not you can use it to initiate a payment, and can have a value of `active`, `pending`, or `inactive`. + """ + class RetrieveParams(RequestOptions): expand: NotRequired[List[str]] """ @@ -308,6 +375,46 @@ class RetrieveParams(RequestOptions): The type of the mandate. """ + @classmethod + def list( + cls, **params: Unpack["Mandate.ListParams"] + ) -> ListObject["Mandate"]: + """ + Retrieves a list of Mandates for a given PaymentMethod. + """ + result = cls._static_request( + "get", + cls.class_url(), + params=params, + ) + if not isinstance(result, ListObject): + raise TypeError( + "Expected list object from API, got %s" + % (type(result).__name__) + ) + + return result + + @classmethod + async def list_async( + cls, **params: Unpack["Mandate.ListParams"] + ) -> ListObject["Mandate"]: + """ + Retrieves a list of Mandates for a given PaymentMethod. + """ + result = await cls._static_request_async( + "get", + cls.class_url(), + params=params, + ) + if not isinstance(result, ListObject): + raise TypeError( + "Expected list object from API, got %s" + % (type(result).__name__) + ) + + return result + @classmethod def retrieve( cls, id: str, **params: Unpack["Mandate.RetrieveParams"] diff --git a/stripe/_mandate_service.py b/stripe/_mandate_service.py index a8d603563..93f2777dc 100644 --- a/stripe/_mandate_service.py +++ b/stripe/_mandate_service.py @@ -1,20 +1,82 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe._list_object import ListObject from stripe._mandate import Mandate from stripe._request_options import RequestOptions from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import List, cast -from typing_extensions import NotRequired, TypedDict +from typing_extensions import Literal, NotRequired, TypedDict class MandateService(StripeService): + class ListParams(TypedDict): + ending_before: NotRequired[str] + """ + A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + """ + expand: NotRequired[List[str]] + """ + 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. + """ + on_behalf_of: NotRequired[str] + """ + The Stripe account ID that the mandates are intended for. Learn more about the [use case for connected accounts payments](https://stripe.com/docs/payments/connected-accounts). + """ + payment_method: str + starting_after: NotRequired[str] + """ + A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + """ + status: Literal["active", "inactive", "pending"] + """ + The status of the mandates to retrieve. Status indicates whether or not you can use it to initiate a payment, and can have a value of `active`, `pending`, or `inactive`. + """ + class RetrieveParams(TypedDict): expand: NotRequired[List[str]] """ Specifies which fields in the response should be expanded. """ + def list( + self, params: "MandateService.ListParams", options: RequestOptions = {} + ) -> ListObject[Mandate]: + """ + Retrieves a list of Mandates for a given PaymentMethod. + """ + return cast( + ListObject[Mandate], + self._request( + "get", + "/v1/mandates", + base_address="api", + params=params, + options=options, + ), + ) + + async def list_async( + self, params: "MandateService.ListParams", options: RequestOptions = {} + ) -> ListObject[Mandate]: + """ + Retrieves a list of Mandates for a given PaymentMethod. + """ + return cast( + ListObject[Mandate], + await self._request_async( + "get", + "/v1/mandates", + base_address="api", + params=params, + options=options, + ), + ) + def retrieve( self, mandate: str, diff --git a/stripe/_payment_attempt_record.py b/stripe/_payment_attempt_record.py index 206349a1a..16a467590 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): @@ -193,7 +223,18 @@ class Alipay(StripeObject): """ class Alma(StripeObject): - pass + class Installments(StripeObject): + count: int + """ + The number of installments. + """ + + installments: Optional[Installments] + transaction_id: Optional[str] + """ + The Alma transaction ID associated with this payment. + """ + _inner_class_types = {"installments": Installments} class AmazonPay(StripeObject): class Funding(StripeObject): @@ -235,6 +276,10 @@ class Card(StripeObject): _inner_class_types = {"card": Card} funding: Optional[Funding] + transaction_id: Optional[str] + """ + The Amazon Pay transaction ID associated with this payment. + """ _inner_class_types = {"funding": Funding} class AuBecsDebit(StripeObject): @@ -310,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): @@ -1049,6 +1097,10 @@ class KakaoPay(StripeObject): """ A unique identifier for the buyer as determined by the local payment processor. """ + transaction_id: Optional[str] + """ + The Kakao Pay transaction ID associated with this payment. + """ class Klarna(StripeObject): class PayerDetails(StripeObject): @@ -1133,6 +1185,10 @@ class KrCard(StripeObject): """ The last four digits of the card. This may not be present for American Express cards. """ + transaction_id: Optional[str] + """ + The Korean Card transaction ID associated with this payment. + """ class Link(StripeObject): country: Optional[str] @@ -1188,6 +1244,10 @@ class NaverPay(StripeObject): """ A unique identifier for the buyer as determined by the local payment processor. """ + transaction_id: Optional[str] + """ + The Naver Pay transaction ID associated with this payment. + """ class NzBankAccount(StripeObject): account_holder_name: Optional[str] @@ -1274,8 +1334,20 @@ class Payco(StripeObject): """ A unique identifier for the buyer as determined by the local payment processor. """ + transaction_id: Optional[str] + """ + The Payco transaction ID associated with this payment. + """ 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 @@ -1425,6 +1497,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] @@ -1478,6 +1554,10 @@ class Card(StripeObject): _inner_class_types = {"card": Card} funding: Optional[Funding] + transaction_id: Optional[str] + """ + The Revolut Pay transaction ID associated with this payment. + """ _inner_class_types = {"funding": Funding} class SamsungPay(StripeObject): @@ -1485,9 +1565,16 @@ class SamsungPay(StripeObject): """ A unique identifier for the buyer as determined by the local payment processor. """ + transaction_id: Optional[str] + """ + The Samsung Pay transaction ID associated with this payment. + """ class Satispay(StripeObject): - pass + transaction_id: Optional[str] + """ + The Satispay transaction ID associated with this payment. + """ class SepaCreditTransfer(StripeObject): bank_name: Optional[str] @@ -1813,6 +1900,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] @@ -1859,6 +1965,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. @@ -1870,6 +1980,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. @@ -1882,10 +2000,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. @@ -1926,9 +2052,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"] """ @@ -2002,11 +2128,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_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/_payment_intent.py b/stripe/_payment_intent.py index d9bf229f8..627adde25 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", @@ -208,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", @@ -351,7 +353,7 @@ class LastPaymentError(StripeObject): """ network_decline_code: Optional[str] """ - For card errors resulting from a card issuer decline, a brand specific 2, 3, or 4 digit code which indicates the reason the authorization failed. + For payments declined by the network, an alphanumeric code which indicates the reason the payment failed. """ param: Optional[str] """ @@ -2764,6 +2766,52 @@ 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. + """ expires_after_seconds: Optional[int] """ The number of seconds (between 10 and 1209600) after which Pix payment will expire. @@ -2772,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. @@ -2782,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"]] @@ -7930,6 +7980,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. @@ -7938,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. @@ -7951,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 40000. + """ + 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"]] """ @@ -8426,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. @@ -12123,6 +12283,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. @@ -12131,7 +12295,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. @@ -12144,6 +12314,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 40000. + """ + 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"]] """ @@ -16654,6 +16860,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. @@ -16662,7 +16872,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. @@ -16675,6 +16891,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 40000. + """ + 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"]] """ @@ -17235,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 4871da2b4..660532bcd 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. @@ -4743,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. @@ -4756,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 40000. + """ + 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"]] """ @@ -5233,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. @@ -8982,6 +9092,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. @@ -8990,7 +9104,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. @@ -9003,6 +9123,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 40000. + """ + 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"]] """ @@ -13603,6 +13759,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. @@ -13611,7 +13771,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. @@ -13624,6 +13790,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 40000. + """ + 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_link.py b/stripe/_payment_link.py index 5e23ba3f0..489165a80 100644 --- a/stripe/_payment_link.py +++ b/stripe/_payment_link.py @@ -1218,7 +1218,7 @@ class CreateParamsLineItem(TypedDict): """ price: NotRequired[str] """ - The ID of the [Price](https://stripe.com/docs/api/prices) or [Plan](https://stripe.com/docs/api/plans) object. + The ID of the [Price](https://stripe.com/docs/api/prices) or [Plan](https://stripe.com/docs/api/plans) object. One of `price` or `price_data` is required. """ price_data: NotRequired["PaymentLink.CreateParamsLineItemPriceData"] """ diff --git a/stripe/_payment_link_service.py b/stripe/_payment_link_service.py index ae59e6980..fb0c7ea53 100644 --- a/stripe/_payment_link_service.py +++ b/stripe/_payment_link_service.py @@ -534,7 +534,7 @@ class CreateParamsLineItem(TypedDict): """ price: NotRequired[str] """ - The ID of the [Price](https://stripe.com/docs/api/prices) or [Plan](https://stripe.com/docs/api/plans) object. + The ID of the [Price](https://stripe.com/docs/api/prices) or [Plan](https://stripe.com/docs/api/plans) object. One of `price` or `price_data` is required. """ price_data: NotRequired[ "PaymentLinkService.CreateParamsLineItemPriceData" diff --git a/stripe/_payment_method.py b/stripe/_payment_method.py index 4888f3dea..d5e1226d9 100644 --- a/stripe/_payment_method.py +++ b/stripe/_payment_method.py @@ -20,6 +20,7 @@ if TYPE_CHECKING: from stripe._charge import Charge from stripe._customer import Customer + from stripe._mandate import Mandate from stripe._setup_attempt import SetupAttempt @@ -2562,6 +2563,10 @@ class RetrieveParams(RequestOptions): klarna: Optional[Klarna] konbini: Optional[Konbini] kr_card: Optional[KrCard] + latest_active_mandate: Optional["Mandate"] + """ + The Mandate object of the most recently created Mandate associated with this payment method + """ link: Optional[Link] livemode: bool """ diff --git a/stripe/_payment_record.py b/stripe/_payment_record.py index 7a247062d..83f9aa0bf 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): @@ -197,7 +227,18 @@ class Alipay(StripeObject): """ class Alma(StripeObject): - pass + class Installments(StripeObject): + count: int + """ + The number of installments. + """ + + installments: Optional[Installments] + transaction_id: Optional[str] + """ + The Alma transaction ID associated with this payment. + """ + _inner_class_types = {"installments": Installments} class AmazonPay(StripeObject): class Funding(StripeObject): @@ -239,6 +280,10 @@ class Card(StripeObject): _inner_class_types = {"card": Card} funding: Optional[Funding] + transaction_id: Optional[str] + """ + The Amazon Pay transaction ID associated with this payment. + """ _inner_class_types = {"funding": Funding} class AuBecsDebit(StripeObject): @@ -314,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): @@ -1053,6 +1101,10 @@ class KakaoPay(StripeObject): """ A unique identifier for the buyer as determined by the local payment processor. """ + transaction_id: Optional[str] + """ + The Kakao Pay transaction ID associated with this payment. + """ class Klarna(StripeObject): class PayerDetails(StripeObject): @@ -1137,6 +1189,10 @@ class KrCard(StripeObject): """ The last four digits of the card. This may not be present for American Express cards. """ + transaction_id: Optional[str] + """ + The Korean Card transaction ID associated with this payment. + """ class Link(StripeObject): country: Optional[str] @@ -1192,6 +1248,10 @@ class NaverPay(StripeObject): """ A unique identifier for the buyer as determined by the local payment processor. """ + transaction_id: Optional[str] + """ + The Naver Pay transaction ID associated with this payment. + """ class NzBankAccount(StripeObject): account_holder_name: Optional[str] @@ -1278,8 +1338,20 @@ class Payco(StripeObject): """ A unique identifier for the buyer as determined by the local payment processor. """ + transaction_id: Optional[str] + """ + The Payco transaction ID associated with this payment. + """ 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 @@ -1429,6 +1501,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] @@ -1482,6 +1558,10 @@ class Card(StripeObject): _inner_class_types = {"card": Card} funding: Optional[Funding] + transaction_id: Optional[str] + """ + The Revolut Pay transaction ID associated with this payment. + """ _inner_class_types = {"funding": Funding} class SamsungPay(StripeObject): @@ -1489,9 +1569,16 @@ class SamsungPay(StripeObject): """ A unique identifier for the buyer as determined by the local payment processor. """ + transaction_id: Optional[str] + """ + The Samsung Pay transaction ID associated with this payment. + """ class Satispay(StripeObject): - pass + transaction_id: Optional[str] + """ + The Satispay transaction ID associated with this payment. + """ class SepaCreditTransfer(StripeObject): bank_name: Optional[str] @@ -1817,6 +1904,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] @@ -2120,9 +2226,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" @@ -2138,7 +2246,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): @@ -2251,6 +2359,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" @@ -2299,6 +2425,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. @@ -2311,10 +2445,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. @@ -2355,9 +2497,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] """ @@ -2929,11 +3071,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/_promotion_code.py b/stripe/_promotion_code.py index bc44ab5e0..035b4900b 100644 --- a/stripe/_promotion_code.py +++ b/stripe/_promotion_code.py @@ -28,8 +28,11 @@ class PromotionCode( UpdateableAPIResource["PromotionCode"], ): """ - A Promotion Code represents a customer-redeemable code for a [coupon](https://stripe.com/docs/api#coupons). It can be used to - create multiple codes for a single coupon. + A Promotion Code represents a customer-redeemable code for a [coupon](https://stripe.com/docs/api#coupons). + You can create multiple codes for a single coupon. + + If you enable promotion codes in your [customer portal configuration](https://stripe.com/docs/customer-management/configure-portal), then customers can redeem a code themselves when updating a subscription in the portal. + Customers can also view the currently active promotion codes and coupons on each of their subscriptions in the portal. """ OBJECT_NAME: ClassVar[Literal["promotion_code"]] = "promotion_code" diff --git a/stripe/_quote_preview_invoice.py b/stripe/_quote_preview_invoice.py index 1cf2c7307..2a5a1995f 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", @@ -464,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", @@ -607,7 +609,7 @@ class LastFinalizationError(StripeObject): """ network_decline_code: Optional[str] """ - For card errors resulting from a card issuer decline, a brand specific 2, 3, or 4 digit code which indicates the reason the authorization failed. + For payments declined by the network, an alphanumeric code which indicates the reason the payment failed. """ param: Optional[str] """ 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/_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/_setup_attempt.py b/stripe/_setup_attempt.py index 3598aa378..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, @@ -533,6 +538,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", @@ -551,6 +557,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", @@ -694,7 +701,7 @@ class SetupError(StripeObject): """ network_decline_code: Optional[str] """ - For card errors resulting from a card issuer decline, a brand specific 2, 3, or 4 digit code which indicates the reason the authorization failed. + For payments declined by the network, an alphanumeric code which indicates the reason the payment failed. """ param: Optional[str] """ diff --git a/stripe/_setup_intent.py b/stripe/_setup_intent.py index c5c3d63f6..67586088c 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", @@ -145,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", @@ -288,7 +290,7 @@ class LastSetupError(StripeObject): """ network_decline_code: Optional[str] """ - For card errors resulting from a card issuer decline, a brand specific 2, 3, or 4 digit code which indicates the reason the authorization failed. + For payments declined by the network, an alphanumeric code which indicates the reason the payment failed. """ param: Optional[str] """ @@ -388,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] """ @@ -415,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 """ @@ -427,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, } @@ -660,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] @@ -755,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 = { @@ -767,6 +840,7 @@ class MandateOptions(StripeObject): "link": Link, "paypal": Paypal, "payto": Payto, + "pix": Pix, "sepa_debit": SepaDebit, "us_bank_account": UsBankAccount, } @@ -1761,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" ] @@ -2210,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 40000. + """ + 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" @@ -3380,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" ] @@ -3829,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 40000. + """ + 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" @@ -4968,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" ] @@ -5417,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 40000. + """ + 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..f6cad97b2 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 40000. + """ + 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 40000. + """ + 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 40000. + """ + 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/_stripe_client.py b/stripe/_stripe_client.py index 6f1a0ee5d..721ef20c9 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_notice_service import AccountNoticeService @@ -52,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 @@ -63,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 @@ -70,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 @@ -99,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 @@ -112,13 +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 -from stripe._v2_services import V2Services # services: The end of the section generated from our OpenAPI spec @@ -196,97 +197,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_notices = AccountNoticeService(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_settings = BalanceSettingsService(self._requestor) - self.balance_transactions = BalanceTransactionService(self._requestor) - self.billing = BillingService(self._requestor) - self.billing_portal = BillingPortalService(self._requestor) - self.capital = CapitalService(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.fx_quotes = FxQuoteService(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.margins = MarginService(self._requestor) - self.orders = OrderService(self._requestor) - self.payment_attempt_records = PaymentAttemptRecordService( - 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.payment_records = PaymentRecordService(self._requestor) - self.payouts = PayoutService(self._requestor) - self.plans = PlanService(self._requestor) - self.prices = PriceService(self._requestor) - self.privacy = PrivacyService(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.external_accounts = ExternalAccountService(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 @@ -394,4 +305,796 @@ 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_notices(self) -> AccountNoticeService: + """ + Deprecation Warning: + StripeClient.account_notices will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.account_notices. + 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_notices + + @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_settings(self) -> BalanceSettingsService: + """ + Deprecation Warning: + StripeClient.balance_settings will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.balance_settings. + 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_settings + + @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 capital(self) -> CapitalService: + """ + Deprecation Warning: + StripeClient.capital will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.capital. + 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.capital + + @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 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 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: + """ + 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 fx_quotes(self) -> FxQuoteService: + """ + Deprecation Warning: + StripeClient.fx_quotes will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.fx_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.fx_quotes + + @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_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: + """ + 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 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 margins(self) -> MarginService: + """ + Deprecation Warning: + StripeClient.margins will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.margins. + 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.margins + + @property + def orders(self) -> OrderService: + """ + Deprecation Warning: + StripeClient.orders will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.orders. + 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.orders + + @property + def payment_attempt_records(self) -> PaymentAttemptRecordService: + """ + Deprecation Warning: + StripeClient.payment_attempt_records will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.payment_attempt_records. + 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_attempt_records + + @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 payment_records(self) -> PaymentRecordService: + """ + Deprecation Warning: + StripeClient.payment_records will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.payment_records. + 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_records + + @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 privacy(self) -> PrivacyService: + """ + Deprecation Warning: + StripeClient.privacy will be deprecated in the next major release. + All functionality under it has been copied over to StripeClient.v1.privacy. + 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.privacy + + @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 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 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: + """ + 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 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: + """ + 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/_subscription.py b/stripe/_subscription.py index c851798dd..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 """ @@ -914,23 +952,23 @@ class CreateParamsAutomaticTaxLiability(TypedDict): class CreateParamsBillingCycleAnchorConfig(TypedDict): day_of_month: int """ - The day of the month the billing_cycle_anchor should be. Ranges from 1 to 31. + The day of the month the anchor should be. Ranges from 1 to 31. """ hour: NotRequired[int] """ - The hour of the day the billing_cycle_anchor should be. Ranges from 0 to 23. + The hour of the day the anchor should be. Ranges from 0 to 23. """ minute: NotRequired[int] """ - The minute of the hour the billing_cycle_anchor should be. Ranges from 0 to 59. + The minute of the hour the anchor should be. Ranges from 0 to 59. """ month: NotRequired[int] """ - The month to start full cycle billing periods. Ranges from 1 to 12. + The month to start full cycle periods. Ranges from 1 to 12. """ second: NotRequired[int] """ - The second of the minute the billing_cycle_anchor should be. Ranges from 0 to 59. + The second of the minute the anchor should be. Ranges from 0 to 59. """ class CreateParamsBillingMode(TypedDict): @@ -1513,13 +1551,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] """ @@ -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_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 """ diff --git a/stripe/_subscription_service.py b/stripe/_subscription_service.py index abfe2a263..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 """ @@ -356,23 +396,23 @@ class CreateParamsAutomaticTaxLiability(TypedDict): class CreateParamsBillingCycleAnchorConfig(TypedDict): day_of_month: int """ - The day of the month the billing_cycle_anchor should be. Ranges from 1 to 31. + The day of the month the anchor should be. Ranges from 1 to 31. """ hour: NotRequired[int] """ - The hour of the day the billing_cycle_anchor should be. Ranges from 0 to 23. + The hour of the day the anchor should be. Ranges from 0 to 23. """ minute: NotRequired[int] """ - The minute of the hour the billing_cycle_anchor should be. Ranges from 0 to 59. + The minute of the hour the anchor should be. Ranges from 0 to 59. """ month: NotRequired[int] """ - The month to start full cycle billing periods. Ranges from 1 to 12. + The month to start full cycle periods. Ranges from 1 to 12. """ second: NotRequired[int] """ - The second of the minute the billing_cycle_anchor should be. Ranges from 0 to 59. + The second of the minute the anchor should be. Ranges from 0 to 59. """ class CreateParamsBillingMode(TypedDict): @@ -963,13 +1003,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] """ @@ -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 """ diff --git a/stripe/_v1_services.py b/stripe/_v1_services.py new file mode 100644 index 000000000..f517ddfee --- /dev/null +++ b/stripe/_v1_services.py @@ -0,0 +1,182 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._account_link_service import AccountLinkService +from stripe._account_notice_service import AccountNoticeService +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_settings_service import BalanceSettingsService +from stripe._balance_transaction_service import BalanceTransactionService +from stripe._billing_portal_service import BillingPortalService +from stripe._billing_service import BillingService +from stripe._capital_service import CapitalService +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._external_account_service import ExternalAccountService +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._fx_quote_service import FxQuoteService +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._margin_service import MarginService +from stripe._order_service import OrderService +from stripe._payment_attempt_record_service import PaymentAttemptRecordService +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._payment_record_service import PaymentRecordService +from stripe._payout_service import PayoutService +from stripe._plan_service import PlanService +from stripe._price_service import PriceService +from stripe._privacy_service import PrivacyService +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_notices = AccountNoticeService(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_settings = BalanceSettingsService(self._requestor) + self.balance_transactions = BalanceTransactionService(self._requestor) + self.billing = BillingService(self._requestor) + self.billing_portal = BillingPortalService(self._requestor) + self.capital = CapitalService(self._requestor) + self.charges = ChargeService(self._requestor) + self.checkout = CheckoutService(self._requestor) + self.climate = ClimateService(self._requestor) + self.confirmation_tokens = ConfirmationTokenService(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.external_accounts = ExternalAccountService(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.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.issuing = IssuingService(self._requestor) + self.mandates = MandateService(self._requestor) + self.margins = MarginService(self._requestor) + self.orders = OrderService(self._requestor) + self.payment_attempt_records = PaymentAttemptRecordService( + 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.payment_records = PaymentRecordService(self._requestor) + self.payouts = PayoutService(self._requestor) + self.plans = PlanService(self._requestor) + self.prices = PriceService(self._requestor) + self.privacy = PrivacyService(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.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) + 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.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) diff --git a/stripe/_webhook_endpoint.py b/stripe/_webhook_endpoint.py index bcf1ab3c8..a5b1855ca 100644 --- a/stripe/_webhook_endpoint.py +++ b/stripe/_webhook_endpoint.py @@ -146,6 +146,7 @@ class CreateParams(RequestOptions): "2025-05-28.basil", "2025-06-30.basil", "2025-07-30.basil", + "2025-08-27.basil", ] ] """ diff --git a/stripe/_webhook_endpoint_service.py b/stripe/_webhook_endpoint_service.py index 08a731696..3887d73cd 100644 --- a/stripe/_webhook_endpoint_service.py +++ b/stripe/_webhook_endpoint_service.py @@ -127,6 +127,7 @@ class CreateParams(TypedDict): "2025-05-28.basil", "2025-06-30.basil", "2025-07-30.basil", + "2025-08-27.basil", ] ] """ diff --git a/stripe/billing/_alert_triggered.py b/stripe/billing/_alert_triggered.py index 3e33e9406..beaed0065 100644 --- a/stripe/billing/_alert_triggered.py +++ b/stripe/billing/_alert_triggered.py @@ -32,7 +32,7 @@ class AlertTriggered(StripeObject): """ String representing the object's type. Objects of the same type share the same value. """ - value: int + value: str """ The value triggering the alert """ diff --git a/stripe/billing/_meter.py b/stripe/billing/_meter.py index 13d26ba41..a0ae2cf4a 100644 --- a/stripe/billing/_meter.py +++ b/stripe/billing/_meter.py @@ -82,7 +82,7 @@ class CreateParams(RequestOptions): """ event_time_window: NotRequired[Literal["day", "hour"]] """ - The time window to pre-aggregate meter events for, if any. + The time window which meter events have been pre-aggregated for, if any. """ expand: NotRequired[List[str]] """ @@ -215,7 +215,7 @@ class RetrieveParams(RequestOptions): """ event_time_window: Optional[Literal["day", "hour"]] """ - The time window to pre-aggregate meter events for, if any. + The time window which meter events have been pre-aggregated for, if any. """ id: str """ diff --git a/stripe/billing/_meter_service.py b/stripe/billing/_meter_service.py index 59643251d..30f6fd72d 100644 --- a/stripe/billing/_meter_service.py +++ b/stripe/billing/_meter_service.py @@ -38,7 +38,7 @@ class CreateParams(TypedDict): """ event_time_window: NotRequired[Literal["day", "hour"]] """ - The time window to pre-aggregate meter events for, if any. + The time window which meter events have been pre-aggregated for, if any. """ expand: NotRequired[List[str]] """ diff --git a/stripe/billing/_meter_usage_row.py b/stripe/billing/_meter_usage_row.py index a59f87b34..4eacf2fb8 100644 --- a/stripe/billing/_meter_usage_row.py +++ b/stripe/billing/_meter_usage_row.py @@ -31,7 +31,7 @@ class MeterUsageRow(StripeObject): """ meter_id: Optional[str] """ - The unique identifier for the meter. + The unique identifier for the meter. Null if no meters were provided and usage was aggregated across all meters. """ object: Literal["billing.meter_usage_row"] """ 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"] diff --git a/stripe/checkout/_session.py b/stripe/checkout/_session.py index a767ed054..afd76e1fc 100644 --- a/stripe/checkout/_session.py +++ b/stripe/checkout/_session.py @@ -61,7 +61,7 @@ class Session( class AdaptivePricing(StripeObject): enabled: bool """ - Whether Adaptive Pricing is enabled. + If enabled, Adaptive Pricing is available on [eligible sessions](https://docs.stripe.com/payments/currencies/localize-prices/adaptive-pricing?payment-ui=stripe-hosted#restrictions). """ class AfterExpiration(StripeObject): @@ -1434,11 +1434,58 @@ 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. + """ expires_after_seconds: Optional[int] """ 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. @@ -1448,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"]] @@ -2347,7 +2395,7 @@ class CreateParams(RequestOptions): """ 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`. + Where the user is coming from. This informs the optimizations that are applied to the session. """ payment_intent_data: NotRequired[ "Session.CreateParamsPaymentIntentData" @@ -2541,7 +2589,7 @@ class CreateParams(RequestOptions): class CreateParamsAdaptivePricing(TypedDict): enabled: NotRequired[bool] """ - Set to `true` to enable [Adaptive Pricing](https://docs.stripe.com/payments/checkout/adaptive-pricing). Defaults to your [dashboard setting](https://dashboard.stripe.com/settings/adaptive-pricing). + If set to `true`, Adaptive Pricing is available on [eligible sessions](https://docs.stripe.com/payments/currencies/localize-prices/adaptive-pricing?payment-ui=stripe-hosted#restrictions). Defaults to your [dashboard setting](https://dashboard.stripe.com/settings/adaptive-pricing). """ class CreateParamsAfterExpiration(TypedDict): @@ -2767,11 +2815,41 @@ class CreateParamsDiscount(TypedDict): """ The ID of the coupon to apply to this Session. """ + coupon_data: NotRequired["Session.CreateParamsDiscountCouponData"] + """ + Data used to generate a new [Coupon](https://stripe.com/docs/api/coupon) object inline. One of `coupon` or `coupon_data` is required when updating discounts. + """ promotion_code: NotRequired[str] """ The ID of a promotion code to apply to this Session. """ + class CreateParamsDiscountCouponData(TypedDict): + amount_off: NotRequired[int] + """ + A positive integer representing the amount to subtract from an invoice total (required if `percent_off` is not passed). + """ + currency: NotRequired[str] + """ + Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `amount_off` parameter (required if `amount_off` is passed). + """ + duration: NotRequired[Literal["forever", "once", "repeating"]] + """ + Specifies how long the discount will be in effect if used on a subscription. Defaults to `once`. + """ + metadata: NotRequired["Literal['']|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: NotRequired[str] + """ + Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the `id` is shown if `name` is not set. + """ + percent_off: NotRequired[float] + """ + A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if `amount_off` is not passed). + """ + class CreateParamsInvoiceCreation(TypedDict): enabled: bool """ @@ -4094,11 +4172,21 @@ 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. """ - 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. @@ -4109,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 40000. + """ + 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 16b851fda..3d6dc6621 100644 --- a/stripe/checkout/_session_service.py +++ b/stripe/checkout/_session_service.py @@ -210,7 +210,7 @@ class CreateParams(TypedDict): """ 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`. + Where the user is coming from. This informs the optimizations that are applied to the session. """ payment_intent_data: NotRequired[ "SessionService.CreateParamsPaymentIntentData" @@ -410,7 +410,7 @@ class CreateParams(TypedDict): class CreateParamsAdaptivePricing(TypedDict): enabled: NotRequired[bool] """ - Set to `true` to enable [Adaptive Pricing](https://docs.stripe.com/payments/checkout/adaptive-pricing). Defaults to your [dashboard setting](https://dashboard.stripe.com/settings/adaptive-pricing). + If set to `true`, Adaptive Pricing is available on [eligible sessions](https://docs.stripe.com/payments/currencies/localize-prices/adaptive-pricing?payment-ui=stripe-hosted#restrictions). Defaults to your [dashboard setting](https://dashboard.stripe.com/settings/adaptive-pricing). """ class CreateParamsAfterExpiration(TypedDict): @@ -642,11 +642,43 @@ class CreateParamsDiscount(TypedDict): """ The ID of the coupon to apply to this Session. """ + coupon_data: NotRequired[ + "SessionService.CreateParamsDiscountCouponData" + ] + """ + Data used to generate a new [Coupon](https://stripe.com/docs/api/coupon) object inline. One of `coupon` or `coupon_data` is required when updating discounts. + """ promotion_code: NotRequired[str] """ The ID of a promotion code to apply to this Session. """ + class CreateParamsDiscountCouponData(TypedDict): + amount_off: NotRequired[int] + """ + A positive integer representing the amount to subtract from an invoice total (required if `percent_off` is not passed). + """ + currency: NotRequired[str] + """ + Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `amount_off` parameter (required if `amount_off` is passed). + """ + duration: NotRequired[Literal["forever", "once", "repeating"]] + """ + Specifies how long the discount will be in effect if used on a subscription. Defaults to `once`. + """ + metadata: NotRequired["Literal['']|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: NotRequired[str] + """ + Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the `id` is shown if `name` is not set. + """ + percent_off: NotRequired[float] + """ + A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if `amount_off` is not passed). + """ + class CreateParamsInvoiceCreation(TypedDict): enabled: bool """ @@ -2009,11 +2041,21 @@ 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. """ - 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. @@ -2024,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 40000. + """ + 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/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/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. diff --git a/stripe/terminal/_configuration.py b/stripe/terminal/_configuration.py index e63dd14e1..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 """ @@ -234,6 +240,20 @@ class Jpy(StripeObject): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class Mxn(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 Myr(StripeObject): fixed_amounts: Optional[List[int]] """ @@ -358,6 +378,7 @@ class Usd(StripeObject): hkd: Optional[Hkd] huf: Optional[Huf] jpy: Optional[Jpy] + mxn: Optional[Mxn] myr: Optional[Myr] nok: Optional[Nok] nzd: Optional[Nzd] @@ -379,6 +400,7 @@ class Usd(StripeObject): "hkd": Hkd, "huf": Huf, "jpy": Jpy, + "mxn": Mxn, "myr": Myr, "nok": Nok, "nzd": Nzd, @@ -478,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. @@ -511,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 """ @@ -576,6 +610,10 @@ class CreateParamsTipping(TypedDict): """ Tipping configuration for JPY """ + mxn: NotRequired["Configuration.CreateParamsTippingMxn"] + """ + Tipping configuration for MXN + """ myr: NotRequired["Configuration.CreateParamsTippingMyr"] """ Tipping configuration for MYR @@ -777,6 +815,20 @@ class CreateParamsTippingJpy(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class CreateParamsTippingMxn(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 CreateParamsTippingMyr(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -1013,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" ] @@ -1052,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 """ @@ -1117,6 +1181,10 @@ class ModifyParamsTipping(TypedDict): """ Tipping configuration for JPY """ + mxn: NotRequired["Configuration.ModifyParamsTippingMxn"] + """ + Tipping configuration for MXN + """ myr: NotRequired["Configuration.ModifyParamsTippingMyr"] """ Tipping configuration for MYR @@ -1318,6 +1386,20 @@ class ModifyParamsTippingJpy(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class ModifyParamsTippingMxn(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 ModifyParamsTippingMyr(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -1542,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] @@ -1777,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 25f494129..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 """ @@ -135,6 +147,10 @@ class CreateParamsTipping(TypedDict): """ Tipping configuration for JPY """ + mxn: NotRequired["ConfigurationService.CreateParamsTippingMxn"] + """ + Tipping configuration for MXN + """ myr: NotRequired["ConfigurationService.CreateParamsTippingMyr"] """ Tipping configuration for MYR @@ -336,6 +352,20 @@ class CreateParamsTippingJpy(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class CreateParamsTippingMxn(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 CreateParamsTippingMyr(TypedDict): fixed_amounts: NotRequired[List[int]] """ @@ -582,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" ] @@ -623,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 """ @@ -688,6 +730,10 @@ class UpdateParamsTipping(TypedDict): """ Tipping configuration for JPY """ + mxn: NotRequired["ConfigurationService.UpdateParamsTippingMxn"] + """ + Tipping configuration for MXN + """ myr: NotRequired["ConfigurationService.UpdateParamsTippingMyr"] """ Tipping configuration for MYR @@ -889,6 +935,20 @@ class UpdateParamsTippingJpy(TypedDict): Below this amount, fixed amounts will be displayed; above it, percentages will be displayed """ + class UpdateParamsTippingMxn(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 UpdateParamsTippingMyr(TypedDict): fixed_amounts: NotRequired[List[int]] """ diff --git a/stripe/terminal/_reader.py b/stripe/terminal/_reader.py index 7eb29b404..54c2fdd3e 100644 --- a/stripe/terminal/_reader.py +++ b/stripe/terminal/_reader.py @@ -748,6 +748,10 @@ class PresentPaymentMethodParams(RequestOptions): """ Simulated on-reader tip amount. """ + card: NotRequired["Reader.PresentPaymentMethodParamsCard"] + """ + Simulated data for the card payment method. + """ card_present: NotRequired[ "Reader.PresentPaymentMethodParamsCardPresent" ] @@ -764,11 +768,29 @@ class PresentPaymentMethodParams(RequestOptions): """ Simulated data for the interac_present payment method. """ - type: NotRequired[Literal["card_present", "interac_present"]] + type: NotRequired[Literal["card", "card_present", "interac_present"]] """ Simulated payment type. """ + class PresentPaymentMethodParamsCard(TypedDict): + cvc: NotRequired[str] + """ + Card security code. + """ + exp_month: int + """ + Two-digit number representing the card's expiration month. + """ + exp_year: int + """ + Two- or four-digit number representing the card's expiration year. + """ + number: str + """ + The card number, as a string without any separators. + """ + class PresentPaymentMethodParamsCardPresent(TypedDict): number: NotRequired[str] """ diff --git a/stripe/test_helpers/terminal/_reader_service.py b/stripe/test_helpers/terminal/_reader_service.py index d7fd0266d..197a76b6b 100644 --- a/stripe/test_helpers/terminal/_reader_service.py +++ b/stripe/test_helpers/terminal/_reader_service.py @@ -14,6 +14,10 @@ class PresentPaymentMethodParams(TypedDict): """ Simulated on-reader tip amount. """ + card: NotRequired["ReaderService.PresentPaymentMethodParamsCard"] + """ + Simulated data for the card payment method. + """ card_present: NotRequired[ "ReaderService.PresentPaymentMethodParamsCardPresent" ] @@ -30,11 +34,29 @@ class PresentPaymentMethodParams(TypedDict): """ Simulated data for the interac_present payment method. """ - type: NotRequired[Literal["card_present", "interac_present"]] + type: NotRequired[Literal["card", "card_present", "interac_present"]] """ Simulated payment type. """ + class PresentPaymentMethodParamsCard(TypedDict): + cvc: NotRequired[str] + """ + Card security code. + """ + exp_month: int + """ + Two-digit number representing the card's expiration month. + """ + exp_year: int + """ + Two- or four-digit number representing the card's expiration year. + """ + number: str + """ + The card number, as a string without any separators. + """ + class PresentPaymentMethodParamsCardPresent(TypedDict): number: NotRequired[str] """ 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/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/_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[ 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", diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index 216ba76f4..4084254f7 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,29 @@ async def test_quotes_post_2_service_async( post_data="metadata[order_id]=6735", ) + def test_quotes_preview_invoices_lines_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/quotes/qt_xyz/preview_invoices/in_xyz/lines", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.quotes.list_preview_invoice_lines( + "qt_xyz", + "in_xyz", + ) + http_client_mock.assert_requested( + "get", + path="/v1/quotes/qt_xyz/preview_invoices/in_xyz/lines", + query_string="", + api_base="https://api.stripe.com", + ) + def test_quotes_preview_invoices_lines_get( self, http_client_mock: HTTPClientMock ) -> None: @@ -18450,7 +24345,7 @@ def test_quotes_preview_invoices_lines_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.quotes.list_preview_invoice_lines( + client.v1.quotes.list_preview_invoice_lines( "qt_xyz", "in_xyz", ) @@ -18488,7 +24383,7 @@ async def test_quotes_preview_invoices_lines_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.quotes.list_preview_invoice_lines_async( + await client.v1.quotes.list_preview_invoice_lines_async( "qt_xyz", "in_xyz", ) @@ -18499,6 +24394,27 @@ async def test_quotes_preview_invoices_lines_get_service_async( api_base="https://api.stripe.com", ) + 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: @@ -18522,7 +24438,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", @@ -18555,7 +24471,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", @@ -18563,6 +24479,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: @@ -18585,7 +24521,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", @@ -18619,7 +24555,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( @@ -18629,6 +24565,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: @@ -18651,7 +24607,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", @@ -18683,7 +24639,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", @@ -18691,6 +24649,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: @@ -18717,7 +24701,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", @@ -18758,7 +24742,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", @@ -18771,6 +24755,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: @@ -18793,7 +24797,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", @@ -18825,8 +24829,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", @@ -18835,6 +24839,32 @@ async def test_radar_value_list_items_get_2_service_async( api_base="https://api.stripe.com", ) + def test_radar_value_list_items_post_service_non_namespaced( + 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(), + ) + + client.radar.value_list_items.create( + { + "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_list_items_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -18861,7 +24891,7 @@ def test_radar_value_list_items_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.radar.value_list_items.create( + client.v1.radar.value_list_items.create( { "value_list": "rsl_xxxxxxxxxxxxx", "value": "1.2.3.4", @@ -18903,7 +24933,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( + await client.v1.radar.value_list_items.create_async( { "value_list": "rsl_xxxxxxxxxxxxx", "value": "1.2.3.4", @@ -18917,6 +24947,26 @@ async def test_radar_value_list_items_post_service_async( 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: @@ -18939,7 +24989,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", @@ -18971,7 +25021,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", @@ -18979,6 +25029,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: @@ -19002,7 +25073,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", @@ -19035,7 +25106,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", @@ -19043,6 +25114,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: @@ -19065,7 +25156,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", @@ -19097,7 +25188,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", @@ -19105,6 +25196,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: @@ -19132,7 +25250,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", @@ -19176,7 +25294,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", @@ -19191,6 +25309,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: @@ -19217,7 +25359,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"}, ) @@ -19257,7 +25399,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"}, ) @@ -19269,6 +25411,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: @@ -19291,7 +25453,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", @@ -19323,7 +25485,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", @@ -19331,6 +25493,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( @@ -19352,7 +25535,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", @@ -19385,7 +25568,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", @@ -19393,6 +25576,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( @@ -19413,7 +25616,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", @@ -19445,7 +25648,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", @@ -19453,6 +25656,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( @@ -19474,7 +25698,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", @@ -19508,7 +25732,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", @@ -19517,6 +25741,30 @@ async def test_refunds_post_service_async( post_data="charge=ch_xxxxxxxxxxxxx", ) + def test_refunds_post_2_service_non_namespaced( + 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(), + ) + + client.refunds.update( + "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_refunds_post_2(self, http_client_mock: HTTPClientMock) -> None: stripe.Refund.modify( "re_xxxxxxxxxxxxx", @@ -19541,7 +25789,7 @@ def test_refunds_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.refunds.update( + client.v1.refunds.update( "re_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -19581,7 +25829,7 @@ async def test_refunds_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.refunds.update_async( + await client.v1.refunds.update_async( "re_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -19593,6 +25841,27 @@ async def test_refunds_post_2_service_async( 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: @@ -19616,7 +25885,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", @@ -19649,7 +25918,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", @@ -19657,6 +25926,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: @@ -19679,7 +25968,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", @@ -19711,7 +26000,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", @@ -19719,6 +26010,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: @@ -19748,7 +26068,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": { @@ -19796,7 +26116,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": { @@ -19813,6 +26133,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: @@ -19835,7 +26175,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", @@ -19867,7 +26207,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", @@ -19875,6 +26215,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: @@ -19897,7 +26257,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", @@ -19929,7 +26289,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", @@ -19937,6 +26299,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: @@ -19959,7 +26341,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", @@ -19991,7 +26373,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", @@ -19999,6 +26381,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( @@ -20020,7 +26423,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", @@ -20053,7 +26456,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", @@ -20061,6 +26464,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( @@ -20081,7 +26504,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", @@ -20113,7 +26536,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", @@ -20121,6 +26544,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: @@ -20147,7 +26591,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", @@ -20183,7 +26627,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", @@ -20196,6 +26640,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: @@ -20218,7 +26682,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", @@ -20250,7 +26714,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", @@ -20258,6 +26722,30 @@ async def test_setup_intents_cancel_post_service_async( api_base="https://api.stripe.com", ) + def test_setup_intents_confirm_post_service_non_namespaced( + 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.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", + ) + def test_setup_intents_confirm_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -20284,7 +26772,7 @@ def test_setup_intents_confirm_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.setup_intents.confirm( + client.v1.setup_intents.confirm( "seti_xxxxxxxxxxxxx", {"payment_method": "pm_card_visa"}, ) @@ -20324,7 +26812,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"}, ) @@ -20336,6 +26824,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( @@ -20357,7 +26866,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", @@ -20390,7 +26899,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", @@ -20398,6 +26907,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: @@ -20420,7 +26949,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", @@ -20452,7 +26981,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", @@ -20460,6 +26989,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: @@ -20483,7 +27033,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", @@ -20517,7 +27067,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"], } @@ -20530,6 +27080,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: @@ -20556,7 +27130,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"}}, ) @@ -20596,7 +27170,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"}}, ) @@ -20608,6 +27182,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: @@ -20630,7 +27224,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", @@ -20664,7 +27258,7 @@ 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( @@ -20674,6 +27268,30 @@ async def test_setup_intents_verify_microdeposits_post_service_async( 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( self, http_client_mock: HTTPClientMock ) -> None: @@ -20700,7 +27318,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]}, ) @@ -20740,7 +27358,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]}, ) @@ -20752,6 +27370,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: @@ -20774,7 +27412,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", @@ -20806,7 +27444,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", @@ -20814,6 +27452,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: @@ -20837,7 +27496,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", @@ -20870,7 +27529,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", @@ -20878,6 +27537,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: @@ -20900,7 +27579,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", @@ -20932,7 +27611,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", @@ -20940,6 +27619,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: @@ -20967,7 +27673,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}, @@ -21011,7 +27717,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}, @@ -21026,6 +27732,33 @@ 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_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": "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", + ) + def test_shipping_rates_post_2( self, http_client_mock: HTTPClientMock ) -> None: @@ -21053,7 +27786,7 @@ def test_shipping_rates_post_2_service( http_client=http_client_mock.get_mock_http_client(), ) - client.shipping_rates.create( + client.v1.shipping_rates.create( { "display_name": "Ground shipping", "type": "fixed_amount", @@ -21097,7 +27830,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", @@ -21112,6 +27845,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: @@ -21138,7 +27895,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"}}, ) @@ -21178,7 +27935,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"}}, ) @@ -21190,6 +27947,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: @@ -21213,7 +27991,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", @@ -21246,7 +28024,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", @@ -21254,6 +28032,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: @@ -21276,7 +28074,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", @@ -21310,7 +28108,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( @@ -21320,6 +28118,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( @@ -21340,7 +28158,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", @@ -21372,7 +28190,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", @@ -21400,7 +28238,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", @@ -21432,7 +28270,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", @@ -21440,6 +28278,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", @@ -21464,7 +28326,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"}}, ) @@ -21504,7 +28366,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"}}, ) @@ -21516,6 +28378,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: @@ -21538,7 +28420,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", @@ -21570,7 +28452,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", @@ -21578,6 +28460,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: @@ -21601,7 +28504,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", @@ -21636,7 +28541,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", } @@ -21648,6 +28553,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: @@ -21670,7 +28595,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", @@ -21702,7 +28627,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", @@ -21710,6 +28635,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: @@ -21737,7 +28689,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", @@ -21781,7 +28733,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", @@ -21796,6 +28748,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: @@ -21822,7 +28798,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"}}, ) @@ -21862,7 +28838,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"}}, ) @@ -21874,6 +28850,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: @@ -21896,7 +28892,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", @@ -21930,7 +28926,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( @@ -21940,6 +28936,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: @@ -21963,7 +28980,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", @@ -21996,7 +29013,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", @@ -22004,6 +29021,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: @@ -22026,7 +29063,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", @@ -22060,7 +29097,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( @@ -22070,28 +29107,7 @@ async def test_subscription_schedules_get_2_service_async( api_base="https://api.stripe.com", ) - def test_subscription_schedules_post( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.SubscriptionSchedule.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="", - 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_service( + def test_subscription_schedules_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -22126,6 +29142,62 @@ def test_subscription_schedules_post_service( 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: + stripe.SubscriptionSchedule.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="", + 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_service( + 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.v1.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", + ) + @pytest.mark.anyio async def test_subscription_schedules_post_async( self, http_client_mock: HTTPClientMock @@ -22161,7 +29233,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, @@ -22184,6 +29256,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: @@ -22210,7 +29306,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"}, ) @@ -22250,7 +29346,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"}, ) @@ -22262,6 +29358,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: @@ -22284,7 +29400,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", @@ -22318,7 +29434,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( @@ -22328,6 +29444,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: @@ -22350,7 +29486,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", @@ -22382,7 +29518,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", @@ -22390,6 +29526,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: @@ -22412,7 +29568,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", @@ -22444,7 +29600,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", @@ -22452,6 +29608,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( @@ -22473,7 +29650,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", @@ -22506,7 +29683,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", @@ -22514,6 +29691,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: @@ -22536,7 +29733,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", @@ -22568,7 +29765,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", @@ -22576,6 +29773,32 @@ async def test_subscriptions_get_2_service_async( api_base="https://api.stripe.com", ) + def test_subscriptions_post_service_non_namespaced( + 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.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", + ) + def test_subscriptions_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -22602,7 +29825,7 @@ def test_subscriptions_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.subscriptions.create( + client.v1.subscriptions.create( { "customer": "cus_xxxxxxxxxxxxx", "items": [{"price": "price_xxxxxxxxxxxxx"}], @@ -22644,7 +29867,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"}], @@ -22658,6 +29881,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: @@ -22684,7 +29931,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"}}, ) @@ -22724,7 +29971,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"}}, ) @@ -22736,6 +29983,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: @@ -22761,7 +30033,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'", } @@ -22800,7 +30072,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'", } @@ -22812,6 +30084,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: @@ -22834,7 +30126,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", @@ -22866,7 +30158,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", @@ -22874,6 +30166,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: @@ -22910,7 +30238,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"}], @@ -22972,7 +30300,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"}], @@ -22996,6 +30324,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( @@ -23017,7 +30366,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", @@ -23050,7 +30399,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", @@ -23058,6 +30407,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( @@ -23078,7 +30447,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", @@ -23110,7 +30479,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", @@ -23118,6 +30487,26 @@ async def test_tax_codes_get_2_service_async( api_base="https://api.stripe.com", ) + def test_tax_forms_pdf_get_service_non_namespaced( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v1/tax/forms/form_xxxxxxxxxxxxx/pdf", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.tax.forms.pdf("form_xxxxxxxxxxxxx") + http_client_mock.assert_requested( + "get", + path="/v1/tax/forms/form_xxxxxxxxxxxxx/pdf", + query_string="", + api_base="https://files.stripe.com", + ) + def test_tax_forms_pdf_get(self, http_client_mock: HTTPClientMock) -> None: stripe.tax.Form.pdf("form_xxxxxxxxxxxxx") http_client_mock.assert_requested( @@ -23138,7 +30527,7 @@ def test_tax_forms_pdf_get_service( http_client=http_client_mock.get_mock_http_client(), ) - client.tax.forms.pdf("form_xxxxxxxxxxxxx") + client.v1.tax.forms.pdf("form_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/tax/forms/form_xxxxxxxxxxxxx/pdf", @@ -23170,7 +30559,7 @@ async def test_tax_forms_pdf_get_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.tax.forms.pdf_async("form_xxxxxxxxxxxxx") + await client.v1.tax.forms.pdf_async("form_xxxxxxxxxxxxx") http_client_mock.assert_requested( "get", path="/v1/tax/forms/form_xxxxxxxxxxxxx/pdf", @@ -23178,6 +30567,26 @@ async def test_tax_forms_pdf_get_service_async( api_base="https://files.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( @@ -23198,7 +30607,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", @@ -23230,7 +30639,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", @@ -23238,6 +30647,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( @@ -23258,7 +30687,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", @@ -23290,7 +30719,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", @@ -23298,6 +30727,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( @@ -23318,7 +30767,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", @@ -23350,7 +30799,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", @@ -23358,6 +30807,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", @@ -23382,7 +30852,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", @@ -23419,7 +30889,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", @@ -23428,6 +30900,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( @@ -23449,7 +30942,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", @@ -23482,7 +30975,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", @@ -23490,6 +30983,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( @@ -23510,7 +31023,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", @@ -23542,7 +31055,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", @@ -23550,6 +31063,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", @@ -23577,7 +31119,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", @@ -23625,7 +31167,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", @@ -23642,19 +31184,7 @@ 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(self, http_client_mock: HTTPClientMock) -> None: - stripe.TaxRate.modify( - "txr_xxxxxxxxxxxxx", - active=False, - ) - http_client_mock.assert_requested( - "post", - path="/v1/tax_rates/txr_xxxxxxxxxxxxx", - query_string="", - post_data="active=false", - ) - - def test_tax_rates_post_2_service( + def test_tax_rates_post_2_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -23678,6 +31208,42 @@ def test_tax_rates_post_2_service( post_data="active=false", ) + def test_tax_rates_post_2(self, http_client_mock: HTTPClientMock) -> None: + stripe.TaxRate.modify( + "txr_xxxxxxxxxxxxx", + active=False, + ) + http_client_mock.assert_requested( + "post", + path="/v1/tax_rates/txr_xxxxxxxxxxxxx", + query_string="", + post_data="active=false", + ) + + def test_tax_rates_post_2_service( + 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.v1.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", + ) + @pytest.mark.anyio async def test_tax_rates_post_2_async( self, http_client_mock: HTTPClientMock @@ -23706,7 +31272,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}, ) @@ -23718,6 +31284,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: @@ -23741,7 +31328,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", @@ -23774,7 +31361,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", @@ -23782,6 +31369,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: @@ -23809,7 +31423,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"}}, @@ -23853,7 +31467,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"}}, @@ -23868,6 +31482,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: @@ -23894,7 +31532,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"}, ) @@ -23934,7 +31572,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"}, ) @@ -23946,6 +31584,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( @@ -23966,7 +31624,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", @@ -23998,7 +31656,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", @@ -24006,6 +31664,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( @@ -24027,7 +31706,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", @@ -24063,7 +31746,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"}, } @@ -24076,6 +31759,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: @@ -24102,7 +31811,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", @@ -24144,7 +31853,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", @@ -24158,6 +31867,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: @@ -24180,7 +31909,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", @@ -24212,7 +31941,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", @@ -24220,6 +31949,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: @@ -24242,7 +31991,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", @@ -24274,7 +32023,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", @@ -24282,6 +32033,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: @@ -24304,7 +32075,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", @@ -24336,7 +32107,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", @@ -24344,6 +32115,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: @@ -24366,7 +32157,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", @@ -24398,7 +32189,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", @@ -24406,6 +32197,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: @@ -24429,7 +32241,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", @@ -24462,7 +32274,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", @@ -24470,6 +32282,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: @@ -24492,7 +32324,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", @@ -24524,8 +32356,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", @@ -24534,6 +32366,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: @@ -24556,7 +32408,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", @@ -24588,7 +32440,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", @@ -24596,6 +32448,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: @@ -24622,7 +32498,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]}}}, ) @@ -24662,7 +32538,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]}}}, ) @@ -24674,6 +32550,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: @@ -24699,7 +32600,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"}, } @@ -24739,7 +32640,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"}, } @@ -24752,6 +32653,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: @@ -24778,7 +32703,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"}}, ) @@ -24818,7 +32743,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"}}, ) @@ -24830,6 +32755,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: @@ -24852,7 +32797,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", @@ -24884,7 +32829,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", @@ -24892,6 +32837,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: @@ -24914,7 +32879,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", @@ -24946,7 +32911,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", @@ -24954,6 +32919,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: @@ -24977,7 +32963,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", @@ -25010,7 +32996,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", @@ -25018,6 +33004,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: @@ -25040,7 +33046,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", @@ -25072,7 +33078,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", @@ -25080,6 +33086,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: @@ -25112,7 +33150,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": { @@ -25166,7 +33204,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": { @@ -25186,21 +33224,7 @@ 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( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.terminal.Location.modify( - "tml_xxxxxxxxxxxxx", - display_name="My First Store", - ) - http_client_mock.assert_requested( - "post", - path="/v1/terminal/locations/tml_xxxxxxxxxxxxx", - query_string="", - post_data="display_name=My%20First%20Store", - ) - - def test_terminal_locations_post_2_service( + def test_terminal_locations_post_2_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -25224,6 +33248,44 @@ def test_terminal_locations_post_2_service( post_data="display_name=My%20First%20Store", ) + def test_terminal_locations_post_2( + self, http_client_mock: HTTPClientMock + ) -> None: + stripe.terminal.Location.modify( + "tml_xxxxxxxxxxxxx", + display_name="My First Store", + ) + http_client_mock.assert_requested( + "post", + path="/v1/terminal/locations/tml_xxxxxxxxxxxxx", + query_string="", + post_data="display_name=My%20First%20Store", + ) + + def test_terminal_locations_post_2_service( + 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.v1.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", + ) + @pytest.mark.anyio async def test_terminal_locations_post_2_async( self, http_client_mock: HTTPClientMock @@ -25252,7 +33314,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"}, ) @@ -25264,6 +33326,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: @@ -25286,7 +33368,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", @@ -25318,7 +33400,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", @@ -25326,6 +33410,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: @@ -25348,7 +33452,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", @@ -25380,7 +33484,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", @@ -25388,6 +33492,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: @@ -25411,7 +33536,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", @@ -25444,7 +33569,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", @@ -25452,6 +33577,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: @@ -25474,7 +33619,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", @@ -25506,7 +33651,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", @@ -25514,6 +33659,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: @@ -25541,7 +33713,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", @@ -25585,7 +33757,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", @@ -25600,6 +33772,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: @@ -25626,7 +33822,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"}, ) @@ -25666,7 +33862,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"}, ) @@ -25678,6 +33874,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: @@ -25704,7 +33924,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"}, ) @@ -25744,7 +33964,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"}, ) @@ -25756,6 +33976,33 @@ 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_service_non_namespaced( + 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(), + ) + + client.terminal.readers.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="", + api_base="https://api.stripe.com", + post_data="setup_intent=seti_xxxxxxxxxxxxx&allow_redisplay=always", + ) + def test_terminal_readers_process_setup_intent_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -25783,7 +34030,7 @@ def test_terminal_readers_process_setup_intent_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.terminal.readers.process_setup_intent( + client.v1.terminal.readers.process_setup_intent( "tmr_xxxxxxxxxxxxx", { "setup_intent": "seti_xxxxxxxxxxxxx", @@ -25827,7 +34074,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( + await client.v1.terminal.readers.process_setup_intent_async( "tmr_xxxxxxxxxxxxx", { "setup_intent": "seti_xxxxxxxxxxxxx", @@ -25842,6 +34089,30 @@ async def test_terminal_readers_process_setup_intent_post_service_async( 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: @@ -25869,7 +34140,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"}, ) @@ -25910,7 +34181,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"}, ) @@ -25922,56 +34193,7 @@ 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( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.issuing.Authorization.TestHelpers.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="", - 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_service( + def test_test_helpers_issuing_authorizations_capture_post_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -26032,6 +34254,116 @@ def test_test_helpers_issuing_authorizations_capture_post_service( 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: + stripe.issuing.Authorization.TestHelpers.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="", + 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_service( + 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.v1.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", + ) + @pytest.mark.anyio async def test_test_helpers_issuing_authorizations_capture_post_async( self, http_client_mock: HTTPClientMock @@ -26095,7 +34427,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, @@ -26144,6 +34476,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: @@ -26168,7 +34522,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( @@ -26204,7 +34558,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( @@ -26214,6 +34568,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: @@ -26241,7 +34619,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}, ) @@ -26282,7 +34660,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}, ) @@ -26294,6 +34672,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: @@ -26342,7 +34768,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}, @@ -26428,7 +34854,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}, @@ -26464,6 +34890,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: @@ -26490,7 +34940,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}, ) @@ -26530,7 +34980,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}, ) @@ -26542,6 +34992,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: @@ -26564,7 +35034,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", @@ -26596,7 +35066,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", @@ -26604,6 +35076,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: @@ -26626,7 +35118,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", @@ -26658,7 +35150,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", @@ -26666,6 +35158,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: @@ -26688,7 +35200,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", @@ -26720,7 +35232,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", @@ -26728,6 +35242,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: @@ -26750,7 +35284,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", @@ -26782,7 +35316,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", @@ -26790,6 +35324,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: @@ -26812,7 +35366,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", @@ -26846,10 +35402,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", @@ -26858,6 +35412,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: @@ -26880,8 +35456,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", @@ -26918,7 +35494,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( @@ -26928,6 +35504,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: @@ -26954,7 +35554,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"]}}, ) @@ -26994,7 +35594,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"]}}, ) @@ -27006,6 +35606,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: @@ -27077,7 +35748,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", @@ -27211,7 +35882,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", @@ -27270,6 +35941,77 @@ 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_service_non_namespaced( + 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.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", + ) + def test_test_helpers_issuing_transactions_create_unlinked_refund_post( self, http_client_mock: HTTPClientMock ) -> None: @@ -27341,7 +36083,7 @@ def test_test_helpers_issuing_transactions_create_unlinked_refund_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.test_helpers.issuing.transactions.create_unlinked_refund( + client.v1.test_helpers.issuing.transactions.create_unlinked_refund( { "amount": 100, "card": "foo", @@ -27473,7 +36215,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", @@ -27532,6 +36274,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: @@ -27558,7 +36324,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}, ) @@ -27598,7 +36364,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}, ) @@ -27610,6 +36376,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: @@ -27632,7 +36418,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", @@ -27664,7 +36450,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", @@ -27672,6 +36458,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: @@ -27698,7 +36508,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}, ) @@ -27738,7 +36548,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}, ) @@ -27750,6 +36560,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: @@ -27776,7 +36610,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}, ) @@ -27816,7 +36650,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}, ) @@ -27828,6 +36662,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: @@ -27850,7 +36704,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", @@ -27882,7 +36736,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", @@ -27890,6 +36744,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: @@ -27912,7 +36786,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", @@ -27944,7 +36818,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( @@ -27954,6 +36828,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: @@ -27976,7 +36870,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", @@ -28008,7 +36902,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", @@ -28016,6 +36910,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: @@ -28038,7 +36952,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", @@ -28070,7 +36984,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", @@ -28078,6 +36992,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: @@ -28101,7 +37036,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", @@ -28134,7 +37069,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", @@ -28142,6 +37077,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: @@ -28164,7 +37119,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", @@ -28198,7 +37153,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( @@ -28208,6 +37163,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: @@ -28234,7 +37215,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", @@ -28276,7 +37257,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", @@ -28290,6 +37271,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: @@ -28313,7 +37315,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", @@ -28349,7 +37351,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, } @@ -28362,6 +37364,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: @@ -28388,7 +37414,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"}}, ) @@ -28428,7 +37454,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"}}, ) @@ -28440,6 +37466,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: @@ -28464,8 +37512,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", @@ -28500,7 +37548,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( @@ -28510,6 +37558,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: @@ -28532,7 +37600,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", @@ -28566,7 +37634,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( @@ -28576,6 +37644,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: @@ -28598,7 +37686,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", @@ -28632,7 +37720,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( @@ -28642,6 +37730,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: @@ -28664,7 +37772,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", @@ -28698,7 +37806,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( @@ -28708,6 +37816,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: @@ -28734,7 +37866,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"}}, ) @@ -28774,7 +37906,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"}}, ) @@ -28786,6 +37918,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: @@ -28814,7 +37974,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", @@ -28860,7 +38020,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", @@ -28876,6 +38036,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: @@ -28904,7 +38092,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", @@ -28950,7 +38138,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", @@ -28966,6 +38154,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( @@ -28986,7 +38194,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", @@ -29018,7 +38226,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", @@ -29026,6 +38234,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={ @@ -29054,7 +38292,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", @@ -29104,7 +38342,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", @@ -29122,25 +38360,7 @@ 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(self, http_client_mock: HTTPClientMock) -> None: - stripe.Token.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="", - 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_service( + def test_tokens_post_2_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -29172,6 +38392,56 @@ def test_tokens_post_2_service( 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={ + "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="", + 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_service( + 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.v1.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", + ) + @pytest.mark.anyio async def test_tokens_post_2_async( self, http_client_mock: HTTPClientMock @@ -29206,7 +38476,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", @@ -29226,6 +38496,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( @@ -29247,7 +38538,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", @@ -29281,7 +38572,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", @@ -29290,6 +38583,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={ @@ -29316,7 +38637,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"}, @@ -29362,7 +38683,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"}, @@ -29378,6 +38699,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={ @@ -29405,7 +38755,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", @@ -29453,7 +38803,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", @@ -29470,6 +38820,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( @@ -29491,7 +38862,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", @@ -29525,7 +38896,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", @@ -29534,6 +38905,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: @@ -29556,7 +38947,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", @@ -29588,7 +38979,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", @@ -29596,6 +38987,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( @@ -29617,7 +39029,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", @@ -29650,7 +39062,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", @@ -29658,6 +39070,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( @@ -29678,7 +39110,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", @@ -29710,7 +39142,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", @@ -29718,6 +39150,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, @@ -29744,7 +39204,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", @@ -29790,7 +39250,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", @@ -29806,19 +39266,7 @@ 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(self, http_client_mock: HTTPClientMock) -> None: - stripe.Topup.modify( - "tu_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - http_client_mock.assert_requested( - "post", - path="/v1/topups/tu_xxxxxxxxxxxxx", - query_string="", - post_data="metadata[order_id]=6735", - ) - - def test_topups_post_2_service( + def test_topups_post_2_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -29842,11 +39290,8 @@ def test_topups_post_2_service( post_data="metadata[order_id]=6735", ) - @pytest.mark.anyio - async def test_topups_post_2_async( - self, http_client_mock: HTTPClientMock - ) -> None: - await stripe.Topup.modify_async( + def test_topups_post_2(self, http_client_mock: HTTPClientMock) -> None: + stripe.Topup.modify( "tu_xxxxxxxxxxxxx", metadata={"order_id": "6735"}, ) @@ -29857,8 +39302,7 @@ async def test_topups_post_2_async( post_data="metadata[order_id]=6735", ) - @pytest.mark.anyio - async def test_topups_post_2_service_async( + def test_topups_post_2_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -29870,7 +39314,7 @@ async def test_topups_post_2_service_async( http_client=http_client_mock.get_mock_http_client(), ) - await client.topups.update_async( + client.v1.topups.update( "tu_xxxxxxxxxxxxx", {"metadata": {"order_id": "6735"}}, ) @@ -29882,6 +39326,67 @@ async def test_topups_post_2_service_async( post_data="metadata[order_id]=6735", ) + @pytest.mark.anyio + async def test_topups_post_2_async( + self, http_client_mock: HTTPClientMock + ) -> None: + await stripe.Topup.modify_async( + "tu_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + http_client_mock.assert_requested( + "post", + path="/v1/topups/tu_xxxxxxxxxxxxx", + query_string="", + post_data="metadata[order_id]=6735", + ) + + @pytest.mark.anyio + async def test_topups_post_2_service_async( + 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(), + ) + + await client.v1.topups.update_async( + "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_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( @@ -29903,7 +39408,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", @@ -29936,7 +39441,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", @@ -29944,6 +39449,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( @@ -29964,7 +39489,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", @@ -29996,7 +39521,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", @@ -30004,6 +39529,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, @@ -30030,7 +39583,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", @@ -30076,7 +39629,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", @@ -30092,6 +39645,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", @@ -30116,7 +39693,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"}}, ) @@ -30156,7 +39733,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"}}, ) @@ -30168,6 +39745,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: @@ -30194,7 +39795,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}, ) @@ -30233,7 +39834,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}, ) @@ -30244,6 +39845,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: @@ -30269,7 +39893,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", ) @@ -30307,7 +39931,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", ) @@ -30318,6 +39942,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: @@ -30344,7 +39992,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}, ) @@ -30384,7 +40032,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}, ) @@ -30396,6 +40044,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: @@ -30423,7 +40096,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"}}, @@ -30465,7 +40138,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"}}, @@ -30478,6 +40151,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: @@ -30504,7 +40203,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, @@ -30545,7 +40244,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, @@ -30558,6 +40257,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: @@ -30580,7 +40299,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", @@ -30614,7 +40333,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( @@ -30624,6 +40343,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: @@ -30649,7 +40393,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", } @@ -30689,7 +40433,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", } @@ -30702,6 +40446,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: @@ -30728,7 +40498,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, @@ -30769,7 +40539,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, @@ -30782,6 +40552,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: @@ -30804,7 +40594,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", @@ -30838,7 +40628,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( @@ -30848,6 +40638,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: @@ -30871,7 +40686,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", } @@ -30911,7 +40726,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", } @@ -30924,6 +40739,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: @@ -30946,8 +40783,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", @@ -30982,7 +40819,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( @@ -30992,6 +40829,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: @@ -31015,7 +40873,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", @@ -31048,7 +40906,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", @@ -31056,6 +40914,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: @@ -31078,7 +40956,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", @@ -31112,7 +40990,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( @@ -31122,6 +41000,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: @@ -31148,7 +41052,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": {}, @@ -31190,7 +41094,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": {}, @@ -31204,6 +41108,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: @@ -31230,7 +41158,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"}}, ) @@ -31270,7 +41198,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"}}, ) @@ -31282,6 +41210,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: @@ -31304,7 +41252,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", @@ -31336,7 +41284,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( @@ -31346,6 +41294,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: @@ -31372,7 +41346,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, @@ -31413,7 +41387,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, @@ -31426,6 +41400,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: @@ -31448,7 +41442,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", @@ -31482,7 +41476,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( @@ -31492,6 +41486,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: @@ -31521,7 +41544,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, @@ -31569,7 +41592,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, @@ -31586,6 +41609,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: @@ -31608,7 +41651,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", @@ -31640,7 +41683,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( @@ -31650,6 +41693,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: @@ -31676,7 +41745,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, @@ -31717,7 +41786,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, @@ -31730,6 +41799,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: @@ -31752,7 +41841,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", @@ -31786,7 +41875,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( @@ -31796,6 +41885,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: @@ -31826,7 +41945,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, @@ -31876,7 +41995,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, @@ -31894,6 +42013,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: @@ -31916,7 +42055,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", @@ -31950,7 +42089,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( @@ -31960,6 +42099,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: @@ -31986,7 +42151,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, @@ -32027,7 +42192,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, @@ -32040,6 +42205,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: @@ -32062,7 +42247,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", @@ -32096,7 +42281,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( @@ -32106,6 +42291,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: @@ -32135,7 +42349,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", @@ -32183,7 +42397,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", @@ -32200,20 +42414,7 @@ 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( - self, http_client_mock: HTTPClientMock - ) -> None: - stripe.treasury.ReceivedCredit.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", - ) - - def test_treasury_received_credits_get_service( + def test_treasury_received_credits_get_service_non_namespaced( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -32239,11 +42440,10 @@ def test_treasury_received_credits_get_service( api_base="https://api.stripe.com", ) - @pytest.mark.anyio - async def test_treasury_received_credits_get_async( + def test_treasury_received_credits_get( self, http_client_mock: HTTPClientMock ) -> None: - await stripe.treasury.ReceivedCredit.list_async( + stripe.treasury.ReceivedCredit.list( financial_account="fa_xxxxxxxxxxxxx", limit=3, ) @@ -32253,8 +42453,7 @@ async def test_treasury_received_credits_get_async( query_string="financial_account=fa_xxxxxxxxxxxxx&limit=3", ) - @pytest.mark.anyio - async def test_treasury_received_credits_get_service_async( + def test_treasury_received_credits_get_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( @@ -32267,7 +42466,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( + client.v1.treasury.received_credits.list( { "financial_account": "fa_xxxxxxxxxxxxx", "limit": 3, @@ -32280,6 +42479,67 @@ async def test_treasury_received_credits_get_service_async( api_base="https://api.stripe.com", ) + @pytest.mark.anyio + async def test_treasury_received_credits_get_async( + self, http_client_mock: HTTPClientMock + ) -> None: + await stripe.treasury.ReceivedCredit.list_async( + 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", + ) + + @pytest.mark.anyio + async def test_treasury_received_credits_get_service_async( + 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(), + ) + + await client.v1.treasury.received_credits.list_async( + { + "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_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: @@ -32302,7 +42562,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", @@ -32334,7 +42594,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( @@ -32344,6 +42604,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: @@ -32370,7 +42656,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, @@ -32411,7 +42697,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, @@ -32424,6 +42710,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: @@ -32446,7 +42752,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", @@ -32478,8 +42784,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", @@ -32488,6 +42794,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: @@ -32514,7 +42846,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, @@ -32555,7 +42887,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, @@ -32568,6 +42900,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: @@ -32590,7 +42942,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", @@ -32624,7 +42976,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( @@ -32634,6 +42986,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: @@ -32660,7 +43038,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, @@ -32701,7 +43079,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, @@ -32714,6 +43092,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: @@ -32736,7 +43134,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", @@ -32768,7 +43166,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", @@ -32776,6 +43176,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: @@ -32798,7 +43218,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", @@ -32830,7 +43250,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", @@ -32838,6 +43258,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: @@ -32861,7 +43302,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", @@ -32894,7 +43335,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", @@ -32902,6 +43343,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: @@ -32924,7 +43385,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", @@ -32956,7 +43417,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", @@ -32964,6 +43425,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: @@ -32990,7 +43477,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"], @@ -33032,7 +43519,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"], @@ -33046,6 +43533,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: @@ -33072,7 +43583,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"}, ) @@ -33112,7 +43623,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"}, ) @@ -33124,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: @@ -33192,7 +43730,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", }, ], @@ -33203,81 +43741,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"}]}', - 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": {"undefined": "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":{"undefined":"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"}}}', + post_data='{"events":[{"event_name":"event_name","identifier":"identifier","payload":{"key":"payload"},"timestamp":"1970-01-01T15:18:46.294Z"}]}', is_json=True, ) @@ -33500,180 +43964,50 @@ def test_v2_core_accounts_person_post_2_service( is_json=True, ) - def test_v2_core_event_destination_get_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "get", - "/v2/core/event_destinations", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.core.event_destinations.list() - http_client_mock.assert_requested( - "get", - path="/v2/core/event_destinations", - query_string="", - api_base="https://api.stripe.com", - ) - - def test_v2_core_event_destination_post_service( + def test_v2_core_account_link_post_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( "post", - "/v2/core/event_destinations", + "/v2/core/account_links", ) client = StripeClient( "sk_test_123", http_client=http_client_mock.get_mock_http_client(), ) - client.v2.core.event_destinations.create( + client.v2.core.account_links.create( { - "enabled_events": ["enabled_events"], - "event_payload": "thin", - "name": "name", - "type": "amazon_eventbridge", + "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/event_destinations", - query_string="", - api_base="https://api.stripe.com", - post_data='{"enabled_events":["enabled_events"],"event_payload":"thin","name":"name","type":"amazon_eventbridge"}', - is_json=True, - ) - - def test_v2_core_event_destination_delete_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "delete", - "/v2/core/event_destinations/id_123", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.core.event_destinations.delete("id_123") - http_client_mock.assert_requested( - "delete", - path="/v2/core/event_destinations/id_123", - query_string="", - api_base="https://api.stripe.com", - ) - - def test_v2_core_event_destination_get_2_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "get", - "/v2/core/event_destinations/id_123", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.core.event_destinations.retrieve("id_123") - http_client_mock.assert_requested( - "get", - path="/v2/core/event_destinations/id_123", - query_string="", - api_base="https://api.stripe.com", - ) - - def test_v2_core_event_destination_post_2_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "post", - "/v2/core/event_destinations/id_123", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.core.event_destinations.update("id_123") - http_client_mock.assert_requested( - "post", - path="/v2/core/event_destinations/id_123", - query_string="", - api_base="https://api.stripe.com", - post_data="{}", - is_json=True, - ) - - def test_v2_core_event_destination_post_3_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "post", - "/v2/core/event_destinations/id_123/disable", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.core.event_destinations.disable("id_123") - http_client_mock.assert_requested( - "post", - path="/v2/core/event_destinations/id_123/disable", - query_string="", - api_base="https://api.stripe.com", - post_data="{}", - is_json=True, - ) - - def test_v2_core_event_destination_post_4_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "post", - "/v2/core/event_destinations/id_123/enable", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.core.event_destinations.enable("id_123") - http_client_mock.assert_requested( - "post", - path="/v2/core/event_destinations/id_123/enable", - query_string="", - api_base="https://api.stripe.com", - post_data="{}", - is_json=True, - ) - - def test_v2_core_event_destination_post_5_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "post", - "/v2/core/event_destinations/id_123/ping", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.core.event_destinations.ping("id_123") - http_client_mock.assert_requested( - "post", - path="/v2/core/event_destinations/id_123/ping", + path="/v2/core/account_links", query_string="", api_base="https://api.stripe.com", - post_data="{}", + 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, ) @@ -33718,6 +44052,183 @@ def test_v2_core_event_get_2_service( api_base="https://api.stripe.com", ) + def test_v2_core_event_destination_get_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/core/event_destinations", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.event_destinations.list() + http_client_mock.assert_requested( + "get", + path="/v2/core/event_destinations", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_v2_core_event_destination_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/core/event_destinations", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.event_destinations.create( + { + "enabled_events": ["enabled_events"], + "event_payload": "thin", + "name": "name", + "type": "amazon_eventbridge", + } + ) + http_client_mock.assert_requested( + "post", + path="/v2/core/event_destinations", + query_string="", + api_base="https://api.stripe.com", + post_data='{"enabled_events":["enabled_events"],"event_payload":"thin","name":"name","type":"amazon_eventbridge"}', + is_json=True, + ) + + def test_v2_core_event_destination_delete_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v2/core/event_destinations/id_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.event_destinations.delete("id_123") + http_client_mock.assert_requested( + "delete", + path="/v2/core/event_destinations/id_123", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_v2_core_event_destination_get_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/core/event_destinations/id_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.event_destinations.retrieve("id_123") + http_client_mock.assert_requested( + "get", + path="/v2/core/event_destinations/id_123", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_v2_core_event_destination_post_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/core/event_destinations/id_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.event_destinations.update("id_123") + http_client_mock.assert_requested( + "post", + path="/v2/core/event_destinations/id_123", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", + is_json=True, + ) + + def test_v2_core_event_destination_post_3_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/core/event_destinations/id_123/disable", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.event_destinations.disable("id_123") + http_client_mock.assert_requested( + "post", + path="/v2/core/event_destinations/id_123/disable", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", + is_json=True, + ) + + def test_v2_core_event_destination_post_4_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/core/event_destinations/id_123/enable", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.event_destinations.enable("id_123") + http_client_mock.assert_requested( + "post", + path="/v2/core/event_destinations/id_123/enable", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", + is_json=True, + ) + + def test_v2_core_event_destination_post_5_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/core/event_destinations/id_123/ping", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.event_destinations.ping("id_123") + http_client_mock.assert_requested( + "post", + path="/v2/core/event_destinations/id_123/ping", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", + is_json=True, + ) + def test_v2_core_vault_gb_bank_account_post_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -34194,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": { @@ -34222,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": { @@ -34297,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( @@ -34729,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", ) @@ -34846,7 +45357,7 @@ def test_v2_payments_off_session_payment_post_service( "amount": {"currency": "USD", "value": 96}, "cadence": "unscheduled", "customer": "customer", - "metadata": {"undefined": "metadata"}, + "metadata": {"key": "metadata"}, "payment_method": "payment_method", } ) @@ -34855,7 +45366,7 @@ def test_v2_payments_off_session_payment_post_service( path="/v2/payments/off_session_payments", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"currency":"USD","value":96},"cadence":"unscheduled","customer":"customer","metadata":{"undefined":"metadata"},"payment_method":"payment_method"}', + post_data='{"amount":{"currency":"USD","value":96},"cadence":"unscheduled","customer":"customer","metadata":{"key":"metadata"},"payment_method":"payment_method"}', is_json=True, ) @@ -34950,13 +45461,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 +45476,25 @@ def test_temporary_session_expired_error_service( ) try: - client.v2.billing.meter_event_stream.create( - { - "events": [ - { - "event_name": "event_name", - "payload": {"undefined": "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":{"undefined":"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 +45503,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 +45534,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 +45640,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 +45696,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 +45707,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 +45722,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 +45749,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 +45776,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 +45855,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 +45870,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, ) 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