From b79a0eef4c3c83821201ab048dc791d6572b5c34 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Tue, 15 Feb 2022 14:43:42 -0800 Subject: [PATCH 1/2] Codegen for openapi a285624 --- stripe/api_resources/__init__.py | 6 +- stripe/api_resources/account.py | 3 +- stripe/api_resources/account_link.py | 1 + stripe/api_resources/alipay_account.py | 1 + stripe/api_resources/apple_pay_domain.py | 1 + stripe/api_resources/application_fee.py | 1 + .../api_resources/application_fee_refund.py | 1 + stripe/api_resources/balance.py | 1 + stripe/api_resources/balance_transaction.py | 1 + stripe/api_resources/bank_account.py | 1 + .../api_resources/billing_portal/__init__.py | 2 +- .../billing_portal/configuration.py | 1 + .../api_resources/billing_portal/session.py | 1 + stripe/api_resources/bitcoin_receiver.py | 1 + stripe/api_resources/bitcoin_transaction.py | 1 + stripe/api_resources/capability.py | 3 +- stripe/api_resources/card.py | 1 + stripe/api_resources/charge.py | 7 +- stripe/api_resources/checkout/__init__.py | 2 +- stripe/api_resources/checkout/session.py | 3 +- stripe/api_resources/country_spec.py | 1 + stripe/api_resources/coupon.py | 1 + stripe/api_resources/credit_note.py | 3 +- stripe/api_resources/credit_note_line_item.py | 1 + stripe/api_resources/customer.py | 3 +- .../customer_balance_transaction.py | 2 +- stripe/api_resources/dispute.py | 3 +- stripe/api_resources/ephemeral_key.py | 1 + stripe/api_resources/event.py | 1 + stripe/api_resources/exchange_rate.py | 1 + stripe/api_resources/file.py | 8 +- stripe/api_resources/file_link.py | 1 + stripe/api_resources/identity/__init__.py | 8 +- .../identity/verification_report.py | 1 + .../identity/verification_session.py | 3 +- stripe/api_resources/invoice.py | 3 +- stripe/api_resources/invoice_item.py | 1 + stripe/api_resources/invoice_line_item.py | 1 + stripe/api_resources/issuer_fraud_record.py | 1 + stripe/api_resources/issuing/__init__.py | 2 +- stripe/api_resources/issuing/authorization.py | 3 +- stripe/api_resources/issuing/card.py | 1 + stripe/api_resources/issuing/card_details.py | 1 + stripe/api_resources/issuing/cardholder.py | 1 + stripe/api_resources/issuing/dispute.py | 3 +- stripe/api_resources/issuing/transaction.py | 1 + stripe/api_resources/line_item.py | 1 + stripe/api_resources/login_link.py | 1 + stripe/api_resources/mandate.py | 1 + stripe/api_resources/order.py | 3 +- stripe/api_resources/order_return.py | 1 + stripe/api_resources/payment_intent.py | 10 +- stripe/api_resources/payment_link.py | 3 +- stripe/api_resources/payment_method.py | 3 +- stripe/api_resources/payout.py | 7 +- stripe/api_resources/person.py | 1 + stripe/api_resources/plan.py | 1 + stripe/api_resources/price.py | 1 + stripe/api_resources/product.py | 1 + stripe/api_resources/promotion_code.py | 1 + stripe/api_resources/quote.py | 45 +- stripe/api_resources/radar/__init__.py | 2 +- .../radar/early_fraud_warning.py | 1 + stripe/api_resources/radar/value_list.py | 1 + stripe/api_resources/radar/value_list_item.py | 1 + stripe/api_resources/recipient.py | 1 + stripe/api_resources/refund.py | 5 +- stripe/api_resources/reporting/__init__.py | 2 +- stripe/api_resources/reporting/report_run.py | 1 + stripe/api_resources/reporting/report_type.py | 1 + stripe/api_resources/reversal.py | 1 + stripe/api_resources/review.py | 3 +- stripe/api_resources/setup_attempt.py | 1 + stripe/api_resources/setup_intent.py | 10 +- stripe/api_resources/shipping_rate.py | 1 + stripe/api_resources/sigma/__init__.py | 2 +- .../sigma/scheduled_query_run.py | 1 + stripe/api_resources/sku.py | 1 + stripe/api_resources/source.py | 4 +- stripe/api_resources/source_transaction.py | 1 + stripe/api_resources/subscription.py | 1 + stripe/api_resources/subscription_item.py | 4 +- stripe/api_resources/subscription_schedule.py | 3 +- stripe/api_resources/tax_code.py | 1 + stripe/api_resources/tax_id.py | 1 + stripe/api_resources/tax_rate.py | 1 + stripe/api_resources/terminal/__init__.py | 2 +- .../terminal/connection_token.py | 1 + stripe/api_resources/terminal/location.py | 1 + stripe/api_resources/terminal/reader.py | 1 + stripe/api_resources/three_d_secure.py | 1 + stripe/api_resources/token.py | 1 + stripe/api_resources/topup.py | 3 +- stripe/api_resources/transfer.py | 3 +- stripe/api_resources/usage_record.py | 1 + stripe/api_resources/usage_record_summary.py | 1 + stripe/api_resources/webhook_endpoint.py | 1 + stripe/object_classes.py | 2 +- tests/test_generated_examples.py | 2914 ++++++++--------- 99 files changed, 1455 insertions(+), 1703 deletions(-) diff --git a/stripe/api_resources/__init__.py b/stripe/api_resources/__init__.py index c61f03fd6..b2f00f665 100644 --- a/stripe/api_resources/__init__.py +++ b/stripe/api_resources/__init__.py @@ -34,9 +34,7 @@ from stripe.api_resources.credit_note import CreditNote from stripe.api_resources.credit_note_line_item import CreditNoteLineItem from stripe.api_resources.customer import Customer -from stripe.api_resources.customer_balance_transaction import ( - CustomerBalanceTransaction, -) +from stripe.api_resources.customer_balance_transaction import CustomerBalanceTransaction from stripe.api_resources.dispute import Dispute from stripe.api_resources.ephemeral_key import EphemeralKey from stripe.api_resources.event import Event @@ -86,4 +84,4 @@ from stripe.api_resources.transfer import Transfer from stripe.api_resources.usage_record import UsageRecord from stripe.api_resources.usage_record_summary import UsageRecordSummary -from stripe.api_resources.webhook_endpoint import WebhookEndpoint +from stripe.api_resources.webhook_endpoint import WebhookEndpoint \ No newline at end of file diff --git a/stripe/api_resources/account.py b/stripe/api_resources/account.py index 0d99f607e..4d5ff74fd 100644 --- a/stripe/api_resources/account.py +++ b/stripe/api_resources/account.py @@ -35,13 +35,13 @@ class Account( UpdateableAPIResource, ): OBJECT_NAME = "account" - def reject(self, idempotency_key=None, **params): url = self.instance_url() + "/reject" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + # We are not adding a helper for capabilities here as the Account object already has a # capabilities property which is a hash and not the sub-list of capabilities. @@ -88,3 +88,4 @@ def serialize(self, previous): params[k] = v.serialize(previous.get(k, None)) return params + diff --git a/stripe/api_resources/account_link.py b/stripe/api_resources/account_link.py index 8ee5e043c..97e0e5247 100644 --- a/stripe/api_resources/account_link.py +++ b/stripe/api_resources/account_link.py @@ -6,3 +6,4 @@ class AccountLink(CreateableAPIResource): OBJECT_NAME = "account_link" + diff --git a/stripe/api_resources/alipay_account.py b/stripe/api_resources/alipay_account.py index a11da90c9..bc4765f87 100644 --- a/stripe/api_resources/alipay_account.py +++ b/stripe/api_resources/alipay_account.py @@ -43,3 +43,4 @@ def retrieve( "Can't retrieve an Alipay account without a customer ID. " "Use customer.sources.retrieve('alipay_account_id') instead." ) + diff --git a/stripe/api_resources/apple_pay_domain.py b/stripe/api_resources/apple_pay_domain.py index d600ff3c5..0bd248d90 100644 --- a/stripe/api_resources/apple_pay_domain.py +++ b/stripe/api_resources/apple_pay_domain.py @@ -16,3 +16,4 @@ class ApplePayDomain( @classmethod def class_url(cls): return "/v1/apple_pay/domains" + diff --git a/stripe/api_resources/application_fee.py b/stripe/api_resources/application_fee.py index 9c44605dd..0ea13798c 100644 --- a/stripe/api_resources/application_fee.py +++ b/stripe/api_resources/application_fee.py @@ -18,3 +18,4 @@ def refund(self, idempotency_key=None, **params): url = self.instance_url() + "/refund" self.refresh_from(self.request("post", url, params, headers)) return self + diff --git a/stripe/api_resources/application_fee_refund.py b/stripe/api_resources/application_fee_refund.py index fbda378bb..cb4036d45 100644 --- a/stripe/api_resources/application_fee_refund.py +++ b/stripe/api_resources/application_fee_refund.py @@ -33,3 +33,4 @@ def retrieve(cls, id, api_key=None, **params): "Can't retrieve a refund without an application fee ID. " "Use application_fee.refunds.retrieve('refund_id') instead." ) + diff --git a/stripe/api_resources/balance.py b/stripe/api_resources/balance.py index af75a95f1..4d00e5195 100644 --- a/stripe/api_resources/balance.py +++ b/stripe/api_resources/balance.py @@ -6,3 +6,4 @@ class Balance(SingletonAPIResource): OBJECT_NAME = "balance" + diff --git a/stripe/api_resources/balance_transaction.py b/stripe/api_resources/balance_transaction.py index dc0659551..7d240315d 100644 --- a/stripe/api_resources/balance_transaction.py +++ b/stripe/api_resources/balance_transaction.py @@ -6,3 +6,4 @@ class BalanceTransaction(ListableAPIResource): OBJECT_NAME = "balance_transaction" + diff --git a/stripe/api_resources/bank_account.py b/stripe/api_resources/bank_account.py index e9cc7c948..2a350526e 100644 --- a/stripe/api_resources/bank_account.py +++ b/stripe/api_resources/bank_account.py @@ -62,3 +62,4 @@ def retrieve( "Use customer.sources.retrieve('bank_account_id') or " "account.external_accounts.retrieve('bank_account_id') instead." ) + diff --git a/stripe/api_resources/billing_portal/__init__.py b/stripe/api_resources/billing_portal/__init__.py index 53bdc6b66..19c989571 100644 --- a/stripe/api_resources/billing_portal/__init__.py +++ b/stripe/api_resources/billing_portal/__init__.py @@ -4,4 +4,4 @@ # flake8: noqa from stripe.api_resources.billing_portal.configuration import Configuration -from stripe.api_resources.billing_portal.session import Session +from stripe.api_resources.billing_portal.session import Session \ No newline at end of file diff --git a/stripe/api_resources/billing_portal/configuration.py b/stripe/api_resources/billing_portal/configuration.py index a6bcfcd7c..0fe69dabf 100644 --- a/stripe/api_resources/billing_portal/configuration.py +++ b/stripe/api_resources/billing_portal/configuration.py @@ -12,3 +12,4 @@ class Configuration( UpdateableAPIResource, ): OBJECT_NAME = "billing_portal.configuration" + diff --git a/stripe/api_resources/billing_portal/session.py b/stripe/api_resources/billing_portal/session.py index ca06b42aa..66a6dd1e0 100644 --- a/stripe/api_resources/billing_portal/session.py +++ b/stripe/api_resources/billing_portal/session.py @@ -6,3 +6,4 @@ class Session(CreateableAPIResource): OBJECT_NAME = "billing_portal.session" + diff --git a/stripe/api_resources/bitcoin_receiver.py b/stripe/api_resources/bitcoin_receiver.py index 6d31bc6af..7a84729ad 100644 --- a/stripe/api_resources/bitcoin_receiver.py +++ b/stripe/api_resources/bitcoin_receiver.py @@ -26,3 +26,4 @@ def instance_url(self): @classmethod def class_url(cls): return "/v1/bitcoin/receivers" + diff --git a/stripe/api_resources/bitcoin_transaction.py b/stripe/api_resources/bitcoin_transaction.py index 96f5a9c85..174208e8c 100644 --- a/stripe/api_resources/bitcoin_transaction.py +++ b/stripe/api_resources/bitcoin_transaction.py @@ -6,3 +6,4 @@ class BitcoinTransaction(StripeObject): OBJECT_NAME = "bitcoin_transaction" + diff --git a/stripe/api_resources/capability.py b/stripe/api_resources/capability.py index b9dcdd919..745f2ed30 100644 --- a/stripe/api_resources/capability.py +++ b/stripe/api_resources/capability.py @@ -17,17 +17,16 @@ def instance_url(self): acct_extn = quote_plus(account) extn = quote_plus(token) return "%s/%s/capabilities/%s" % (base, acct_extn, extn) - @classmethod def modify(cls, sid, **params): raise NotImplementedError( "Can't update a capability without an account ID. Update a capability using " "account.modify_capability('acct_123', 'acap_123', params)" ) - @classmethod def retrieve(cls, id, api_key=None, **params): raise NotImplementedError( "Can't retrieve a capability without an account ID. Retrieve a capability using " "account.retrieve_capability('acct_123', 'acap_123')" ) + diff --git a/stripe/api_resources/card.py b/stripe/api_resources/card.py index 53503691d..a679db6e6 100644 --- a/stripe/api_resources/card.py +++ b/stripe/api_resources/card.py @@ -72,3 +72,4 @@ def retrieve( "recipient.cards.retrieve('card_id'), or " "account.external_accounts.retrieve('card_id') instead." ) + diff --git a/stripe/api_resources/charge.py b/stripe/api_resources/charge.py index d77411f6c..66bfd351e 100644 --- a/stripe/api_resources/charge.py +++ b/stripe/api_resources/charge.py @@ -10,17 +10,15 @@ @custom_method("capture", http_verb="post") -class Charge( - CreateableAPIResource, ListableAPIResource, UpdateableAPIResource -): +class Charge(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "charge" - def capture(self, idempotency_key=None, **params): url = self.instance_url() + "/capture" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + def refund(self, idempotency_key=None, **params): url = self.instance_url() + "/refund" headers = util.populate_headers(idempotency_key) @@ -64,3 +62,4 @@ def mark_as_safe(self, idempotency_key=None): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + diff --git a/stripe/api_resources/checkout/__init__.py b/stripe/api_resources/checkout/__init__.py index 68c840ab9..7b99e61c0 100644 --- a/stripe/api_resources/checkout/__init__.py +++ b/stripe/api_resources/checkout/__init__.py @@ -3,4 +3,4 @@ # flake8: noqa -from stripe.api_resources.checkout.session import Session +from stripe.api_resources.checkout.session import Session \ No newline at end of file diff --git a/stripe/api_resources/checkout/session.py b/stripe/api_resources/checkout/session.py index 9a900777a..647f1e68c 100644 --- a/stripe/api_resources/checkout/session.py +++ b/stripe/api_resources/checkout/session.py @@ -12,9 +12,10 @@ @nested_resource_class_methods("line_item", operations=["list"]) class Session(CreateableAPIResource, ListableAPIResource): OBJECT_NAME = "checkout.session" - def expire(self, idempotency_key=None, **params): url = self.instance_url() + "/expire" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + diff --git a/stripe/api_resources/country_spec.py b/stripe/api_resources/country_spec.py index 86254337f..79ed47846 100644 --- a/stripe/api_resources/country_spec.py +++ b/stripe/api_resources/country_spec.py @@ -6,3 +6,4 @@ class CountrySpec(ListableAPIResource): OBJECT_NAME = "country_spec" + diff --git a/stripe/api_resources/coupon.py b/stripe/api_resources/coupon.py index e258aacc3..791dbb874 100644 --- a/stripe/api_resources/coupon.py +++ b/stripe/api_resources/coupon.py @@ -14,3 +14,4 @@ class Coupon( UpdateableAPIResource, ): OBJECT_NAME = "coupon" + diff --git a/stripe/api_resources/credit_note.py b/stripe/api_resources/credit_note.py index beec2ad6c..0b0ebc69a 100644 --- a/stripe/api_resources/credit_note.py +++ b/stripe/api_resources/credit_note.py @@ -16,13 +16,13 @@ class CreditNote( UpdateableAPIResource, ): OBJECT_NAME = "credit_note" - def void_credit_note(self, idempotency_key=None, **params): url = self.instance_url() + "/void" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + @classmethod def preview( cls, api_key=None, stripe_version=None, stripe_account=None, **params @@ -35,3 +35,4 @@ def preview( return util.convert_to_stripe_object( response, api_key, stripe_version, stripe_account ) + diff --git a/stripe/api_resources/credit_note_line_item.py b/stripe/api_resources/credit_note_line_item.py index f0dd6bbaa..c8d3d7299 100644 --- a/stripe/api_resources/credit_note_line_item.py +++ b/stripe/api_resources/credit_note_line_item.py @@ -6,3 +6,4 @@ class CreditNoteLineItem(StripeObject): OBJECT_NAME = "credit_note_line_item" + diff --git a/stripe/api_resources/customer.py b/stripe/api_resources/customer.py index 5aab5b69c..194fc8710 100644 --- a/stripe/api_resources/customer.py +++ b/stripe/api_resources/customer.py @@ -36,7 +36,6 @@ class Customer( UpdateableAPIResource, ): OBJECT_NAME = "customer" - def list_payment_methods(self, idempotency_key=None, **params): url = self.instance_url() + "/payment_methods" headers = util.populate_headers(idempotency_key) @@ -45,6 +44,7 @@ def list_payment_methods(self, idempotency_key=None, **params): stripe_object._retrieve_params = params return stripe_object + def delete_discount(self, **params): requestor = api_requestor.APIRequestor( self.api_key, @@ -54,3 +54,4 @@ def delete_discount(self, **params): url = self.instance_url() + "/discount" _, api_key = requestor.request("delete", url, params) self.refresh_from({"discount": None}, api_key, True) + diff --git a/stripe/api_resources/customer_balance_transaction.py b/stripe/api_resources/customer_balance_transaction.py index 59d233091..49a2cadc7 100644 --- a/stripe/api_resources/customer_balance_transaction.py +++ b/stripe/api_resources/customer_balance_transaction.py @@ -17,10 +17,10 @@ def instance_url(self): cust_extn = quote_plus(customer) extn = quote_plus(token) return "%s/%s/balance_transactions/%s" % (base, cust_extn, extn) - @classmethod def retrieve(cls, id, api_key=None, **params): raise NotImplementedError( "Can't retrieve a Customer Balance Transaction without a Customer ID. " "Use Customer.retrieve_customer_balance_transaction('cus_123', 'cbtxn_123')" ) + diff --git a/stripe/api_resources/dispute.py b/stripe/api_resources/dispute.py index cc779f1d7..0be9864a8 100644 --- a/stripe/api_resources/dispute.py +++ b/stripe/api_resources/dispute.py @@ -10,9 +10,10 @@ @custom_method("close", http_verb="post") class Dispute(ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "dispute" - def close(self, idempotency_key=None, **params): url = self.instance_url() + "/close" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + diff --git a/stripe/api_resources/ephemeral_key.py b/stripe/api_resources/ephemeral_key.py index 644e6a79d..296f3461d 100644 --- a/stripe/api_resources/ephemeral_key.py +++ b/stripe/api_resources/ephemeral_key.py @@ -34,3 +34,4 @@ def create( return util.convert_to_stripe_object( response, api_key, stripe_version, stripe_account ) + diff --git a/stripe/api_resources/event.py b/stripe/api_resources/event.py index a86a1d802..2a7b7d627 100644 --- a/stripe/api_resources/event.py +++ b/stripe/api_resources/event.py @@ -6,3 +6,4 @@ class Event(ListableAPIResource): OBJECT_NAME = "event" + diff --git a/stripe/api_resources/exchange_rate.py b/stripe/api_resources/exchange_rate.py index dbd412aaa..62b43b85a 100644 --- a/stripe/api_resources/exchange_rate.py +++ b/stripe/api_resources/exchange_rate.py @@ -6,3 +6,4 @@ class ExchangeRate(ListableAPIResource): OBJECT_NAME = "exchange_rate" + diff --git a/stripe/api_resources/file.py b/stripe/api_resources/file.py index ebc9e9274..b7135b2bf 100644 --- a/stripe/api_resources/file.py +++ b/stripe/api_resources/file.py @@ -23,12 +23,7 @@ def class_url(cls): @classmethod def create( # 'api_version' is deprecated, please use 'stripe_version' - cls, - api_key=None, - api_version=None, - stripe_version=None, - stripe_account=None, - **params + cls, api_key=None, api_version=None, stripe_version=None, stripe_account=None, **params ): version = api_version or stripe_version requestor = api_requestor.APIRequestor( @@ -46,6 +41,5 @@ def create( response, api_key, version, stripe_account ) - # For backwards compatibility, the `File` class is aliased to `FileUpload`. FileUpload = File diff --git a/stripe/api_resources/file_link.py b/stripe/api_resources/file_link.py index 67ea204f4..ba14d6214 100644 --- a/stripe/api_resources/file_link.py +++ b/stripe/api_resources/file_link.py @@ -12,3 +12,4 @@ class FileLink( UpdateableAPIResource, ): OBJECT_NAME = "file_link" + diff --git a/stripe/api_resources/identity/__init__.py b/stripe/api_resources/identity/__init__.py index 531515dab..13e92f600 100644 --- a/stripe/api_resources/identity/__init__.py +++ b/stripe/api_resources/identity/__init__.py @@ -3,9 +3,5 @@ # flake8: noqa -from stripe.api_resources.identity.verification_report import ( - VerificationReport, -) -from stripe.api_resources.identity.verification_session import ( - VerificationSession, -) +from stripe.api_resources.identity.verification_report import VerificationReport +from stripe.api_resources.identity.verification_session import VerificationSession \ No newline at end of file diff --git a/stripe/api_resources/identity/verification_report.py b/stripe/api_resources/identity/verification_report.py index d110f8f7b..0d954c141 100644 --- a/stripe/api_resources/identity/verification_report.py +++ b/stripe/api_resources/identity/verification_report.py @@ -6,3 +6,4 @@ class VerificationReport(ListableAPIResource): OBJECT_NAME = "identity.verification_report" + diff --git a/stripe/api_resources/identity/verification_session.py b/stripe/api_resources/identity/verification_session.py index e2933e143..b802f6947 100644 --- a/stripe/api_resources/identity/verification_session.py +++ b/stripe/api_resources/identity/verification_session.py @@ -16,7 +16,6 @@ class VerificationSession( UpdateableAPIResource, ): OBJECT_NAME = "identity.verification_session" - def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) @@ -28,3 +27,5 @@ def redact(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + diff --git a/stripe/api_resources/invoice.py b/stripe/api_resources/invoice.py index cd0e43e6a..2d0409e9d 100644 --- a/stripe/api_resources/invoice.py +++ b/stripe/api_resources/invoice.py @@ -22,7 +22,6 @@ class Invoice( UpdateableAPIResource, ): OBJECT_NAME = "invoice" - def finalize_invoice(self, idempotency_key=None, **params): url = self.instance_url() + "/finalize" headers = util.populate_headers(idempotency_key) @@ -53,6 +52,7 @@ def void_invoice(self, idempotency_key=None, **params): self.refresh_from(self.request("post", url, params, headers)) return self + @classmethod def upcoming( cls, api_key=None, stripe_version=None, stripe_account=None, **params @@ -65,3 +65,4 @@ def upcoming( return util.convert_to_stripe_object( response, api_key, stripe_version, stripe_account ) + diff --git a/stripe/api_resources/invoice_item.py b/stripe/api_resources/invoice_item.py index 58b7dd871..a0e487105 100644 --- a/stripe/api_resources/invoice_item.py +++ b/stripe/api_resources/invoice_item.py @@ -14,3 +14,4 @@ class InvoiceItem( UpdateableAPIResource, ): OBJECT_NAME = "invoiceitem" + diff --git a/stripe/api_resources/invoice_line_item.py b/stripe/api_resources/invoice_line_item.py index 0daa10d12..19828b80e 100644 --- a/stripe/api_resources/invoice_line_item.py +++ b/stripe/api_resources/invoice_line_item.py @@ -6,3 +6,4 @@ class InvoiceLineItem(StripeObject): OBJECT_NAME = "line_item" + diff --git a/stripe/api_resources/issuer_fraud_record.py b/stripe/api_resources/issuer_fraud_record.py index a626f919e..64c09fcd0 100644 --- a/stripe/api_resources/issuer_fraud_record.py +++ b/stripe/api_resources/issuer_fraud_record.py @@ -6,3 +6,4 @@ class IssuerFraudRecord(ListableAPIResource): OBJECT_NAME = "issuer_fraud_record" + diff --git a/stripe/api_resources/issuing/__init__.py b/stripe/api_resources/issuing/__init__.py index 1dad47db2..469550879 100644 --- a/stripe/api_resources/issuing/__init__.py +++ b/stripe/api_resources/issuing/__init__.py @@ -8,4 +8,4 @@ from stripe.api_resources.issuing.card_details import CardDetails from stripe.api_resources.issuing.cardholder import Cardholder from stripe.api_resources.issuing.dispute import Dispute -from stripe.api_resources.issuing.transaction import Transaction +from stripe.api_resources.issuing.transaction import Transaction \ No newline at end of file diff --git a/stripe/api_resources/issuing/authorization.py b/stripe/api_resources/issuing/authorization.py index 206e8b9f9..852e16036 100644 --- a/stripe/api_resources/issuing/authorization.py +++ b/stripe/api_resources/issuing/authorization.py @@ -11,7 +11,6 @@ @custom_method("decline", http_verb="post") class Authorization(ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "issuing.authorization" - def approve(self, idempotency_key=None, **params): url = self.instance_url() + "/approve" headers = util.populate_headers(idempotency_key) @@ -23,3 +22,5 @@ def decline(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + diff --git a/stripe/api_resources/issuing/card.py b/stripe/api_resources/issuing/card.py index 0896a494f..b3e57637f 100644 --- a/stripe/api_resources/issuing/card.py +++ b/stripe/api_resources/issuing/card.py @@ -13,3 +13,4 @@ class Card(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): def details(self, idempotency_key=None, **params): return self.request("get", self.instance_url() + "/details", params) + diff --git a/stripe/api_resources/issuing/card_details.py b/stripe/api_resources/issuing/card_details.py index 70e29c468..8f96b6e4a 100644 --- a/stripe/api_resources/issuing/card_details.py +++ b/stripe/api_resources/issuing/card_details.py @@ -6,3 +6,4 @@ class CardDetails(StripeObject): OBJECT_NAME = "issuing.card_details" + diff --git a/stripe/api_resources/issuing/cardholder.py b/stripe/api_resources/issuing/cardholder.py index e8060341d..fc3506c60 100644 --- a/stripe/api_resources/issuing/cardholder.py +++ b/stripe/api_resources/issuing/cardholder.py @@ -12,3 +12,4 @@ class Cardholder( UpdateableAPIResource, ): OBJECT_NAME = "issuing.cardholder" + diff --git a/stripe/api_resources/issuing/dispute.py b/stripe/api_resources/issuing/dispute.py index da9be3ea2..ecf9263d4 100644 --- a/stripe/api_resources/issuing/dispute.py +++ b/stripe/api_resources/issuing/dispute.py @@ -15,9 +15,10 @@ class Dispute( UpdateableAPIResource, ): OBJECT_NAME = "issuing.dispute" - def submit(self, idempotency_key=None, **params): url = self.instance_url() + "/submit" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + diff --git a/stripe/api_resources/issuing/transaction.py b/stripe/api_resources/issuing/transaction.py index 319b717c8..e1f960660 100644 --- a/stripe/api_resources/issuing/transaction.py +++ b/stripe/api_resources/issuing/transaction.py @@ -7,3 +7,4 @@ class Transaction(ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "issuing.transaction" + diff --git a/stripe/api_resources/line_item.py b/stripe/api_resources/line_item.py index 1629c5338..756648360 100644 --- a/stripe/api_resources/line_item.py +++ b/stripe/api_resources/line_item.py @@ -6,3 +6,4 @@ class LineItem(APIResource): OBJECT_NAME = "item" + diff --git a/stripe/api_resources/login_link.py b/stripe/api_resources/login_link.py index 7d0635a51..e95c4645e 100644 --- a/stripe/api_resources/login_link.py +++ b/stripe/api_resources/login_link.py @@ -6,3 +6,4 @@ class LoginLink(StripeObject): OBJECT_NAME = "login_link" + diff --git a/stripe/api_resources/mandate.py b/stripe/api_resources/mandate.py index acee29432..1807855ce 100644 --- a/stripe/api_resources/mandate.py +++ b/stripe/api_resources/mandate.py @@ -6,3 +6,4 @@ class Mandate(APIResource): OBJECT_NAME = "mandate" + diff --git a/stripe/api_resources/order.py b/stripe/api_resources/order.py index 7d7e6b89d..7d0faa430 100644 --- a/stripe/api_resources/order.py +++ b/stripe/api_resources/order.py @@ -12,15 +12,16 @@ @custom_method("pay", http_verb="post") class Order(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "order" - def pay(self, idempotency_key=None, **params): url = self.instance_url() + "/pay" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + def return_order(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) return self.request( "post", self.instance_url() + "/returns", params, headers ) + diff --git a/stripe/api_resources/order_return.py b/stripe/api_resources/order_return.py index ecaa170f0..fe7306ac4 100644 --- a/stripe/api_resources/order_return.py +++ b/stripe/api_resources/order_return.py @@ -6,3 +6,4 @@ class OrderReturn(ListableAPIResource): OBJECT_NAME = "order_return" + diff --git a/stripe/api_resources/payment_intent.py b/stripe/api_resources/payment_intent.py index cb10a009d..8184c6586 100644 --- a/stripe/api_resources/payment_intent.py +++ b/stripe/api_resources/payment_intent.py @@ -11,13 +11,13 @@ @custom_method("cancel", http_verb="post") @custom_method("capture", http_verb="post") @custom_method("confirm", http_verb="post") +@custom_method("verify_microdeposits", http_verb="post") class PaymentIntent( CreateableAPIResource, ListableAPIResource, UpdateableAPIResource, ): OBJECT_NAME = "payment_intent" - def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) @@ -35,3 +35,11 @@ def confirm(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + def verify_microdeposits(self, idempotency_key=None, **params): + url = self.instance_url() + "/verify_microdeposits" + headers = util.populate_headers(idempotency_key) + self.refresh_from(self.request("post", url, params, headers)) + return self + + diff --git a/stripe/api_resources/payment_link.py b/stripe/api_resources/payment_link.py index 976faba9c..733a821bb 100644 --- a/stripe/api_resources/payment_link.py +++ b/stripe/api_resources/payment_link.py @@ -15,7 +15,6 @@ class PaymentLink( UpdateableAPIResource, ): OBJECT_NAME = "payment_link" - def list_line_items(self, idempotency_key=None, **params): url = self.instance_url() + "/line_items" headers = util.populate_headers(idempotency_key) @@ -23,3 +22,5 @@ def list_line_items(self, idempotency_key=None, **params): stripe_object = util.convert_to_stripe_object(resp) stripe_object._retrieve_params = params return stripe_object + + diff --git a/stripe/api_resources/payment_method.py b/stripe/api_resources/payment_method.py index a2f919a30..0c1564bf3 100644 --- a/stripe/api_resources/payment_method.py +++ b/stripe/api_resources/payment_method.py @@ -16,7 +16,6 @@ class PaymentMethod( UpdateableAPIResource, ): OBJECT_NAME = "payment_method" - def attach(self, idempotency_key=None, **params): url = self.instance_url() + "/attach" headers = util.populate_headers(idempotency_key) @@ -28,3 +27,5 @@ def detach(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + diff --git a/stripe/api_resources/payout.py b/stripe/api_resources/payout.py index 82c5807e1..5c1e6f51a 100644 --- a/stripe/api_resources/payout.py +++ b/stripe/api_resources/payout.py @@ -10,11 +10,8 @@ @custom_method("cancel", http_verb="post") @custom_method("reverse", http_verb="post") -class Payout( - CreateableAPIResource, ListableAPIResource, UpdateableAPIResource -): +class Payout(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "payout" - def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) @@ -26,3 +23,5 @@ def reverse(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + diff --git a/stripe/api_resources/person.py b/stripe/api_resources/person.py index 45df5a826..9f69c0650 100644 --- a/stripe/api_resources/person.py +++ b/stripe/api_resources/person.py @@ -31,3 +31,4 @@ def retrieve(cls, id, api_key=None, **params): "Can't retrieve a person without an account" "ID. Use account.persons.retrieve('person_id')" ) + diff --git a/stripe/api_resources/plan.py b/stripe/api_resources/plan.py index 9f9904d94..2eaeaeafe 100644 --- a/stripe/api_resources/plan.py +++ b/stripe/api_resources/plan.py @@ -14,3 +14,4 @@ class Plan( UpdateableAPIResource, ): OBJECT_NAME = "plan" + diff --git a/stripe/api_resources/price.py b/stripe/api_resources/price.py index 132d5db3f..7a5f44186 100644 --- a/stripe/api_resources/price.py +++ b/stripe/api_resources/price.py @@ -8,3 +8,4 @@ class Price(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "price" + diff --git a/stripe/api_resources/product.py b/stripe/api_resources/product.py index 51c30a4e9..5edd723b2 100644 --- a/stripe/api_resources/product.py +++ b/stripe/api_resources/product.py @@ -14,3 +14,4 @@ class Product( UpdateableAPIResource, ): OBJECT_NAME = "product" + diff --git a/stripe/api_resources/promotion_code.py b/stripe/api_resources/promotion_code.py index 1b3ba12de..7106fe57e 100644 --- a/stripe/api_resources/promotion_code.py +++ b/stripe/api_resources/promotion_code.py @@ -12,3 +12,4 @@ class PromotionCode( UpdateableAPIResource, ): OBJECT_NAME = "promotion_code" + diff --git a/stripe/api_resources/quote.py b/stripe/api_resources/quote.py index a8fb86903..bc4dcd88c 100644 --- a/stripe/api_resources/quote.py +++ b/stripe/api_resources/quote.py @@ -22,7 +22,6 @@ @custom_method("list_line_items", http_verb="get", http_path="line_items") class Quote(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "quote" - def accept(self, idempotency_key=None, **params): url = self.instance_url() + "/accept" headers = util.populate_headers(idempotency_key) @@ -57,30 +56,31 @@ def list_line_items(self, idempotency_key=None, **params): stripe_object._retrieve_params = params return stripe_object + @classmethod def _cls_pdf( - cls, - sid, - api_key=None, - idempotency_key=None, - stripe_version=None, - stripe_account=None, - **params + cls, + sid, + api_key=None, + idempotency_key=None, + stripe_version=None, + stripe_account=None, + **params ): - url = "%s/%s/%s" % ( - cls.class_url(), - quote_plus(util.utf8(sid)), - "pdf", - ) - requestor = api_requestor.APIRequestor( - api_key, - api_base=stripe.upload_api_base, - api_version=stripe_version, - account=stripe_account, - ) - headers = util.populate_headers(idempotency_key) - response, _ = requestor.request_stream("get", url, params, headers) - return response + url = "%s/%s/%s" % ( + cls.class_url(), + quote_plus(util.utf8(sid)), + "pdf", + ) + requestor = api_requestor.APIRequestor( + api_key, + api_base=stripe.upload_api_base, + api_version=stripe_version, + account=stripe_account, + ) + headers = util.populate_headers(idempotency_key) + response, _ = requestor.request_stream("get", url, params, headers) + return response @util.class_method_variant("_cls_pdf") def pdf( @@ -100,3 +100,4 @@ def pdf( ) url = self.instance_url() + "/pdf" return requestor.request_stream("get", url, params=params) + diff --git a/stripe/api_resources/radar/__init__.py b/stripe/api_resources/radar/__init__.py index ce2561fd6..2e8e12c90 100644 --- a/stripe/api_resources/radar/__init__.py +++ b/stripe/api_resources/radar/__init__.py @@ -5,4 +5,4 @@ from stripe.api_resources.radar.early_fraud_warning import EarlyFraudWarning from stripe.api_resources.radar.value_list import ValueList -from stripe.api_resources.radar.value_list_item import ValueListItem +from stripe.api_resources.radar.value_list_item import ValueListItem \ No newline at end of file diff --git a/stripe/api_resources/radar/early_fraud_warning.py b/stripe/api_resources/radar/early_fraud_warning.py index 46a871eb4..9c16cb835 100644 --- a/stripe/api_resources/radar/early_fraud_warning.py +++ b/stripe/api_resources/radar/early_fraud_warning.py @@ -6,3 +6,4 @@ class EarlyFraudWarning(ListableAPIResource): OBJECT_NAME = "radar.early_fraud_warning" + diff --git a/stripe/api_resources/radar/value_list.py b/stripe/api_resources/radar/value_list.py index cba9e5c75..bfbd7fb8b 100644 --- a/stripe/api_resources/radar/value_list.py +++ b/stripe/api_resources/radar/value_list.py @@ -14,3 +14,4 @@ class ValueList( UpdateableAPIResource, ): OBJECT_NAME = "radar.value_list" + diff --git a/stripe/api_resources/radar/value_list_item.py b/stripe/api_resources/radar/value_list_item.py index 7c2c71d53..ab005a121 100644 --- a/stripe/api_resources/radar/value_list_item.py +++ b/stripe/api_resources/radar/value_list_item.py @@ -12,3 +12,4 @@ class ValueListItem( ListableAPIResource, ): OBJECT_NAME = "radar.value_list_item" + diff --git a/stripe/api_resources/recipient.py b/stripe/api_resources/recipient.py index 856f69af5..dc0c87c32 100644 --- a/stripe/api_resources/recipient.py +++ b/stripe/api_resources/recipient.py @@ -14,3 +14,4 @@ class Recipient( UpdateableAPIResource, ): OBJECT_NAME = "recipient" + diff --git a/stripe/api_resources/refund.py b/stripe/api_resources/refund.py index 2c5e726cb..82ae00b7e 100644 --- a/stripe/api_resources/refund.py +++ b/stripe/api_resources/refund.py @@ -6,7 +6,6 @@ from stripe.api_resources.abstract import UpdateableAPIResource -class Refund( - CreateableAPIResource, ListableAPIResource, UpdateableAPIResource -): +class Refund(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "refund" + diff --git a/stripe/api_resources/reporting/__init__.py b/stripe/api_resources/reporting/__init__.py index 95cc9c1e7..0bbb37ab9 100644 --- a/stripe/api_resources/reporting/__init__.py +++ b/stripe/api_resources/reporting/__init__.py @@ -4,4 +4,4 @@ # flake8: noqa from stripe.api_resources.reporting.report_run import ReportRun -from stripe.api_resources.reporting.report_type import ReportType +from stripe.api_resources.reporting.report_type import ReportType \ No newline at end of file diff --git a/stripe/api_resources/reporting/report_run.py b/stripe/api_resources/reporting/report_run.py index d04405040..6248300c2 100644 --- a/stripe/api_resources/reporting/report_run.py +++ b/stripe/api_resources/reporting/report_run.py @@ -7,3 +7,4 @@ class ReportRun(CreateableAPIResource, ListableAPIResource): OBJECT_NAME = "reporting.report_run" + diff --git a/stripe/api_resources/reporting/report_type.py b/stripe/api_resources/reporting/report_type.py index 694bbb832..333a3e1ec 100644 --- a/stripe/api_resources/reporting/report_type.py +++ b/stripe/api_resources/reporting/report_type.py @@ -6,3 +6,4 @@ class ReportType(ListableAPIResource): OBJECT_NAME = "reporting.report_type" + diff --git a/stripe/api_resources/reversal.py b/stripe/api_resources/reversal.py index eadeee536..4557f513a 100644 --- a/stripe/api_resources/reversal.py +++ b/stripe/api_resources/reversal.py @@ -31,3 +31,4 @@ def retrieve(cls, id, api_key=None, **params): "Can't retrieve a reversal without a transfer" "ID. Use transfer.reversals.retrieve('reversal_id')" ) + diff --git a/stripe/api_resources/review.py b/stripe/api_resources/review.py index 13dd143c7..b42ea1dcb 100644 --- a/stripe/api_resources/review.py +++ b/stripe/api_resources/review.py @@ -9,9 +9,10 @@ @custom_method("approve", http_verb="post") class Review(ListableAPIResource): OBJECT_NAME = "review" - def approve(self, idempotency_key=None, **params): url = self.instance_url() + "/approve" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + diff --git a/stripe/api_resources/setup_attempt.py b/stripe/api_resources/setup_attempt.py index 14b93ab52..0a05bf7b6 100644 --- a/stripe/api_resources/setup_attempt.py +++ b/stripe/api_resources/setup_attempt.py @@ -6,3 +6,4 @@ class SetupAttempt(ListableAPIResource): OBJECT_NAME = "setup_attempt" + diff --git a/stripe/api_resources/setup_intent.py b/stripe/api_resources/setup_intent.py index 749097359..f2dc72d36 100644 --- a/stripe/api_resources/setup_intent.py +++ b/stripe/api_resources/setup_intent.py @@ -10,13 +10,13 @@ @custom_method("cancel", http_verb="post") @custom_method("confirm", http_verb="post") +@custom_method("verify_microdeposits", http_verb="post") class SetupIntent( CreateableAPIResource, ListableAPIResource, UpdateableAPIResource, ): OBJECT_NAME = "setup_intent" - def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) @@ -28,3 +28,11 @@ def confirm(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + def verify_microdeposits(self, idempotency_key=None, **params): + url = self.instance_url() + "/verify_microdeposits" + headers = util.populate_headers(idempotency_key) + self.refresh_from(self.request("post", url, params, headers)) + return self + + diff --git a/stripe/api_resources/shipping_rate.py b/stripe/api_resources/shipping_rate.py index eb701c7e3..15f0e376c 100644 --- a/stripe/api_resources/shipping_rate.py +++ b/stripe/api_resources/shipping_rate.py @@ -12,3 +12,4 @@ class ShippingRate( UpdateableAPIResource, ): OBJECT_NAME = "shipping_rate" + diff --git a/stripe/api_resources/sigma/__init__.py b/stripe/api_resources/sigma/__init__.py index b167a5854..19034d2c4 100644 --- a/stripe/api_resources/sigma/__init__.py +++ b/stripe/api_resources/sigma/__init__.py @@ -3,4 +3,4 @@ # flake8: noqa -from stripe.api_resources.sigma.scheduled_query_run import ScheduledQueryRun +from stripe.api_resources.sigma.scheduled_query_run import ScheduledQueryRun \ No newline at end of file diff --git a/stripe/api_resources/sigma/scheduled_query_run.py b/stripe/api_resources/sigma/scheduled_query_run.py index 058516c12..212387418 100644 --- a/stripe/api_resources/sigma/scheduled_query_run.py +++ b/stripe/api_resources/sigma/scheduled_query_run.py @@ -10,3 +10,4 @@ class ScheduledQueryRun(ListableAPIResource): @classmethod def class_url(cls): return "/v1/sigma/scheduled_query_runs" + diff --git a/stripe/api_resources/sku.py b/stripe/api_resources/sku.py index 75d97249d..23090bf60 100644 --- a/stripe/api_resources/sku.py +++ b/stripe/api_resources/sku.py @@ -14,3 +14,4 @@ class SKU( UpdateableAPIResource, ): OBJECT_NAME = "sku" + diff --git a/stripe/api_resources/source.py b/stripe/api_resources/source.py index 1014b1573..9c3af430a 100644 --- a/stripe/api_resources/source.py +++ b/stripe/api_resources/source.py @@ -37,7 +37,9 @@ def detach(self, idempotency_key=None, **params): ) def source_transactions(self, **params): - """source_transactions is deprecated, use Source.list_source_transactions instead.""" + '''source_transactions is deprecated, use Source.list_source_transactions instead. + ''' return self.request( "get", self.instance_url() + "/source_transactions", params ) + diff --git a/stripe/api_resources/source_transaction.py b/stripe/api_resources/source_transaction.py index 6bd8fdcc6..ed927b036 100644 --- a/stripe/api_resources/source_transaction.py +++ b/stripe/api_resources/source_transaction.py @@ -6,3 +6,4 @@ class SourceTransaction(StripeObject): OBJECT_NAME = "source_transaction" + diff --git a/stripe/api_resources/subscription.py b/stripe/api_resources/subscription.py index afb2386ed..d42b125d6 100644 --- a/stripe/api_resources/subscription.py +++ b/stripe/api_resources/subscription.py @@ -27,3 +27,4 @@ def delete_discount(self, **params): url = self.instance_url() + "/discount" _, api_key = requestor.request("delete", url, params) self.refresh_from({"discount": None}, api_key, True) + diff --git a/stripe/api_resources/subscription_item.py b/stripe/api_resources/subscription_item.py index e3b794af0..d9967d1ba 100644 --- a/stripe/api_resources/subscription_item.py +++ b/stripe/api_resources/subscription_item.py @@ -23,7 +23,9 @@ class SubscriptionItem( OBJECT_NAME = "subscription_item" def usage_record_summaries(self, **params): - """usage_record_summaries is deprecated, use SubscriptionItem.list_usage_record_summaries instead.""" + '''usage_record_summaries is deprecated, use SubscriptionItem.list_usage_record_summaries instead. + ''' return self.request( "get", self.instance_url() + "/usage_record_summaries", params ) + diff --git a/stripe/api_resources/subscription_schedule.py b/stripe/api_resources/subscription_schedule.py index d939ec671..98de9f6c8 100644 --- a/stripe/api_resources/subscription_schedule.py +++ b/stripe/api_resources/subscription_schedule.py @@ -16,7 +16,6 @@ class SubscriptionSchedule( UpdateableAPIResource, ): OBJECT_NAME = "subscription_schedule" - def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) @@ -28,3 +27,5 @@ def release(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + diff --git a/stripe/api_resources/tax_code.py b/stripe/api_resources/tax_code.py index 9663acb4c..87fd1b0a7 100644 --- a/stripe/api_resources/tax_code.py +++ b/stripe/api_resources/tax_code.py @@ -6,3 +6,4 @@ class TaxCode(ListableAPIResource): OBJECT_NAME = "tax_code" + diff --git a/stripe/api_resources/tax_id.py b/stripe/api_resources/tax_id.py index 7a44bfcf0..e81bb2fb9 100644 --- a/stripe/api_resources/tax_id.py +++ b/stripe/api_resources/tax_id.py @@ -23,3 +23,4 @@ def retrieve(cls, id, api_key=None, **params): raise NotImplementedError( "Can't retrieve a tax id without a customer ID. Use customer.retrieve_tax_id('tax_id')" ) + diff --git a/stripe/api_resources/tax_rate.py b/stripe/api_resources/tax_rate.py index 874f82720..b4e4aba1a 100644 --- a/stripe/api_resources/tax_rate.py +++ b/stripe/api_resources/tax_rate.py @@ -12,3 +12,4 @@ class TaxRate( UpdateableAPIResource, ): OBJECT_NAME = "tax_rate" + diff --git a/stripe/api_resources/terminal/__init__.py b/stripe/api_resources/terminal/__init__.py index 2a5a4b320..977f1d1b9 100644 --- a/stripe/api_resources/terminal/__init__.py +++ b/stripe/api_resources/terminal/__init__.py @@ -5,4 +5,4 @@ from stripe.api_resources.terminal.connection_token import ConnectionToken from stripe.api_resources.terminal.location import Location -from stripe.api_resources.terminal.reader import Reader +from stripe.api_resources.terminal.reader import Reader \ No newline at end of file diff --git a/stripe/api_resources/terminal/connection_token.py b/stripe/api_resources/terminal/connection_token.py index 0ec7c8944..d1bd65469 100644 --- a/stripe/api_resources/terminal/connection_token.py +++ b/stripe/api_resources/terminal/connection_token.py @@ -6,3 +6,4 @@ class ConnectionToken(CreateableAPIResource): OBJECT_NAME = "terminal.connection_token" + diff --git a/stripe/api_resources/terminal/location.py b/stripe/api_resources/terminal/location.py index 49c69fb20..a9520a3bf 100644 --- a/stripe/api_resources/terminal/location.py +++ b/stripe/api_resources/terminal/location.py @@ -14,3 +14,4 @@ class Location( UpdateableAPIResource, ): OBJECT_NAME = "terminal.location" + diff --git a/stripe/api_resources/terminal/reader.py b/stripe/api_resources/terminal/reader.py index e2670eeff..677c01b22 100644 --- a/stripe/api_resources/terminal/reader.py +++ b/stripe/api_resources/terminal/reader.py @@ -14,3 +14,4 @@ class Reader( UpdateableAPIResource, ): OBJECT_NAME = "terminal.reader" + diff --git a/stripe/api_resources/three_d_secure.py b/stripe/api_resources/three_d_secure.py index 27edc6606..1430fa6a8 100644 --- a/stripe/api_resources/three_d_secure.py +++ b/stripe/api_resources/three_d_secure.py @@ -10,3 +10,4 @@ class ThreeDSecure(CreateableAPIResource): @classmethod def class_url(cls): return "/v1/3d_secure" + diff --git a/stripe/api_resources/token.py b/stripe/api_resources/token.py index a101d935c..8877359ef 100644 --- a/stripe/api_resources/token.py +++ b/stripe/api_resources/token.py @@ -6,3 +6,4 @@ class Token(CreateableAPIResource): OBJECT_NAME = "token" + diff --git a/stripe/api_resources/topup.py b/stripe/api_resources/topup.py index 099c6b9f1..ef699cfb8 100644 --- a/stripe/api_resources/topup.py +++ b/stripe/api_resources/topup.py @@ -11,9 +11,10 @@ @custom_method("cancel", http_verb="post") class Topup(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "topup" - def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + diff --git a/stripe/api_resources/transfer.py b/stripe/api_resources/transfer.py index f73b10152..00ba019b8 100644 --- a/stripe/api_resources/transfer.py +++ b/stripe/api_resources/transfer.py @@ -20,9 +20,10 @@ class Transfer( UpdateableAPIResource, ): OBJECT_NAME = "transfer" - def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + diff --git a/stripe/api_resources/usage_record.py b/stripe/api_resources/usage_record.py index 9dc913838..a008175e0 100644 --- a/stripe/api_resources/usage_record.py +++ b/stripe/api_resources/usage_record.py @@ -32,3 +32,4 @@ def create( return util.convert_to_stripe_object( response, api_key, stripe_version, stripe_account ) + diff --git a/stripe/api_resources/usage_record_summary.py b/stripe/api_resources/usage_record_summary.py index e7f707699..11e79c3cb 100644 --- a/stripe/api_resources/usage_record_summary.py +++ b/stripe/api_resources/usage_record_summary.py @@ -6,3 +6,4 @@ class UsageRecordSummary(StripeObject): OBJECT_NAME = "usage_record_summary" + diff --git a/stripe/api_resources/webhook_endpoint.py b/stripe/api_resources/webhook_endpoint.py index 86d90eafa..d903e1ae4 100644 --- a/stripe/api_resources/webhook_endpoint.py +++ b/stripe/api_resources/webhook_endpoint.py @@ -14,3 +14,4 @@ class WebhookEndpoint( UpdateableAPIResource, ): OBJECT_NAME = "webhook_endpoint" + diff --git a/stripe/object_classes.py b/stripe/object_classes.py index 61d619464..c5d574909 100644 --- a/stripe/object_classes.py +++ b/stripe/object_classes.py @@ -98,4 +98,4 @@ api_resources.UsageRecord.OBJECT_NAME: api_resources.UsageRecord, api_resources.UsageRecordSummary.OBJECT_NAME: api_resources.UsageRecordSummary, api_resources.WebhookEndpoint.OBJECT_NAME: api_resources.WebhookEndpoint, -} +} \ No newline at end of file diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index 6bfc0a178..a08aa77c2 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -1,1627 +1,1297 @@ from __future__ import absolute_import, division, print_function import stripe - - class TestGeneratedExamples(object): - def test_customer_list(self, request_mock): - stripe.Customer.list(limit=3) - request_mock.assert_requested("get", "/v1/customers") - - def test_balancetransaction_retrieve(self, request_mock): - stripe.BalanceTransaction.retrieve("txn_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/balance_transactions/txn_xxxxxxxxxxxxx", - ) - - def test_balancetransaction_list(self, request_mock): - stripe.BalanceTransaction.list(limit=3) - request_mock.assert_requested("get", "/v1/balance_transactions") - - def test_charge_create(self, request_mock): - stripe.Charge.create( - amount=2000, - currency="usd", - source="tok_xxxx", - description="My First Test Charge (created for API docs)", - ) - request_mock.assert_requested("post", "/v1/charges") - - def test_charge_retrieve(self, request_mock): - stripe.Charge.retrieve("ch_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/charges/ch_xxxxxxxxxxxxx") - - def test_charge_update(self, request_mock): - stripe.Charge.modify("ch_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/charges/ch_xxxxxxxxxxxxx") - - def test_charge_capture(self, request_mock): - stripe.Charge.capture("ch_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/charges/ch_xxxxxxxxxxxxx/capture", - ) - - def test_charge_list(self, request_mock): - stripe.Charge.list(limit=3) - request_mock.assert_requested("get", "/v1/charges") - - def test_customer_create(self, request_mock): - stripe.Customer.create( - description="My First Test Customer (created for API docs)", - ) - request_mock.assert_requested("post", "/v1/customers") - - def test_customer_retrieve(self, request_mock): - stripe.Customer.retrieve("cus_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/customers/cus_xxxxxxxxxxxxx") - - def test_customer_update(self, request_mock): - stripe.Customer.modify( - "cus_xxxxxxxxxxxxx", metadata={"order_id": "6735"} - ) - request_mock.assert_requested( - "post", "/v1/customers/cus_xxxxxxxxxxxxx" - ) - - def test_customer_delete(self, request_mock): - stripe.Customer.delete("cus_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", "/v1/customers/cus_xxxxxxxxxxxxx" - ) - - def test_customer_list2(self, request_mock): - stripe.Customer.list(limit=3) - request_mock.assert_requested("get", "/v1/customers") - - def test_dispute_retrieve(self, request_mock): - stripe.Dispute.retrieve("dp_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/disputes/dp_xxxxxxxxxxxxx") - - def test_dispute_update(self, request_mock): - stripe.Dispute.modify( - "dp_xxxxxxxxxxxxx", metadata={"order_id": "6735"} - ) - request_mock.assert_requested("post", "/v1/disputes/dp_xxxxxxxxxxxxx") - - def test_dispute_close(self, request_mock): - stripe.Dispute.close("dp_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", "/v1/disputes/dp_xxxxxxxxxxxxx/close" - ) - - def test_dispute_list(self, request_mock): - stripe.Dispute.list(limit=3) - request_mock.assert_requested("get", "/v1/disputes") - - def test_event_retrieve(self, request_mock): - stripe.Event.retrieve("evt_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/events/evt_xxxxxxxxxxxxx") - - def test_event_list(self, request_mock): - stripe.Event.list(limit=3) - request_mock.assert_requested("get", "/v1/events") - - def test_file_retrieve(self, request_mock): - stripe.File.retrieve("file_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/files/file_xxxxxxxxxxxxx") - - def test_file_list(self, request_mock): - stripe.File.list(limit=3) - request_mock.assert_requested("get", "/v1/files") - - def test_filelink_create(self, request_mock): - stripe.FileLink.create(file="file_xxxxxxxxxxxxx") - request_mock.assert_requested("post", "/v1/file_links") - - def test_filelink_retrieve(self, request_mock): - stripe.FileLink.retrieve("link_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", "/v1/file_links/link_xxxxxxxxxxxxx" - ) - - def test_filelink_update(self, request_mock): - stripe.FileLink.modify( - "link_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", "/v1/file_links/link_xxxxxxxxxxxxx" - ) - - def test_filelink_list(self, request_mock): - stripe.FileLink.list(limit=3) - request_mock.assert_requested("get", "/v1/file_links") - - def test_mandate_retrieve(self, request_mock): - stripe.Mandate.retrieve("mandate_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", "/v1/mandates/mandate_xxxxxxxxxxxxx" - ) - - def test_paymentintent_create(self, request_mock): - stripe.PaymentIntent.create( - amount=2000, - currency="usd", - payment_method_types=["card"], - ) - request_mock.assert_requested("post", "/v1/payment_intents") - - def test_paymentintent_retrieve(self, request_mock): - stripe.PaymentIntent.retrieve("pi_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", "/v1/payment_intents/pi_xxxxxxxxxxxxx" - ) - - def test_paymentintent_update(self, request_mock): - stripe.PaymentIntent.modify( - "pi_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/payment_intents/pi_xxxxxxxxxxxxx", - ) - - def test_paymentintent_confirm(self, request_mock): - stripe.PaymentIntent.confirm( - "pi_xxxxxxxxxxxxx", - payment_method="pm_card_visa", - ) - request_mock.assert_requested( - "post", - "/v1/payment_intents/pi_xxxxxxxxxxxxx/confirm", - ) - - def test_paymentintent_capture(self, request_mock): - stripe.PaymentIntent.capture("pi_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/payment_intents/pi_xxxxxxxxxxxxx/capture", - ) - - def test_paymentintent_cancel(self, request_mock): - stripe.PaymentIntent.cancel("pi_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/payment_intents/pi_xxxxxxxxxxxxx/cancel", - ) - - def test_paymentintent_list(self, request_mock): - stripe.PaymentIntent.list(limit=3) - request_mock.assert_requested("get", "/v1/payment_intents") - - def test_setupintent_create(self, request_mock): - stripe.SetupIntent.create(payment_method_types=["card"]) - request_mock.assert_requested("post", "/v1/setup_intents") - - def test_setupintent_retrieve(self, request_mock): - stripe.SetupIntent.retrieve("seti_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", "/v1/setup_intents/seti_xxxxxxxxxxxxx" - ) - - def test_setupintent_update(self, request_mock): - stripe.SetupIntent.modify( - "seti_xxxxxxxxxxxxx", - metadata={"user_id": "3435453"}, - ) - request_mock.assert_requested( - "post", - "/v1/setup_intents/seti_xxxxxxxxxxxxx", - ) - - def test_setupintent_confirm(self, request_mock): - stripe.SetupIntent.confirm( - "seti_xxxxxxxxxxxxx", - payment_method="pm_card_visa", - ) - request_mock.assert_requested( - "post", - "/v1/setup_intents/seti_xxxxxxxxxxxxx/confirm", - ) - - def test_setupintent_cancel(self, request_mock): - stripe.SetupIntent.cancel("seti_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/setup_intents/seti_xxxxxxxxxxxxx/cancel", - ) - - def test_setupintent_list(self, request_mock): - stripe.SetupIntent.list(limit=3) - request_mock.assert_requested("get", "/v1/setup_intents") - - def test_setupattempt_list(self, request_mock): - stripe.SetupAttempt.list(setup_intent="seti_xxxxxxxxxxxxx", limit=3) - request_mock.assert_requested("get", "/v1/setup_attempts") - - def test_payout_create(self, request_mock): - stripe.Payout.create(amount=1100, currency="usd") - request_mock.assert_requested("post", "/v1/payouts") - - def test_payout_retrieve(self, request_mock): - stripe.Payout.retrieve("po_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/payouts/po_xxxxxxxxxxxxx") - - def test_payout_update(self, request_mock): - stripe.Payout.modify("po_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/payouts/po_xxxxxxxxxxxxx") - - def test_payout_list(self, request_mock): - stripe.Payout.list(limit=3) - request_mock.assert_requested("get", "/v1/payouts") - - def test_payout_cancel(self, request_mock): - stripe.Payout.cancel("po_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", "/v1/payouts/po_xxxxxxxxxxxxx/cancel" - ) - - def test_payout_reverse(self, request_mock): - stripe.Payout.reverse("po_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/payouts/po_xxxxxxxxxxxxx/reverse", - ) - - def test_product_create(self, request_mock): - stripe.Product.create(name="Gold Special") - request_mock.assert_requested("post", "/v1/products") - - def test_product_retrieve(self, request_mock): - stripe.Product.retrieve("prod_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/products/prod_xxxxxxxxxxxxx") - - def test_product_update(self, request_mock): - stripe.Product.modify( - "prod_xxxxxxxxxxxxx", metadata={"order_id": "6735"} - ) - request_mock.assert_requested( - "post", "/v1/products/prod_xxxxxxxxxxxxx" - ) - - def test_product_list(self, request_mock): - stripe.Product.list(limit=3) - request_mock.assert_requested("get", "/v1/products") - - def test_product_delete(self, request_mock): - stripe.Product.delete("prod_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", "/v1/products/prod_xxxxxxxxxxxxx" - ) - - def test_price_create(self, request_mock): - stripe.Price.create( - unit_amount=2000, - currency="usd", - recurring={"interval": "month"}, - product="prod_xxxxxxxxxxxxx", - ) - request_mock.assert_requested("post", "/v1/prices") - - def test_price_retrieve(self, request_mock): - stripe.Price.retrieve("price_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/prices/price_xxxxxxxxxxxxx") - - def test_price_update(self, request_mock): - stripe.Price.modify( - "price_xxxxxxxxxxxxx", metadata={"order_id": "6735"} - ) - request_mock.assert_requested("post", "/v1/prices/price_xxxxxxxxxxxxx") - - def test_price_list(self, request_mock): - stripe.Price.list(limit=3) - request_mock.assert_requested("get", "/v1/prices") - - def test_refund_create(self, request_mock): - stripe.Refund.create(charge="ch_xxxxxxxxxxxxx") - request_mock.assert_requested("post", "/v1/refunds") - - def test_refund_retrieve(self, request_mock): - stripe.Refund.retrieve("re_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/refunds/re_xxxxxxxxxxxxx") - - def test_refund_update(self, request_mock): - stripe.Refund.modify("re_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/refunds/re_xxxxxxxxxxxxx") - - def test_refund_list(self, request_mock): - stripe.Refund.list(limit=3) - request_mock.assert_requested("get", "/v1/refunds") - - def test_token_create(self, request_mock): - stripe.Token.create( - card={ - "number": "4242424242424242", - "exp_month": "5", - "exp_year": "2022", - "cvc": "314", + def test_customer_list(self, request_mock): + stripe.Customer.list(limit = 3) + request_mock.assert_requested("get", "/v1/customers") + def test_balancetransaction_retrieve(self, request_mock): + stripe.BalanceTransaction.retrieve("txn_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/balance_transactions/txn_xxxxxxxxxxxxx", + ) + def test_balancetransaction_list(self, request_mock): + stripe.BalanceTransaction.list(limit = 3) + request_mock.assert_requested("get", "/v1/balance_transactions") + def test_charge_create(self, request_mock): + stripe.Charge.create( + amount = 2000, + currency = "usd", + source = "tok_xxxx", + description = "My First Test Charge (created for API docs)", + ) + request_mock.assert_requested("post", "/v1/charges") + def test_charge_retrieve(self, request_mock): + stripe.Charge.retrieve("ch_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/charges/ch_xxxxxxxxxxxxx") + def test_charge_update(self, request_mock): + stripe.Charge.modify("ch_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/charges/ch_xxxxxxxxxxxxx") + def test_charge_capture(self, request_mock): + stripe.Charge.capture("ch_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/charges/ch_xxxxxxxxxxxxx/capture", + ) + def test_charge_list(self, request_mock): + stripe.Charge.list(limit = 3) + request_mock.assert_requested("get", "/v1/charges") + def test_customer_create(self, request_mock): + stripe.Customer.create( + description = "My First Test Customer (created for API docs)", + ) + request_mock.assert_requested("post", "/v1/customers") + def test_customer_retrieve(self, request_mock): + stripe.Customer.retrieve("cus_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/customers/cus_xxxxxxxxxxxxx") + def test_customer_update(self, request_mock): + stripe.Customer.modify("cus_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/customers/cus_xxxxxxxxxxxxx") + def test_customer_delete(self, request_mock): + stripe.Customer.delete("cus_xxxxxxxxxxxxx") + request_mock.assert_requested("delete", "/v1/customers/cus_xxxxxxxxxxxxx") + def test_customer_list2(self, request_mock): + stripe.Customer.list(limit = 3) + request_mock.assert_requested("get", "/v1/customers") + def test_dispute_retrieve(self, request_mock): + stripe.Dispute.retrieve("dp_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/disputes/dp_xxxxxxxxxxxxx") + def test_dispute_update(self, request_mock): + stripe.Dispute.modify("dp_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/disputes/dp_xxxxxxxxxxxxx") + def test_dispute_close(self, request_mock): + stripe.Dispute.close("dp_xxxxxxxxxxxxx") + request_mock.assert_requested("post", "/v1/disputes/dp_xxxxxxxxxxxxx/close") + def test_dispute_list(self, request_mock): + stripe.Dispute.list(limit = 3) + request_mock.assert_requested("get", "/v1/disputes") + def test_event_retrieve(self, request_mock): + stripe.Event.retrieve("evt_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/events/evt_xxxxxxxxxxxxx") + def test_event_list(self, request_mock): + stripe.Event.list(limit = 3) + request_mock.assert_requested("get", "/v1/events") + def test_file_retrieve(self, request_mock): + stripe.File.retrieve("file_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/files/file_xxxxxxxxxxxxx") + def test_file_list(self, request_mock): + stripe.File.list(limit = 3) + request_mock.assert_requested("get", "/v1/files") + def test_filelink_create(self, request_mock): + stripe.FileLink.create(file = "file_xxxxxxxxxxxxx") + request_mock.assert_requested("post", "/v1/file_links") + def test_filelink_retrieve(self, request_mock): + stripe.FileLink.retrieve("link_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/file_links/link_xxxxxxxxxxxxx") + def test_filelink_update(self, request_mock): + stripe.FileLink.modify( + "link_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested("post", "/v1/file_links/link_xxxxxxxxxxxxx") + def test_filelink_list(self, request_mock): + stripe.FileLink.list(limit = 3) + request_mock.assert_requested("get", "/v1/file_links") + def test_mandate_retrieve(self, request_mock): + stripe.Mandate.retrieve("mandate_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/mandates/mandate_xxxxxxxxxxxxx") + def test_paymentintent_create(self, request_mock): + stripe.PaymentIntent.create( + amount = 2000, + currency = "usd", + payment_method_types = ["card"], + ) + request_mock.assert_requested("post", "/v1/payment_intents") + def test_paymentintent_retrieve(self, request_mock): + stripe.PaymentIntent.retrieve("pi_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/payment_intents/pi_xxxxxxxxxxxxx") + def test_paymentintent_update(self, request_mock): + stripe.PaymentIntent.modify( + "pi_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx", + ) + def test_paymentintent_confirm(self, request_mock): + stripe.PaymentIntent.confirm( + "pi_xxxxxxxxxxxxx", + payment_method = "pm_card_visa", + ) + request_mock.assert_requested( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/confirm", + ) + def test_paymentintent_capture(self, request_mock): + stripe.PaymentIntent.capture("pi_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/capture", + ) + def test_paymentintent_cancel(self, request_mock): + stripe.PaymentIntent.cancel("pi_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/cancel", + ) + def test_paymentintent_list(self, request_mock): + stripe.PaymentIntent.list(limit = 3) + request_mock.assert_requested("get", "/v1/payment_intents") + def test_setupintent_create(self, request_mock): + stripe.SetupIntent.create(payment_method_types = ["card"]) + request_mock.assert_requested("post", "/v1/setup_intents") + def test_setupintent_retrieve(self, request_mock): + stripe.SetupIntent.retrieve("seti_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/setup_intents/seti_xxxxxxxxxxxxx") + def test_setupintent_update(self, request_mock): + stripe.SetupIntent.modify( + "seti_xxxxxxxxxxxxx", + metadata = {"user_id": "3435453"}, + ) + request_mock.assert_requested( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx", + ) + def test_setupintent_confirm(self, request_mock): + stripe.SetupIntent.confirm( + "seti_xxxxxxxxxxxxx", + payment_method = "pm_card_visa", + ) + request_mock.assert_requested( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx/confirm", + ) + def test_setupintent_cancel(self, request_mock): + stripe.SetupIntent.cancel("seti_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx/cancel", + ) + def test_setupintent_list(self, request_mock): + stripe.SetupIntent.list(limit = 3) + request_mock.assert_requested("get", "/v1/setup_intents") + def test_setupattempt_list(self, request_mock): + stripe.SetupAttempt.list(setup_intent = "seti_xxxxxxxxxxxxx", limit = 3) + request_mock.assert_requested("get", "/v1/setup_attempts") + def test_payout_create(self, request_mock): + stripe.Payout.create(amount = 1100, currency = "usd") + request_mock.assert_requested("post", "/v1/payouts") + def test_payout_retrieve(self, request_mock): + stripe.Payout.retrieve("po_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/payouts/po_xxxxxxxxxxxxx") + def test_payout_update(self, request_mock): + stripe.Payout.modify("po_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/payouts/po_xxxxxxxxxxxxx") + def test_payout_list(self, request_mock): + stripe.Payout.list(limit = 3) + request_mock.assert_requested("get", "/v1/payouts") + def test_payout_cancel(self, request_mock): + stripe.Payout.cancel("po_xxxxxxxxxxxxx") + request_mock.assert_requested("post", "/v1/payouts/po_xxxxxxxxxxxxx/cancel") + def test_payout_reverse(self, request_mock): + stripe.Payout.reverse("po_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/payouts/po_xxxxxxxxxxxxx/reverse", + ) + def test_product_create(self, request_mock): + stripe.Product.create(name = "Gold Special") + request_mock.assert_requested("post", "/v1/products") + def test_product_retrieve(self, request_mock): + stripe.Product.retrieve("prod_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/products/prod_xxxxxxxxxxxxx") + def test_product_update(self, request_mock): + stripe.Product.modify("prod_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/products/prod_xxxxxxxxxxxxx") + def test_product_list(self, request_mock): + stripe.Product.list(limit = 3) + request_mock.assert_requested("get", "/v1/products") + def test_product_delete(self, request_mock): + stripe.Product.delete("prod_xxxxxxxxxxxxx") + request_mock.assert_requested("delete", "/v1/products/prod_xxxxxxxxxxxxx") + def test_price_create(self, request_mock): + stripe.Price.create( + unit_amount = 2000, + currency = "usd", + recurring = {"interval": "month"}, + product = "prod_xxxxxxxxxxxxx", + ) + request_mock.assert_requested("post", "/v1/prices") + def test_price_retrieve(self, request_mock): + stripe.Price.retrieve("price_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/prices/price_xxxxxxxxxxxxx") + def test_price_update(self, request_mock): + stripe.Price.modify("price_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/prices/price_xxxxxxxxxxxxx") + def test_price_list(self, request_mock): + stripe.Price.list(limit = 3) + request_mock.assert_requested("get", "/v1/prices") + def test_refund_create(self, request_mock): + stripe.Refund.create(charge = "ch_xxxxxxxxxxxxx") + request_mock.assert_requested("post", "/v1/refunds") + def test_refund_retrieve(self, request_mock): + stripe.Refund.retrieve("re_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/refunds/re_xxxxxxxxxxxxx") + def test_refund_update(self, request_mock): + stripe.Refund.modify("re_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/refunds/re_xxxxxxxxxxxxx") + def test_refund_list(self, request_mock): + stripe.Refund.list(limit = 3) + request_mock.assert_requested("get", "/v1/refunds") + def test_token_create(self, request_mock): + stripe.Token.create( + card = { + "number": "4242424242424242", + "exp_month": "5", + "exp_year": "2022", + "cvc": "314", + }, + ) + request_mock.assert_requested("post", "/v1/tokens") + def test_token_create2(self, request_mock): + stripe.Token.create( + bank_account = { + "country": "US", + "currency": "usd", + "account_holder_name": "Jenny Rosen", + "account_holder_type": "individual", + "routing_number": "110000000", + "account_number": "000123456789", + }, + ) + request_mock.assert_requested("post", "/v1/tokens") + def test_token_create3(self, request_mock): + stripe.Token.create(pii = {"id_number": "000000000"}) + request_mock.assert_requested("post", "/v1/tokens") + def test_token_create4(self, request_mock): + stripe.Token.create( + account = { + "individual": {"first_name": "Jane", "last_name": "Doe"}, + "tos_shown_and_accepted": True, + }, + ) + request_mock.assert_requested("post", "/v1/tokens") + def test_token_create5(self, request_mock): + stripe.Token.create( + person = { + "first_name": "Jane", + "last_name": "Doe", + "relationship": {"owner": True}, + }, + ) + request_mock.assert_requested("post", "/v1/tokens") + def test_token_create6(self, request_mock): + stripe.Token.create(cvc_update = {"cvc": "123"}) + request_mock.assert_requested("post", "/v1/tokens") + def test_token_retrieve(self, request_mock): + stripe.Token.retrieve("tok_xxxx") + request_mock.assert_requested("get", "/v1/tokens/tok_xxxx") + def test_paymentmethod_create(self, request_mock): + stripe.PaymentMethod.create( + type = "card", + card = { + "number": "4242424242424242", + "exp_month": 5, + "exp_year": 2022, + "cvc": "314", + }, + ) + request_mock.assert_requested("post", "/v1/payment_methods") + def test_paymentmethod_retrieve(self, request_mock): + stripe.PaymentMethod.retrieve("pm_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/payment_methods/pm_xxxxxxxxxxxxx") + def test_paymentmethod_update(self, request_mock): + stripe.PaymentMethod.modify( + "pm_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/payment_methods/pm_xxxxxxxxxxxxx", + ) + def test_paymentmethod_list(self, request_mock): + stripe.PaymentMethod.list(customer = "cus_xxxxxxxxxxxxx", type = "card") + request_mock.assert_requested("get", "/v1/payment_methods") + def test_paymentmethod_attach(self, request_mock): + stripe.PaymentMethod.attach( + "pm_xxxxxxxxxxxxx", + customer = "cus_xxxxxxxxxxxxx", + ) + request_mock.assert_requested( + "post", + "/v1/payment_methods/pm_xxxxxxxxxxxxx/attach", + ) + def test_paymentmethod_detach(self, request_mock): + stripe.PaymentMethod.detach("pm_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/payment_methods/pm_xxxxxxxxxxxxx/detach", + ) + def test_source_retrieve(self, request_mock): + stripe.Source.retrieve("src_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/sources/src_xxxxxxxxxxxxx") + def test_source_update(self, request_mock): + stripe.Source.modify("src_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/sources/src_xxxxxxxxxxxxx") + def test_checkout_session_create(self, request_mock): + stripe.checkout.Session.create( + success_url = "https://example.com/success", + cancel_url = "https://example.com/cancel", + payment_method_types = ["card"], + line_items = [{"price": "price_xxxxxxxxxxxxx", "quantity": 2}], + mode = "payment", + ) + request_mock.assert_requested("post", "/v1/checkout/sessions") + def test_checkout_session_retrieve(self, request_mock): + stripe.checkout.Session.retrieve("cs_test_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx", + ) + def test_checkout_session_list(self, request_mock): + stripe.checkout.Session.list(limit = 3) + request_mock.assert_requested("get", "/v1/checkout/sessions") + def test_coupon_create(self, request_mock): + stripe.Coupon.create( + percent_off = 25, + duration = "repeating", + duration_in_months = 3, + ) + request_mock.assert_requested("post", "/v1/coupons") + def test_coupon_retrieve(self, request_mock): + stripe.Coupon.retrieve("25_5OFF") + request_mock.assert_requested("get", "/v1/coupons/25_5OFF") + def test_coupon_update(self, request_mock): + stripe.Coupon.modify("co_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/coupons/co_xxxxxxxxxxxxx") + def test_coupon_delete(self, request_mock): + stripe.Coupon.delete("co_xxxxxxxxxxxxx") + request_mock.assert_requested("delete", "/v1/coupons/co_xxxxxxxxxxxxx") + def test_coupon_list(self, request_mock): + stripe.Coupon.list(limit = 3) + request_mock.assert_requested("get", "/v1/coupons") + def test_creditnote_create(self, request_mock): + stripe.CreditNote.create( + invoice = "in_xxxxxxxxxxxxx", + lines = [ + { + "type": "invoice_line_item", + "invoice_line_item": "il_xxxxxxxxxxxxx", + "quantity": 1, + }, + ], + ) + request_mock.assert_requested("post", "/v1/credit_notes") + def test_creditnote_update(self, request_mock): + stripe.CreditNote.modify( + "cn_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested("post", "/v1/credit_notes/cn_xxxxxxxxxxxxx") + def test_creditnote_void_credit_note(self, request_mock): + stripe.CreditNote.void_credit_note("cn_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/credit_notes/cn_xxxxxxxxxxxxx/void", + ) + def test_creditnote_list(self, request_mock): + stripe.CreditNote.list(limit = 3) + request_mock.assert_requested("get", "/v1/credit_notes") + def test_customer_customerbalancetransaction_retrieve(self, request_mock): + stripe.Customer.retrieve_balance_transaction( + "cus_xxxxxxxxxxxxx", + "cbtxn_xxxxxxxxxxxxx", + ) + request_mock.assert_requested( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx", + ) + def test_billing_portal_session_create(self, request_mock): + stripe.billing_portal.Session.create( + customer = "cus_xxxxxxxxxxxxx", + return_url = "https://example.com/account", + ) + request_mock.assert_requested("post", "/v1/billing_portal/sessions") + def test_billing_portal_configuration_create(self, request_mock): + stripe.billing_portal.Configuration.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", + }, + ) + request_mock.assert_requested("post", "/v1/billing_portal/configurations") + def test_billing_portal_configuration_update(self, request_mock): + stripe.billing_portal.Configuration.modify( + "bpc_xxxxxxxxxxxxx", + business_profile = { + "privacy_policy_url": "https://example.com/privacy", + "terms_of_service_url": "https://example.com/terms", + }, + ) + request_mock.assert_requested( + "post", + "/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", + ) + def test_billing_portal_configuration_retrieve(self, request_mock): + stripe.billing_portal.Configuration.retrieve("bpc_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", + ) + def test_billing_portal_configuration_list(self, request_mock): + stripe.billing_portal.Configuration.list(limit = 3) + request_mock.assert_requested("get", "/v1/billing_portal/configurations") + def test_customer_taxid_retrieve(self, request_mock): + stripe.Customer.retrieve_tax_id("cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx", + ) + def test_invoice_create(self, request_mock): + stripe.Invoice.create(customer = "cus_xxxxxxxxxxxxx") + request_mock.assert_requested("post", "/v1/invoices") + def test_invoice_retrieve(self, request_mock): + stripe.Invoice.retrieve("in_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/invoices/in_xxxxxxxxxxxxx") + def test_invoice_update(self, request_mock): + stripe.Invoice.modify("in_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/invoices/in_xxxxxxxxxxxxx") + def test_invoice_delete(self, request_mock): + stripe.Invoice.delete("in_xxxxxxxxxxxxx") + request_mock.assert_requested("delete", "/v1/invoices/in_xxxxxxxxxxxxx") + def test_invoice_finalize_invoice(self, request_mock): + stripe.Invoice.finalize_invoice("in_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/invoices/in_xxxxxxxxxxxxx/finalize", + ) + def test_invoice_pay(self, request_mock): + stripe.Invoice.pay("in_xxxxxxxxxxxxx") + request_mock.assert_requested("post", "/v1/invoices/in_xxxxxxxxxxxxx/pay") + def test_invoice_send_invoice(self, request_mock): + stripe.Invoice.send_invoice("in_xxxxxxxxxxxxx") + request_mock.assert_requested("post", "/v1/invoices/in_xxxxxxxxxxxxx/send") + def test_invoice_void_invoice(self, request_mock): + stripe.Invoice.void_invoice("in_xxxxxxxxxxxxx") + request_mock.assert_requested("post", "/v1/invoices/in_xxxxxxxxxxxxx/void") + def test_invoice_mark_uncollectible(self, request_mock): + stripe.Invoice.mark_uncollectible("in_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/invoices/in_xxxxxxxxxxxxx/mark_uncollectible", + ) + def test_invoice_list(self, request_mock): + stripe.Invoice.list(limit = 3) + request_mock.assert_requested("get", "/v1/invoices") + def test_invoiceitem_create(self, request_mock): + stripe.InvoiceItem.create( + customer = "cus_xxxxxxxxxxxxx", + price = "price_xxxxxxxxxxxxx", + ) + request_mock.assert_requested("post", "/v1/invoiceitems") + def test_invoiceitem_retrieve(self, request_mock): + stripe.InvoiceItem.retrieve("ii_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/invoiceitems/ii_xxxxxxxxxxxxx") + def test_invoiceitem_update(self, request_mock): + stripe.InvoiceItem.modify( + "ii_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested("post", "/v1/invoiceitems/ii_xxxxxxxxxxxxx") + def test_invoiceitem_delete(self, request_mock): + stripe.InvoiceItem.delete("ii_xxxxxxxxxxxxx") + request_mock.assert_requested("delete", "/v1/invoiceitems/ii_xxxxxxxxxxxxx") + def test_invoiceitem_list(self, request_mock): + stripe.InvoiceItem.list(limit = 3) + request_mock.assert_requested("get", "/v1/invoiceitems") + def test_plan_create(self, request_mock): + stripe.Plan.create( + amount = 2000, + currency = "usd", + interval = "month", + product = "prod_xxxxxxxxxxxxx", + ) + request_mock.assert_requested("post", "/v1/plans") + def test_plan_retrieve(self, request_mock): + stripe.Plan.retrieve("price_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/plans/price_xxxxxxxxxxxxx") + def test_plan_update(self, request_mock): + stripe.Plan.modify("price_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/plans/price_xxxxxxxxxxxxx") + def test_plan_delete(self, request_mock): + stripe.Plan.delete("price_xxxxxxxxxxxxx") + request_mock.assert_requested("delete", "/v1/plans/price_xxxxxxxxxxxxx") + def test_plan_list(self, request_mock): + stripe.Plan.list(limit = 3) + request_mock.assert_requested("get", "/v1/plans") + def test_promotioncode_create(self, request_mock): + stripe.PromotionCode.create(coupon = "25_5OFF") + request_mock.assert_requested("post", "/v1/promotion_codes") + def test_promotioncode_update(self, request_mock): + stripe.PromotionCode.modify( + "promo_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/promotion_codes/promo_xxxxxxxxxxxxx", + ) + def test_promotioncode_retrieve(self, request_mock): + stripe.PromotionCode.retrieve("promo_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/promotion_codes/promo_xxxxxxxxxxxxx", + ) + def test_promotioncode_list(self, request_mock): + stripe.PromotionCode.list(limit = 3) + request_mock.assert_requested("get", "/v1/promotion_codes") + def test_subscription_create(self, request_mock): + stripe.Subscription.create( + customer = "cus_xxxxxxxxxxxxx", + items = [{"price": "price_xxxxxxxxxxxxx"}], + ) + request_mock.assert_requested("post", "/v1/subscriptions") + def test_subscription_retrieve(self, request_mock): + stripe.Subscription.retrieve("sub_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/subscriptions/sub_xxxxxxxxxxxxx") + def test_subscription_update(self, request_mock): + stripe.Subscription.modify( + "sub_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested("post", "/v1/subscriptions/sub_xxxxxxxxxxxxx") + def test_subscription_list(self, request_mock): + stripe.Subscription.list(limit = 3) + request_mock.assert_requested("get", "/v1/subscriptions") + def test_subscriptionitem_create(self, request_mock): + stripe.SubscriptionItem.create( + subscription = "sub_xxxxxxxxxxxxx", + price = "price_xxxxxxxxxxxxx", + quantity = 2, + ) + request_mock.assert_requested("post", "/v1/subscription_items") + def test_subscriptionitem_retrieve(self, request_mock): + stripe.SubscriptionItem.retrieve("si_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/subscription_items/si_xxxxxxxxxxxxx", + ) + def test_subscriptionitem_update(self, request_mock): + stripe.SubscriptionItem.modify( + "si_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/subscription_items/si_xxxxxxxxxxxxx", + ) + def test_subscriptionitem_delete(self, request_mock): + stripe.SubscriptionItem.delete("si_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", + "/v1/subscription_items/si_xxxxxxxxxxxxx", + ) + def test_subscriptionitem_list(self, request_mock): + stripe.SubscriptionItem.list(subscription = "sub_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/subscription_items") + def test_subscriptionschedule_create(self, request_mock): + stripe.SubscriptionSchedule.create( + customer = "cus_xxxxxxxxxxxxx", + start_date = 1620753115, + end_behavior = "release", + phases = [ + { + "items": [{"price": "price_xxxxxxxxxxxxx", "quantity": 1}], + "iterations": 12, + }, + ], + ) + request_mock.assert_requested("post", "/v1/subscription_schedules") + def test_subscriptionschedule_retrieve(self, request_mock): + stripe.SubscriptionSchedule.retrieve("sub_sched_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", + ) + def test_subscriptionschedule_update(self, request_mock): + stripe.SubscriptionSchedule.modify( + "sub_sched_xxxxxxxxxxxxx", + end_behavior = "release", + ) + request_mock.assert_requested( + "post", + "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", + ) + def test_subscriptionschedule_cancel(self, request_mock): + stripe.SubscriptionSchedule.cancel("sub_sched_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/cancel", + ) + def test_subscriptionschedule_release(self, request_mock): + stripe.SubscriptionSchedule.release("sub_sched_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/release", + ) + def test_subscriptionschedule_list(self, request_mock): + stripe.SubscriptionSchedule.list(limit = 3) + request_mock.assert_requested("get", "/v1/subscription_schedules") + def test_taxrate_create(self, request_mock): + stripe.TaxRate.create( + display_name = "VAT", + description = "VAT Germany", + jurisdiction = "DE", + percentage = 16, + inclusive = False, + ) + request_mock.assert_requested("post", "/v1/tax_rates") + def test_taxrate_retrieve(self, request_mock): + stripe.TaxRate.retrieve("txr_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/tax_rates/txr_xxxxxxxxxxxxx") + def test_taxrate_update(self, request_mock): + stripe.TaxRate.modify("txr_xxxxxxxxxxxxx", active = False) + request_mock.assert_requested("post", "/v1/tax_rates/txr_xxxxxxxxxxxxx") + def test_taxrate_list(self, request_mock): + stripe.TaxRate.list(limit = 3) + request_mock.assert_requested("get", "/v1/tax_rates") + def test_account_create(self, request_mock): + stripe.Account.create( + type = "custom", + country = "US", + email = "jenny.rosen@example.com", + capabilities = { + "card_payments": {"requested": True}, + "transfers": {"requested": True}, + }, + ) + request_mock.assert_requested("post", "/v1/accounts") + def test_account_retrieve(self, request_mock): + stripe.Account.retrieve("acct_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/accounts/acct_xxxxxxxxxxxxx") + def test_account_update(self, request_mock): + stripe.Account.modify("acct_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/accounts/acct_xxxxxxxxxxxxx") + def test_account_delete(self, request_mock): + stripe.Account.delete("acct_xxxxxxxxxxxxx") + request_mock.assert_requested("delete", "/v1/accounts/acct_xxxxxxxxxxxxx") + def test_account_reject(self, request_mock): + stripe.Account.reject("acct_xxxxxxxxxxxxx", reason = "fraud") + request_mock.assert_requested( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/reject", + ) + def test_account_list(self, request_mock): + stripe.Account.list(limit = 3) + request_mock.assert_requested("get", "/v1/accounts") + def test_accountlink_create(self, request_mock): + stripe.AccountLink.create( + account = "acct_xxxxxxxxxxxxx", + refresh_url = "https://example.com/reauth", + return_url = "https://example.com/return", + type = "account_onboarding", + ) + request_mock.assert_requested("post", "/v1/account_links") + def test_applicationfee_retrieve(self, request_mock): + stripe.ApplicationFee.retrieve("fee_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/application_fees/fee_xxxxxxxxxxxxx", + ) + def test_applicationfee_list(self, request_mock): + stripe.ApplicationFee.list(limit = 3) + request_mock.assert_requested("get", "/v1/application_fees") + def test_applicationfee_feerefund_retrieve(self, request_mock): + stripe.ApplicationFee.retrieve_refund( + "fee_xxxxxxxxxxxxx", + "fr_xxxxxxxxxxxxx", + ) + request_mock.assert_requested( + "get", + "/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", + ) + def test_applicationfee_feerefund_update(self, request_mock): + stripe.ApplicationFee.modify_refund( + "fee_xxxxxxxxxxxxx", + "fr_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", + ) + def test_account_capability_retrieve(self, request_mock): + stripe.Account.retrieve_capability("acct_xxxxxxxxxxxxx", "card_payments") + request_mock.assert_requested( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments", + ) + def test_account_capability_update(self, request_mock): + stripe.Account.modify_capability( + "acct_xxxxxxxxxxxxx", + "card_payments", + requested = True, + ) + request_mock.assert_requested( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments", + ) + def test_countryspec_list(self, request_mock): + stripe.CountrySpec.list(limit = 3) + request_mock.assert_requested("get", "/v1/country_specs") + def test_countryspec_retrieve(self, request_mock): + stripe.CountrySpec.retrieve("US") + request_mock.assert_requested("get", "/v1/country_specs/US") + def test_account_person_retrieve(self, request_mock): + stripe.Account.retrieve_person("acct_xxxxxxxxxxxxx", "person_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", + ) + def test_account_person_update(self, request_mock): + stripe.Account.modify_person( + "acct_xxxxxxxxxxxxx", + "person_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", + ) + def test_topup_create(self, request_mock): + stripe.Topup.create( + amount = 2000, + currency = "usd", + description = "Top-up for Jenny Rosen", + statement_descriptor = "Top-up", + ) + request_mock.assert_requested("post", "/v1/topups") + def test_topup_retrieve(self, request_mock): + stripe.Topup.retrieve("tu_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/topups/tu_xxxxxxxxxxxxx") + def test_topup_update(self, request_mock): + stripe.Topup.modify("tu_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/topups/tu_xxxxxxxxxxxxx") + def test_topup_list(self, request_mock): + stripe.Topup.list(limit = 3) + request_mock.assert_requested("get", "/v1/topups") + def test_topup_cancel(self, request_mock): + stripe.Topup.cancel("tu_xxxxxxxxxxxxx") + request_mock.assert_requested("post", "/v1/topups/tu_xxxxxxxxxxxxx/cancel") + def test_transfer_create(self, request_mock): + stripe.Transfer.create( + amount = 400, + currency = "usd", + destination = "acct_xxxxxxxxxxxxx", + transfer_group = "ORDER_95", + ) + request_mock.assert_requested("post", "/v1/transfers") + def test_transfer_retrieve(self, request_mock): + stripe.Transfer.retrieve("tr_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/transfers/tr_xxxxxxxxxxxxx") + def test_transfer_update(self, request_mock): + stripe.Transfer.modify("tr_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/transfers/tr_xxxxxxxxxxxxx") + def test_transfer_list(self, request_mock): + stripe.Transfer.list(limit = 3) + request_mock.assert_requested("get", "/v1/transfers") + def test_transfer_transferreversal_retrieve(self, request_mock): + stripe.Transfer.retrieve_reversal("tr_xxxxxxxxxxxxx", "trr_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx", + ) + def test_transfer_transferreversal_update(self, request_mock): + stripe.Transfer.modify_reversal( + "tr_xxxxxxxxxxxxx", + "trr_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx", + ) + def test_radar_earlyfraudwarning_retrieve(self, request_mock): + stripe.radar.EarlyFraudWarning.retrieve("issfr_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/radar/early_fraud_warnings/issfr_xxxxxxxxxxxxx", + ) + def test_radar_earlyfraudwarning_list(self, request_mock): + stripe.radar.EarlyFraudWarning.list(limit = 3) + request_mock.assert_requested("get", "/v1/radar/early_fraud_warnings") + def test_review_approve(self, request_mock): + stripe.Review.approve("prv_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/reviews/prv_xxxxxxxxxxxxx/approve", + ) + def test_review_retrieve(self, request_mock): + stripe.Review.retrieve("prv_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/reviews/prv_xxxxxxxxxxxxx") + def test_review_list(self, request_mock): + stripe.Review.list(limit = 3) + request_mock.assert_requested("get", "/v1/reviews") + def test_radar_valuelist_create(self, request_mock): + stripe.radar.ValueList.create( + alias = "custom_ip_xxxxxxxxxxxxx", + name = "Custom IP Blocklist", + item_type = "ip_address", + ) + request_mock.assert_requested("post", "/v1/radar/value_lists") + def test_radar_valuelist_retrieve(self, request_mock): + stripe.radar.ValueList.retrieve("rsl_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", + ) + def test_radar_valuelist_update(self, request_mock): + stripe.radar.ValueList.modify( + "rsl_xxxxxxxxxxxxx", + name = "Updated IP Block List", + ) + request_mock.assert_requested( + "post", + "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", + ) + def test_radar_valuelist_delete(self, request_mock): + stripe.radar.ValueList.delete("rsl_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", + "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", + ) + def test_radar_valuelist_list(self, request_mock): + stripe.radar.ValueList.list(limit = 3) + request_mock.assert_requested("get", "/v1/radar/value_lists") + def test_radar_valuelistitem_create(self, request_mock): + stripe.radar.ValueListItem.create( + value_list = "rsl_xxxxxxxxxxxxx", + value = "1.2.3.4", + ) + request_mock.assert_requested("post", "/v1/radar/value_list_items") + def test_radar_valuelistitem_retrieve(self, request_mock): + stripe.radar.ValueListItem.retrieve("rsli_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", + ) + def test_radar_valuelistitem_delete(self, request_mock): + stripe.radar.ValueListItem.delete("rsli_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", + "/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", + ) + def test_radar_valuelistitem_list(self, request_mock): + stripe.radar.ValueListItem.list(limit = 3, value_list = "rsl_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/radar/value_list_items") + def test_issuing_authorization_retrieve(self, request_mock): + stripe.issuing.Authorization.retrieve("iauth_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", + ) + def test_issuing_authorization_update(self, request_mock): + stripe.issuing.Authorization.modify( + "iauth_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", + ) + def test_issuing_authorization_approve(self, request_mock): + stripe.issuing.Authorization.approve("iauth_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/approve", + ) + def test_issuing_authorization_decline(self, request_mock): + stripe.issuing.Authorization.decline("iauth_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/decline", + ) + def test_issuing_authorization_list(self, request_mock): + stripe.issuing.Authorization.list(limit = 3) + request_mock.assert_requested("get", "/v1/issuing/authorizations") + def test_issuing_cardholder_create(self, request_mock): + stripe.issuing.Cardholder.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", + }, + }, + ) + request_mock.assert_requested("post", "/v1/issuing/cardholders") + def test_issuing_cardholder_retrieve(self, request_mock): + stripe.issuing.Cardholder.retrieve("ich_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", + ) + def test_issuing_cardholder_update(self, request_mock): + stripe.issuing.Cardholder.modify( + "ich_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", + ) + def test_issuing_cardholder_list(self, request_mock): + stripe.issuing.Cardholder.list(limit = 3) + request_mock.assert_requested("get", "/v1/issuing/cardholders") + def test_issuing_card_create(self, request_mock): + stripe.issuing.Card.create( + cardholder = "ich_xxxxxxxxxxxxx", + currency = "usd", + type = "virtual", + ) + request_mock.assert_requested("post", "/v1/issuing/cards") + def test_issuing_card_retrieve(self, request_mock): + stripe.issuing.Card.retrieve("ic_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/issuing/cards/ic_xxxxxxxxxxxxx") + def test_issuing_card_update(self, request_mock): + stripe.issuing.Card.modify( + "ic_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested("post", "/v1/issuing/cards/ic_xxxxxxxxxxxxx") + def test_issuing_card_list(self, request_mock): + stripe.issuing.Card.list(limit = 3) + request_mock.assert_requested("get", "/v1/issuing/cards") + def test_issuing_dispute_create(self, request_mock): + stripe.issuing.Dispute.create( + transaction = "ipi_xxxxxxxxxxxxx", + evidence = { + "reason": "fraudulent", + "fraudulent": {"explanation": "Purchase was unrecognized."}, + }, + ) + request_mock.assert_requested("post", "/v1/issuing/disputes") + def test_issuing_dispute_submit(self, request_mock): + stripe.issuing.Dispute.submit("idp_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/issuing/disputes/idp_xxxxxxxxxxxxx/submit", + ) + def test_issuing_dispute_retrieve(self, request_mock): + stripe.issuing.Dispute.retrieve("idp_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/issuing/disputes/idp_xxxxxxxxxxxxx", + ) + def test_issuing_dispute_update(self, request_mock): + stripe.issuing.Dispute.modify( + "idp_xxxxxxxxxxxxx", + evidence = { + "reason": "not_received", + "not_received": { + "expected_at": 1590000000, + "explanation": "", + "product_description": "Baseball cap", + "product_type": "merchandise", + }, + }, + ) + request_mock.assert_requested( + "post", + "/v1/issuing/disputes/idp_xxxxxxxxxxxxx", + ) + def test_issuing_dispute_list(self, request_mock): + stripe.issuing.Dispute.list(limit = 3) + request_mock.assert_requested("get", "/v1/issuing/disputes") + def test_issuing_transaction_retrieve(self, request_mock): + stripe.issuing.Transaction.retrieve("ipi_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", + ) + def test_issuing_transaction_update(self, request_mock): + stripe.issuing.Transaction.modify( + "ipi_xxxxxxxxxxxxx", + metadata = {"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", + ) + def test_issuing_transaction_list(self, request_mock): + stripe.issuing.Transaction.list(limit = 3) + request_mock.assert_requested("get", "/v1/issuing/transactions") + def test_terminal_connectiontoken_create(self, request_mock): + stripe.terminal.ConnectionToken.create() + request_mock.assert_requested("post", "/v1/terminal/connection_tokens") + def test_terminal_location_create(self, request_mock): + stripe.terminal.Location.create( + display_name = "My First Store", + address = { + "line1": "1234 Main Street", + "city": "San Francisco", + "country": "US", + "postal_code": "94111", + }, + ) + request_mock.assert_requested("post", "/v1/terminal/locations") + def test_terminal_location_retrieve(self, request_mock): + stripe.terminal.Location.retrieve("tml_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/terminal/locations/tml_xxxxxxxxxxxxx", + ) + def test_terminal_location_update(self, request_mock): + stripe.terminal.Location.modify( + "tml_xxxxxxxxxxxxx", + display_name = "My First Store", + ) + request_mock.assert_requested( + "post", + "/v1/terminal/locations/tml_xxxxxxxxxxxxx", + ) + def test_terminal_location_delete(self, request_mock): + stripe.terminal.Location.delete("tml_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", + "/v1/terminal/locations/tml_xxxxxxxxxxxxx", + ) + def test_terminal_location_list(self, request_mock): + stripe.terminal.Location.list(limit = 3) + request_mock.assert_requested("get", "/v1/terminal/locations") + def test_terminal_reader_create(self, request_mock): + stripe.terminal.Reader.create( + registration_code = "puppies-plug-could", + label = "Blue Rabbit", + location = "tml_1234", + ) + request_mock.assert_requested("post", "/v1/terminal/readers") + def test_terminal_reader_retrieve(self, request_mock): + stripe.terminal.Reader.retrieve("tmr_P400-123-456-789") + request_mock.assert_requested( + "get", + "/v1/terminal/readers/tmr_P400-123-456-789", + ) + def test_terminal_reader_update(self, request_mock): + stripe.terminal.Reader.modify("tmr_P400-123-456-789", label = "Blue Rabbit") + request_mock.assert_requested( + "post", + "/v1/terminal/readers/tmr_P400-123-456-789", + ) + def test_terminal_reader_delete(self, request_mock): + stripe.terminal.Reader.delete("tmr_P400-123-456-789") + request_mock.assert_requested( + "delete", + "/v1/terminal/readers/tmr_P400-123-456-789", + ) + def test_terminal_reader_list(self, request_mock): + stripe.terminal.Reader.list(limit = 3) + request_mock.assert_requested("get", "/v1/terminal/readers") + def test_order_create(self, request_mock): + stripe.Order.create( + currency = "usd", + email = "jenny.rosen@example.com", + items = [{"type": "sku", "parent": "sku_xxxxxxxxxxxxx"}], + shipping = { + "name": "Jenny Rosen", + "address": { + "line1": "1234 Main Street", + "city": "San Francisco", + "state": "CA", + "country": "US", + "postal_code": "94111", + }, + }, + ) + request_mock.assert_requested("post", "/v1/orders") + def test_order_retrieve(self, request_mock): + stripe.Order.retrieve("or_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/orders/or_xxxxxxxxxxxxx") + def test_order_update(self, request_mock): + stripe.Order.modify("or_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/orders/or_xxxxxxxxxxxxx") + def test_order_pay(self, request_mock): + stripe.Order.pay("or_xxxxxxxxxxxxx", source = "tok_xxxx") + request_mock.assert_requested("post", "/v1/orders/or_xxxxxxxxxxxxx/pay") + def test_order_list(self, request_mock): + stripe.Order.list(limit = 3) + request_mock.assert_requested("get", "/v1/orders") + def test_orderreturn_retrieve(self, request_mock): + stripe.OrderReturn.retrieve("orret_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/order_returns/orret_xxxxxxxxxxxxx", + ) + def test_orderreturn_list(self, request_mock): + stripe.OrderReturn.list(limit = 3) + request_mock.assert_requested("get", "/v1/order_returns") + def test_sku_create(self, request_mock): + stripe.SKU.create( + attributes = {"size": "Medium", "gender": "Unisex"}, + price = 1500, + currency = "usd", + inventory = {"type": "finite", "quantity": 500}, + product = "prod_xxxxxxxxxxxxx", + ) + request_mock.assert_requested("post", "/v1/skus") + def test_sku_retrieve(self, request_mock): + stripe.SKU.retrieve("sku_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/skus/sku_xxxxxxxxxxxxx") + def test_sku_update(self, request_mock): + stripe.SKU.modify("sku_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/skus/sku_xxxxxxxxxxxxx") + def test_sku_list(self, request_mock): + stripe.SKU.list(limit = 3) + request_mock.assert_requested("get", "/v1/skus") + def test_sku_delete(self, request_mock): + stripe.SKU.delete("sku_xxxxxxxxxxxxx") + request_mock.assert_requested("delete", "/v1/skus/sku_xxxxxxxxxxxxx") + def test_sigma_scheduledqueryrun_retrieve(self, request_mock): + stripe.sigma.ScheduledQueryRun.retrieve("sqr_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/sigma/scheduled_query_runs/sqr_xxxxxxxxxxxxx", + ) + def test_sigma_scheduledqueryrun_list(self, request_mock): + stripe.sigma.ScheduledQueryRun.list(limit = 3) + request_mock.assert_requested("get", "/v1/sigma/scheduled_query_runs") + def test_reporting_reportrun_create(self, request_mock): + stripe.reporting.ReportRun.create( + report_type = "balance.summary.1", + parameters = {"interval_start": 1522540800, "interval_end": 1525132800}, + ) + request_mock.assert_requested("post", "/v1/reporting/report_runs") + def test_reporting_reportrun_retrieve(self, request_mock): + stripe.reporting.ReportRun.retrieve("frr_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/reporting/report_runs/frr_xxxxxxxxxxxxx", + ) + def test_reporting_reportrun_list(self, request_mock): + stripe.reporting.ReportRun.list(limit = 3) + request_mock.assert_requested("get", "/v1/reporting/report_runs") + def test_reporting_reporttype_retrieve(self, request_mock): + stripe.reporting.ReportType.retrieve("balance.summary.1") + request_mock.assert_requested( + "get", + "/v1/reporting/report_types/balance.summary.1", + ) + def test_reporting_reporttype_list(self, request_mock): + stripe.reporting.ReportType.list() + request_mock.assert_requested("get", "/v1/reporting/report_types") + def test_webhookendpoint_create(self, request_mock): + stripe.WebhookEndpoint.create( + url = "https://example.com/my/webhook/endpoint", + enabled_events = ["charge.failed", "charge.succeeded"], + ) + request_mock.assert_requested("post", "/v1/webhook_endpoints") + def test_webhookendpoint_retrieve(self, request_mock): + stripe.WebhookEndpoint.retrieve("we_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", + ) + def test_webhookendpoint_update(self, request_mock): + stripe.WebhookEndpoint.modify( + "we_xxxxxxxxxxxxx", + url = "https://example.com/new_endpoint", + ) + request_mock.assert_requested( + "post", + "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", + ) + def test_webhookendpoint_list(self, request_mock): + stripe.WebhookEndpoint.list(limit = 3) + request_mock.assert_requested("get", "/v1/webhook_endpoints") + def test_webhookendpoint_delete(self, request_mock): + stripe.WebhookEndpoint.delete("we_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", + "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", + ) + def test_customer_list_payment_methods(self, request_mock): + stripe.Customer.list_payment_methods("cus_xyz", type = "card") + request_mock.assert_requested( + "get", + "/v1/customers/cus_xyz/payment_methods", + ) + def test_checkout_session_expire(self, request_mock): + stripe.checkout.Session.expire("sess_xyz") + request_mock.assert_requested( + "post", + "/v1/checkout/sessions/sess_xyz/expire", + ) + def test_shippingrate_create(self, request_mock): + stripe.ShippingRate.create( + display_name = "Sample Shipper", + fixed_amount = {"currency": "usd", "amount": 400}, + type = "fixed_amount", + ) + request_mock.assert_requested("post", "/v1/shipping_rates") + def test_shippingrate_list(self, request_mock): + stripe.ShippingRate.list() + request_mock.assert_requested("get", "/v1/shipping_rates") + def test_checkout_session_create2(self, request_mock): + stripe.checkout.Session.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}, }, - ) - request_mock.assert_requested("post", "/v1/tokens") - - def test_token_create2(self, request_mock): - stripe.Token.create( - bank_account={ - "country": "US", - "currency": "usd", - "account_holder_name": "Jenny Rosen", - "account_holder_type": "individual", - "routing_number": "110000000", - "account_number": "000123456789", - }, - ) - request_mock.assert_requested("post", "/v1/tokens") - - def test_token_create3(self, request_mock): - stripe.Token.create(pii={"id_number": "000000000"}) - request_mock.assert_requested("post", "/v1/tokens") - - def test_token_create4(self, request_mock): - stripe.Token.create( - account={ - "individual": {"first_name": "Jane", "last_name": "Doe"}, - "tos_shown_and_accepted": True, - }, - ) - request_mock.assert_requested("post", "/v1/tokens") - - def test_token_create5(self, request_mock): - stripe.Token.create( - person={ - "first_name": "Jane", - "last_name": "Doe", - "relationship": {"owner": True}, - }, - ) - request_mock.assert_requested("post", "/v1/tokens") - - def test_token_create6(self, request_mock): - stripe.Token.create(cvc_update={"cvc": "123"}) - request_mock.assert_requested("post", "/v1/tokens") - - def test_token_retrieve(self, request_mock): - stripe.Token.retrieve("tok_xxxx") - request_mock.assert_requested("get", "/v1/tokens/tok_xxxx") - - def test_paymentmethod_create(self, request_mock): - stripe.PaymentMethod.create( - type="card", - card={ - "number": "4242424242424242", - "exp_month": 5, - "exp_year": 2022, - "cvc": "314", - }, - ) - request_mock.assert_requested("post", "/v1/payment_methods") - - def test_paymentmethod_retrieve(self, request_mock): - stripe.PaymentMethod.retrieve("pm_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", "/v1/payment_methods/pm_xxxxxxxxxxxxx" - ) - - def test_paymentmethod_update(self, request_mock): - stripe.PaymentMethod.modify( - "pm_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/payment_methods/pm_xxxxxxxxxxxxx", - ) - - def test_paymentmethod_list(self, request_mock): - stripe.PaymentMethod.list(customer="cus_xxxxxxxxxxxxx", type="card") - request_mock.assert_requested("get", "/v1/payment_methods") - - def test_paymentmethod_attach(self, request_mock): - stripe.PaymentMethod.attach( - "pm_xxxxxxxxxxxxx", - customer="cus_xxxxxxxxxxxxx", - ) - request_mock.assert_requested( - "post", - "/v1/payment_methods/pm_xxxxxxxxxxxxx/attach", - ) - - def test_paymentmethod_detach(self, request_mock): - stripe.PaymentMethod.detach("pm_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/payment_methods/pm_xxxxxxxxxxxxx/detach", - ) - - def test_source_retrieve(self, request_mock): - stripe.Source.retrieve("src_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/sources/src_xxxxxxxxxxxxx") - - def test_source_update(self, request_mock): - stripe.Source.modify( - "src_xxxxxxxxxxxxx", metadata={"order_id": "6735"} - ) - request_mock.assert_requested("post", "/v1/sources/src_xxxxxxxxxxxxx") - - def test_checkout_session_create(self, request_mock): - stripe.checkout.Session.create( - success_url="https://example.com/success", - cancel_url="https://example.com/cancel", - payment_method_types=["card"], - line_items=[{"price": "price_xxxxxxxxxxxxx", "quantity": 2}], - mode="payment", - ) - request_mock.assert_requested("post", "/v1/checkout/sessions") - - def test_checkout_session_retrieve(self, request_mock): - stripe.checkout.Session.retrieve("cs_test_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx", - ) - - def test_checkout_session_list(self, request_mock): - stripe.checkout.Session.list(limit=3) - request_mock.assert_requested("get", "/v1/checkout/sessions") - - def test_coupon_create(self, request_mock): - stripe.Coupon.create( - percent_off=25, - duration="repeating", - duration_in_months=3, - ) - request_mock.assert_requested("post", "/v1/coupons") - - def test_coupon_retrieve(self, request_mock): - stripe.Coupon.retrieve("25_5OFF") - request_mock.assert_requested("get", "/v1/coupons/25_5OFF") - - def test_coupon_update(self, request_mock): - stripe.Coupon.modify("co_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/coupons/co_xxxxxxxxxxxxx") - - def test_coupon_delete(self, request_mock): - stripe.Coupon.delete("co_xxxxxxxxxxxxx") - request_mock.assert_requested("delete", "/v1/coupons/co_xxxxxxxxxxxxx") - - def test_coupon_list(self, request_mock): - stripe.Coupon.list(limit=3) - request_mock.assert_requested("get", "/v1/coupons") - - def test_creditnote_create(self, request_mock): - stripe.CreditNote.create( - invoice="in_xxxxxxxxxxxxx", - lines=[ - { - "type": "invoice_line_item", - "invoice_line_item": "il_xxxxxxxxxxxxx", - "quantity": 1, - }, - ], - ) - request_mock.assert_requested("post", "/v1/credit_notes") - - def test_creditnote_update(self, request_mock): - stripe.CreditNote.modify( - "cn_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", "/v1/credit_notes/cn_xxxxxxxxxxxxx" - ) - - def test_creditnote_void_credit_note(self, request_mock): - stripe.CreditNote.void_credit_note("cn_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/credit_notes/cn_xxxxxxxxxxxxx/void", - ) - - def test_creditnote_list(self, request_mock): - stripe.CreditNote.list(limit=3) - request_mock.assert_requested("get", "/v1/credit_notes") - - def test_customer_customerbalancetransaction_retrieve(self, request_mock): - stripe.Customer.retrieve_balance_transaction( - "cus_xxxxxxxxxxxxx", - "cbtxn_xxxxxxxxxxxxx", - ) - request_mock.assert_requested( - "get", - "/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx", - ) - - def test_billing_portal_session_create(self, request_mock): - stripe.billing_portal.Session.create( - customer="cus_xxxxxxxxxxxxx", - return_url="https://example.com/account", - ) - request_mock.assert_requested("post", "/v1/billing_portal/sessions") - - def test_billing_portal_configuration_create(self, request_mock): - stripe.billing_portal.Configuration.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", - }, - ) - request_mock.assert_requested( - "post", "/v1/billing_portal/configurations" - ) - - def test_billing_portal_configuration_update(self, request_mock): - stripe.billing_portal.Configuration.modify( - "bpc_xxxxxxxxxxxxx", - business_profile={ - "privacy_policy_url": "https://example.com/privacy", - "terms_of_service_url": "https://example.com/terms", - }, - ) - request_mock.assert_requested( - "post", - "/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", - ) - - def test_billing_portal_configuration_retrieve(self, request_mock): - stripe.billing_portal.Configuration.retrieve("bpc_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", - ) - - def test_billing_portal_configuration_list(self, request_mock): - stripe.billing_portal.Configuration.list(limit=3) - request_mock.assert_requested( - "get", "/v1/billing_portal/configurations" - ) - - def test_customer_taxid_retrieve(self, request_mock): - stripe.Customer.retrieve_tax_id( - "cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx" - ) - request_mock.assert_requested( - "get", - "/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx", - ) - - def test_invoice_create(self, request_mock): - stripe.Invoice.create(customer="cus_xxxxxxxxxxxxx") - request_mock.assert_requested("post", "/v1/invoices") - - def test_invoice_retrieve(self, request_mock): - stripe.Invoice.retrieve("in_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/invoices/in_xxxxxxxxxxxxx") - - def test_invoice_update(self, request_mock): - stripe.Invoice.modify( - "in_xxxxxxxxxxxxx", metadata={"order_id": "6735"} - ) - request_mock.assert_requested("post", "/v1/invoices/in_xxxxxxxxxxxxx") - - def test_invoice_delete(self, request_mock): - stripe.Invoice.delete("in_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", "/v1/invoices/in_xxxxxxxxxxxxx" - ) - - def test_invoice_finalize_invoice(self, request_mock): - stripe.Invoice.finalize_invoice("in_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/invoices/in_xxxxxxxxxxxxx/finalize", - ) - - def test_invoice_pay(self, request_mock): - stripe.Invoice.pay("in_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", "/v1/invoices/in_xxxxxxxxxxxxx/pay" - ) - - def test_invoice_send_invoice(self, request_mock): - stripe.Invoice.send_invoice("in_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", "/v1/invoices/in_xxxxxxxxxxxxx/send" - ) - - def test_invoice_void_invoice(self, request_mock): - stripe.Invoice.void_invoice("in_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", "/v1/invoices/in_xxxxxxxxxxxxx/void" - ) - - def test_invoice_mark_uncollectible(self, request_mock): - stripe.Invoice.mark_uncollectible("in_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/invoices/in_xxxxxxxxxxxxx/mark_uncollectible", - ) - - def test_invoice_list(self, request_mock): - stripe.Invoice.list(limit=3) - request_mock.assert_requested("get", "/v1/invoices") - - def test_invoiceitem_create(self, request_mock): - stripe.InvoiceItem.create( - customer="cus_xxxxxxxxxxxxx", - price="price_xxxxxxxxxxxxx", - ) - request_mock.assert_requested("post", "/v1/invoiceitems") - - def test_invoiceitem_retrieve(self, request_mock): - stripe.InvoiceItem.retrieve("ii_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", "/v1/invoiceitems/ii_xxxxxxxxxxxxx" - ) - - def test_invoiceitem_update(self, request_mock): - stripe.InvoiceItem.modify( - "ii_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", "/v1/invoiceitems/ii_xxxxxxxxxxxxx" - ) - - def test_invoiceitem_delete(self, request_mock): - stripe.InvoiceItem.delete("ii_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", "/v1/invoiceitems/ii_xxxxxxxxxxxxx" - ) - - def test_invoiceitem_list(self, request_mock): - stripe.InvoiceItem.list(limit=3) - request_mock.assert_requested("get", "/v1/invoiceitems") - - def test_plan_create(self, request_mock): - stripe.Plan.create( - amount=2000, - currency="usd", - interval="month", - product="prod_xxxxxxxxxxxxx", - ) - request_mock.assert_requested("post", "/v1/plans") - - def test_plan_retrieve(self, request_mock): - stripe.Plan.retrieve("price_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/plans/price_xxxxxxxxxxxxx") - - def test_plan_update(self, request_mock): - stripe.Plan.modify( - "price_xxxxxxxxxxxxx", metadata={"order_id": "6735"} - ) - request_mock.assert_requested("post", "/v1/plans/price_xxxxxxxxxxxxx") - - def test_plan_delete(self, request_mock): - stripe.Plan.delete("price_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", "/v1/plans/price_xxxxxxxxxxxxx" - ) - - def test_plan_list(self, request_mock): - stripe.Plan.list(limit=3) - request_mock.assert_requested("get", "/v1/plans") - - def test_promotioncode_create(self, request_mock): - stripe.PromotionCode.create(coupon="25_5OFF") - request_mock.assert_requested("post", "/v1/promotion_codes") - - def test_promotioncode_update(self, request_mock): - stripe.PromotionCode.modify( - "promo_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/promotion_codes/promo_xxxxxxxxxxxxx", - ) - - def test_promotioncode_retrieve(self, request_mock): - stripe.PromotionCode.retrieve("promo_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/promotion_codes/promo_xxxxxxxxxxxxx", - ) - - def test_promotioncode_list(self, request_mock): - stripe.PromotionCode.list(limit=3) - request_mock.assert_requested("get", "/v1/promotion_codes") - - def test_subscription_create(self, request_mock): - stripe.Subscription.create( - customer="cus_xxxxxxxxxxxxx", - items=[{"price": "price_xxxxxxxxxxxxx"}], - ) - request_mock.assert_requested("post", "/v1/subscriptions") - - def test_subscription_retrieve(self, request_mock): - stripe.Subscription.retrieve("sub_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", "/v1/subscriptions/sub_xxxxxxxxxxxxx" - ) - - def test_subscription_update(self, request_mock): - stripe.Subscription.modify( - "sub_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", "/v1/subscriptions/sub_xxxxxxxxxxxxx" - ) - - def test_subscription_list(self, request_mock): - stripe.Subscription.list(limit=3) - request_mock.assert_requested("get", "/v1/subscriptions") - - def test_subscriptionitem_create(self, request_mock): - stripe.SubscriptionItem.create( - subscription="sub_xxxxxxxxxxxxx", - price="price_xxxxxxxxxxxxx", - quantity=2, - ) - request_mock.assert_requested("post", "/v1/subscription_items") - - def test_subscriptionitem_retrieve(self, request_mock): - stripe.SubscriptionItem.retrieve("si_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/subscription_items/si_xxxxxxxxxxxxx", - ) - - def test_subscriptionitem_update(self, request_mock): - stripe.SubscriptionItem.modify( - "si_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/subscription_items/si_xxxxxxxxxxxxx", - ) - - def test_subscriptionitem_delete(self, request_mock): - stripe.SubscriptionItem.delete("si_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", - "/v1/subscription_items/si_xxxxxxxxxxxxx", - ) - - def test_subscriptionitem_list(self, request_mock): - stripe.SubscriptionItem.list(subscription="sub_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/subscription_items") - - def test_subscriptionschedule_create(self, request_mock): - stripe.SubscriptionSchedule.create( - customer="cus_xxxxxxxxxxxxx", - start_date=1620753115, - end_behavior="release", - phases=[ - { - "items": [{"price": "price_xxxxxxxxxxxxx", "quantity": 1}], - "iterations": 12, - }, - ], - ) - request_mock.assert_requested("post", "/v1/subscription_schedules") - - def test_subscriptionschedule_retrieve(self, request_mock): - stripe.SubscriptionSchedule.retrieve("sub_sched_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", - ) - - def test_subscriptionschedule_update(self, request_mock): - stripe.SubscriptionSchedule.modify( - "sub_sched_xxxxxxxxxxxxx", - end_behavior="release", - ) - request_mock.assert_requested( - "post", - "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", - ) - - def test_subscriptionschedule_cancel(self, request_mock): - stripe.SubscriptionSchedule.cancel("sub_sched_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/cancel", - ) - - def test_subscriptionschedule_release(self, request_mock): - stripe.SubscriptionSchedule.release("sub_sched_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/release", - ) - - def test_subscriptionschedule_list(self, request_mock): - stripe.SubscriptionSchedule.list(limit=3) - request_mock.assert_requested("get", "/v1/subscription_schedules") - - def test_taxrate_create(self, request_mock): - stripe.TaxRate.create( - display_name="VAT", - description="VAT Germany", - jurisdiction="DE", - percentage=16, - inclusive=False, - ) - request_mock.assert_requested("post", "/v1/tax_rates") - - def test_taxrate_retrieve(self, request_mock): - stripe.TaxRate.retrieve("txr_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/tax_rates/txr_xxxxxxxxxxxxx") - - def test_taxrate_update(self, request_mock): - stripe.TaxRate.modify("txr_xxxxxxxxxxxxx", active=False) - request_mock.assert_requested( - "post", "/v1/tax_rates/txr_xxxxxxxxxxxxx" - ) - - def test_taxrate_list(self, request_mock): - stripe.TaxRate.list(limit=3) - request_mock.assert_requested("get", "/v1/tax_rates") - - def test_account_create(self, request_mock): - stripe.Account.create( - type="custom", - country="US", - email="jenny.rosen@example.com", - capabilities={ - "card_payments": {"requested": True}, - "transfers": {"requested": True}, - }, - ) - request_mock.assert_requested("post", "/v1/accounts") - - def test_account_retrieve(self, request_mock): - stripe.Account.retrieve("acct_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/accounts/acct_xxxxxxxxxxxxx") - - def test_account_update(self, request_mock): - stripe.Account.modify( - "acct_xxxxxxxxxxxxx", metadata={"order_id": "6735"} - ) - request_mock.assert_requested( - "post", "/v1/accounts/acct_xxxxxxxxxxxxx" - ) - - def test_account_delete(self, request_mock): - stripe.Account.delete("acct_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", "/v1/accounts/acct_xxxxxxxxxxxxx" - ) - - def test_account_reject(self, request_mock): - stripe.Account.reject("acct_xxxxxxxxxxxxx", reason="fraud") - request_mock.assert_requested( - "post", - "/v1/accounts/acct_xxxxxxxxxxxxx/reject", - ) - - def test_account_list(self, request_mock): - stripe.Account.list(limit=3) - request_mock.assert_requested("get", "/v1/accounts") - - def test_accountlink_create(self, request_mock): - stripe.AccountLink.create( - account="acct_xxxxxxxxxxxxx", - refresh_url="https://example.com/reauth", - return_url="https://example.com/return", - type="account_onboarding", - ) - request_mock.assert_requested("post", "/v1/account_links") - - def test_applicationfee_retrieve(self, request_mock): - stripe.ApplicationFee.retrieve("fee_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/application_fees/fee_xxxxxxxxxxxxx", - ) - - def test_applicationfee_list(self, request_mock): - stripe.ApplicationFee.list(limit=3) - request_mock.assert_requested("get", "/v1/application_fees") - - def test_applicationfee_feerefund_retrieve(self, request_mock): - stripe.ApplicationFee.retrieve_refund( - "fee_xxxxxxxxxxxxx", - "fr_xxxxxxxxxxxxx", - ) - request_mock.assert_requested( - "get", - "/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", - ) - - def test_applicationfee_feerefund_update(self, request_mock): - stripe.ApplicationFee.modify_refund( - "fee_xxxxxxxxxxxxx", - "fr_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", - ) - - def test_account_capability_retrieve(self, request_mock): - stripe.Account.retrieve_capability( - "acct_xxxxxxxxxxxxx", "card_payments" - ) - request_mock.assert_requested( - "get", - "/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments", - ) - - def test_account_capability_update(self, request_mock): - stripe.Account.modify_capability( - "acct_xxxxxxxxxxxxx", - "card_payments", - requested=True, - ) - request_mock.assert_requested( - "post", - "/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments", - ) - - def test_countryspec_list(self, request_mock): - stripe.CountrySpec.list(limit=3) - request_mock.assert_requested("get", "/v1/country_specs") - - def test_countryspec_retrieve(self, request_mock): - stripe.CountrySpec.retrieve("US") - request_mock.assert_requested("get", "/v1/country_specs/US") - - def test_account_person_retrieve(self, request_mock): - stripe.Account.retrieve_person( - "acct_xxxxxxxxxxxxx", "person_xxxxxxxxxxxxx" - ) - request_mock.assert_requested( - "get", - "/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", - ) - - def test_account_person_update(self, request_mock): - stripe.Account.modify_person( - "acct_xxxxxxxxxxxxx", - "person_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", - ) - - def test_topup_create(self, request_mock): - stripe.Topup.create( - amount=2000, - currency="usd", - description="Top-up for Jenny Rosen", - statement_descriptor="Top-up", - ) - request_mock.assert_requested("post", "/v1/topups") - - def test_topup_retrieve(self, request_mock): - stripe.Topup.retrieve("tu_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/topups/tu_xxxxxxxxxxxxx") - - def test_topup_update(self, request_mock): - stripe.Topup.modify("tu_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/topups/tu_xxxxxxxxxxxxx") - - def test_topup_list(self, request_mock): - stripe.Topup.list(limit=3) - request_mock.assert_requested("get", "/v1/topups") - - def test_topup_cancel(self, request_mock): - stripe.Topup.cancel("tu_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", "/v1/topups/tu_xxxxxxxxxxxxx/cancel" - ) - - def test_transfer_create(self, request_mock): - stripe.Transfer.create( - amount=400, - currency="usd", - destination="acct_xxxxxxxxxxxxx", - transfer_group="ORDER_95", - ) - request_mock.assert_requested("post", "/v1/transfers") - - def test_transfer_retrieve(self, request_mock): - stripe.Transfer.retrieve("tr_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/transfers/tr_xxxxxxxxxxxxx") - - def test_transfer_update(self, request_mock): - stripe.Transfer.modify( - "tr_xxxxxxxxxxxxx", metadata={"order_id": "6735"} - ) - request_mock.assert_requested("post", "/v1/transfers/tr_xxxxxxxxxxxxx") - - def test_transfer_list(self, request_mock): - stripe.Transfer.list(limit=3) - request_mock.assert_requested("get", "/v1/transfers") - - def test_transfer_transferreversal_retrieve(self, request_mock): - stripe.Transfer.retrieve_reversal( - "tr_xxxxxxxxxxxxx", "trr_xxxxxxxxxxxxx" - ) - request_mock.assert_requested( - "get", - "/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx", - ) - - def test_transfer_transferreversal_update(self, request_mock): - stripe.Transfer.modify_reversal( - "tr_xxxxxxxxxxxxx", - "trr_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx", - ) - - def test_radar_earlyfraudwarning_retrieve(self, request_mock): - stripe.radar.EarlyFraudWarning.retrieve("issfr_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/radar/early_fraud_warnings/issfr_xxxxxxxxxxxxx", - ) - - def test_radar_earlyfraudwarning_list(self, request_mock): - stripe.radar.EarlyFraudWarning.list(limit=3) - request_mock.assert_requested("get", "/v1/radar/early_fraud_warnings") - - def test_review_approve(self, request_mock): - stripe.Review.approve("prv_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/reviews/prv_xxxxxxxxxxxxx/approve", - ) - - def test_review_retrieve(self, request_mock): - stripe.Review.retrieve("prv_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/reviews/prv_xxxxxxxxxxxxx") - - def test_review_list(self, request_mock): - stripe.Review.list(limit=3) - request_mock.assert_requested("get", "/v1/reviews") - - def test_radar_valuelist_create(self, request_mock): - stripe.radar.ValueList.create( - alias="custom_ip_xxxxxxxxxxxxx", - name="Custom IP Blocklist", - item_type="ip_address", - ) - request_mock.assert_requested("post", "/v1/radar/value_lists") - - def test_radar_valuelist_retrieve(self, request_mock): - stripe.radar.ValueList.retrieve("rsl_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", - ) - - def test_radar_valuelist_update(self, request_mock): - stripe.radar.ValueList.modify( - "rsl_xxxxxxxxxxxxx", - name="Updated IP Block List", - ) - request_mock.assert_requested( - "post", - "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", - ) - - def test_radar_valuelist_delete(self, request_mock): - stripe.radar.ValueList.delete("rsl_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", - "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", - ) - - def test_radar_valuelist_list(self, request_mock): - stripe.radar.ValueList.list(limit=3) - request_mock.assert_requested("get", "/v1/radar/value_lists") - - def test_radar_valuelistitem_create(self, request_mock): - stripe.radar.ValueListItem.create( - value_list="rsl_xxxxxxxxxxxxx", - value="1.2.3.4", - ) - request_mock.assert_requested("post", "/v1/radar/value_list_items") - - def test_radar_valuelistitem_retrieve(self, request_mock): - stripe.radar.ValueListItem.retrieve("rsli_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", - ) - - def test_radar_valuelistitem_delete(self, request_mock): - stripe.radar.ValueListItem.delete("rsli_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", - "/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", - ) - - def test_radar_valuelistitem_list(self, request_mock): - stripe.radar.ValueListItem.list( - limit=3, value_list="rsl_xxxxxxxxxxxxx" - ) - request_mock.assert_requested("get", "/v1/radar/value_list_items") - - def test_issuing_authorization_retrieve(self, request_mock): - stripe.issuing.Authorization.retrieve("iauth_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", - ) - - def test_issuing_authorization_update(self, request_mock): - stripe.issuing.Authorization.modify( - "iauth_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", - ) - - def test_issuing_authorization_approve(self, request_mock): - stripe.issuing.Authorization.approve("iauth_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/approve", - ) - - def test_issuing_authorization_decline(self, request_mock): - stripe.issuing.Authorization.decline("iauth_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/decline", - ) - - def test_issuing_authorization_list(self, request_mock): - stripe.issuing.Authorization.list(limit=3) - request_mock.assert_requested("get", "/v1/issuing/authorizations") - - def test_issuing_cardholder_create(self, request_mock): - stripe.issuing.Cardholder.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", - }, - }, - ) - request_mock.assert_requested("post", "/v1/issuing/cardholders") - - def test_issuing_cardholder_retrieve(self, request_mock): - stripe.issuing.Cardholder.retrieve("ich_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", - ) - - def test_issuing_cardholder_update(self, request_mock): - stripe.issuing.Cardholder.modify( - "ich_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", - ) - - def test_issuing_cardholder_list(self, request_mock): - stripe.issuing.Cardholder.list(limit=3) - request_mock.assert_requested("get", "/v1/issuing/cardholders") - - def test_issuing_card_create(self, request_mock): - stripe.issuing.Card.create( - cardholder="ich_xxxxxxxxxxxxx", - currency="usd", - type="virtual", - ) - request_mock.assert_requested("post", "/v1/issuing/cards") - - def test_issuing_card_retrieve(self, request_mock): - stripe.issuing.Card.retrieve("ic_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", "/v1/issuing/cards/ic_xxxxxxxxxxxxx" - ) - - def test_issuing_card_update(self, request_mock): - stripe.issuing.Card.modify( - "ic_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", "/v1/issuing/cards/ic_xxxxxxxxxxxxx" - ) - - def test_issuing_card_list(self, request_mock): - stripe.issuing.Card.list(limit=3) - request_mock.assert_requested("get", "/v1/issuing/cards") - - def test_issuing_dispute_create(self, request_mock): - stripe.issuing.Dispute.create( - transaction="ipi_xxxxxxxxxxxxx", - evidence={ - "reason": "fraudulent", - "fraudulent": {"explanation": "Purchase was unrecognized."}, - }, - ) - request_mock.assert_requested("post", "/v1/issuing/disputes") - - def test_issuing_dispute_submit(self, request_mock): - stripe.issuing.Dispute.submit("idp_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/issuing/disputes/idp_xxxxxxxxxxxxx/submit", - ) - - def test_issuing_dispute_retrieve(self, request_mock): - stripe.issuing.Dispute.retrieve("idp_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/issuing/disputes/idp_xxxxxxxxxxxxx", - ) - - def test_issuing_dispute_update(self, request_mock): - stripe.issuing.Dispute.modify( - "idp_xxxxxxxxxxxxx", - evidence={ - "reason": "not_received", - "not_received": { - "expected_at": 1590000000, - "explanation": "", - "product_description": "Baseball cap", - "product_type": "merchandise", - }, - }, - ) - request_mock.assert_requested( - "post", - "/v1/issuing/disputes/idp_xxxxxxxxxxxxx", - ) - - def test_issuing_dispute_list(self, request_mock): - stripe.issuing.Dispute.list(limit=3) - request_mock.assert_requested("get", "/v1/issuing/disputes") - - def test_issuing_transaction_retrieve(self, request_mock): - stripe.issuing.Transaction.retrieve("ipi_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", - ) - - def test_issuing_transaction_update(self, request_mock): - stripe.issuing.Transaction.modify( - "ipi_xxxxxxxxxxxxx", - metadata={"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", - ) - - def test_issuing_transaction_list(self, request_mock): - stripe.issuing.Transaction.list(limit=3) - request_mock.assert_requested("get", "/v1/issuing/transactions") - - def test_terminal_connectiontoken_create(self, request_mock): - stripe.terminal.ConnectionToken.create() - request_mock.assert_requested("post", "/v1/terminal/connection_tokens") - - def test_terminal_location_create(self, request_mock): - stripe.terminal.Location.create( - display_name="My First Store", - address={ - "line1": "1234 Main Street", - "city": "San Francisco", - "country": "US", - "postal_code": "94111", - }, - ) - request_mock.assert_requested("post", "/v1/terminal/locations") - - def test_terminal_location_retrieve(self, request_mock): - stripe.terminal.Location.retrieve("tml_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/terminal/locations/tml_xxxxxxxxxxxxx", - ) - - def test_terminal_location_update(self, request_mock): - stripe.terminal.Location.modify( - "tml_xxxxxxxxxxxxx", - display_name="My First Store", - ) - request_mock.assert_requested( - "post", - "/v1/terminal/locations/tml_xxxxxxxxxxxxx", - ) - - def test_terminal_location_delete(self, request_mock): - stripe.terminal.Location.delete("tml_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", - "/v1/terminal/locations/tml_xxxxxxxxxxxxx", - ) - - def test_terminal_location_list(self, request_mock): - stripe.terminal.Location.list(limit=3) - request_mock.assert_requested("get", "/v1/terminal/locations") - - def test_terminal_reader_create(self, request_mock): - stripe.terminal.Reader.create( - registration_code="puppies-plug-could", - label="Blue Rabbit", - location="tml_1234", - ) - request_mock.assert_requested("post", "/v1/terminal/readers") - - def test_terminal_reader_retrieve(self, request_mock): - stripe.terminal.Reader.retrieve("tmr_P400-123-456-789") - request_mock.assert_requested( - "get", - "/v1/terminal/readers/tmr_P400-123-456-789", - ) - - def test_terminal_reader_update(self, request_mock): - stripe.terminal.Reader.modify( - "tmr_P400-123-456-789", label="Blue Rabbit" - ) - request_mock.assert_requested( - "post", - "/v1/terminal/readers/tmr_P400-123-456-789", - ) - - def test_terminal_reader_delete(self, request_mock): - stripe.terminal.Reader.delete("tmr_P400-123-456-789") - request_mock.assert_requested( - "delete", - "/v1/terminal/readers/tmr_P400-123-456-789", - ) - - def test_terminal_reader_list(self, request_mock): - stripe.terminal.Reader.list(limit=3) - request_mock.assert_requested("get", "/v1/terminal/readers") - - def test_order_create(self, request_mock): - stripe.Order.create( - currency="usd", - email="jenny.rosen@example.com", - items=[{"type": "sku", "parent": "sku_xxxxxxxxxxxxx"}], - shipping={ - "name": "Jenny Rosen", - "address": { - "line1": "1234 Main Street", - "city": "San Francisco", - "state": "CA", - "country": "US", - "postal_code": "94111", - }, - }, - ) - request_mock.assert_requested("post", "/v1/orders") - - def test_order_retrieve(self, request_mock): - stripe.Order.retrieve("or_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/orders/or_xxxxxxxxxxxxx") - - def test_order_update(self, request_mock): - stripe.Order.modify("or_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/orders/or_xxxxxxxxxxxxx") - - def test_order_pay(self, request_mock): - stripe.Order.pay("or_xxxxxxxxxxxxx", source="tok_xxxx") - request_mock.assert_requested( - "post", "/v1/orders/or_xxxxxxxxxxxxx/pay" - ) - - def test_order_list(self, request_mock): - stripe.Order.list(limit=3) - request_mock.assert_requested("get", "/v1/orders") - - def test_orderreturn_retrieve(self, request_mock): - stripe.OrderReturn.retrieve("orret_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/order_returns/orret_xxxxxxxxxxxxx", - ) - - def test_orderreturn_list(self, request_mock): - stripe.OrderReturn.list(limit=3) - request_mock.assert_requested("get", "/v1/order_returns") - - def test_sku_create(self, request_mock): - stripe.SKU.create( - attributes={"size": "Medium", "gender": "Unisex"}, - price=1500, - currency="usd", - inventory={"type": "finite", "quantity": 500}, - product="prod_xxxxxxxxxxxxx", - ) - request_mock.assert_requested("post", "/v1/skus") - - def test_sku_retrieve(self, request_mock): - stripe.SKU.retrieve("sku_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/skus/sku_xxxxxxxxxxxxx") - - def test_sku_update(self, request_mock): - stripe.SKU.modify("sku_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/skus/sku_xxxxxxxxxxxxx") - - def test_sku_list(self, request_mock): - stripe.SKU.list(limit=3) - request_mock.assert_requested("get", "/v1/skus") - - def test_sku_delete(self, request_mock): - stripe.SKU.delete("sku_xxxxxxxxxxxxx") - request_mock.assert_requested("delete", "/v1/skus/sku_xxxxxxxxxxxxx") - - def test_sigma_scheduledqueryrun_retrieve(self, request_mock): - stripe.sigma.ScheduledQueryRun.retrieve("sqr_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/sigma/scheduled_query_runs/sqr_xxxxxxxxxxxxx", - ) - - def test_sigma_scheduledqueryrun_list(self, request_mock): - stripe.sigma.ScheduledQueryRun.list(limit=3) - request_mock.assert_requested("get", "/v1/sigma/scheduled_query_runs") - - def test_reporting_reportrun_create(self, request_mock): - stripe.reporting.ReportRun.create( - report_type="balance.summary.1", - parameters={ - "interval_start": 1522540800, - "interval_end": 1525132800, - }, - ) - request_mock.assert_requested("post", "/v1/reporting/report_runs") - - def test_reporting_reportrun_retrieve(self, request_mock): - stripe.reporting.ReportRun.retrieve("frr_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/reporting/report_runs/frr_xxxxxxxxxxxxx", - ) - - def test_reporting_reportrun_list(self, request_mock): - stripe.reporting.ReportRun.list(limit=3) - request_mock.assert_requested("get", "/v1/reporting/report_runs") - - def test_reporting_reporttype_retrieve(self, request_mock): - stripe.reporting.ReportType.retrieve("balance.summary.1") - request_mock.assert_requested( - "get", - "/v1/reporting/report_types/balance.summary.1", - ) - - def test_reporting_reporttype_list(self, request_mock): - stripe.reporting.ReportType.list() - request_mock.assert_requested("get", "/v1/reporting/report_types") - - def test_webhookendpoint_create(self, request_mock): - stripe.WebhookEndpoint.create( - url="https://example.com/my/webhook/endpoint", - enabled_events=["charge.failed", "charge.succeeded"], - ) - request_mock.assert_requested("post", "/v1/webhook_endpoints") - - def test_webhookendpoint_retrieve(self, request_mock): - stripe.WebhookEndpoint.retrieve("we_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", - ) - - def test_webhookendpoint_update(self, request_mock): - stripe.WebhookEndpoint.modify( - "we_xxxxxxxxxxxxx", - url="https://example.com/new_endpoint", - ) - request_mock.assert_requested( - "post", - "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", - ) - - def test_webhookendpoint_list(self, request_mock): - stripe.WebhookEndpoint.list(limit=3) - request_mock.assert_requested("get", "/v1/webhook_endpoints") - - def test_webhookendpoint_delete(self, request_mock): - stripe.WebhookEndpoint.delete("we_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", - "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", - ) - - def test_customer_list_payment_methods(self, request_mock): - stripe.Customer.list_payment_methods("cus_xyz", type="card") - request_mock.assert_requested( - "get", - "/v1/customers/cus_xyz/payment_methods", - ) - - def test_checkout_session_expire(self, request_mock): - stripe.checkout.Session.expire("sess_xyz") - request_mock.assert_requested( - "post", - "/v1/checkout/sessions/sess_xyz/expire", - ) - - def test_shippingrate_create(self, request_mock): - stripe.ShippingRate.create( - display_name="Sample Shipper", - fixed_amount={"currency": "usd", "amount": 400}, - type="fixed_amount", - ) - request_mock.assert_requested("post", "/v1/shipping_rates") - - def test_shippingrate_list(self, request_mock): - stripe.ShippingRate.list() - request_mock.assert_requested("get", "/v1/shipping_rates") - - def test_checkout_session_create2(self, request_mock): - stripe.checkout.Session.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}, - }, - }, - }, - ], - ) - request_mock.assert_requested("post", "/v1/checkout/sessions") - - def test_paymentintent_create2(self, request_mock): - stripe.PaymentIntent.create( - amount=1099, - currency="eur", - automatic_payment_methods={"enabled": True}, - ) - request_mock.assert_requested("post", "/v1/payment_intents") - - def test_paymentlink_create(self, request_mock): - stripe.PaymentLink.create( - line_items=[{"price": "price_xxxxxxxxxxxxx", "quantity": 1}], - ) - request_mock.assert_requested("post", "/v1/payment_links") - - def test_paymentlink_list_line_items(self, request_mock): - stripe.PaymentLink.list_line_items("pl_xyz") - request_mock.assert_requested( - "get", "/v1/payment_links/pl_xyz/line_items" - ) + }, + }, + ], + ) + request_mock.assert_requested("post", "/v1/checkout/sessions") + def test_paymentintent_create2(self, request_mock): + stripe.PaymentIntent.create( + amount = 1099, + currency = "eur", + automatic_payment_methods = {"enabled": True}, + ) + request_mock.assert_requested("post", "/v1/payment_intents") + def test_paymentlink_create(self, request_mock): + stripe.PaymentLink.create( + line_items = [{"price": "price_xxxxxxxxxxxxx", "quantity": 1}], + ) + request_mock.assert_requested("post", "/v1/payment_links") + def test_paymentlink_list_line_items(self, request_mock): + stripe.PaymentLink.list_line_items("pl_xyz") + request_mock.assert_requested("get", "/v1/payment_links/pl_xyz/line_items") + def test_paymentlink_retrieve(self, request_mock): + stripe.PaymentLink.retrieve("pl_xyz") + request_mock.assert_requested("get", "/v1/payment_links/pl_xyz") + def test_paymentintent_verify_microdeposits(self, request_mock): + stripe.PaymentIntent.verify_microdeposits("pi_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits", + ) + def test_setupintent_verify_microdeposits(self, request_mock): + stripe.SetupIntent.verify_microdeposits("seti_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits", + ) - def test_paymentlink_retrieve(self, request_mock): - stripe.PaymentLink.retrieve("pl_xyz") - request_mock.assert_requested("get", "/v1/payment_links/pl_xyz") From 0ae710c71e6f47f9eb8783737a7a195ba6a119b6 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Tue, 15 Feb 2022 14:50:17 -0800 Subject: [PATCH 2/2] Format --- stripe/api_resources/__init__.py | 6 +- stripe/api_resources/account.py | 3 +- stripe/api_resources/account_link.py | 1 - stripe/api_resources/alipay_account.py | 1 - stripe/api_resources/apple_pay_domain.py | 1 - stripe/api_resources/application_fee.py | 1 - .../api_resources/application_fee_refund.py | 1 - stripe/api_resources/balance.py | 1 - stripe/api_resources/balance_transaction.py | 1 - stripe/api_resources/bank_account.py | 1 - .../api_resources/billing_portal/__init__.py | 2 +- .../billing_portal/configuration.py | 1 - .../api_resources/billing_portal/session.py | 1 - stripe/api_resources/bitcoin_receiver.py | 1 - stripe/api_resources/bitcoin_transaction.py | 1 - stripe/api_resources/capability.py | 3 +- stripe/api_resources/card.py | 1 - stripe/api_resources/charge.py | 7 +- stripe/api_resources/checkout/__init__.py | 2 +- stripe/api_resources/checkout/session.py | 3 +- stripe/api_resources/country_spec.py | 1 - stripe/api_resources/coupon.py | 1 - stripe/api_resources/credit_note.py | 3 +- stripe/api_resources/credit_note_line_item.py | 1 - stripe/api_resources/customer.py | 3 +- .../customer_balance_transaction.py | 2 +- stripe/api_resources/dispute.py | 3 +- stripe/api_resources/ephemeral_key.py | 1 - stripe/api_resources/event.py | 1 - stripe/api_resources/exchange_rate.py | 1 - stripe/api_resources/file.py | 8 +- stripe/api_resources/file_link.py | 1 - stripe/api_resources/identity/__init__.py | 8 +- .../identity/verification_report.py | 1 - .../identity/verification_session.py | 3 +- stripe/api_resources/invoice.py | 3 +- stripe/api_resources/invoice_item.py | 1 - stripe/api_resources/invoice_line_item.py | 1 - stripe/api_resources/issuer_fraud_record.py | 1 - stripe/api_resources/issuing/__init__.py | 2 +- stripe/api_resources/issuing/authorization.py | 3 +- stripe/api_resources/issuing/card.py | 1 - stripe/api_resources/issuing/card_details.py | 1 - stripe/api_resources/issuing/cardholder.py | 1 - stripe/api_resources/issuing/dispute.py | 3 +- stripe/api_resources/issuing/transaction.py | 1 - stripe/api_resources/line_item.py | 1 - stripe/api_resources/login_link.py | 1 - stripe/api_resources/mandate.py | 1 - stripe/api_resources/order.py | 3 +- stripe/api_resources/order_return.py | 1 - stripe/api_resources/payment_intent.py | 3 +- stripe/api_resources/payment_link.py | 3 +- stripe/api_resources/payment_method.py | 3 +- stripe/api_resources/payout.py | 7 +- stripe/api_resources/person.py | 1 - stripe/api_resources/plan.py | 1 - stripe/api_resources/price.py | 1 - stripe/api_resources/product.py | 1 - stripe/api_resources/promotion_code.py | 1 - stripe/api_resources/quote.py | 45 +- stripe/api_resources/radar/__init__.py | 2 +- .../radar/early_fraud_warning.py | 1 - stripe/api_resources/radar/value_list.py | 1 - stripe/api_resources/radar/value_list_item.py | 1 - stripe/api_resources/recipient.py | 1 - stripe/api_resources/refund.py | 5 +- stripe/api_resources/reporting/__init__.py | 2 +- stripe/api_resources/reporting/report_run.py | 1 - stripe/api_resources/reporting/report_type.py | 1 - stripe/api_resources/reversal.py | 1 - stripe/api_resources/review.py | 3 +- stripe/api_resources/setup_attempt.py | 1 - stripe/api_resources/setup_intent.py | 3 +- stripe/api_resources/shipping_rate.py | 1 - stripe/api_resources/sigma/__init__.py | 2 +- .../sigma/scheduled_query_run.py | 1 - stripe/api_resources/sku.py | 1 - stripe/api_resources/source.py | 4 +- stripe/api_resources/source_transaction.py | 1 - stripe/api_resources/subscription.py | 1 - stripe/api_resources/subscription_item.py | 4 +- stripe/api_resources/subscription_schedule.py | 3 +- stripe/api_resources/tax_code.py | 1 - stripe/api_resources/tax_id.py | 1 - stripe/api_resources/tax_rate.py | 1 - stripe/api_resources/terminal/__init__.py | 2 +- .../terminal/connection_token.py | 1 - stripe/api_resources/terminal/location.py | 1 - stripe/api_resources/terminal/reader.py | 1 - stripe/api_resources/three_d_secure.py | 1 - stripe/api_resources/token.py | 1 - stripe/api_resources/topup.py | 3 +- stripe/api_resources/transfer.py | 3 +- stripe/api_resources/usage_record.py | 1 - stripe/api_resources/usage_record_summary.py | 1 - stripe/api_resources/webhook_endpoint.py | 1 - stripe/object_classes.py | 2 +- tests/test_generated_examples.py | 2928 +++++++++-------- 99 files changed, 1717 insertions(+), 1441 deletions(-) diff --git a/stripe/api_resources/__init__.py b/stripe/api_resources/__init__.py index b2f00f665..c61f03fd6 100644 --- a/stripe/api_resources/__init__.py +++ b/stripe/api_resources/__init__.py @@ -34,7 +34,9 @@ from stripe.api_resources.credit_note import CreditNote from stripe.api_resources.credit_note_line_item import CreditNoteLineItem from stripe.api_resources.customer import Customer -from stripe.api_resources.customer_balance_transaction import CustomerBalanceTransaction +from stripe.api_resources.customer_balance_transaction import ( + CustomerBalanceTransaction, +) from stripe.api_resources.dispute import Dispute from stripe.api_resources.ephemeral_key import EphemeralKey from stripe.api_resources.event import Event @@ -84,4 +86,4 @@ from stripe.api_resources.transfer import Transfer from stripe.api_resources.usage_record import UsageRecord from stripe.api_resources.usage_record_summary import UsageRecordSummary -from stripe.api_resources.webhook_endpoint import WebhookEndpoint \ No newline at end of file +from stripe.api_resources.webhook_endpoint import WebhookEndpoint diff --git a/stripe/api_resources/account.py b/stripe/api_resources/account.py index 4d5ff74fd..0d99f607e 100644 --- a/stripe/api_resources/account.py +++ b/stripe/api_resources/account.py @@ -35,13 +35,13 @@ class Account( UpdateableAPIResource, ): OBJECT_NAME = "account" + def reject(self, idempotency_key=None, **params): url = self.instance_url() + "/reject" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - # We are not adding a helper for capabilities here as the Account object already has a # capabilities property which is a hash and not the sub-list of capabilities. @@ -88,4 +88,3 @@ def serialize(self, previous): params[k] = v.serialize(previous.get(k, None)) return params - diff --git a/stripe/api_resources/account_link.py b/stripe/api_resources/account_link.py index 97e0e5247..8ee5e043c 100644 --- a/stripe/api_resources/account_link.py +++ b/stripe/api_resources/account_link.py @@ -6,4 +6,3 @@ class AccountLink(CreateableAPIResource): OBJECT_NAME = "account_link" - diff --git a/stripe/api_resources/alipay_account.py b/stripe/api_resources/alipay_account.py index bc4765f87..a11da90c9 100644 --- a/stripe/api_resources/alipay_account.py +++ b/stripe/api_resources/alipay_account.py @@ -43,4 +43,3 @@ def retrieve( "Can't retrieve an Alipay account without a customer ID. " "Use customer.sources.retrieve('alipay_account_id') instead." ) - diff --git a/stripe/api_resources/apple_pay_domain.py b/stripe/api_resources/apple_pay_domain.py index 0bd248d90..d600ff3c5 100644 --- a/stripe/api_resources/apple_pay_domain.py +++ b/stripe/api_resources/apple_pay_domain.py @@ -16,4 +16,3 @@ class ApplePayDomain( @classmethod def class_url(cls): return "/v1/apple_pay/domains" - diff --git a/stripe/api_resources/application_fee.py b/stripe/api_resources/application_fee.py index 0ea13798c..9c44605dd 100644 --- a/stripe/api_resources/application_fee.py +++ b/stripe/api_resources/application_fee.py @@ -18,4 +18,3 @@ def refund(self, idempotency_key=None, **params): url = self.instance_url() + "/refund" self.refresh_from(self.request("post", url, params, headers)) return self - diff --git a/stripe/api_resources/application_fee_refund.py b/stripe/api_resources/application_fee_refund.py index cb4036d45..fbda378bb 100644 --- a/stripe/api_resources/application_fee_refund.py +++ b/stripe/api_resources/application_fee_refund.py @@ -33,4 +33,3 @@ def retrieve(cls, id, api_key=None, **params): "Can't retrieve a refund without an application fee ID. " "Use application_fee.refunds.retrieve('refund_id') instead." ) - diff --git a/stripe/api_resources/balance.py b/stripe/api_resources/balance.py index 4d00e5195..af75a95f1 100644 --- a/stripe/api_resources/balance.py +++ b/stripe/api_resources/balance.py @@ -6,4 +6,3 @@ class Balance(SingletonAPIResource): OBJECT_NAME = "balance" - diff --git a/stripe/api_resources/balance_transaction.py b/stripe/api_resources/balance_transaction.py index 7d240315d..dc0659551 100644 --- a/stripe/api_resources/balance_transaction.py +++ b/stripe/api_resources/balance_transaction.py @@ -6,4 +6,3 @@ class BalanceTransaction(ListableAPIResource): OBJECT_NAME = "balance_transaction" - diff --git a/stripe/api_resources/bank_account.py b/stripe/api_resources/bank_account.py index 2a350526e..e9cc7c948 100644 --- a/stripe/api_resources/bank_account.py +++ b/stripe/api_resources/bank_account.py @@ -62,4 +62,3 @@ def retrieve( "Use customer.sources.retrieve('bank_account_id') or " "account.external_accounts.retrieve('bank_account_id') instead." ) - diff --git a/stripe/api_resources/billing_portal/__init__.py b/stripe/api_resources/billing_portal/__init__.py index 19c989571..53bdc6b66 100644 --- a/stripe/api_resources/billing_portal/__init__.py +++ b/stripe/api_resources/billing_portal/__init__.py @@ -4,4 +4,4 @@ # flake8: noqa from stripe.api_resources.billing_portal.configuration import Configuration -from stripe.api_resources.billing_portal.session import Session \ No newline at end of file +from stripe.api_resources.billing_portal.session import Session diff --git a/stripe/api_resources/billing_portal/configuration.py b/stripe/api_resources/billing_portal/configuration.py index 0fe69dabf..a6bcfcd7c 100644 --- a/stripe/api_resources/billing_portal/configuration.py +++ b/stripe/api_resources/billing_portal/configuration.py @@ -12,4 +12,3 @@ class Configuration( UpdateableAPIResource, ): OBJECT_NAME = "billing_portal.configuration" - diff --git a/stripe/api_resources/billing_portal/session.py b/stripe/api_resources/billing_portal/session.py index 66a6dd1e0..ca06b42aa 100644 --- a/stripe/api_resources/billing_portal/session.py +++ b/stripe/api_resources/billing_portal/session.py @@ -6,4 +6,3 @@ class Session(CreateableAPIResource): OBJECT_NAME = "billing_portal.session" - diff --git a/stripe/api_resources/bitcoin_receiver.py b/stripe/api_resources/bitcoin_receiver.py index 7a84729ad..6d31bc6af 100644 --- a/stripe/api_resources/bitcoin_receiver.py +++ b/stripe/api_resources/bitcoin_receiver.py @@ -26,4 +26,3 @@ def instance_url(self): @classmethod def class_url(cls): return "/v1/bitcoin/receivers" - diff --git a/stripe/api_resources/bitcoin_transaction.py b/stripe/api_resources/bitcoin_transaction.py index 174208e8c..96f5a9c85 100644 --- a/stripe/api_resources/bitcoin_transaction.py +++ b/stripe/api_resources/bitcoin_transaction.py @@ -6,4 +6,3 @@ class BitcoinTransaction(StripeObject): OBJECT_NAME = "bitcoin_transaction" - diff --git a/stripe/api_resources/capability.py b/stripe/api_resources/capability.py index 745f2ed30..b9dcdd919 100644 --- a/stripe/api_resources/capability.py +++ b/stripe/api_resources/capability.py @@ -17,16 +17,17 @@ def instance_url(self): acct_extn = quote_plus(account) extn = quote_plus(token) return "%s/%s/capabilities/%s" % (base, acct_extn, extn) + @classmethod def modify(cls, sid, **params): raise NotImplementedError( "Can't update a capability without an account ID. Update a capability using " "account.modify_capability('acct_123', 'acap_123', params)" ) + @classmethod def retrieve(cls, id, api_key=None, **params): raise NotImplementedError( "Can't retrieve a capability without an account ID. Retrieve a capability using " "account.retrieve_capability('acct_123', 'acap_123')" ) - diff --git a/stripe/api_resources/card.py b/stripe/api_resources/card.py index a679db6e6..53503691d 100644 --- a/stripe/api_resources/card.py +++ b/stripe/api_resources/card.py @@ -72,4 +72,3 @@ def retrieve( "recipient.cards.retrieve('card_id'), or " "account.external_accounts.retrieve('card_id') instead." ) - diff --git a/stripe/api_resources/charge.py b/stripe/api_resources/charge.py index 66bfd351e..d77411f6c 100644 --- a/stripe/api_resources/charge.py +++ b/stripe/api_resources/charge.py @@ -10,15 +10,17 @@ @custom_method("capture", http_verb="post") -class Charge(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): +class Charge( + CreateableAPIResource, ListableAPIResource, UpdateableAPIResource +): OBJECT_NAME = "charge" + def capture(self, idempotency_key=None, **params): url = self.instance_url() + "/capture" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - def refund(self, idempotency_key=None, **params): url = self.instance_url() + "/refund" headers = util.populate_headers(idempotency_key) @@ -62,4 +64,3 @@ def mark_as_safe(self, idempotency_key=None): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - diff --git a/stripe/api_resources/checkout/__init__.py b/stripe/api_resources/checkout/__init__.py index 7b99e61c0..68c840ab9 100644 --- a/stripe/api_resources/checkout/__init__.py +++ b/stripe/api_resources/checkout/__init__.py @@ -3,4 +3,4 @@ # flake8: noqa -from stripe.api_resources.checkout.session import Session \ No newline at end of file +from stripe.api_resources.checkout.session import Session diff --git a/stripe/api_resources/checkout/session.py b/stripe/api_resources/checkout/session.py index 647f1e68c..9a900777a 100644 --- a/stripe/api_resources/checkout/session.py +++ b/stripe/api_resources/checkout/session.py @@ -12,10 +12,9 @@ @nested_resource_class_methods("line_item", operations=["list"]) class Session(CreateableAPIResource, ListableAPIResource): OBJECT_NAME = "checkout.session" + def expire(self, idempotency_key=None, **params): url = self.instance_url() + "/expire" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/country_spec.py b/stripe/api_resources/country_spec.py index 79ed47846..86254337f 100644 --- a/stripe/api_resources/country_spec.py +++ b/stripe/api_resources/country_spec.py @@ -6,4 +6,3 @@ class CountrySpec(ListableAPIResource): OBJECT_NAME = "country_spec" - diff --git a/stripe/api_resources/coupon.py b/stripe/api_resources/coupon.py index 791dbb874..e258aacc3 100644 --- a/stripe/api_resources/coupon.py +++ b/stripe/api_resources/coupon.py @@ -14,4 +14,3 @@ class Coupon( UpdateableAPIResource, ): OBJECT_NAME = "coupon" - diff --git a/stripe/api_resources/credit_note.py b/stripe/api_resources/credit_note.py index 0b0ebc69a..beec2ad6c 100644 --- a/stripe/api_resources/credit_note.py +++ b/stripe/api_resources/credit_note.py @@ -16,13 +16,13 @@ class CreditNote( UpdateableAPIResource, ): OBJECT_NAME = "credit_note" + def void_credit_note(self, idempotency_key=None, **params): url = self.instance_url() + "/void" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - @classmethod def preview( cls, api_key=None, stripe_version=None, stripe_account=None, **params @@ -35,4 +35,3 @@ def preview( return util.convert_to_stripe_object( response, api_key, stripe_version, stripe_account ) - diff --git a/stripe/api_resources/credit_note_line_item.py b/stripe/api_resources/credit_note_line_item.py index c8d3d7299..f0dd6bbaa 100644 --- a/stripe/api_resources/credit_note_line_item.py +++ b/stripe/api_resources/credit_note_line_item.py @@ -6,4 +6,3 @@ class CreditNoteLineItem(StripeObject): OBJECT_NAME = "credit_note_line_item" - diff --git a/stripe/api_resources/customer.py b/stripe/api_resources/customer.py index 194fc8710..5aab5b69c 100644 --- a/stripe/api_resources/customer.py +++ b/stripe/api_resources/customer.py @@ -36,6 +36,7 @@ class Customer( UpdateableAPIResource, ): OBJECT_NAME = "customer" + def list_payment_methods(self, idempotency_key=None, **params): url = self.instance_url() + "/payment_methods" headers = util.populate_headers(idempotency_key) @@ -44,7 +45,6 @@ def list_payment_methods(self, idempotency_key=None, **params): stripe_object._retrieve_params = params return stripe_object - def delete_discount(self, **params): requestor = api_requestor.APIRequestor( self.api_key, @@ -54,4 +54,3 @@ def delete_discount(self, **params): url = self.instance_url() + "/discount" _, api_key = requestor.request("delete", url, params) self.refresh_from({"discount": None}, api_key, True) - diff --git a/stripe/api_resources/customer_balance_transaction.py b/stripe/api_resources/customer_balance_transaction.py index 49a2cadc7..59d233091 100644 --- a/stripe/api_resources/customer_balance_transaction.py +++ b/stripe/api_resources/customer_balance_transaction.py @@ -17,10 +17,10 @@ def instance_url(self): cust_extn = quote_plus(customer) extn = quote_plus(token) return "%s/%s/balance_transactions/%s" % (base, cust_extn, extn) + @classmethod def retrieve(cls, id, api_key=None, **params): raise NotImplementedError( "Can't retrieve a Customer Balance Transaction without a Customer ID. " "Use Customer.retrieve_customer_balance_transaction('cus_123', 'cbtxn_123')" ) - diff --git a/stripe/api_resources/dispute.py b/stripe/api_resources/dispute.py index 0be9864a8..cc779f1d7 100644 --- a/stripe/api_resources/dispute.py +++ b/stripe/api_resources/dispute.py @@ -10,10 +10,9 @@ @custom_method("close", http_verb="post") class Dispute(ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "dispute" + def close(self, idempotency_key=None, **params): url = self.instance_url() + "/close" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/ephemeral_key.py b/stripe/api_resources/ephemeral_key.py index 296f3461d..644e6a79d 100644 --- a/stripe/api_resources/ephemeral_key.py +++ b/stripe/api_resources/ephemeral_key.py @@ -34,4 +34,3 @@ def create( return util.convert_to_stripe_object( response, api_key, stripe_version, stripe_account ) - diff --git a/stripe/api_resources/event.py b/stripe/api_resources/event.py index 2a7b7d627..a86a1d802 100644 --- a/stripe/api_resources/event.py +++ b/stripe/api_resources/event.py @@ -6,4 +6,3 @@ class Event(ListableAPIResource): OBJECT_NAME = "event" - diff --git a/stripe/api_resources/exchange_rate.py b/stripe/api_resources/exchange_rate.py index 62b43b85a..dbd412aaa 100644 --- a/stripe/api_resources/exchange_rate.py +++ b/stripe/api_resources/exchange_rate.py @@ -6,4 +6,3 @@ class ExchangeRate(ListableAPIResource): OBJECT_NAME = "exchange_rate" - diff --git a/stripe/api_resources/file.py b/stripe/api_resources/file.py index b7135b2bf..ebc9e9274 100644 --- a/stripe/api_resources/file.py +++ b/stripe/api_resources/file.py @@ -23,7 +23,12 @@ def class_url(cls): @classmethod def create( # 'api_version' is deprecated, please use 'stripe_version' - cls, api_key=None, api_version=None, stripe_version=None, stripe_account=None, **params + cls, + api_key=None, + api_version=None, + stripe_version=None, + stripe_account=None, + **params ): version = api_version or stripe_version requestor = api_requestor.APIRequestor( @@ -41,5 +46,6 @@ def create( response, api_key, version, stripe_account ) + # For backwards compatibility, the `File` class is aliased to `FileUpload`. FileUpload = File diff --git a/stripe/api_resources/file_link.py b/stripe/api_resources/file_link.py index ba14d6214..67ea204f4 100644 --- a/stripe/api_resources/file_link.py +++ b/stripe/api_resources/file_link.py @@ -12,4 +12,3 @@ class FileLink( UpdateableAPIResource, ): OBJECT_NAME = "file_link" - diff --git a/stripe/api_resources/identity/__init__.py b/stripe/api_resources/identity/__init__.py index 13e92f600..531515dab 100644 --- a/stripe/api_resources/identity/__init__.py +++ b/stripe/api_resources/identity/__init__.py @@ -3,5 +3,9 @@ # flake8: noqa -from stripe.api_resources.identity.verification_report import VerificationReport -from stripe.api_resources.identity.verification_session import VerificationSession \ No newline at end of file +from stripe.api_resources.identity.verification_report import ( + VerificationReport, +) +from stripe.api_resources.identity.verification_session import ( + VerificationSession, +) diff --git a/stripe/api_resources/identity/verification_report.py b/stripe/api_resources/identity/verification_report.py index 0d954c141..d110f8f7b 100644 --- a/stripe/api_resources/identity/verification_report.py +++ b/stripe/api_resources/identity/verification_report.py @@ -6,4 +6,3 @@ class VerificationReport(ListableAPIResource): OBJECT_NAME = "identity.verification_report" - diff --git a/stripe/api_resources/identity/verification_session.py b/stripe/api_resources/identity/verification_session.py index b802f6947..e2933e143 100644 --- a/stripe/api_resources/identity/verification_session.py +++ b/stripe/api_resources/identity/verification_session.py @@ -16,6 +16,7 @@ class VerificationSession( UpdateableAPIResource, ): OBJECT_NAME = "identity.verification_session" + def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) @@ -27,5 +28,3 @@ def redact(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/invoice.py b/stripe/api_resources/invoice.py index 2d0409e9d..cd0e43e6a 100644 --- a/stripe/api_resources/invoice.py +++ b/stripe/api_resources/invoice.py @@ -22,6 +22,7 @@ class Invoice( UpdateableAPIResource, ): OBJECT_NAME = "invoice" + def finalize_invoice(self, idempotency_key=None, **params): url = self.instance_url() + "/finalize" headers = util.populate_headers(idempotency_key) @@ -52,7 +53,6 @@ def void_invoice(self, idempotency_key=None, **params): self.refresh_from(self.request("post", url, params, headers)) return self - @classmethod def upcoming( cls, api_key=None, stripe_version=None, stripe_account=None, **params @@ -65,4 +65,3 @@ def upcoming( return util.convert_to_stripe_object( response, api_key, stripe_version, stripe_account ) - diff --git a/stripe/api_resources/invoice_item.py b/stripe/api_resources/invoice_item.py index a0e487105..58b7dd871 100644 --- a/stripe/api_resources/invoice_item.py +++ b/stripe/api_resources/invoice_item.py @@ -14,4 +14,3 @@ class InvoiceItem( UpdateableAPIResource, ): OBJECT_NAME = "invoiceitem" - diff --git a/stripe/api_resources/invoice_line_item.py b/stripe/api_resources/invoice_line_item.py index 19828b80e..0daa10d12 100644 --- a/stripe/api_resources/invoice_line_item.py +++ b/stripe/api_resources/invoice_line_item.py @@ -6,4 +6,3 @@ class InvoiceLineItem(StripeObject): OBJECT_NAME = "line_item" - diff --git a/stripe/api_resources/issuer_fraud_record.py b/stripe/api_resources/issuer_fraud_record.py index 64c09fcd0..a626f919e 100644 --- a/stripe/api_resources/issuer_fraud_record.py +++ b/stripe/api_resources/issuer_fraud_record.py @@ -6,4 +6,3 @@ class IssuerFraudRecord(ListableAPIResource): OBJECT_NAME = "issuer_fraud_record" - diff --git a/stripe/api_resources/issuing/__init__.py b/stripe/api_resources/issuing/__init__.py index 469550879..1dad47db2 100644 --- a/stripe/api_resources/issuing/__init__.py +++ b/stripe/api_resources/issuing/__init__.py @@ -8,4 +8,4 @@ from stripe.api_resources.issuing.card_details import CardDetails from stripe.api_resources.issuing.cardholder import Cardholder from stripe.api_resources.issuing.dispute import Dispute -from stripe.api_resources.issuing.transaction import Transaction \ No newline at end of file +from stripe.api_resources.issuing.transaction import Transaction diff --git a/stripe/api_resources/issuing/authorization.py b/stripe/api_resources/issuing/authorization.py index 852e16036..206e8b9f9 100644 --- a/stripe/api_resources/issuing/authorization.py +++ b/stripe/api_resources/issuing/authorization.py @@ -11,6 +11,7 @@ @custom_method("decline", http_verb="post") class Authorization(ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "issuing.authorization" + def approve(self, idempotency_key=None, **params): url = self.instance_url() + "/approve" headers = util.populate_headers(idempotency_key) @@ -22,5 +23,3 @@ def decline(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/issuing/card.py b/stripe/api_resources/issuing/card.py index b3e57637f..0896a494f 100644 --- a/stripe/api_resources/issuing/card.py +++ b/stripe/api_resources/issuing/card.py @@ -13,4 +13,3 @@ class Card(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): def details(self, idempotency_key=None, **params): return self.request("get", self.instance_url() + "/details", params) - diff --git a/stripe/api_resources/issuing/card_details.py b/stripe/api_resources/issuing/card_details.py index 8f96b6e4a..70e29c468 100644 --- a/stripe/api_resources/issuing/card_details.py +++ b/stripe/api_resources/issuing/card_details.py @@ -6,4 +6,3 @@ class CardDetails(StripeObject): OBJECT_NAME = "issuing.card_details" - diff --git a/stripe/api_resources/issuing/cardholder.py b/stripe/api_resources/issuing/cardholder.py index fc3506c60..e8060341d 100644 --- a/stripe/api_resources/issuing/cardholder.py +++ b/stripe/api_resources/issuing/cardholder.py @@ -12,4 +12,3 @@ class Cardholder( UpdateableAPIResource, ): OBJECT_NAME = "issuing.cardholder" - diff --git a/stripe/api_resources/issuing/dispute.py b/stripe/api_resources/issuing/dispute.py index ecf9263d4..da9be3ea2 100644 --- a/stripe/api_resources/issuing/dispute.py +++ b/stripe/api_resources/issuing/dispute.py @@ -15,10 +15,9 @@ class Dispute( UpdateableAPIResource, ): OBJECT_NAME = "issuing.dispute" + def submit(self, idempotency_key=None, **params): url = self.instance_url() + "/submit" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/issuing/transaction.py b/stripe/api_resources/issuing/transaction.py index e1f960660..319b717c8 100644 --- a/stripe/api_resources/issuing/transaction.py +++ b/stripe/api_resources/issuing/transaction.py @@ -7,4 +7,3 @@ class Transaction(ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "issuing.transaction" - diff --git a/stripe/api_resources/line_item.py b/stripe/api_resources/line_item.py index 756648360..1629c5338 100644 --- a/stripe/api_resources/line_item.py +++ b/stripe/api_resources/line_item.py @@ -6,4 +6,3 @@ class LineItem(APIResource): OBJECT_NAME = "item" - diff --git a/stripe/api_resources/login_link.py b/stripe/api_resources/login_link.py index e95c4645e..7d0635a51 100644 --- a/stripe/api_resources/login_link.py +++ b/stripe/api_resources/login_link.py @@ -6,4 +6,3 @@ class LoginLink(StripeObject): OBJECT_NAME = "login_link" - diff --git a/stripe/api_resources/mandate.py b/stripe/api_resources/mandate.py index 1807855ce..acee29432 100644 --- a/stripe/api_resources/mandate.py +++ b/stripe/api_resources/mandate.py @@ -6,4 +6,3 @@ class Mandate(APIResource): OBJECT_NAME = "mandate" - diff --git a/stripe/api_resources/order.py b/stripe/api_resources/order.py index 7d0faa430..7d7e6b89d 100644 --- a/stripe/api_resources/order.py +++ b/stripe/api_resources/order.py @@ -12,16 +12,15 @@ @custom_method("pay", http_verb="post") class Order(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "order" + def pay(self, idempotency_key=None, **params): url = self.instance_url() + "/pay" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - def return_order(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) return self.request( "post", self.instance_url() + "/returns", params, headers ) - diff --git a/stripe/api_resources/order_return.py b/stripe/api_resources/order_return.py index fe7306ac4..ecaa170f0 100644 --- a/stripe/api_resources/order_return.py +++ b/stripe/api_resources/order_return.py @@ -6,4 +6,3 @@ class OrderReturn(ListableAPIResource): OBJECT_NAME = "order_return" - diff --git a/stripe/api_resources/payment_intent.py b/stripe/api_resources/payment_intent.py index 8184c6586..2eabb0283 100644 --- a/stripe/api_resources/payment_intent.py +++ b/stripe/api_resources/payment_intent.py @@ -18,6 +18,7 @@ class PaymentIntent( UpdateableAPIResource, ): OBJECT_NAME = "payment_intent" + def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) @@ -41,5 +42,3 @@ def verify_microdeposits(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/payment_link.py b/stripe/api_resources/payment_link.py index 733a821bb..976faba9c 100644 --- a/stripe/api_resources/payment_link.py +++ b/stripe/api_resources/payment_link.py @@ -15,6 +15,7 @@ class PaymentLink( UpdateableAPIResource, ): OBJECT_NAME = "payment_link" + def list_line_items(self, idempotency_key=None, **params): url = self.instance_url() + "/line_items" headers = util.populate_headers(idempotency_key) @@ -22,5 +23,3 @@ def list_line_items(self, idempotency_key=None, **params): stripe_object = util.convert_to_stripe_object(resp) stripe_object._retrieve_params = params return stripe_object - - diff --git a/stripe/api_resources/payment_method.py b/stripe/api_resources/payment_method.py index 0c1564bf3..a2f919a30 100644 --- a/stripe/api_resources/payment_method.py +++ b/stripe/api_resources/payment_method.py @@ -16,6 +16,7 @@ class PaymentMethod( UpdateableAPIResource, ): OBJECT_NAME = "payment_method" + def attach(self, idempotency_key=None, **params): url = self.instance_url() + "/attach" headers = util.populate_headers(idempotency_key) @@ -27,5 +28,3 @@ def detach(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/payout.py b/stripe/api_resources/payout.py index 5c1e6f51a..82c5807e1 100644 --- a/stripe/api_resources/payout.py +++ b/stripe/api_resources/payout.py @@ -10,8 +10,11 @@ @custom_method("cancel", http_verb="post") @custom_method("reverse", http_verb="post") -class Payout(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): +class Payout( + CreateableAPIResource, ListableAPIResource, UpdateableAPIResource +): OBJECT_NAME = "payout" + def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) @@ -23,5 +26,3 @@ def reverse(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/person.py b/stripe/api_resources/person.py index 9f69c0650..45df5a826 100644 --- a/stripe/api_resources/person.py +++ b/stripe/api_resources/person.py @@ -31,4 +31,3 @@ def retrieve(cls, id, api_key=None, **params): "Can't retrieve a person without an account" "ID. Use account.persons.retrieve('person_id')" ) - diff --git a/stripe/api_resources/plan.py b/stripe/api_resources/plan.py index 2eaeaeafe..9f9904d94 100644 --- a/stripe/api_resources/plan.py +++ b/stripe/api_resources/plan.py @@ -14,4 +14,3 @@ class Plan( UpdateableAPIResource, ): OBJECT_NAME = "plan" - diff --git a/stripe/api_resources/price.py b/stripe/api_resources/price.py index 7a5f44186..132d5db3f 100644 --- a/stripe/api_resources/price.py +++ b/stripe/api_resources/price.py @@ -8,4 +8,3 @@ class Price(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "price" - diff --git a/stripe/api_resources/product.py b/stripe/api_resources/product.py index 5edd723b2..51c30a4e9 100644 --- a/stripe/api_resources/product.py +++ b/stripe/api_resources/product.py @@ -14,4 +14,3 @@ class Product( UpdateableAPIResource, ): OBJECT_NAME = "product" - diff --git a/stripe/api_resources/promotion_code.py b/stripe/api_resources/promotion_code.py index 7106fe57e..1b3ba12de 100644 --- a/stripe/api_resources/promotion_code.py +++ b/stripe/api_resources/promotion_code.py @@ -12,4 +12,3 @@ class PromotionCode( UpdateableAPIResource, ): OBJECT_NAME = "promotion_code" - diff --git a/stripe/api_resources/quote.py b/stripe/api_resources/quote.py index bc4dcd88c..a8fb86903 100644 --- a/stripe/api_resources/quote.py +++ b/stripe/api_resources/quote.py @@ -22,6 +22,7 @@ @custom_method("list_line_items", http_verb="get", http_path="line_items") class Quote(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "quote" + def accept(self, idempotency_key=None, **params): url = self.instance_url() + "/accept" headers = util.populate_headers(idempotency_key) @@ -56,31 +57,30 @@ def list_line_items(self, idempotency_key=None, **params): stripe_object._retrieve_params = params return stripe_object - @classmethod def _cls_pdf( - cls, - sid, - api_key=None, - idempotency_key=None, - stripe_version=None, - stripe_account=None, - **params + cls, + sid, + api_key=None, + idempotency_key=None, + stripe_version=None, + stripe_account=None, + **params ): - url = "%s/%s/%s" % ( - cls.class_url(), - quote_plus(util.utf8(sid)), - "pdf", - ) - requestor = api_requestor.APIRequestor( - api_key, - api_base=stripe.upload_api_base, - api_version=stripe_version, - account=stripe_account, - ) - headers = util.populate_headers(idempotency_key) - response, _ = requestor.request_stream("get", url, params, headers) - return response + url = "%s/%s/%s" % ( + cls.class_url(), + quote_plus(util.utf8(sid)), + "pdf", + ) + requestor = api_requestor.APIRequestor( + api_key, + api_base=stripe.upload_api_base, + api_version=stripe_version, + account=stripe_account, + ) + headers = util.populate_headers(idempotency_key) + response, _ = requestor.request_stream("get", url, params, headers) + return response @util.class_method_variant("_cls_pdf") def pdf( @@ -100,4 +100,3 @@ def pdf( ) url = self.instance_url() + "/pdf" return requestor.request_stream("get", url, params=params) - diff --git a/stripe/api_resources/radar/__init__.py b/stripe/api_resources/radar/__init__.py index 2e8e12c90..ce2561fd6 100644 --- a/stripe/api_resources/radar/__init__.py +++ b/stripe/api_resources/radar/__init__.py @@ -5,4 +5,4 @@ from stripe.api_resources.radar.early_fraud_warning import EarlyFraudWarning from stripe.api_resources.radar.value_list import ValueList -from stripe.api_resources.radar.value_list_item import ValueListItem \ No newline at end of file +from stripe.api_resources.radar.value_list_item import ValueListItem diff --git a/stripe/api_resources/radar/early_fraud_warning.py b/stripe/api_resources/radar/early_fraud_warning.py index 9c16cb835..46a871eb4 100644 --- a/stripe/api_resources/radar/early_fraud_warning.py +++ b/stripe/api_resources/radar/early_fraud_warning.py @@ -6,4 +6,3 @@ class EarlyFraudWarning(ListableAPIResource): OBJECT_NAME = "radar.early_fraud_warning" - diff --git a/stripe/api_resources/radar/value_list.py b/stripe/api_resources/radar/value_list.py index bfbd7fb8b..cba9e5c75 100644 --- a/stripe/api_resources/radar/value_list.py +++ b/stripe/api_resources/radar/value_list.py @@ -14,4 +14,3 @@ class ValueList( UpdateableAPIResource, ): OBJECT_NAME = "radar.value_list" - diff --git a/stripe/api_resources/radar/value_list_item.py b/stripe/api_resources/radar/value_list_item.py index ab005a121..7c2c71d53 100644 --- a/stripe/api_resources/radar/value_list_item.py +++ b/stripe/api_resources/radar/value_list_item.py @@ -12,4 +12,3 @@ class ValueListItem( ListableAPIResource, ): OBJECT_NAME = "radar.value_list_item" - diff --git a/stripe/api_resources/recipient.py b/stripe/api_resources/recipient.py index dc0c87c32..856f69af5 100644 --- a/stripe/api_resources/recipient.py +++ b/stripe/api_resources/recipient.py @@ -14,4 +14,3 @@ class Recipient( UpdateableAPIResource, ): OBJECT_NAME = "recipient" - diff --git a/stripe/api_resources/refund.py b/stripe/api_resources/refund.py index 82ae00b7e..2c5e726cb 100644 --- a/stripe/api_resources/refund.py +++ b/stripe/api_resources/refund.py @@ -6,6 +6,7 @@ from stripe.api_resources.abstract import UpdateableAPIResource -class Refund(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): +class Refund( + CreateableAPIResource, ListableAPIResource, UpdateableAPIResource +): OBJECT_NAME = "refund" - diff --git a/stripe/api_resources/reporting/__init__.py b/stripe/api_resources/reporting/__init__.py index 0bbb37ab9..95cc9c1e7 100644 --- a/stripe/api_resources/reporting/__init__.py +++ b/stripe/api_resources/reporting/__init__.py @@ -4,4 +4,4 @@ # flake8: noqa from stripe.api_resources.reporting.report_run import ReportRun -from stripe.api_resources.reporting.report_type import ReportType \ No newline at end of file +from stripe.api_resources.reporting.report_type import ReportType diff --git a/stripe/api_resources/reporting/report_run.py b/stripe/api_resources/reporting/report_run.py index 6248300c2..d04405040 100644 --- a/stripe/api_resources/reporting/report_run.py +++ b/stripe/api_resources/reporting/report_run.py @@ -7,4 +7,3 @@ class ReportRun(CreateableAPIResource, ListableAPIResource): OBJECT_NAME = "reporting.report_run" - diff --git a/stripe/api_resources/reporting/report_type.py b/stripe/api_resources/reporting/report_type.py index 333a3e1ec..694bbb832 100644 --- a/stripe/api_resources/reporting/report_type.py +++ b/stripe/api_resources/reporting/report_type.py @@ -6,4 +6,3 @@ class ReportType(ListableAPIResource): OBJECT_NAME = "reporting.report_type" - diff --git a/stripe/api_resources/reversal.py b/stripe/api_resources/reversal.py index 4557f513a..eadeee536 100644 --- a/stripe/api_resources/reversal.py +++ b/stripe/api_resources/reversal.py @@ -31,4 +31,3 @@ def retrieve(cls, id, api_key=None, **params): "Can't retrieve a reversal without a transfer" "ID. Use transfer.reversals.retrieve('reversal_id')" ) - diff --git a/stripe/api_resources/review.py b/stripe/api_resources/review.py index b42ea1dcb..13dd143c7 100644 --- a/stripe/api_resources/review.py +++ b/stripe/api_resources/review.py @@ -9,10 +9,9 @@ @custom_method("approve", http_verb="post") class Review(ListableAPIResource): OBJECT_NAME = "review" + def approve(self, idempotency_key=None, **params): url = self.instance_url() + "/approve" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/setup_attempt.py b/stripe/api_resources/setup_attempt.py index 0a05bf7b6..14b93ab52 100644 --- a/stripe/api_resources/setup_attempt.py +++ b/stripe/api_resources/setup_attempt.py @@ -6,4 +6,3 @@ class SetupAttempt(ListableAPIResource): OBJECT_NAME = "setup_attempt" - diff --git a/stripe/api_resources/setup_intent.py b/stripe/api_resources/setup_intent.py index f2dc72d36..058ac6a9e 100644 --- a/stripe/api_resources/setup_intent.py +++ b/stripe/api_resources/setup_intent.py @@ -17,6 +17,7 @@ class SetupIntent( UpdateableAPIResource, ): OBJECT_NAME = "setup_intent" + def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) @@ -34,5 +35,3 @@ def verify_microdeposits(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/shipping_rate.py b/stripe/api_resources/shipping_rate.py index 15f0e376c..eb701c7e3 100644 --- a/stripe/api_resources/shipping_rate.py +++ b/stripe/api_resources/shipping_rate.py @@ -12,4 +12,3 @@ class ShippingRate( UpdateableAPIResource, ): OBJECT_NAME = "shipping_rate" - diff --git a/stripe/api_resources/sigma/__init__.py b/stripe/api_resources/sigma/__init__.py index 19034d2c4..b167a5854 100644 --- a/stripe/api_resources/sigma/__init__.py +++ b/stripe/api_resources/sigma/__init__.py @@ -3,4 +3,4 @@ # flake8: noqa -from stripe.api_resources.sigma.scheduled_query_run import ScheduledQueryRun \ No newline at end of file +from stripe.api_resources.sigma.scheduled_query_run import ScheduledQueryRun diff --git a/stripe/api_resources/sigma/scheduled_query_run.py b/stripe/api_resources/sigma/scheduled_query_run.py index 212387418..058516c12 100644 --- a/stripe/api_resources/sigma/scheduled_query_run.py +++ b/stripe/api_resources/sigma/scheduled_query_run.py @@ -10,4 +10,3 @@ class ScheduledQueryRun(ListableAPIResource): @classmethod def class_url(cls): return "/v1/sigma/scheduled_query_runs" - diff --git a/stripe/api_resources/sku.py b/stripe/api_resources/sku.py index 23090bf60..75d97249d 100644 --- a/stripe/api_resources/sku.py +++ b/stripe/api_resources/sku.py @@ -14,4 +14,3 @@ class SKU( UpdateableAPIResource, ): OBJECT_NAME = "sku" - diff --git a/stripe/api_resources/source.py b/stripe/api_resources/source.py index 9c3af430a..1014b1573 100644 --- a/stripe/api_resources/source.py +++ b/stripe/api_resources/source.py @@ -37,9 +37,7 @@ def detach(self, idempotency_key=None, **params): ) def source_transactions(self, **params): - '''source_transactions is deprecated, use Source.list_source_transactions instead. - ''' + """source_transactions is deprecated, use Source.list_source_transactions instead.""" return self.request( "get", self.instance_url() + "/source_transactions", params ) - diff --git a/stripe/api_resources/source_transaction.py b/stripe/api_resources/source_transaction.py index ed927b036..6bd8fdcc6 100644 --- a/stripe/api_resources/source_transaction.py +++ b/stripe/api_resources/source_transaction.py @@ -6,4 +6,3 @@ class SourceTransaction(StripeObject): OBJECT_NAME = "source_transaction" - diff --git a/stripe/api_resources/subscription.py b/stripe/api_resources/subscription.py index d42b125d6..afb2386ed 100644 --- a/stripe/api_resources/subscription.py +++ b/stripe/api_resources/subscription.py @@ -27,4 +27,3 @@ def delete_discount(self, **params): url = self.instance_url() + "/discount" _, api_key = requestor.request("delete", url, params) self.refresh_from({"discount": None}, api_key, True) - diff --git a/stripe/api_resources/subscription_item.py b/stripe/api_resources/subscription_item.py index d9967d1ba..e3b794af0 100644 --- a/stripe/api_resources/subscription_item.py +++ b/stripe/api_resources/subscription_item.py @@ -23,9 +23,7 @@ class SubscriptionItem( OBJECT_NAME = "subscription_item" def usage_record_summaries(self, **params): - '''usage_record_summaries is deprecated, use SubscriptionItem.list_usage_record_summaries instead. - ''' + """usage_record_summaries is deprecated, use SubscriptionItem.list_usage_record_summaries instead.""" return self.request( "get", self.instance_url() + "/usage_record_summaries", params ) - diff --git a/stripe/api_resources/subscription_schedule.py b/stripe/api_resources/subscription_schedule.py index 98de9f6c8..d939ec671 100644 --- a/stripe/api_resources/subscription_schedule.py +++ b/stripe/api_resources/subscription_schedule.py @@ -16,6 +16,7 @@ class SubscriptionSchedule( UpdateableAPIResource, ): OBJECT_NAME = "subscription_schedule" + def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) @@ -27,5 +28,3 @@ def release(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/tax_code.py b/stripe/api_resources/tax_code.py index 87fd1b0a7..9663acb4c 100644 --- a/stripe/api_resources/tax_code.py +++ b/stripe/api_resources/tax_code.py @@ -6,4 +6,3 @@ class TaxCode(ListableAPIResource): OBJECT_NAME = "tax_code" - diff --git a/stripe/api_resources/tax_id.py b/stripe/api_resources/tax_id.py index e81bb2fb9..7a44bfcf0 100644 --- a/stripe/api_resources/tax_id.py +++ b/stripe/api_resources/tax_id.py @@ -23,4 +23,3 @@ def retrieve(cls, id, api_key=None, **params): raise NotImplementedError( "Can't retrieve a tax id without a customer ID. Use customer.retrieve_tax_id('tax_id')" ) - diff --git a/stripe/api_resources/tax_rate.py b/stripe/api_resources/tax_rate.py index b4e4aba1a..874f82720 100644 --- a/stripe/api_resources/tax_rate.py +++ b/stripe/api_resources/tax_rate.py @@ -12,4 +12,3 @@ class TaxRate( UpdateableAPIResource, ): OBJECT_NAME = "tax_rate" - diff --git a/stripe/api_resources/terminal/__init__.py b/stripe/api_resources/terminal/__init__.py index 977f1d1b9..2a5a4b320 100644 --- a/stripe/api_resources/terminal/__init__.py +++ b/stripe/api_resources/terminal/__init__.py @@ -5,4 +5,4 @@ from stripe.api_resources.terminal.connection_token import ConnectionToken from stripe.api_resources.terminal.location import Location -from stripe.api_resources.terminal.reader import Reader \ No newline at end of file +from stripe.api_resources.terminal.reader import Reader diff --git a/stripe/api_resources/terminal/connection_token.py b/stripe/api_resources/terminal/connection_token.py index d1bd65469..0ec7c8944 100644 --- a/stripe/api_resources/terminal/connection_token.py +++ b/stripe/api_resources/terminal/connection_token.py @@ -6,4 +6,3 @@ class ConnectionToken(CreateableAPIResource): OBJECT_NAME = "terminal.connection_token" - diff --git a/stripe/api_resources/terminal/location.py b/stripe/api_resources/terminal/location.py index a9520a3bf..49c69fb20 100644 --- a/stripe/api_resources/terminal/location.py +++ b/stripe/api_resources/terminal/location.py @@ -14,4 +14,3 @@ class Location( UpdateableAPIResource, ): OBJECT_NAME = "terminal.location" - diff --git a/stripe/api_resources/terminal/reader.py b/stripe/api_resources/terminal/reader.py index 677c01b22..e2670eeff 100644 --- a/stripe/api_resources/terminal/reader.py +++ b/stripe/api_resources/terminal/reader.py @@ -14,4 +14,3 @@ class Reader( UpdateableAPIResource, ): OBJECT_NAME = "terminal.reader" - diff --git a/stripe/api_resources/three_d_secure.py b/stripe/api_resources/three_d_secure.py index 1430fa6a8..27edc6606 100644 --- a/stripe/api_resources/three_d_secure.py +++ b/stripe/api_resources/three_d_secure.py @@ -10,4 +10,3 @@ class ThreeDSecure(CreateableAPIResource): @classmethod def class_url(cls): return "/v1/3d_secure" - diff --git a/stripe/api_resources/token.py b/stripe/api_resources/token.py index 8877359ef..a101d935c 100644 --- a/stripe/api_resources/token.py +++ b/stripe/api_resources/token.py @@ -6,4 +6,3 @@ class Token(CreateableAPIResource): OBJECT_NAME = "token" - diff --git a/stripe/api_resources/topup.py b/stripe/api_resources/topup.py index ef699cfb8..099c6b9f1 100644 --- a/stripe/api_resources/topup.py +++ b/stripe/api_resources/topup.py @@ -11,10 +11,9 @@ @custom_method("cancel", http_verb="post") class Topup(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME = "topup" + def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/transfer.py b/stripe/api_resources/transfer.py index 00ba019b8..f73b10152 100644 --- a/stripe/api_resources/transfer.py +++ b/stripe/api_resources/transfer.py @@ -20,10 +20,9 @@ class Transfer( UpdateableAPIResource, ): OBJECT_NAME = "transfer" + def cancel(self, idempotency_key=None, **params): url = self.instance_url() + "/cancel" headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self - - diff --git a/stripe/api_resources/usage_record.py b/stripe/api_resources/usage_record.py index a008175e0..9dc913838 100644 --- a/stripe/api_resources/usage_record.py +++ b/stripe/api_resources/usage_record.py @@ -32,4 +32,3 @@ def create( return util.convert_to_stripe_object( response, api_key, stripe_version, stripe_account ) - diff --git a/stripe/api_resources/usage_record_summary.py b/stripe/api_resources/usage_record_summary.py index 11e79c3cb..e7f707699 100644 --- a/stripe/api_resources/usage_record_summary.py +++ b/stripe/api_resources/usage_record_summary.py @@ -6,4 +6,3 @@ class UsageRecordSummary(StripeObject): OBJECT_NAME = "usage_record_summary" - diff --git a/stripe/api_resources/webhook_endpoint.py b/stripe/api_resources/webhook_endpoint.py index d903e1ae4..86d90eafa 100644 --- a/stripe/api_resources/webhook_endpoint.py +++ b/stripe/api_resources/webhook_endpoint.py @@ -14,4 +14,3 @@ class WebhookEndpoint( UpdateableAPIResource, ): OBJECT_NAME = "webhook_endpoint" - diff --git a/stripe/object_classes.py b/stripe/object_classes.py index c5d574909..61d619464 100644 --- a/stripe/object_classes.py +++ b/stripe/object_classes.py @@ -98,4 +98,4 @@ api_resources.UsageRecord.OBJECT_NAME: api_resources.UsageRecord, api_resources.UsageRecordSummary.OBJECT_NAME: api_resources.UsageRecordSummary, api_resources.WebhookEndpoint.OBJECT_NAME: api_resources.WebhookEndpoint, -} \ No newline at end of file +} diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index a08aa77c2..d53a4ae04 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -1,1297 +1,1641 @@ from __future__ import absolute_import, division, print_function import stripe + + class TestGeneratedExamples(object): - def test_customer_list(self, request_mock): - stripe.Customer.list(limit = 3) - request_mock.assert_requested("get", "/v1/customers") - def test_balancetransaction_retrieve(self, request_mock): - stripe.BalanceTransaction.retrieve("txn_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/balance_transactions/txn_xxxxxxxxxxxxx", - ) - def test_balancetransaction_list(self, request_mock): - stripe.BalanceTransaction.list(limit = 3) - request_mock.assert_requested("get", "/v1/balance_transactions") - def test_charge_create(self, request_mock): - stripe.Charge.create( - amount = 2000, - currency = "usd", - source = "tok_xxxx", - description = "My First Test Charge (created for API docs)", - ) - request_mock.assert_requested("post", "/v1/charges") - def test_charge_retrieve(self, request_mock): - stripe.Charge.retrieve("ch_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/charges/ch_xxxxxxxxxxxxx") - def test_charge_update(self, request_mock): - stripe.Charge.modify("ch_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/charges/ch_xxxxxxxxxxxxx") - def test_charge_capture(self, request_mock): - stripe.Charge.capture("ch_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/charges/ch_xxxxxxxxxxxxx/capture", - ) - def test_charge_list(self, request_mock): - stripe.Charge.list(limit = 3) - request_mock.assert_requested("get", "/v1/charges") - def test_customer_create(self, request_mock): - stripe.Customer.create( - description = "My First Test Customer (created for API docs)", - ) - request_mock.assert_requested("post", "/v1/customers") - def test_customer_retrieve(self, request_mock): - stripe.Customer.retrieve("cus_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/customers/cus_xxxxxxxxxxxxx") - def test_customer_update(self, request_mock): - stripe.Customer.modify("cus_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/customers/cus_xxxxxxxxxxxxx") - def test_customer_delete(self, request_mock): - stripe.Customer.delete("cus_xxxxxxxxxxxxx") - request_mock.assert_requested("delete", "/v1/customers/cus_xxxxxxxxxxxxx") - def test_customer_list2(self, request_mock): - stripe.Customer.list(limit = 3) - request_mock.assert_requested("get", "/v1/customers") - def test_dispute_retrieve(self, request_mock): - stripe.Dispute.retrieve("dp_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/disputes/dp_xxxxxxxxxxxxx") - def test_dispute_update(self, request_mock): - stripe.Dispute.modify("dp_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/disputes/dp_xxxxxxxxxxxxx") - def test_dispute_close(self, request_mock): - stripe.Dispute.close("dp_xxxxxxxxxxxxx") - request_mock.assert_requested("post", "/v1/disputes/dp_xxxxxxxxxxxxx/close") - def test_dispute_list(self, request_mock): - stripe.Dispute.list(limit = 3) - request_mock.assert_requested("get", "/v1/disputes") - def test_event_retrieve(self, request_mock): - stripe.Event.retrieve("evt_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/events/evt_xxxxxxxxxxxxx") - def test_event_list(self, request_mock): - stripe.Event.list(limit = 3) - request_mock.assert_requested("get", "/v1/events") - def test_file_retrieve(self, request_mock): - stripe.File.retrieve("file_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/files/file_xxxxxxxxxxxxx") - def test_file_list(self, request_mock): - stripe.File.list(limit = 3) - request_mock.assert_requested("get", "/v1/files") - def test_filelink_create(self, request_mock): - stripe.FileLink.create(file = "file_xxxxxxxxxxxxx") - request_mock.assert_requested("post", "/v1/file_links") - def test_filelink_retrieve(self, request_mock): - stripe.FileLink.retrieve("link_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/file_links/link_xxxxxxxxxxxxx") - def test_filelink_update(self, request_mock): - stripe.FileLink.modify( - "link_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested("post", "/v1/file_links/link_xxxxxxxxxxxxx") - def test_filelink_list(self, request_mock): - stripe.FileLink.list(limit = 3) - request_mock.assert_requested("get", "/v1/file_links") - def test_mandate_retrieve(self, request_mock): - stripe.Mandate.retrieve("mandate_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/mandates/mandate_xxxxxxxxxxxxx") - def test_paymentintent_create(self, request_mock): - stripe.PaymentIntent.create( - amount = 2000, - currency = "usd", - payment_method_types = ["card"], - ) - request_mock.assert_requested("post", "/v1/payment_intents") - def test_paymentintent_retrieve(self, request_mock): - stripe.PaymentIntent.retrieve("pi_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/payment_intents/pi_xxxxxxxxxxxxx") - def test_paymentintent_update(self, request_mock): - stripe.PaymentIntent.modify( - "pi_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/payment_intents/pi_xxxxxxxxxxxxx", - ) - def test_paymentintent_confirm(self, request_mock): - stripe.PaymentIntent.confirm( - "pi_xxxxxxxxxxxxx", - payment_method = "pm_card_visa", - ) - request_mock.assert_requested( - "post", - "/v1/payment_intents/pi_xxxxxxxxxxxxx/confirm", - ) - def test_paymentintent_capture(self, request_mock): - stripe.PaymentIntent.capture("pi_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/payment_intents/pi_xxxxxxxxxxxxx/capture", - ) - def test_paymentintent_cancel(self, request_mock): - stripe.PaymentIntent.cancel("pi_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/payment_intents/pi_xxxxxxxxxxxxx/cancel", - ) - def test_paymentintent_list(self, request_mock): - stripe.PaymentIntent.list(limit = 3) - request_mock.assert_requested("get", "/v1/payment_intents") - def test_setupintent_create(self, request_mock): - stripe.SetupIntent.create(payment_method_types = ["card"]) - request_mock.assert_requested("post", "/v1/setup_intents") - def test_setupintent_retrieve(self, request_mock): - stripe.SetupIntent.retrieve("seti_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/setup_intents/seti_xxxxxxxxxxxxx") - def test_setupintent_update(self, request_mock): - stripe.SetupIntent.modify( - "seti_xxxxxxxxxxxxx", - metadata = {"user_id": "3435453"}, - ) - request_mock.assert_requested( - "post", - "/v1/setup_intents/seti_xxxxxxxxxxxxx", - ) - def test_setupintent_confirm(self, request_mock): - stripe.SetupIntent.confirm( - "seti_xxxxxxxxxxxxx", - payment_method = "pm_card_visa", - ) - request_mock.assert_requested( - "post", - "/v1/setup_intents/seti_xxxxxxxxxxxxx/confirm", - ) - def test_setupintent_cancel(self, request_mock): - stripe.SetupIntent.cancel("seti_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/setup_intents/seti_xxxxxxxxxxxxx/cancel", - ) - def test_setupintent_list(self, request_mock): - stripe.SetupIntent.list(limit = 3) - request_mock.assert_requested("get", "/v1/setup_intents") - def test_setupattempt_list(self, request_mock): - stripe.SetupAttempt.list(setup_intent = "seti_xxxxxxxxxxxxx", limit = 3) - request_mock.assert_requested("get", "/v1/setup_attempts") - def test_payout_create(self, request_mock): - stripe.Payout.create(amount = 1100, currency = "usd") - request_mock.assert_requested("post", "/v1/payouts") - def test_payout_retrieve(self, request_mock): - stripe.Payout.retrieve("po_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/payouts/po_xxxxxxxxxxxxx") - def test_payout_update(self, request_mock): - stripe.Payout.modify("po_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/payouts/po_xxxxxxxxxxxxx") - def test_payout_list(self, request_mock): - stripe.Payout.list(limit = 3) - request_mock.assert_requested("get", "/v1/payouts") - def test_payout_cancel(self, request_mock): - stripe.Payout.cancel("po_xxxxxxxxxxxxx") - request_mock.assert_requested("post", "/v1/payouts/po_xxxxxxxxxxxxx/cancel") - def test_payout_reverse(self, request_mock): - stripe.Payout.reverse("po_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/payouts/po_xxxxxxxxxxxxx/reverse", - ) - def test_product_create(self, request_mock): - stripe.Product.create(name = "Gold Special") - request_mock.assert_requested("post", "/v1/products") - def test_product_retrieve(self, request_mock): - stripe.Product.retrieve("prod_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/products/prod_xxxxxxxxxxxxx") - def test_product_update(self, request_mock): - stripe.Product.modify("prod_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/products/prod_xxxxxxxxxxxxx") - def test_product_list(self, request_mock): - stripe.Product.list(limit = 3) - request_mock.assert_requested("get", "/v1/products") - def test_product_delete(self, request_mock): - stripe.Product.delete("prod_xxxxxxxxxxxxx") - request_mock.assert_requested("delete", "/v1/products/prod_xxxxxxxxxxxxx") - def test_price_create(self, request_mock): - stripe.Price.create( - unit_amount = 2000, - currency = "usd", - recurring = {"interval": "month"}, - product = "prod_xxxxxxxxxxxxx", - ) - request_mock.assert_requested("post", "/v1/prices") - def test_price_retrieve(self, request_mock): - stripe.Price.retrieve("price_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/prices/price_xxxxxxxxxxxxx") - def test_price_update(self, request_mock): - stripe.Price.modify("price_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/prices/price_xxxxxxxxxxxxx") - def test_price_list(self, request_mock): - stripe.Price.list(limit = 3) - request_mock.assert_requested("get", "/v1/prices") - def test_refund_create(self, request_mock): - stripe.Refund.create(charge = "ch_xxxxxxxxxxxxx") - request_mock.assert_requested("post", "/v1/refunds") - def test_refund_retrieve(self, request_mock): - stripe.Refund.retrieve("re_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/refunds/re_xxxxxxxxxxxxx") - def test_refund_update(self, request_mock): - stripe.Refund.modify("re_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/refunds/re_xxxxxxxxxxxxx") - def test_refund_list(self, request_mock): - stripe.Refund.list(limit = 3) - request_mock.assert_requested("get", "/v1/refunds") - def test_token_create(self, request_mock): - stripe.Token.create( - card = { - "number": "4242424242424242", - "exp_month": "5", - "exp_year": "2022", - "cvc": "314", - }, - ) - request_mock.assert_requested("post", "/v1/tokens") - def test_token_create2(self, request_mock): - stripe.Token.create( - bank_account = { - "country": "US", - "currency": "usd", - "account_holder_name": "Jenny Rosen", - "account_holder_type": "individual", - "routing_number": "110000000", - "account_number": "000123456789", - }, - ) - request_mock.assert_requested("post", "/v1/tokens") - def test_token_create3(self, request_mock): - stripe.Token.create(pii = {"id_number": "000000000"}) - request_mock.assert_requested("post", "/v1/tokens") - def test_token_create4(self, request_mock): - stripe.Token.create( - account = { - "individual": {"first_name": "Jane", "last_name": "Doe"}, - "tos_shown_and_accepted": True, - }, - ) - request_mock.assert_requested("post", "/v1/tokens") - def test_token_create5(self, request_mock): - stripe.Token.create( - person = { - "first_name": "Jane", - "last_name": "Doe", - "relationship": {"owner": True}, - }, - ) - request_mock.assert_requested("post", "/v1/tokens") - def test_token_create6(self, request_mock): - stripe.Token.create(cvc_update = {"cvc": "123"}) - request_mock.assert_requested("post", "/v1/tokens") - def test_token_retrieve(self, request_mock): - stripe.Token.retrieve("tok_xxxx") - request_mock.assert_requested("get", "/v1/tokens/tok_xxxx") - def test_paymentmethod_create(self, request_mock): - stripe.PaymentMethod.create( - type = "card", - card = { - "number": "4242424242424242", - "exp_month": 5, - "exp_year": 2022, - "cvc": "314", - }, - ) - request_mock.assert_requested("post", "/v1/payment_methods") - def test_paymentmethod_retrieve(self, request_mock): - stripe.PaymentMethod.retrieve("pm_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/payment_methods/pm_xxxxxxxxxxxxx") - def test_paymentmethod_update(self, request_mock): - stripe.PaymentMethod.modify( - "pm_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/payment_methods/pm_xxxxxxxxxxxxx", - ) - def test_paymentmethod_list(self, request_mock): - stripe.PaymentMethod.list(customer = "cus_xxxxxxxxxxxxx", type = "card") - request_mock.assert_requested("get", "/v1/payment_methods") - def test_paymentmethod_attach(self, request_mock): - stripe.PaymentMethod.attach( - "pm_xxxxxxxxxxxxx", - customer = "cus_xxxxxxxxxxxxx", - ) - request_mock.assert_requested( - "post", - "/v1/payment_methods/pm_xxxxxxxxxxxxx/attach", - ) - def test_paymentmethod_detach(self, request_mock): - stripe.PaymentMethod.detach("pm_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/payment_methods/pm_xxxxxxxxxxxxx/detach", - ) - def test_source_retrieve(self, request_mock): - stripe.Source.retrieve("src_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/sources/src_xxxxxxxxxxxxx") - def test_source_update(self, request_mock): - stripe.Source.modify("src_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/sources/src_xxxxxxxxxxxxx") - def test_checkout_session_create(self, request_mock): - stripe.checkout.Session.create( - success_url = "https://example.com/success", - cancel_url = "https://example.com/cancel", - payment_method_types = ["card"], - line_items = [{"price": "price_xxxxxxxxxxxxx", "quantity": 2}], - mode = "payment", - ) - request_mock.assert_requested("post", "/v1/checkout/sessions") - def test_checkout_session_retrieve(self, request_mock): - stripe.checkout.Session.retrieve("cs_test_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx", - ) - def test_checkout_session_list(self, request_mock): - stripe.checkout.Session.list(limit = 3) - request_mock.assert_requested("get", "/v1/checkout/sessions") - def test_coupon_create(self, request_mock): - stripe.Coupon.create( - percent_off = 25, - duration = "repeating", - duration_in_months = 3, - ) - request_mock.assert_requested("post", "/v1/coupons") - def test_coupon_retrieve(self, request_mock): - stripe.Coupon.retrieve("25_5OFF") - request_mock.assert_requested("get", "/v1/coupons/25_5OFF") - def test_coupon_update(self, request_mock): - stripe.Coupon.modify("co_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/coupons/co_xxxxxxxxxxxxx") - def test_coupon_delete(self, request_mock): - stripe.Coupon.delete("co_xxxxxxxxxxxxx") - request_mock.assert_requested("delete", "/v1/coupons/co_xxxxxxxxxxxxx") - def test_coupon_list(self, request_mock): - stripe.Coupon.list(limit = 3) - request_mock.assert_requested("get", "/v1/coupons") - def test_creditnote_create(self, request_mock): - stripe.CreditNote.create( - invoice = "in_xxxxxxxxxxxxx", - lines = [ - { - "type": "invoice_line_item", - "invoice_line_item": "il_xxxxxxxxxxxxx", - "quantity": 1, - }, - ], - ) - request_mock.assert_requested("post", "/v1/credit_notes") - def test_creditnote_update(self, request_mock): - stripe.CreditNote.modify( - "cn_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested("post", "/v1/credit_notes/cn_xxxxxxxxxxxxx") - def test_creditnote_void_credit_note(self, request_mock): - stripe.CreditNote.void_credit_note("cn_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/credit_notes/cn_xxxxxxxxxxxxx/void", - ) - def test_creditnote_list(self, request_mock): - stripe.CreditNote.list(limit = 3) - request_mock.assert_requested("get", "/v1/credit_notes") - def test_customer_customerbalancetransaction_retrieve(self, request_mock): - stripe.Customer.retrieve_balance_transaction( - "cus_xxxxxxxxxxxxx", - "cbtxn_xxxxxxxxxxxxx", - ) - request_mock.assert_requested( - "get", - "/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx", - ) - def test_billing_portal_session_create(self, request_mock): - stripe.billing_portal.Session.create( - customer = "cus_xxxxxxxxxxxxx", - return_url = "https://example.com/account", - ) - request_mock.assert_requested("post", "/v1/billing_portal/sessions") - def test_billing_portal_configuration_create(self, request_mock): - stripe.billing_portal.Configuration.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", - }, - ) - request_mock.assert_requested("post", "/v1/billing_portal/configurations") - def test_billing_portal_configuration_update(self, request_mock): - stripe.billing_portal.Configuration.modify( - "bpc_xxxxxxxxxxxxx", - business_profile = { - "privacy_policy_url": "https://example.com/privacy", - "terms_of_service_url": "https://example.com/terms", - }, - ) - request_mock.assert_requested( - "post", - "/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", - ) - def test_billing_portal_configuration_retrieve(self, request_mock): - stripe.billing_portal.Configuration.retrieve("bpc_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", - ) - def test_billing_portal_configuration_list(self, request_mock): - stripe.billing_portal.Configuration.list(limit = 3) - request_mock.assert_requested("get", "/v1/billing_portal/configurations") - def test_customer_taxid_retrieve(self, request_mock): - stripe.Customer.retrieve_tax_id("cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx", - ) - def test_invoice_create(self, request_mock): - stripe.Invoice.create(customer = "cus_xxxxxxxxxxxxx") - request_mock.assert_requested("post", "/v1/invoices") - def test_invoice_retrieve(self, request_mock): - stripe.Invoice.retrieve("in_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/invoices/in_xxxxxxxxxxxxx") - def test_invoice_update(self, request_mock): - stripe.Invoice.modify("in_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/invoices/in_xxxxxxxxxxxxx") - def test_invoice_delete(self, request_mock): - stripe.Invoice.delete("in_xxxxxxxxxxxxx") - request_mock.assert_requested("delete", "/v1/invoices/in_xxxxxxxxxxxxx") - def test_invoice_finalize_invoice(self, request_mock): - stripe.Invoice.finalize_invoice("in_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/invoices/in_xxxxxxxxxxxxx/finalize", - ) - def test_invoice_pay(self, request_mock): - stripe.Invoice.pay("in_xxxxxxxxxxxxx") - request_mock.assert_requested("post", "/v1/invoices/in_xxxxxxxxxxxxx/pay") - def test_invoice_send_invoice(self, request_mock): - stripe.Invoice.send_invoice("in_xxxxxxxxxxxxx") - request_mock.assert_requested("post", "/v1/invoices/in_xxxxxxxxxxxxx/send") - def test_invoice_void_invoice(self, request_mock): - stripe.Invoice.void_invoice("in_xxxxxxxxxxxxx") - request_mock.assert_requested("post", "/v1/invoices/in_xxxxxxxxxxxxx/void") - def test_invoice_mark_uncollectible(self, request_mock): - stripe.Invoice.mark_uncollectible("in_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/invoices/in_xxxxxxxxxxxxx/mark_uncollectible", - ) - def test_invoice_list(self, request_mock): - stripe.Invoice.list(limit = 3) - request_mock.assert_requested("get", "/v1/invoices") - def test_invoiceitem_create(self, request_mock): - stripe.InvoiceItem.create( - customer = "cus_xxxxxxxxxxxxx", - price = "price_xxxxxxxxxxxxx", - ) - request_mock.assert_requested("post", "/v1/invoiceitems") - def test_invoiceitem_retrieve(self, request_mock): - stripe.InvoiceItem.retrieve("ii_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/invoiceitems/ii_xxxxxxxxxxxxx") - def test_invoiceitem_update(self, request_mock): - stripe.InvoiceItem.modify( - "ii_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested("post", "/v1/invoiceitems/ii_xxxxxxxxxxxxx") - def test_invoiceitem_delete(self, request_mock): - stripe.InvoiceItem.delete("ii_xxxxxxxxxxxxx") - request_mock.assert_requested("delete", "/v1/invoiceitems/ii_xxxxxxxxxxxxx") - def test_invoiceitem_list(self, request_mock): - stripe.InvoiceItem.list(limit = 3) - request_mock.assert_requested("get", "/v1/invoiceitems") - def test_plan_create(self, request_mock): - stripe.Plan.create( - amount = 2000, - currency = "usd", - interval = "month", - product = "prod_xxxxxxxxxxxxx", - ) - request_mock.assert_requested("post", "/v1/plans") - def test_plan_retrieve(self, request_mock): - stripe.Plan.retrieve("price_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/plans/price_xxxxxxxxxxxxx") - def test_plan_update(self, request_mock): - stripe.Plan.modify("price_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/plans/price_xxxxxxxxxxxxx") - def test_plan_delete(self, request_mock): - stripe.Plan.delete("price_xxxxxxxxxxxxx") - request_mock.assert_requested("delete", "/v1/plans/price_xxxxxxxxxxxxx") - def test_plan_list(self, request_mock): - stripe.Plan.list(limit = 3) - request_mock.assert_requested("get", "/v1/plans") - def test_promotioncode_create(self, request_mock): - stripe.PromotionCode.create(coupon = "25_5OFF") - request_mock.assert_requested("post", "/v1/promotion_codes") - def test_promotioncode_update(self, request_mock): - stripe.PromotionCode.modify( - "promo_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/promotion_codes/promo_xxxxxxxxxxxxx", - ) - def test_promotioncode_retrieve(self, request_mock): - stripe.PromotionCode.retrieve("promo_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/promotion_codes/promo_xxxxxxxxxxxxx", - ) - def test_promotioncode_list(self, request_mock): - stripe.PromotionCode.list(limit = 3) - request_mock.assert_requested("get", "/v1/promotion_codes") - def test_subscription_create(self, request_mock): - stripe.Subscription.create( - customer = "cus_xxxxxxxxxxxxx", - items = [{"price": "price_xxxxxxxxxxxxx"}], - ) - request_mock.assert_requested("post", "/v1/subscriptions") - def test_subscription_retrieve(self, request_mock): - stripe.Subscription.retrieve("sub_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/subscriptions/sub_xxxxxxxxxxxxx") - def test_subscription_update(self, request_mock): - stripe.Subscription.modify( - "sub_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested("post", "/v1/subscriptions/sub_xxxxxxxxxxxxx") - def test_subscription_list(self, request_mock): - stripe.Subscription.list(limit = 3) - request_mock.assert_requested("get", "/v1/subscriptions") - def test_subscriptionitem_create(self, request_mock): - stripe.SubscriptionItem.create( - subscription = "sub_xxxxxxxxxxxxx", - price = "price_xxxxxxxxxxxxx", - quantity = 2, - ) - request_mock.assert_requested("post", "/v1/subscription_items") - def test_subscriptionitem_retrieve(self, request_mock): - stripe.SubscriptionItem.retrieve("si_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/subscription_items/si_xxxxxxxxxxxxx", - ) - def test_subscriptionitem_update(self, request_mock): - stripe.SubscriptionItem.modify( - "si_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/subscription_items/si_xxxxxxxxxxxxx", - ) - def test_subscriptionitem_delete(self, request_mock): - stripe.SubscriptionItem.delete("si_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", - "/v1/subscription_items/si_xxxxxxxxxxxxx", - ) - def test_subscriptionitem_list(self, request_mock): - stripe.SubscriptionItem.list(subscription = "sub_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/subscription_items") - def test_subscriptionschedule_create(self, request_mock): - stripe.SubscriptionSchedule.create( - customer = "cus_xxxxxxxxxxxxx", - start_date = 1620753115, - end_behavior = "release", - phases = [ - { - "items": [{"price": "price_xxxxxxxxxxxxx", "quantity": 1}], - "iterations": 12, - }, - ], - ) - request_mock.assert_requested("post", "/v1/subscription_schedules") - def test_subscriptionschedule_retrieve(self, request_mock): - stripe.SubscriptionSchedule.retrieve("sub_sched_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", - ) - def test_subscriptionschedule_update(self, request_mock): - stripe.SubscriptionSchedule.modify( - "sub_sched_xxxxxxxxxxxxx", - end_behavior = "release", - ) - request_mock.assert_requested( - "post", - "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", - ) - def test_subscriptionschedule_cancel(self, request_mock): - stripe.SubscriptionSchedule.cancel("sub_sched_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/cancel", - ) - def test_subscriptionschedule_release(self, request_mock): - stripe.SubscriptionSchedule.release("sub_sched_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/release", - ) - def test_subscriptionschedule_list(self, request_mock): - stripe.SubscriptionSchedule.list(limit = 3) - request_mock.assert_requested("get", "/v1/subscription_schedules") - def test_taxrate_create(self, request_mock): - stripe.TaxRate.create( - display_name = "VAT", - description = "VAT Germany", - jurisdiction = "DE", - percentage = 16, - inclusive = False, - ) - request_mock.assert_requested("post", "/v1/tax_rates") - def test_taxrate_retrieve(self, request_mock): - stripe.TaxRate.retrieve("txr_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/tax_rates/txr_xxxxxxxxxxxxx") - def test_taxrate_update(self, request_mock): - stripe.TaxRate.modify("txr_xxxxxxxxxxxxx", active = False) - request_mock.assert_requested("post", "/v1/tax_rates/txr_xxxxxxxxxxxxx") - def test_taxrate_list(self, request_mock): - stripe.TaxRate.list(limit = 3) - request_mock.assert_requested("get", "/v1/tax_rates") - def test_account_create(self, request_mock): - stripe.Account.create( - type = "custom", - country = "US", - email = "jenny.rosen@example.com", - capabilities = { - "card_payments": {"requested": True}, - "transfers": {"requested": True}, - }, - ) - request_mock.assert_requested("post", "/v1/accounts") - def test_account_retrieve(self, request_mock): - stripe.Account.retrieve("acct_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/accounts/acct_xxxxxxxxxxxxx") - def test_account_update(self, request_mock): - stripe.Account.modify("acct_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/accounts/acct_xxxxxxxxxxxxx") - def test_account_delete(self, request_mock): - stripe.Account.delete("acct_xxxxxxxxxxxxx") - request_mock.assert_requested("delete", "/v1/accounts/acct_xxxxxxxxxxxxx") - def test_account_reject(self, request_mock): - stripe.Account.reject("acct_xxxxxxxxxxxxx", reason = "fraud") - request_mock.assert_requested( - "post", - "/v1/accounts/acct_xxxxxxxxxxxxx/reject", - ) - def test_account_list(self, request_mock): - stripe.Account.list(limit = 3) - request_mock.assert_requested("get", "/v1/accounts") - def test_accountlink_create(self, request_mock): - stripe.AccountLink.create( - account = "acct_xxxxxxxxxxxxx", - refresh_url = "https://example.com/reauth", - return_url = "https://example.com/return", - type = "account_onboarding", - ) - request_mock.assert_requested("post", "/v1/account_links") - def test_applicationfee_retrieve(self, request_mock): - stripe.ApplicationFee.retrieve("fee_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/application_fees/fee_xxxxxxxxxxxxx", - ) - def test_applicationfee_list(self, request_mock): - stripe.ApplicationFee.list(limit = 3) - request_mock.assert_requested("get", "/v1/application_fees") - def test_applicationfee_feerefund_retrieve(self, request_mock): - stripe.ApplicationFee.retrieve_refund( - "fee_xxxxxxxxxxxxx", - "fr_xxxxxxxxxxxxx", - ) - request_mock.assert_requested( - "get", - "/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", - ) - def test_applicationfee_feerefund_update(self, request_mock): - stripe.ApplicationFee.modify_refund( - "fee_xxxxxxxxxxxxx", - "fr_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", - ) - def test_account_capability_retrieve(self, request_mock): - stripe.Account.retrieve_capability("acct_xxxxxxxxxxxxx", "card_payments") - request_mock.assert_requested( - "get", - "/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments", - ) - def test_account_capability_update(self, request_mock): - stripe.Account.modify_capability( - "acct_xxxxxxxxxxxxx", - "card_payments", - requested = True, - ) - request_mock.assert_requested( - "post", - "/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments", - ) - def test_countryspec_list(self, request_mock): - stripe.CountrySpec.list(limit = 3) - request_mock.assert_requested("get", "/v1/country_specs") - def test_countryspec_retrieve(self, request_mock): - stripe.CountrySpec.retrieve("US") - request_mock.assert_requested("get", "/v1/country_specs/US") - def test_account_person_retrieve(self, request_mock): - stripe.Account.retrieve_person("acct_xxxxxxxxxxxxx", "person_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", - ) - def test_account_person_update(self, request_mock): - stripe.Account.modify_person( - "acct_xxxxxxxxxxxxx", - "person_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", - ) - def test_topup_create(self, request_mock): - stripe.Topup.create( - amount = 2000, - currency = "usd", - description = "Top-up for Jenny Rosen", - statement_descriptor = "Top-up", - ) - request_mock.assert_requested("post", "/v1/topups") - def test_topup_retrieve(self, request_mock): - stripe.Topup.retrieve("tu_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/topups/tu_xxxxxxxxxxxxx") - def test_topup_update(self, request_mock): - stripe.Topup.modify("tu_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/topups/tu_xxxxxxxxxxxxx") - def test_topup_list(self, request_mock): - stripe.Topup.list(limit = 3) - request_mock.assert_requested("get", "/v1/topups") - def test_topup_cancel(self, request_mock): - stripe.Topup.cancel("tu_xxxxxxxxxxxxx") - request_mock.assert_requested("post", "/v1/topups/tu_xxxxxxxxxxxxx/cancel") - def test_transfer_create(self, request_mock): - stripe.Transfer.create( - amount = 400, - currency = "usd", - destination = "acct_xxxxxxxxxxxxx", - transfer_group = "ORDER_95", - ) - request_mock.assert_requested("post", "/v1/transfers") - def test_transfer_retrieve(self, request_mock): - stripe.Transfer.retrieve("tr_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/transfers/tr_xxxxxxxxxxxxx") - def test_transfer_update(self, request_mock): - stripe.Transfer.modify("tr_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/transfers/tr_xxxxxxxxxxxxx") - def test_transfer_list(self, request_mock): - stripe.Transfer.list(limit = 3) - request_mock.assert_requested("get", "/v1/transfers") - def test_transfer_transferreversal_retrieve(self, request_mock): - stripe.Transfer.retrieve_reversal("tr_xxxxxxxxxxxxx", "trr_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx", - ) - def test_transfer_transferreversal_update(self, request_mock): - stripe.Transfer.modify_reversal( - "tr_xxxxxxxxxxxxx", - "trr_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx", - ) - def test_radar_earlyfraudwarning_retrieve(self, request_mock): - stripe.radar.EarlyFraudWarning.retrieve("issfr_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/radar/early_fraud_warnings/issfr_xxxxxxxxxxxxx", - ) - def test_radar_earlyfraudwarning_list(self, request_mock): - stripe.radar.EarlyFraudWarning.list(limit = 3) - request_mock.assert_requested("get", "/v1/radar/early_fraud_warnings") - def test_review_approve(self, request_mock): - stripe.Review.approve("prv_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/reviews/prv_xxxxxxxxxxxxx/approve", - ) - def test_review_retrieve(self, request_mock): - stripe.Review.retrieve("prv_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/reviews/prv_xxxxxxxxxxxxx") - def test_review_list(self, request_mock): - stripe.Review.list(limit = 3) - request_mock.assert_requested("get", "/v1/reviews") - def test_radar_valuelist_create(self, request_mock): - stripe.radar.ValueList.create( - alias = "custom_ip_xxxxxxxxxxxxx", - name = "Custom IP Blocklist", - item_type = "ip_address", - ) - request_mock.assert_requested("post", "/v1/radar/value_lists") - def test_radar_valuelist_retrieve(self, request_mock): - stripe.radar.ValueList.retrieve("rsl_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", - ) - def test_radar_valuelist_update(self, request_mock): - stripe.radar.ValueList.modify( - "rsl_xxxxxxxxxxxxx", - name = "Updated IP Block List", - ) - request_mock.assert_requested( - "post", - "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", - ) - def test_radar_valuelist_delete(self, request_mock): - stripe.radar.ValueList.delete("rsl_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", - "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", - ) - def test_radar_valuelist_list(self, request_mock): - stripe.radar.ValueList.list(limit = 3) - request_mock.assert_requested("get", "/v1/radar/value_lists") - def test_radar_valuelistitem_create(self, request_mock): - stripe.radar.ValueListItem.create( - value_list = "rsl_xxxxxxxxxxxxx", - value = "1.2.3.4", - ) - request_mock.assert_requested("post", "/v1/radar/value_list_items") - def test_radar_valuelistitem_retrieve(self, request_mock): - stripe.radar.ValueListItem.retrieve("rsli_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", - ) - def test_radar_valuelistitem_delete(self, request_mock): - stripe.radar.ValueListItem.delete("rsli_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", - "/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", - ) - def test_radar_valuelistitem_list(self, request_mock): - stripe.radar.ValueListItem.list(limit = 3, value_list = "rsl_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/radar/value_list_items") - def test_issuing_authorization_retrieve(self, request_mock): - stripe.issuing.Authorization.retrieve("iauth_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", - ) - def test_issuing_authorization_update(self, request_mock): - stripe.issuing.Authorization.modify( - "iauth_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", - ) - def test_issuing_authorization_approve(self, request_mock): - stripe.issuing.Authorization.approve("iauth_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/approve", - ) - def test_issuing_authorization_decline(self, request_mock): - stripe.issuing.Authorization.decline("iauth_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/decline", - ) - def test_issuing_authorization_list(self, request_mock): - stripe.issuing.Authorization.list(limit = 3) - request_mock.assert_requested("get", "/v1/issuing/authorizations") - def test_issuing_cardholder_create(self, request_mock): - stripe.issuing.Cardholder.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", - }, - }, - ) - request_mock.assert_requested("post", "/v1/issuing/cardholders") - def test_issuing_cardholder_retrieve(self, request_mock): - stripe.issuing.Cardholder.retrieve("ich_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", - ) - def test_issuing_cardholder_update(self, request_mock): - stripe.issuing.Cardholder.modify( - "ich_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", - ) - def test_issuing_cardholder_list(self, request_mock): - stripe.issuing.Cardholder.list(limit = 3) - request_mock.assert_requested("get", "/v1/issuing/cardholders") - def test_issuing_card_create(self, request_mock): - stripe.issuing.Card.create( - cardholder = "ich_xxxxxxxxxxxxx", - currency = "usd", - type = "virtual", - ) - request_mock.assert_requested("post", "/v1/issuing/cards") - def test_issuing_card_retrieve(self, request_mock): - stripe.issuing.Card.retrieve("ic_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/issuing/cards/ic_xxxxxxxxxxxxx") - def test_issuing_card_update(self, request_mock): - stripe.issuing.Card.modify( - "ic_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested("post", "/v1/issuing/cards/ic_xxxxxxxxxxxxx") - def test_issuing_card_list(self, request_mock): - stripe.issuing.Card.list(limit = 3) - request_mock.assert_requested("get", "/v1/issuing/cards") - def test_issuing_dispute_create(self, request_mock): - stripe.issuing.Dispute.create( - transaction = "ipi_xxxxxxxxxxxxx", - evidence = { - "reason": "fraudulent", - "fraudulent": {"explanation": "Purchase was unrecognized."}, - }, - ) - request_mock.assert_requested("post", "/v1/issuing/disputes") - def test_issuing_dispute_submit(self, request_mock): - stripe.issuing.Dispute.submit("idp_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/issuing/disputes/idp_xxxxxxxxxxxxx/submit", - ) - def test_issuing_dispute_retrieve(self, request_mock): - stripe.issuing.Dispute.retrieve("idp_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/issuing/disputes/idp_xxxxxxxxxxxxx", - ) - def test_issuing_dispute_update(self, request_mock): - stripe.issuing.Dispute.modify( - "idp_xxxxxxxxxxxxx", - evidence = { - "reason": "not_received", - "not_received": { - "expected_at": 1590000000, - "explanation": "", - "product_description": "Baseball cap", - "product_type": "merchandise", - }, - }, - ) - request_mock.assert_requested( - "post", - "/v1/issuing/disputes/idp_xxxxxxxxxxxxx", - ) - def test_issuing_dispute_list(self, request_mock): - stripe.issuing.Dispute.list(limit = 3) - request_mock.assert_requested("get", "/v1/issuing/disputes") - def test_issuing_transaction_retrieve(self, request_mock): - stripe.issuing.Transaction.retrieve("ipi_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", - ) - def test_issuing_transaction_update(self, request_mock): - stripe.issuing.Transaction.modify( - "ipi_xxxxxxxxxxxxx", - metadata = {"order_id": "6735"}, - ) - request_mock.assert_requested( - "post", - "/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", - ) - def test_issuing_transaction_list(self, request_mock): - stripe.issuing.Transaction.list(limit = 3) - request_mock.assert_requested("get", "/v1/issuing/transactions") - def test_terminal_connectiontoken_create(self, request_mock): - stripe.terminal.ConnectionToken.create() - request_mock.assert_requested("post", "/v1/terminal/connection_tokens") - def test_terminal_location_create(self, request_mock): - stripe.terminal.Location.create( - display_name = "My First Store", - address = { - "line1": "1234 Main Street", - "city": "San Francisco", - "country": "US", - "postal_code": "94111", - }, - ) - request_mock.assert_requested("post", "/v1/terminal/locations") - def test_terminal_location_retrieve(self, request_mock): - stripe.terminal.Location.retrieve("tml_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/terminal/locations/tml_xxxxxxxxxxxxx", - ) - def test_terminal_location_update(self, request_mock): - stripe.terminal.Location.modify( - "tml_xxxxxxxxxxxxx", - display_name = "My First Store", - ) - request_mock.assert_requested( - "post", - "/v1/terminal/locations/tml_xxxxxxxxxxxxx", - ) - def test_terminal_location_delete(self, request_mock): - stripe.terminal.Location.delete("tml_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", - "/v1/terminal/locations/tml_xxxxxxxxxxxxx", - ) - def test_terminal_location_list(self, request_mock): - stripe.terminal.Location.list(limit = 3) - request_mock.assert_requested("get", "/v1/terminal/locations") - def test_terminal_reader_create(self, request_mock): - stripe.terminal.Reader.create( - registration_code = "puppies-plug-could", - label = "Blue Rabbit", - location = "tml_1234", - ) - request_mock.assert_requested("post", "/v1/terminal/readers") - def test_terminal_reader_retrieve(self, request_mock): - stripe.terminal.Reader.retrieve("tmr_P400-123-456-789") - request_mock.assert_requested( - "get", - "/v1/terminal/readers/tmr_P400-123-456-789", - ) - def test_terminal_reader_update(self, request_mock): - stripe.terminal.Reader.modify("tmr_P400-123-456-789", label = "Blue Rabbit") - request_mock.assert_requested( - "post", - "/v1/terminal/readers/tmr_P400-123-456-789", - ) - def test_terminal_reader_delete(self, request_mock): - stripe.terminal.Reader.delete("tmr_P400-123-456-789") - request_mock.assert_requested( - "delete", - "/v1/terminal/readers/tmr_P400-123-456-789", - ) - def test_terminal_reader_list(self, request_mock): - stripe.terminal.Reader.list(limit = 3) - request_mock.assert_requested("get", "/v1/terminal/readers") - def test_order_create(self, request_mock): - stripe.Order.create( - currency = "usd", - email = "jenny.rosen@example.com", - items = [{"type": "sku", "parent": "sku_xxxxxxxxxxxxx"}], - shipping = { - "name": "Jenny Rosen", - "address": { - "line1": "1234 Main Street", - "city": "San Francisco", - "state": "CA", - "country": "US", - "postal_code": "94111", - }, - }, - ) - request_mock.assert_requested("post", "/v1/orders") - def test_order_retrieve(self, request_mock): - stripe.Order.retrieve("or_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/orders/or_xxxxxxxxxxxxx") - def test_order_update(self, request_mock): - stripe.Order.modify("or_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/orders/or_xxxxxxxxxxxxx") - def test_order_pay(self, request_mock): - stripe.Order.pay("or_xxxxxxxxxxxxx", source = "tok_xxxx") - request_mock.assert_requested("post", "/v1/orders/or_xxxxxxxxxxxxx/pay") - def test_order_list(self, request_mock): - stripe.Order.list(limit = 3) - request_mock.assert_requested("get", "/v1/orders") - def test_orderreturn_retrieve(self, request_mock): - stripe.OrderReturn.retrieve("orret_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/order_returns/orret_xxxxxxxxxxxxx", - ) - def test_orderreturn_list(self, request_mock): - stripe.OrderReturn.list(limit = 3) - request_mock.assert_requested("get", "/v1/order_returns") - def test_sku_create(self, request_mock): - stripe.SKU.create( - attributes = {"size": "Medium", "gender": "Unisex"}, - price = 1500, - currency = "usd", - inventory = {"type": "finite", "quantity": 500}, - product = "prod_xxxxxxxxxxxxx", - ) - request_mock.assert_requested("post", "/v1/skus") - def test_sku_retrieve(self, request_mock): - stripe.SKU.retrieve("sku_xxxxxxxxxxxxx") - request_mock.assert_requested("get", "/v1/skus/sku_xxxxxxxxxxxxx") - def test_sku_update(self, request_mock): - stripe.SKU.modify("sku_xxxxxxxxxxxxx", metadata = {"order_id": "6735"}) - request_mock.assert_requested("post", "/v1/skus/sku_xxxxxxxxxxxxx") - def test_sku_list(self, request_mock): - stripe.SKU.list(limit = 3) - request_mock.assert_requested("get", "/v1/skus") - def test_sku_delete(self, request_mock): - stripe.SKU.delete("sku_xxxxxxxxxxxxx") - request_mock.assert_requested("delete", "/v1/skus/sku_xxxxxxxxxxxxx") - def test_sigma_scheduledqueryrun_retrieve(self, request_mock): - stripe.sigma.ScheduledQueryRun.retrieve("sqr_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/sigma/scheduled_query_runs/sqr_xxxxxxxxxxxxx", - ) - def test_sigma_scheduledqueryrun_list(self, request_mock): - stripe.sigma.ScheduledQueryRun.list(limit = 3) - request_mock.assert_requested("get", "/v1/sigma/scheduled_query_runs") - def test_reporting_reportrun_create(self, request_mock): - stripe.reporting.ReportRun.create( - report_type = "balance.summary.1", - parameters = {"interval_start": 1522540800, "interval_end": 1525132800}, - ) - request_mock.assert_requested("post", "/v1/reporting/report_runs") - def test_reporting_reportrun_retrieve(self, request_mock): - stripe.reporting.ReportRun.retrieve("frr_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/reporting/report_runs/frr_xxxxxxxxxxxxx", - ) - def test_reporting_reportrun_list(self, request_mock): - stripe.reporting.ReportRun.list(limit = 3) - request_mock.assert_requested("get", "/v1/reporting/report_runs") - def test_reporting_reporttype_retrieve(self, request_mock): - stripe.reporting.ReportType.retrieve("balance.summary.1") - request_mock.assert_requested( - "get", - "/v1/reporting/report_types/balance.summary.1", - ) - def test_reporting_reporttype_list(self, request_mock): - stripe.reporting.ReportType.list() - request_mock.assert_requested("get", "/v1/reporting/report_types") - def test_webhookendpoint_create(self, request_mock): - stripe.WebhookEndpoint.create( - url = "https://example.com/my/webhook/endpoint", - enabled_events = ["charge.failed", "charge.succeeded"], - ) - request_mock.assert_requested("post", "/v1/webhook_endpoints") - def test_webhookendpoint_retrieve(self, request_mock): - stripe.WebhookEndpoint.retrieve("we_xxxxxxxxxxxxx") - request_mock.assert_requested( - "get", - "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", - ) - def test_webhookendpoint_update(self, request_mock): - stripe.WebhookEndpoint.modify( - "we_xxxxxxxxxxxxx", - url = "https://example.com/new_endpoint", - ) - request_mock.assert_requested( - "post", - "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", - ) - def test_webhookendpoint_list(self, request_mock): - stripe.WebhookEndpoint.list(limit = 3) - request_mock.assert_requested("get", "/v1/webhook_endpoints") - def test_webhookendpoint_delete(self, request_mock): - stripe.WebhookEndpoint.delete("we_xxxxxxxxxxxxx") - request_mock.assert_requested( - "delete", - "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", - ) - def test_customer_list_payment_methods(self, request_mock): - stripe.Customer.list_payment_methods("cus_xyz", type = "card") - request_mock.assert_requested( - "get", - "/v1/customers/cus_xyz/payment_methods", - ) - def test_checkout_session_expire(self, request_mock): - stripe.checkout.Session.expire("sess_xyz") - request_mock.assert_requested( - "post", - "/v1/checkout/sessions/sess_xyz/expire", - ) - def test_shippingrate_create(self, request_mock): - stripe.ShippingRate.create( - display_name = "Sample Shipper", - fixed_amount = {"currency": "usd", "amount": 400}, - type = "fixed_amount", - ) - request_mock.assert_requested("post", "/v1/shipping_rates") - def test_shippingrate_list(self, request_mock): - stripe.ShippingRate.list() - request_mock.assert_requested("get", "/v1/shipping_rates") - def test_checkout_session_create2(self, request_mock): - stripe.checkout.Session.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}, + def test_customer_list(self, request_mock): + stripe.Customer.list(limit=3) + request_mock.assert_requested("get", "/v1/customers") + + def test_balancetransaction_retrieve(self, request_mock): + stripe.BalanceTransaction.retrieve("txn_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/balance_transactions/txn_xxxxxxxxxxxxx", + ) + + def test_balancetransaction_list(self, request_mock): + stripe.BalanceTransaction.list(limit=3) + request_mock.assert_requested("get", "/v1/balance_transactions") + + def test_charge_create(self, request_mock): + stripe.Charge.create( + amount=2000, + currency="usd", + source="tok_xxxx", + description="My First Test Charge (created for API docs)", + ) + request_mock.assert_requested("post", "/v1/charges") + + def test_charge_retrieve(self, request_mock): + stripe.Charge.retrieve("ch_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/charges/ch_xxxxxxxxxxxxx") + + def test_charge_update(self, request_mock): + stripe.Charge.modify("ch_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/charges/ch_xxxxxxxxxxxxx") + + def test_charge_capture(self, request_mock): + stripe.Charge.capture("ch_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/charges/ch_xxxxxxxxxxxxx/capture", + ) + + def test_charge_list(self, request_mock): + stripe.Charge.list(limit=3) + request_mock.assert_requested("get", "/v1/charges") + + def test_customer_create(self, request_mock): + stripe.Customer.create( + description="My First Test Customer (created for API docs)", + ) + request_mock.assert_requested("post", "/v1/customers") + + def test_customer_retrieve(self, request_mock): + stripe.Customer.retrieve("cus_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/customers/cus_xxxxxxxxxxxxx") + + def test_customer_update(self, request_mock): + stripe.Customer.modify( + "cus_xxxxxxxxxxxxx", metadata={"order_id": "6735"} + ) + request_mock.assert_requested( + "post", "/v1/customers/cus_xxxxxxxxxxxxx" + ) + + def test_customer_delete(self, request_mock): + stripe.Customer.delete("cus_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", "/v1/customers/cus_xxxxxxxxxxxxx" + ) + + def test_customer_list2(self, request_mock): + stripe.Customer.list(limit=3) + request_mock.assert_requested("get", "/v1/customers") + + def test_dispute_retrieve(self, request_mock): + stripe.Dispute.retrieve("dp_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/disputes/dp_xxxxxxxxxxxxx") + + def test_dispute_update(self, request_mock): + stripe.Dispute.modify( + "dp_xxxxxxxxxxxxx", metadata={"order_id": "6735"} + ) + request_mock.assert_requested("post", "/v1/disputes/dp_xxxxxxxxxxxxx") + + def test_dispute_close(self, request_mock): + stripe.Dispute.close("dp_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", "/v1/disputes/dp_xxxxxxxxxxxxx/close" + ) + + def test_dispute_list(self, request_mock): + stripe.Dispute.list(limit=3) + request_mock.assert_requested("get", "/v1/disputes") + + def test_event_retrieve(self, request_mock): + stripe.Event.retrieve("evt_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/events/evt_xxxxxxxxxxxxx") + + def test_event_list(self, request_mock): + stripe.Event.list(limit=3) + request_mock.assert_requested("get", "/v1/events") + + def test_file_retrieve(self, request_mock): + stripe.File.retrieve("file_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/files/file_xxxxxxxxxxxxx") + + def test_file_list(self, request_mock): + stripe.File.list(limit=3) + request_mock.assert_requested("get", "/v1/files") + + def test_filelink_create(self, request_mock): + stripe.FileLink.create(file="file_xxxxxxxxxxxxx") + request_mock.assert_requested("post", "/v1/file_links") + + def test_filelink_retrieve(self, request_mock): + stripe.FileLink.retrieve("link_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", "/v1/file_links/link_xxxxxxxxxxxxx" + ) + + def test_filelink_update(self, request_mock): + stripe.FileLink.modify( + "link_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", "/v1/file_links/link_xxxxxxxxxxxxx" + ) + + def test_filelink_list(self, request_mock): + stripe.FileLink.list(limit=3) + request_mock.assert_requested("get", "/v1/file_links") + + def test_mandate_retrieve(self, request_mock): + stripe.Mandate.retrieve("mandate_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", "/v1/mandates/mandate_xxxxxxxxxxxxx" + ) + + def test_paymentintent_create(self, request_mock): + stripe.PaymentIntent.create( + amount=2000, + currency="usd", + payment_method_types=["card"], + ) + request_mock.assert_requested("post", "/v1/payment_intents") + + def test_paymentintent_retrieve(self, request_mock): + stripe.PaymentIntent.retrieve("pi_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", "/v1/payment_intents/pi_xxxxxxxxxxxxx" + ) + + def test_paymentintent_update(self, request_mock): + stripe.PaymentIntent.modify( + "pi_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx", + ) + + def test_paymentintent_confirm(self, request_mock): + stripe.PaymentIntent.confirm( + "pi_xxxxxxxxxxxxx", + payment_method="pm_card_visa", + ) + request_mock.assert_requested( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/confirm", + ) + + def test_paymentintent_capture(self, request_mock): + stripe.PaymentIntent.capture("pi_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/capture", + ) + + def test_paymentintent_cancel(self, request_mock): + stripe.PaymentIntent.cancel("pi_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/cancel", + ) + + def test_paymentintent_list(self, request_mock): + stripe.PaymentIntent.list(limit=3) + request_mock.assert_requested("get", "/v1/payment_intents") + + def test_setupintent_create(self, request_mock): + stripe.SetupIntent.create(payment_method_types=["card"]) + request_mock.assert_requested("post", "/v1/setup_intents") + + def test_setupintent_retrieve(self, request_mock): + stripe.SetupIntent.retrieve("seti_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", "/v1/setup_intents/seti_xxxxxxxxxxxxx" + ) + + def test_setupintent_update(self, request_mock): + stripe.SetupIntent.modify( + "seti_xxxxxxxxxxxxx", + metadata={"user_id": "3435453"}, + ) + request_mock.assert_requested( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx", + ) + + def test_setupintent_confirm(self, request_mock): + stripe.SetupIntent.confirm( + "seti_xxxxxxxxxxxxx", + payment_method="pm_card_visa", + ) + request_mock.assert_requested( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx/confirm", + ) + + def test_setupintent_cancel(self, request_mock): + stripe.SetupIntent.cancel("seti_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx/cancel", + ) + + def test_setupintent_list(self, request_mock): + stripe.SetupIntent.list(limit=3) + request_mock.assert_requested("get", "/v1/setup_intents") + + def test_setupattempt_list(self, request_mock): + stripe.SetupAttempt.list(setup_intent="seti_xxxxxxxxxxxxx", limit=3) + request_mock.assert_requested("get", "/v1/setup_attempts") + + def test_payout_create(self, request_mock): + stripe.Payout.create(amount=1100, currency="usd") + request_mock.assert_requested("post", "/v1/payouts") + + def test_payout_retrieve(self, request_mock): + stripe.Payout.retrieve("po_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/payouts/po_xxxxxxxxxxxxx") + + def test_payout_update(self, request_mock): + stripe.Payout.modify("po_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/payouts/po_xxxxxxxxxxxxx") + + def test_payout_list(self, request_mock): + stripe.Payout.list(limit=3) + request_mock.assert_requested("get", "/v1/payouts") + + def test_payout_cancel(self, request_mock): + stripe.Payout.cancel("po_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", "/v1/payouts/po_xxxxxxxxxxxxx/cancel" + ) + + def test_payout_reverse(self, request_mock): + stripe.Payout.reverse("po_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/payouts/po_xxxxxxxxxxxxx/reverse", + ) + + def test_product_create(self, request_mock): + stripe.Product.create(name="Gold Special") + request_mock.assert_requested("post", "/v1/products") + + def test_product_retrieve(self, request_mock): + stripe.Product.retrieve("prod_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/products/prod_xxxxxxxxxxxxx") + + def test_product_update(self, request_mock): + stripe.Product.modify( + "prod_xxxxxxxxxxxxx", metadata={"order_id": "6735"} + ) + request_mock.assert_requested( + "post", "/v1/products/prod_xxxxxxxxxxxxx" + ) + + def test_product_list(self, request_mock): + stripe.Product.list(limit=3) + request_mock.assert_requested("get", "/v1/products") + + def test_product_delete(self, request_mock): + stripe.Product.delete("prod_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", "/v1/products/prod_xxxxxxxxxxxxx" + ) + + def test_price_create(self, request_mock): + stripe.Price.create( + unit_amount=2000, + currency="usd", + recurring={"interval": "month"}, + product="prod_xxxxxxxxxxxxx", + ) + request_mock.assert_requested("post", "/v1/prices") + + def test_price_retrieve(self, request_mock): + stripe.Price.retrieve("price_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/prices/price_xxxxxxxxxxxxx") + + def test_price_update(self, request_mock): + stripe.Price.modify( + "price_xxxxxxxxxxxxx", metadata={"order_id": "6735"} + ) + request_mock.assert_requested("post", "/v1/prices/price_xxxxxxxxxxxxx") + + def test_price_list(self, request_mock): + stripe.Price.list(limit=3) + request_mock.assert_requested("get", "/v1/prices") + + def test_refund_create(self, request_mock): + stripe.Refund.create(charge="ch_xxxxxxxxxxxxx") + request_mock.assert_requested("post", "/v1/refunds") + + def test_refund_retrieve(self, request_mock): + stripe.Refund.retrieve("re_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/refunds/re_xxxxxxxxxxxxx") + + def test_refund_update(self, request_mock): + stripe.Refund.modify("re_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/refunds/re_xxxxxxxxxxxxx") + + def test_refund_list(self, request_mock): + stripe.Refund.list(limit=3) + request_mock.assert_requested("get", "/v1/refunds") + + def test_token_create(self, request_mock): + stripe.Token.create( + card={ + "number": "4242424242424242", + "exp_month": "5", + "exp_year": "2022", + "cvc": "314", + }, + ) + request_mock.assert_requested("post", "/v1/tokens") + + def test_token_create2(self, request_mock): + stripe.Token.create( + bank_account={ + "country": "US", + "currency": "usd", + "account_holder_name": "Jenny Rosen", + "account_holder_type": "individual", + "routing_number": "110000000", + "account_number": "000123456789", + }, + ) + request_mock.assert_requested("post", "/v1/tokens") + + def test_token_create3(self, request_mock): + stripe.Token.create(pii={"id_number": "000000000"}) + request_mock.assert_requested("post", "/v1/tokens") + + def test_token_create4(self, request_mock): + stripe.Token.create( + account={ + "individual": {"first_name": "Jane", "last_name": "Doe"}, + "tos_shown_and_accepted": True, + }, + ) + request_mock.assert_requested("post", "/v1/tokens") + + def test_token_create5(self, request_mock): + stripe.Token.create( + person={ + "first_name": "Jane", + "last_name": "Doe", + "relationship": {"owner": True}, + }, + ) + request_mock.assert_requested("post", "/v1/tokens") + + def test_token_create6(self, request_mock): + stripe.Token.create(cvc_update={"cvc": "123"}) + request_mock.assert_requested("post", "/v1/tokens") + + def test_token_retrieve(self, request_mock): + stripe.Token.retrieve("tok_xxxx") + request_mock.assert_requested("get", "/v1/tokens/tok_xxxx") + + def test_paymentmethod_create(self, request_mock): + stripe.PaymentMethod.create( + type="card", + card={ + "number": "4242424242424242", + "exp_month": 5, + "exp_year": 2022, + "cvc": "314", + }, + ) + request_mock.assert_requested("post", "/v1/payment_methods") + + def test_paymentmethod_retrieve(self, request_mock): + stripe.PaymentMethod.retrieve("pm_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", "/v1/payment_methods/pm_xxxxxxxxxxxxx" + ) + + def test_paymentmethod_update(self, request_mock): + stripe.PaymentMethod.modify( + "pm_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/payment_methods/pm_xxxxxxxxxxxxx", + ) + + def test_paymentmethod_list(self, request_mock): + stripe.PaymentMethod.list(customer="cus_xxxxxxxxxxxxx", type="card") + request_mock.assert_requested("get", "/v1/payment_methods") + + def test_paymentmethod_attach(self, request_mock): + stripe.PaymentMethod.attach( + "pm_xxxxxxxxxxxxx", + customer="cus_xxxxxxxxxxxxx", + ) + request_mock.assert_requested( + "post", + "/v1/payment_methods/pm_xxxxxxxxxxxxx/attach", + ) + + def test_paymentmethod_detach(self, request_mock): + stripe.PaymentMethod.detach("pm_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/payment_methods/pm_xxxxxxxxxxxxx/detach", + ) + + def test_source_retrieve(self, request_mock): + stripe.Source.retrieve("src_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/sources/src_xxxxxxxxxxxxx") + + def test_source_update(self, request_mock): + stripe.Source.modify( + "src_xxxxxxxxxxxxx", metadata={"order_id": "6735"} + ) + request_mock.assert_requested("post", "/v1/sources/src_xxxxxxxxxxxxx") + + def test_checkout_session_create(self, request_mock): + stripe.checkout.Session.create( + success_url="https://example.com/success", + cancel_url="https://example.com/cancel", + payment_method_types=["card"], + line_items=[{"price": "price_xxxxxxxxxxxxx", "quantity": 2}], + mode="payment", + ) + request_mock.assert_requested("post", "/v1/checkout/sessions") + + def test_checkout_session_retrieve(self, request_mock): + stripe.checkout.Session.retrieve("cs_test_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx", + ) + + def test_checkout_session_list(self, request_mock): + stripe.checkout.Session.list(limit=3) + request_mock.assert_requested("get", "/v1/checkout/sessions") + + def test_coupon_create(self, request_mock): + stripe.Coupon.create( + percent_off=25, + duration="repeating", + duration_in_months=3, + ) + request_mock.assert_requested("post", "/v1/coupons") + + def test_coupon_retrieve(self, request_mock): + stripe.Coupon.retrieve("25_5OFF") + request_mock.assert_requested("get", "/v1/coupons/25_5OFF") + + def test_coupon_update(self, request_mock): + stripe.Coupon.modify("co_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/coupons/co_xxxxxxxxxxxxx") + + def test_coupon_delete(self, request_mock): + stripe.Coupon.delete("co_xxxxxxxxxxxxx") + request_mock.assert_requested("delete", "/v1/coupons/co_xxxxxxxxxxxxx") + + def test_coupon_list(self, request_mock): + stripe.Coupon.list(limit=3) + request_mock.assert_requested("get", "/v1/coupons") + + def test_creditnote_create(self, request_mock): + stripe.CreditNote.create( + invoice="in_xxxxxxxxxxxxx", + lines=[ + { + "type": "invoice_line_item", + "invoice_line_item": "il_xxxxxxxxxxxxx", + "quantity": 1, + }, + ], + ) + request_mock.assert_requested("post", "/v1/credit_notes") + + def test_creditnote_update(self, request_mock): + stripe.CreditNote.modify( + "cn_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", "/v1/credit_notes/cn_xxxxxxxxxxxxx" + ) + + def test_creditnote_void_credit_note(self, request_mock): + stripe.CreditNote.void_credit_note("cn_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/credit_notes/cn_xxxxxxxxxxxxx/void", + ) + + def test_creditnote_list(self, request_mock): + stripe.CreditNote.list(limit=3) + request_mock.assert_requested("get", "/v1/credit_notes") + + def test_customer_customerbalancetransaction_retrieve(self, request_mock): + stripe.Customer.retrieve_balance_transaction( + "cus_xxxxxxxxxxxxx", + "cbtxn_xxxxxxxxxxxxx", + ) + request_mock.assert_requested( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx", + ) + + def test_billing_portal_session_create(self, request_mock): + stripe.billing_portal.Session.create( + customer="cus_xxxxxxxxxxxxx", + return_url="https://example.com/account", + ) + request_mock.assert_requested("post", "/v1/billing_portal/sessions") + + def test_billing_portal_configuration_create(self, request_mock): + stripe.billing_portal.Configuration.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", + }, + ) + request_mock.assert_requested( + "post", "/v1/billing_portal/configurations" + ) + + def test_billing_portal_configuration_update(self, request_mock): + stripe.billing_portal.Configuration.modify( + "bpc_xxxxxxxxxxxxx", + business_profile={ + "privacy_policy_url": "https://example.com/privacy", + "terms_of_service_url": "https://example.com/terms", }, - }, - }, - ], - ) - request_mock.assert_requested("post", "/v1/checkout/sessions") - def test_paymentintent_create2(self, request_mock): - stripe.PaymentIntent.create( - amount = 1099, - currency = "eur", - automatic_payment_methods = {"enabled": True}, - ) - request_mock.assert_requested("post", "/v1/payment_intents") - def test_paymentlink_create(self, request_mock): - stripe.PaymentLink.create( - line_items = [{"price": "price_xxxxxxxxxxxxx", "quantity": 1}], - ) - request_mock.assert_requested("post", "/v1/payment_links") - def test_paymentlink_list_line_items(self, request_mock): - stripe.PaymentLink.list_line_items("pl_xyz") - request_mock.assert_requested("get", "/v1/payment_links/pl_xyz/line_items") - def test_paymentlink_retrieve(self, request_mock): - stripe.PaymentLink.retrieve("pl_xyz") - request_mock.assert_requested("get", "/v1/payment_links/pl_xyz") - def test_paymentintent_verify_microdeposits(self, request_mock): - stripe.PaymentIntent.verify_microdeposits("pi_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits", - ) - def test_setupintent_verify_microdeposits(self, request_mock): - stripe.SetupIntent.verify_microdeposits("seti_xxxxxxxxxxxxx") - request_mock.assert_requested( - "post", - "/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits", - ) + ) + request_mock.assert_requested( + "post", + "/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", + ) + + def test_billing_portal_configuration_retrieve(self, request_mock): + stripe.billing_portal.Configuration.retrieve("bpc_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx", + ) + + def test_billing_portal_configuration_list(self, request_mock): + stripe.billing_portal.Configuration.list(limit=3) + request_mock.assert_requested( + "get", "/v1/billing_portal/configurations" + ) + + def test_customer_taxid_retrieve(self, request_mock): + stripe.Customer.retrieve_tax_id( + "cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx" + ) + request_mock.assert_requested( + "get", + "/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx", + ) + + def test_invoice_create(self, request_mock): + stripe.Invoice.create(customer="cus_xxxxxxxxxxxxx") + request_mock.assert_requested("post", "/v1/invoices") + + def test_invoice_retrieve(self, request_mock): + stripe.Invoice.retrieve("in_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/invoices/in_xxxxxxxxxxxxx") + + def test_invoice_update(self, request_mock): + stripe.Invoice.modify( + "in_xxxxxxxxxxxxx", metadata={"order_id": "6735"} + ) + request_mock.assert_requested("post", "/v1/invoices/in_xxxxxxxxxxxxx") + + def test_invoice_delete(self, request_mock): + stripe.Invoice.delete("in_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", "/v1/invoices/in_xxxxxxxxxxxxx" + ) + + def test_invoice_finalize_invoice(self, request_mock): + stripe.Invoice.finalize_invoice("in_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/invoices/in_xxxxxxxxxxxxx/finalize", + ) + + def test_invoice_pay(self, request_mock): + stripe.Invoice.pay("in_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", "/v1/invoices/in_xxxxxxxxxxxxx/pay" + ) + + def test_invoice_send_invoice(self, request_mock): + stripe.Invoice.send_invoice("in_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", "/v1/invoices/in_xxxxxxxxxxxxx/send" + ) + + def test_invoice_void_invoice(self, request_mock): + stripe.Invoice.void_invoice("in_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", "/v1/invoices/in_xxxxxxxxxxxxx/void" + ) + + def test_invoice_mark_uncollectible(self, request_mock): + stripe.Invoice.mark_uncollectible("in_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/invoices/in_xxxxxxxxxxxxx/mark_uncollectible", + ) + + def test_invoice_list(self, request_mock): + stripe.Invoice.list(limit=3) + request_mock.assert_requested("get", "/v1/invoices") + + def test_invoiceitem_create(self, request_mock): + stripe.InvoiceItem.create( + customer="cus_xxxxxxxxxxxxx", + price="price_xxxxxxxxxxxxx", + ) + request_mock.assert_requested("post", "/v1/invoiceitems") + + def test_invoiceitem_retrieve(self, request_mock): + stripe.InvoiceItem.retrieve("ii_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", "/v1/invoiceitems/ii_xxxxxxxxxxxxx" + ) + + def test_invoiceitem_update(self, request_mock): + stripe.InvoiceItem.modify( + "ii_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", "/v1/invoiceitems/ii_xxxxxxxxxxxxx" + ) + + def test_invoiceitem_delete(self, request_mock): + stripe.InvoiceItem.delete("ii_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", "/v1/invoiceitems/ii_xxxxxxxxxxxxx" + ) + + def test_invoiceitem_list(self, request_mock): + stripe.InvoiceItem.list(limit=3) + request_mock.assert_requested("get", "/v1/invoiceitems") + + def test_plan_create(self, request_mock): + stripe.Plan.create( + amount=2000, + currency="usd", + interval="month", + product="prod_xxxxxxxxxxxxx", + ) + request_mock.assert_requested("post", "/v1/plans") + + def test_plan_retrieve(self, request_mock): + stripe.Plan.retrieve("price_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/plans/price_xxxxxxxxxxxxx") + + def test_plan_update(self, request_mock): + stripe.Plan.modify( + "price_xxxxxxxxxxxxx", metadata={"order_id": "6735"} + ) + request_mock.assert_requested("post", "/v1/plans/price_xxxxxxxxxxxxx") + + def test_plan_delete(self, request_mock): + stripe.Plan.delete("price_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", "/v1/plans/price_xxxxxxxxxxxxx" + ) + + def test_plan_list(self, request_mock): + stripe.Plan.list(limit=3) + request_mock.assert_requested("get", "/v1/plans") + + def test_promotioncode_create(self, request_mock): + stripe.PromotionCode.create(coupon="25_5OFF") + request_mock.assert_requested("post", "/v1/promotion_codes") + + def test_promotioncode_update(self, request_mock): + stripe.PromotionCode.modify( + "promo_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/promotion_codes/promo_xxxxxxxxxxxxx", + ) + + def test_promotioncode_retrieve(self, request_mock): + stripe.PromotionCode.retrieve("promo_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/promotion_codes/promo_xxxxxxxxxxxxx", + ) + + def test_promotioncode_list(self, request_mock): + stripe.PromotionCode.list(limit=3) + request_mock.assert_requested("get", "/v1/promotion_codes") + + def test_subscription_create(self, request_mock): + stripe.Subscription.create( + customer="cus_xxxxxxxxxxxxx", + items=[{"price": "price_xxxxxxxxxxxxx"}], + ) + request_mock.assert_requested("post", "/v1/subscriptions") + + def test_subscription_retrieve(self, request_mock): + stripe.Subscription.retrieve("sub_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", "/v1/subscriptions/sub_xxxxxxxxxxxxx" + ) + + def test_subscription_update(self, request_mock): + stripe.Subscription.modify( + "sub_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", "/v1/subscriptions/sub_xxxxxxxxxxxxx" + ) + + def test_subscription_list(self, request_mock): + stripe.Subscription.list(limit=3) + request_mock.assert_requested("get", "/v1/subscriptions") + + def test_subscriptionitem_create(self, request_mock): + stripe.SubscriptionItem.create( + subscription="sub_xxxxxxxxxxxxx", + price="price_xxxxxxxxxxxxx", + quantity=2, + ) + request_mock.assert_requested("post", "/v1/subscription_items") + + def test_subscriptionitem_retrieve(self, request_mock): + stripe.SubscriptionItem.retrieve("si_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/subscription_items/si_xxxxxxxxxxxxx", + ) + + def test_subscriptionitem_update(self, request_mock): + stripe.SubscriptionItem.modify( + "si_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/subscription_items/si_xxxxxxxxxxxxx", + ) + + def test_subscriptionitem_delete(self, request_mock): + stripe.SubscriptionItem.delete("si_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", + "/v1/subscription_items/si_xxxxxxxxxxxxx", + ) + + def test_subscriptionitem_list(self, request_mock): + stripe.SubscriptionItem.list(subscription="sub_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/subscription_items") + + def test_subscriptionschedule_create(self, request_mock): + stripe.SubscriptionSchedule.create( + customer="cus_xxxxxxxxxxxxx", + start_date=1620753115, + end_behavior="release", + phases=[ + { + "items": [{"price": "price_xxxxxxxxxxxxx", "quantity": 1}], + "iterations": 12, + }, + ], + ) + request_mock.assert_requested("post", "/v1/subscription_schedules") + + def test_subscriptionschedule_retrieve(self, request_mock): + stripe.SubscriptionSchedule.retrieve("sub_sched_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", + ) + + def test_subscriptionschedule_update(self, request_mock): + stripe.SubscriptionSchedule.modify( + "sub_sched_xxxxxxxxxxxxx", + end_behavior="release", + ) + request_mock.assert_requested( + "post", + "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx", + ) + + def test_subscriptionschedule_cancel(self, request_mock): + stripe.SubscriptionSchedule.cancel("sub_sched_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/cancel", + ) + + def test_subscriptionschedule_release(self, request_mock): + stripe.SubscriptionSchedule.release("sub_sched_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/release", + ) + + def test_subscriptionschedule_list(self, request_mock): + stripe.SubscriptionSchedule.list(limit=3) + request_mock.assert_requested("get", "/v1/subscription_schedules") + + def test_taxrate_create(self, request_mock): + stripe.TaxRate.create( + display_name="VAT", + description="VAT Germany", + jurisdiction="DE", + percentage=16, + inclusive=False, + ) + request_mock.assert_requested("post", "/v1/tax_rates") + + def test_taxrate_retrieve(self, request_mock): + stripe.TaxRate.retrieve("txr_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/tax_rates/txr_xxxxxxxxxxxxx") + + def test_taxrate_update(self, request_mock): + stripe.TaxRate.modify("txr_xxxxxxxxxxxxx", active=False) + request_mock.assert_requested( + "post", "/v1/tax_rates/txr_xxxxxxxxxxxxx" + ) + + def test_taxrate_list(self, request_mock): + stripe.TaxRate.list(limit=3) + request_mock.assert_requested("get", "/v1/tax_rates") + + def test_account_create(self, request_mock): + stripe.Account.create( + type="custom", + country="US", + email="jenny.rosen@example.com", + capabilities={ + "card_payments": {"requested": True}, + "transfers": {"requested": True}, + }, + ) + request_mock.assert_requested("post", "/v1/accounts") + + def test_account_retrieve(self, request_mock): + stripe.Account.retrieve("acct_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/accounts/acct_xxxxxxxxxxxxx") + + def test_account_update(self, request_mock): + stripe.Account.modify( + "acct_xxxxxxxxxxxxx", metadata={"order_id": "6735"} + ) + request_mock.assert_requested( + "post", "/v1/accounts/acct_xxxxxxxxxxxxx" + ) + + def test_account_delete(self, request_mock): + stripe.Account.delete("acct_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", "/v1/accounts/acct_xxxxxxxxxxxxx" + ) + + def test_account_reject(self, request_mock): + stripe.Account.reject("acct_xxxxxxxxxxxxx", reason="fraud") + request_mock.assert_requested( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/reject", + ) + + def test_account_list(self, request_mock): + stripe.Account.list(limit=3) + request_mock.assert_requested("get", "/v1/accounts") + + def test_accountlink_create(self, request_mock): + stripe.AccountLink.create( + account="acct_xxxxxxxxxxxxx", + refresh_url="https://example.com/reauth", + return_url="https://example.com/return", + type="account_onboarding", + ) + request_mock.assert_requested("post", "/v1/account_links") + + def test_applicationfee_retrieve(self, request_mock): + stripe.ApplicationFee.retrieve("fee_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/application_fees/fee_xxxxxxxxxxxxx", + ) + + def test_applicationfee_list(self, request_mock): + stripe.ApplicationFee.list(limit=3) + request_mock.assert_requested("get", "/v1/application_fees") + + def test_applicationfee_feerefund_retrieve(self, request_mock): + stripe.ApplicationFee.retrieve_refund( + "fee_xxxxxxxxxxxxx", + "fr_xxxxxxxxxxxxx", + ) + request_mock.assert_requested( + "get", + "/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", + ) + + def test_applicationfee_feerefund_update(self, request_mock): + stripe.ApplicationFee.modify_refund( + "fee_xxxxxxxxxxxxx", + "fr_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx", + ) + + def test_account_capability_retrieve(self, request_mock): + stripe.Account.retrieve_capability( + "acct_xxxxxxxxxxxxx", "card_payments" + ) + request_mock.assert_requested( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments", + ) + + def test_account_capability_update(self, request_mock): + stripe.Account.modify_capability( + "acct_xxxxxxxxxxxxx", + "card_payments", + requested=True, + ) + request_mock.assert_requested( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments", + ) + + def test_countryspec_list(self, request_mock): + stripe.CountrySpec.list(limit=3) + request_mock.assert_requested("get", "/v1/country_specs") + + def test_countryspec_retrieve(self, request_mock): + stripe.CountrySpec.retrieve("US") + request_mock.assert_requested("get", "/v1/country_specs/US") + + def test_account_person_retrieve(self, request_mock): + stripe.Account.retrieve_person( + "acct_xxxxxxxxxxxxx", "person_xxxxxxxxxxxxx" + ) + request_mock.assert_requested( + "get", + "/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", + ) + + def test_account_person_update(self, request_mock): + stripe.Account.modify_person( + "acct_xxxxxxxxxxxxx", + "person_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx", + ) + + def test_topup_create(self, request_mock): + stripe.Topup.create( + amount=2000, + currency="usd", + description="Top-up for Jenny Rosen", + statement_descriptor="Top-up", + ) + request_mock.assert_requested("post", "/v1/topups") + + def test_topup_retrieve(self, request_mock): + stripe.Topup.retrieve("tu_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/topups/tu_xxxxxxxxxxxxx") + + def test_topup_update(self, request_mock): + stripe.Topup.modify("tu_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/topups/tu_xxxxxxxxxxxxx") + + def test_topup_list(self, request_mock): + stripe.Topup.list(limit=3) + request_mock.assert_requested("get", "/v1/topups") + + def test_topup_cancel(self, request_mock): + stripe.Topup.cancel("tu_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", "/v1/topups/tu_xxxxxxxxxxxxx/cancel" + ) + + def test_transfer_create(self, request_mock): + stripe.Transfer.create( + amount=400, + currency="usd", + destination="acct_xxxxxxxxxxxxx", + transfer_group="ORDER_95", + ) + request_mock.assert_requested("post", "/v1/transfers") + + def test_transfer_retrieve(self, request_mock): + stripe.Transfer.retrieve("tr_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/transfers/tr_xxxxxxxxxxxxx") + + def test_transfer_update(self, request_mock): + stripe.Transfer.modify( + "tr_xxxxxxxxxxxxx", metadata={"order_id": "6735"} + ) + request_mock.assert_requested("post", "/v1/transfers/tr_xxxxxxxxxxxxx") + + def test_transfer_list(self, request_mock): + stripe.Transfer.list(limit=3) + request_mock.assert_requested("get", "/v1/transfers") + + def test_transfer_transferreversal_retrieve(self, request_mock): + stripe.Transfer.retrieve_reversal( + "tr_xxxxxxxxxxxxx", "trr_xxxxxxxxxxxxx" + ) + request_mock.assert_requested( + "get", + "/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx", + ) + + def test_transfer_transferreversal_update(self, request_mock): + stripe.Transfer.modify_reversal( + "tr_xxxxxxxxxxxxx", + "trr_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx", + ) + + def test_radar_earlyfraudwarning_retrieve(self, request_mock): + stripe.radar.EarlyFraudWarning.retrieve("issfr_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/radar/early_fraud_warnings/issfr_xxxxxxxxxxxxx", + ) + + def test_radar_earlyfraudwarning_list(self, request_mock): + stripe.radar.EarlyFraudWarning.list(limit=3) + request_mock.assert_requested("get", "/v1/radar/early_fraud_warnings") + + def test_review_approve(self, request_mock): + stripe.Review.approve("prv_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/reviews/prv_xxxxxxxxxxxxx/approve", + ) + + def test_review_retrieve(self, request_mock): + stripe.Review.retrieve("prv_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/reviews/prv_xxxxxxxxxxxxx") + + def test_review_list(self, request_mock): + stripe.Review.list(limit=3) + request_mock.assert_requested("get", "/v1/reviews") + + def test_radar_valuelist_create(self, request_mock): + stripe.radar.ValueList.create( + alias="custom_ip_xxxxxxxxxxxxx", + name="Custom IP Blocklist", + item_type="ip_address", + ) + request_mock.assert_requested("post", "/v1/radar/value_lists") + + def test_radar_valuelist_retrieve(self, request_mock): + stripe.radar.ValueList.retrieve("rsl_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", + ) + + def test_radar_valuelist_update(self, request_mock): + stripe.radar.ValueList.modify( + "rsl_xxxxxxxxxxxxx", + name="Updated IP Block List", + ) + request_mock.assert_requested( + "post", + "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", + ) + + def test_radar_valuelist_delete(self, request_mock): + stripe.radar.ValueList.delete("rsl_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", + "/v1/radar/value_lists/rsl_xxxxxxxxxxxxx", + ) + + def test_radar_valuelist_list(self, request_mock): + stripe.radar.ValueList.list(limit=3) + request_mock.assert_requested("get", "/v1/radar/value_lists") + + def test_radar_valuelistitem_create(self, request_mock): + stripe.radar.ValueListItem.create( + value_list="rsl_xxxxxxxxxxxxx", + value="1.2.3.4", + ) + request_mock.assert_requested("post", "/v1/radar/value_list_items") + + def test_radar_valuelistitem_retrieve(self, request_mock): + stripe.radar.ValueListItem.retrieve("rsli_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", + ) + + def test_radar_valuelistitem_delete(self, request_mock): + stripe.radar.ValueListItem.delete("rsli_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", + "/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx", + ) + + def test_radar_valuelistitem_list(self, request_mock): + stripe.radar.ValueListItem.list( + limit=3, value_list="rsl_xxxxxxxxxxxxx" + ) + request_mock.assert_requested("get", "/v1/radar/value_list_items") + + def test_issuing_authorization_retrieve(self, request_mock): + stripe.issuing.Authorization.retrieve("iauth_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", + ) + + def test_issuing_authorization_update(self, request_mock): + stripe.issuing.Authorization.modify( + "iauth_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx", + ) + + def test_issuing_authorization_approve(self, request_mock): + stripe.issuing.Authorization.approve("iauth_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/approve", + ) + + def test_issuing_authorization_decline(self, request_mock): + stripe.issuing.Authorization.decline("iauth_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/decline", + ) + + def test_issuing_authorization_list(self, request_mock): + stripe.issuing.Authorization.list(limit=3) + request_mock.assert_requested("get", "/v1/issuing/authorizations") + + def test_issuing_cardholder_create(self, request_mock): + stripe.issuing.Cardholder.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", + }, + }, + ) + request_mock.assert_requested("post", "/v1/issuing/cardholders") + + def test_issuing_cardholder_retrieve(self, request_mock): + stripe.issuing.Cardholder.retrieve("ich_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", + ) + + def test_issuing_cardholder_update(self, request_mock): + stripe.issuing.Cardholder.modify( + "ich_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/issuing/cardholders/ich_xxxxxxxxxxxxx", + ) + + def test_issuing_cardholder_list(self, request_mock): + stripe.issuing.Cardholder.list(limit=3) + request_mock.assert_requested("get", "/v1/issuing/cardholders") + + def test_issuing_card_create(self, request_mock): + stripe.issuing.Card.create( + cardholder="ich_xxxxxxxxxxxxx", + currency="usd", + type="virtual", + ) + request_mock.assert_requested("post", "/v1/issuing/cards") + + def test_issuing_card_retrieve(self, request_mock): + stripe.issuing.Card.retrieve("ic_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", "/v1/issuing/cards/ic_xxxxxxxxxxxxx" + ) + + def test_issuing_card_update(self, request_mock): + stripe.issuing.Card.modify( + "ic_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", "/v1/issuing/cards/ic_xxxxxxxxxxxxx" + ) + + def test_issuing_card_list(self, request_mock): + stripe.issuing.Card.list(limit=3) + request_mock.assert_requested("get", "/v1/issuing/cards") + + def test_issuing_dispute_create(self, request_mock): + stripe.issuing.Dispute.create( + transaction="ipi_xxxxxxxxxxxxx", + evidence={ + "reason": "fraudulent", + "fraudulent": {"explanation": "Purchase was unrecognized."}, + }, + ) + request_mock.assert_requested("post", "/v1/issuing/disputes") + + def test_issuing_dispute_submit(self, request_mock): + stripe.issuing.Dispute.submit("idp_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/issuing/disputes/idp_xxxxxxxxxxxxx/submit", + ) + + def test_issuing_dispute_retrieve(self, request_mock): + stripe.issuing.Dispute.retrieve("idp_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/issuing/disputes/idp_xxxxxxxxxxxxx", + ) + + def test_issuing_dispute_update(self, request_mock): + stripe.issuing.Dispute.modify( + "idp_xxxxxxxxxxxxx", + evidence={ + "reason": "not_received", + "not_received": { + "expected_at": 1590000000, + "explanation": "", + "product_description": "Baseball cap", + "product_type": "merchandise", + }, + }, + ) + request_mock.assert_requested( + "post", + "/v1/issuing/disputes/idp_xxxxxxxxxxxxx", + ) + + def test_issuing_dispute_list(self, request_mock): + stripe.issuing.Dispute.list(limit=3) + request_mock.assert_requested("get", "/v1/issuing/disputes") + + def test_issuing_transaction_retrieve(self, request_mock): + stripe.issuing.Transaction.retrieve("ipi_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", + ) + + def test_issuing_transaction_update(self, request_mock): + stripe.issuing.Transaction.modify( + "ipi_xxxxxxxxxxxxx", + metadata={"order_id": "6735"}, + ) + request_mock.assert_requested( + "post", + "/v1/issuing/transactions/ipi_xxxxxxxxxxxxx", + ) + + def test_issuing_transaction_list(self, request_mock): + stripe.issuing.Transaction.list(limit=3) + request_mock.assert_requested("get", "/v1/issuing/transactions") + + def test_terminal_connectiontoken_create(self, request_mock): + stripe.terminal.ConnectionToken.create() + request_mock.assert_requested("post", "/v1/terminal/connection_tokens") + + def test_terminal_location_create(self, request_mock): + stripe.terminal.Location.create( + display_name="My First Store", + address={ + "line1": "1234 Main Street", + "city": "San Francisco", + "country": "US", + "postal_code": "94111", + }, + ) + request_mock.assert_requested("post", "/v1/terminal/locations") + + def test_terminal_location_retrieve(self, request_mock): + stripe.terminal.Location.retrieve("tml_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/terminal/locations/tml_xxxxxxxxxxxxx", + ) + + def test_terminal_location_update(self, request_mock): + stripe.terminal.Location.modify( + "tml_xxxxxxxxxxxxx", + display_name="My First Store", + ) + request_mock.assert_requested( + "post", + "/v1/terminal/locations/tml_xxxxxxxxxxxxx", + ) + + def test_terminal_location_delete(self, request_mock): + stripe.terminal.Location.delete("tml_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", + "/v1/terminal/locations/tml_xxxxxxxxxxxxx", + ) + + def test_terminal_location_list(self, request_mock): + stripe.terminal.Location.list(limit=3) + request_mock.assert_requested("get", "/v1/terminal/locations") + + def test_terminal_reader_create(self, request_mock): + stripe.terminal.Reader.create( + registration_code="puppies-plug-could", + label="Blue Rabbit", + location="tml_1234", + ) + request_mock.assert_requested("post", "/v1/terminal/readers") + + def test_terminal_reader_retrieve(self, request_mock): + stripe.terminal.Reader.retrieve("tmr_P400-123-456-789") + request_mock.assert_requested( + "get", + "/v1/terminal/readers/tmr_P400-123-456-789", + ) + + def test_terminal_reader_update(self, request_mock): + stripe.terminal.Reader.modify( + "tmr_P400-123-456-789", label="Blue Rabbit" + ) + request_mock.assert_requested( + "post", + "/v1/terminal/readers/tmr_P400-123-456-789", + ) + + def test_terminal_reader_delete(self, request_mock): + stripe.terminal.Reader.delete("tmr_P400-123-456-789") + request_mock.assert_requested( + "delete", + "/v1/terminal/readers/tmr_P400-123-456-789", + ) + + def test_terminal_reader_list(self, request_mock): + stripe.terminal.Reader.list(limit=3) + request_mock.assert_requested("get", "/v1/terminal/readers") + + def test_order_create(self, request_mock): + stripe.Order.create( + currency="usd", + email="jenny.rosen@example.com", + items=[{"type": "sku", "parent": "sku_xxxxxxxxxxxxx"}], + shipping={ + "name": "Jenny Rosen", + "address": { + "line1": "1234 Main Street", + "city": "San Francisco", + "state": "CA", + "country": "US", + "postal_code": "94111", + }, + }, + ) + request_mock.assert_requested("post", "/v1/orders") + + def test_order_retrieve(self, request_mock): + stripe.Order.retrieve("or_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/orders/or_xxxxxxxxxxxxx") + + def test_order_update(self, request_mock): + stripe.Order.modify("or_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/orders/or_xxxxxxxxxxxxx") + + def test_order_pay(self, request_mock): + stripe.Order.pay("or_xxxxxxxxxxxxx", source="tok_xxxx") + request_mock.assert_requested( + "post", "/v1/orders/or_xxxxxxxxxxxxx/pay" + ) + + def test_order_list(self, request_mock): + stripe.Order.list(limit=3) + request_mock.assert_requested("get", "/v1/orders") + + def test_orderreturn_retrieve(self, request_mock): + stripe.OrderReturn.retrieve("orret_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/order_returns/orret_xxxxxxxxxxxxx", + ) + + def test_orderreturn_list(self, request_mock): + stripe.OrderReturn.list(limit=3) + request_mock.assert_requested("get", "/v1/order_returns") + + def test_sku_create(self, request_mock): + stripe.SKU.create( + attributes={"size": "Medium", "gender": "Unisex"}, + price=1500, + currency="usd", + inventory={"type": "finite", "quantity": 500}, + product="prod_xxxxxxxxxxxxx", + ) + request_mock.assert_requested("post", "/v1/skus") + + def test_sku_retrieve(self, request_mock): + stripe.SKU.retrieve("sku_xxxxxxxxxxxxx") + request_mock.assert_requested("get", "/v1/skus/sku_xxxxxxxxxxxxx") + + def test_sku_update(self, request_mock): + stripe.SKU.modify("sku_xxxxxxxxxxxxx", metadata={"order_id": "6735"}) + request_mock.assert_requested("post", "/v1/skus/sku_xxxxxxxxxxxxx") + + def test_sku_list(self, request_mock): + stripe.SKU.list(limit=3) + request_mock.assert_requested("get", "/v1/skus") + + def test_sku_delete(self, request_mock): + stripe.SKU.delete("sku_xxxxxxxxxxxxx") + request_mock.assert_requested("delete", "/v1/skus/sku_xxxxxxxxxxxxx") + + def test_sigma_scheduledqueryrun_retrieve(self, request_mock): + stripe.sigma.ScheduledQueryRun.retrieve("sqr_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/sigma/scheduled_query_runs/sqr_xxxxxxxxxxxxx", + ) + + def test_sigma_scheduledqueryrun_list(self, request_mock): + stripe.sigma.ScheduledQueryRun.list(limit=3) + request_mock.assert_requested("get", "/v1/sigma/scheduled_query_runs") + + def test_reporting_reportrun_create(self, request_mock): + stripe.reporting.ReportRun.create( + report_type="balance.summary.1", + parameters={ + "interval_start": 1522540800, + "interval_end": 1525132800, + }, + ) + request_mock.assert_requested("post", "/v1/reporting/report_runs") + + def test_reporting_reportrun_retrieve(self, request_mock): + stripe.reporting.ReportRun.retrieve("frr_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/reporting/report_runs/frr_xxxxxxxxxxxxx", + ) + + def test_reporting_reportrun_list(self, request_mock): + stripe.reporting.ReportRun.list(limit=3) + request_mock.assert_requested("get", "/v1/reporting/report_runs") + + def test_reporting_reporttype_retrieve(self, request_mock): + stripe.reporting.ReportType.retrieve("balance.summary.1") + request_mock.assert_requested( + "get", + "/v1/reporting/report_types/balance.summary.1", + ) + + def test_reporting_reporttype_list(self, request_mock): + stripe.reporting.ReportType.list() + request_mock.assert_requested("get", "/v1/reporting/report_types") + + def test_webhookendpoint_create(self, request_mock): + stripe.WebhookEndpoint.create( + url="https://example.com/my/webhook/endpoint", + enabled_events=["charge.failed", "charge.succeeded"], + ) + request_mock.assert_requested("post", "/v1/webhook_endpoints") + + def test_webhookendpoint_retrieve(self, request_mock): + stripe.WebhookEndpoint.retrieve("we_xxxxxxxxxxxxx") + request_mock.assert_requested( + "get", + "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", + ) + + def test_webhookendpoint_update(self, request_mock): + stripe.WebhookEndpoint.modify( + "we_xxxxxxxxxxxxx", + url="https://example.com/new_endpoint", + ) + request_mock.assert_requested( + "post", + "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", + ) + + def test_webhookendpoint_list(self, request_mock): + stripe.WebhookEndpoint.list(limit=3) + request_mock.assert_requested("get", "/v1/webhook_endpoints") + + def test_webhookendpoint_delete(self, request_mock): + stripe.WebhookEndpoint.delete("we_xxxxxxxxxxxxx") + request_mock.assert_requested( + "delete", + "/v1/webhook_endpoints/we_xxxxxxxxxxxxx", + ) + + def test_customer_list_payment_methods(self, request_mock): + stripe.Customer.list_payment_methods("cus_xyz", type="card") + request_mock.assert_requested( + "get", + "/v1/customers/cus_xyz/payment_methods", + ) + + def test_checkout_session_expire(self, request_mock): + stripe.checkout.Session.expire("sess_xyz") + request_mock.assert_requested( + "post", + "/v1/checkout/sessions/sess_xyz/expire", + ) + + def test_shippingrate_create(self, request_mock): + stripe.ShippingRate.create( + display_name="Sample Shipper", + fixed_amount={"currency": "usd", "amount": 400}, + type="fixed_amount", + ) + request_mock.assert_requested("post", "/v1/shipping_rates") + + def test_shippingrate_list(self, request_mock): + stripe.ShippingRate.list() + request_mock.assert_requested("get", "/v1/shipping_rates") + + def test_checkout_session_create2(self, request_mock): + stripe.checkout.Session.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}, + }, + }, + }, + ], + ) + request_mock.assert_requested("post", "/v1/checkout/sessions") + + def test_paymentintent_create2(self, request_mock): + stripe.PaymentIntent.create( + amount=1099, + currency="eur", + automatic_payment_methods={"enabled": True}, + ) + request_mock.assert_requested("post", "/v1/payment_intents") + + def test_paymentlink_create(self, request_mock): + stripe.PaymentLink.create( + line_items=[{"price": "price_xxxxxxxxxxxxx", "quantity": 1}], + ) + request_mock.assert_requested("post", "/v1/payment_links") + + def test_paymentlink_list_line_items(self, request_mock): + stripe.PaymentLink.list_line_items("pl_xyz") + request_mock.assert_requested( + "get", "/v1/payment_links/pl_xyz/line_items" + ) + + def test_paymentlink_retrieve(self, request_mock): + stripe.PaymentLink.retrieve("pl_xyz") + request_mock.assert_requested("get", "/v1/payment_links/pl_xyz") + + def test_paymentintent_verify_microdeposits(self, request_mock): + stripe.PaymentIntent.verify_microdeposits("pi_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits", + ) + def test_setupintent_verify_microdeposits(self, request_mock): + stripe.SetupIntent.verify_microdeposits("seti_xxxxxxxxxxxxx") + request_mock.assert_requested( + "post", + "/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits", + )