diff --git a/stripe/api_resources/refund.py b/stripe/api_resources/refund.py index 40d393928..bd0fbe9cd 100644 --- a/stripe/api_resources/refund.py +++ b/stripe/api_resources/refund.py @@ -2,12 +2,15 @@ from __future__ import absolute_import, division, print_function from stripe import util +from stripe.api_resources.abstract import APIResourceTestHelpers from stripe.api_resources.abstract import CreateableAPIResource from stripe.api_resources.abstract import ListableAPIResource from stripe.api_resources.abstract import UpdateableAPIResource from stripe.api_resources.abstract import custom_method +from stripe.api_resources.abstract import test_helpers +@test_helpers @custom_method("cancel", http_verb="post") class Refund( CreateableAPIResource, ListableAPIResource, UpdateableAPIResource @@ -19,3 +22,13 @@ def cancel(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + @custom_method("expire", http_verb="post") + class TestHelpers(APIResourceTestHelpers): + def expire(self, idempotency_key=None, **params): + url = self.instance_url() + "/expire" + headers = util.populate_headers(idempotency_key) + self.resource.refresh_from( + self.resource.request("post", url, params, headers) + ) + return self.resource diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index 48628c232..b27867328 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -1710,3 +1710,10 @@ def test_terminal_configuration_delete(self, request_mock): "delete", "/v1/terminal/configurations/uc_123", ) + + def test_refund_expire(self, request_mock): + stripe.Refund.TestHelpers.expire("re_123") + request_mock.assert_requested( + "post", + "/v1/test_helpers/refunds/re_123/expire", + )