From 03a54c2823504c8f8849ba9349141015020b94d4 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Thu, 11 Nov 2021 12:42:37 -0500 Subject: [PATCH 1/2] Codegen for openapi 21065d4 --- stripe/api_resources/checkout/session.py | 9 +++++++++ tests/test_generated_examples.py | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/stripe/api_resources/checkout/session.py b/stripe/api_resources/checkout/session.py index 2d23f6fe0..9a900777a 100644 --- a/stripe/api_resources/checkout/session.py +++ b/stripe/api_resources/checkout/session.py @@ -1,11 +1,20 @@ # File generated from our OpenAPI spec from __future__ import absolute_import, division, print_function +from stripe import util from stripe.api_resources.abstract import CreateableAPIResource from stripe.api_resources.abstract import ListableAPIResource +from stripe.api_resources.abstract import custom_method from stripe.api_resources.abstract import nested_resource_class_methods +@custom_method("expire", http_verb="post") @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/tests/test_generated_examples.py b/tests/test_generated_examples.py index 2422fdbaa..2e0c99923 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -1562,3 +1562,10 @@ def test_customer_list_payment_methods(self, request_mock): "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", + ) From 62e94a082b378573d45a989c6e685f2dd649b1c2 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Thu, 11 Nov 2021 15:19:47 -0500 Subject: [PATCH 2/2] Update black --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index bd1f21fa0..e6a1bdd6c 100644 --- a/tox.ini +++ b/tox.ini @@ -37,7 +37,7 @@ passenv = LDFLAGS CFLAGS [testenv:fmt] description = run code formatting using black basepython = python3.9 -deps = black==20.8b1 +deps = black==21.10b0 commands = black . {posargs} skip_install = true