Skip to content

Commit

Permalink
API Updates (#745)
Browse files Browse the repository at this point in the history
* Codegen for openapi 21065d4

* Update black
  • Loading branch information
richardm-stripe authored Nov 11, 2021
1 parent f7e16fe commit f7bde48
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions stripe/api_resources/checkout/session.py
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions tests/test_generated_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f7bde48

Please sign in to comment.