Skip to content

Commit

Permalink
Add support for expire method on resource Checkout.Session
Browse files Browse the repository at this point in the history
  • Loading branch information
bhch committed Nov 24, 2021
1 parent 60ab3e4 commit 290cba9
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions async_stripe/api_resources/checkout/session.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
import stripe
from async_stripe.api_resources.abstract import patch_nested_resources
from stripe import util
from async_stripe.api_resources.abstract import patch_custom_methods, patch_nested_resources


nested_resources = ["line_item"]
async def expire_patch(self, idempotency_key=None, **params):
url = self.instance_url() + "/expire"
headers = util.populate_headers(idempotency_key)
self.refresh_from(await self.request("post", url, params, headers))
return self


stripe.checkout.Session.expire = expire_patch


custom_resources = [
{"name": "expire", "http_verb": "post"},
]
patch_custom_methods(stripe.checkout.Session, custom_resources)


nested_resources = ["line_item"]
patch_nested_resources(stripe.checkout.Session, nested_resources)

0 comments on commit 290cba9

Please sign in to comment.