From 71a8dca1af48be9acded504ab5b8827ccf1990d6 Mon Sep 17 00:00:00 2001 From: Bharat Chauhan Date: Tue, 19 Apr 2022 22:42:17 +0530 Subject: [PATCH] Add support for PaymentIntent.increment_authorization mehtod --- async_stripe/api_resources/payment_intent.py | 9 +++++++++ tests/api_resources/test_payment_intent.py | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/async_stripe/api_resources/payment_intent.py b/async_stripe/api_resources/payment_intent.py index 5e03153..f69ff65 100644 --- a/async_stripe/api_resources/payment_intent.py +++ b/async_stripe/api_resources/payment_intent.py @@ -38,11 +38,19 @@ async def apply_customer_balance_patch(self, idempotency_key=None, **params): return self +async def increment_authorization_patch(self, idempotency_key=None, **params): + url = self.instance_url() + "/increment_authorization" + headers = util.populate_headers(idempotency_key) + self.refresh_from(await self.request("post", url, params, headers)) + return self + + stripe.PaymentIntent.cancel = cancel_patch stripe.PaymentIntent.capture = capture_patch stripe.PaymentIntent.confirm = confirm_patch stripe.PaymentIntent.verify_microdeposits = verify_microdeposits_patch stripe.PaymentIntent.apply_customer_balance = apply_customer_balance_patch +stripe.PaymentIntent.increment_authorization = increment_authorization_patch custom_resources = [ @@ -51,5 +59,6 @@ async def apply_customer_balance_patch(self, idempotency_key=None, **params): {"name": "confirm", "http_verb": "post"}, {"name": "verify_microdeposits", "http_verb": "post"}, {"name": "apply_customer_balance", "http_verb": "post"}, + {"name": "increment_authorization", "http_verb": "post"}, ] patch_custom_methods(stripe.PaymentIntent, custom_resources) diff --git a/tests/api_resources/test_payment_intent.py b/tests/api_resources/test_payment_intent.py index caadb43..443521e 100644 --- a/tests/api_resources/test_payment_intent.py +++ b/tests/api_resources/test_payment_intent.py @@ -128,3 +128,10 @@ async def test_paymentintent_apply_customer_balance(self, request_mock): "post", "/v1/payment_intents/pi_xxxxxxxxxxxxx/apply_customer_balance" ) + + async def test_paymentintent_increment_authorization(self, request_mock): + await stripe.PaymentIntent.increment_authorization("pi_xxxxxxxxxxxxx", amount=100) + request_mock.assert_requested( + "post", + "/v1/payment_intents/pi_xxxxxxxxxxxxx/increment_authorization" + )