diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 515f433c0..1f7b99f73 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v161 \ No newline at end of file +v163 \ No newline at end of file diff --git a/stripe/api_resources/credit_note.py b/stripe/api_resources/credit_note.py index 27b46775e..01d2b0a15 100644 --- a/stripe/api_resources/credit_note.py +++ b/stripe/api_resources/credit_note.py @@ -17,14 +17,6 @@ class CreditNote( ): OBJECT_NAME = "credit_note" - def void_credit_note(self, idempotency_key=None, **params): - url = "/v1/credit_notes/{id}/void".format( - id=util.sanitize_id(self.get("id")) - ) - 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 @@ -32,8 +24,17 @@ def preview( requestor = api_requestor.APIRequestor( api_key, api_version=stripe_version, account=stripe_account ) - url = cls.class_url() + "/preview" + url = "/v1/credit_notes/preview" response, api_key = requestor.request("get", url, params) - return util.convert_to_stripe_object( + stripe_object = util.convert_to_stripe_object( response, api_key, stripe_version, stripe_account ) + return stripe_object + + def void_credit_note(self, idempotency_key=None, **params): + url = "/v1/credit_notes/{id}/void".format( + id=util.sanitize_id(self.get("id")) + ) + headers = util.populate_headers(idempotency_key) + self.refresh_from(self.request("post", url, params, headers)) + return self diff --git a/stripe/api_version.py b/stripe/api_version.py index 63fc38ee7..ec664eb6b 100644 --- a/stripe/api_version.py +++ b/stripe/api_version.py @@ -2,4 +2,4 @@ class _ApiVersion: - CURRENT = "2020-08-27" + CURRENT = "2020-08-27; server_side_confirmation_beta=v1" diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index 89d2e51fa..422396a48 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -147,6 +147,10 @@ def test_financial_connections_session_retrieve(self, request_mock): "/v1/financial_connections/sessions/fcsess_xyz", ) + def test_invoice_upcoming(self, request_mock): + stripe.Invoice.upcoming(customer="cus_9utnxg47pWjV1e") + request_mock.assert_requested("get", "/v1/invoices/upcoming") + def test_order_create(self, request_mock): stripe.Order.create( description="description", @@ -210,6 +214,19 @@ def test_paymentlink_list_line_items(self, request_mock): "get", "/v1/payment_links/pl_xyz/line_items" ) + def test_price_create(self, request_mock): + stripe.Price.create( + unit_amount=2000, + currency="usd", + currency_options={ + "uah": {"unit_amount": 5000}, + "eur": {"unit_amount": 1800}, + }, + recurring={"interval": "month"}, + product="prod_xxxxxxxxxxxxx", + ) + request_mock.assert_requested("post", "/v1/prices") + def test_setupattempt_list(self, request_mock): stripe.SetupAttempt.list(limit=3, setup_intent="si_xyz") request_mock.assert_requested("get", "/v1/setup_attempts") @@ -736,6 +753,19 @@ def test_creditnote_void_credit_note(self, request_mock): "/v1/credit_notes/cn_xxxxxxxxxxxxx/void", ) + def test_creditnote_preview(self, request_mock): + stripe.CreditNote.preview( + invoice="in_xxxxxxxxxxxxx", + lines=[ + { + "type": "invoice_line_item", + "invoice_line_item": "il_xxxxxxxxxxxxx", + "quantity": 1, + }, + ], + ) + request_mock.assert_requested("get", "/v1/credit_notes/preview") + def test_customer_list(self, request_mock): stripe.Customer.list(limit=3) request_mock.assert_requested("get", "/v1/customers") @@ -1429,7 +1459,7 @@ def test_price_list(self, request_mock): stripe.Price.list(limit=3) request_mock.assert_requested("get", "/v1/prices") - def test_price_create(self, request_mock): + def test_price_create2(self, request_mock): stripe.Price.create( unit_amount=2000, currency="usd",