diff --git a/.travis.yml b/.travis.yml index 3b8249930..7951391ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ cache: env: global: # If changing this number, please also change it in `tests/conftest.py`. - - STRIPE_MOCK_VERSION=0.99.0 + - STRIPE_MOCK_VERSION=0.101.0 before_install: # Unpack and start stripe-mock so that the test suite can talk to it diff --git a/stripe/api_resources/payout.py b/stripe/api_resources/payout.py index fc69e4fa0..370bf8d39 100644 --- a/stripe/api_resources/payout.py +++ b/stripe/api_resources/payout.py @@ -8,6 +8,7 @@ @custom_method("cancel", http_verb="post") +@custom_method("reverse", http_verb="post") class Payout( CreateableAPIResource, ListableAPIResource, UpdateableAPIResource ): @@ -18,3 +19,9 @@ def cancel(self, idempotency_key=None, **params): headers = util.populate_headers(idempotency_key) self.refresh_from(self.request("post", url, params, headers)) return self + + def reverse(self, idempotency_key=None, **params): + url = self.instance_url() + "/reverse" + headers = util.populate_headers(idempotency_key) + self.refresh_from(self.request("post", url, params, headers)) + return self diff --git a/tests/api_resources/test_payout.py b/tests/api_resources/test_payout.py index e01f763cf..0ca35c1ea 100644 --- a/tests/api_resources/test_payout.py +++ b/tests/api_resources/test_payout.py @@ -56,3 +56,18 @@ def test_can_cancel_classmethod(self, request_mock): "post", "/v1/payouts/%s/cancel" % TEST_RESOURCE_ID ) assert isinstance(resource, stripe.Payout) + + def test_can_reverse(self, request_mock): + payout = stripe.Payout.retrieve(TEST_RESOURCE_ID) + resource = payout.reverse() + request_mock.assert_requested( + "post", "/v1/payouts/%s/reverse" % TEST_RESOURCE_ID + ) + assert isinstance(resource, stripe.Payout) + + def test_can_reverse_classmethod(self, request_mock): + resource = stripe.Payout.reverse(TEST_RESOURCE_ID) + request_mock.assert_requested( + "post", "/v1/payouts/%s/reverse" % TEST_RESOURCE_ID + ) + assert isinstance(resource, stripe.Payout) diff --git a/tests/conftest.py b/tests/conftest.py index 012b6b28d..391b7dabe 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -16,7 +16,7 @@ # When changing this number, don't forget to change it in `.travis.yml` too. -MOCK_MINIMUM_VERSION = "0.99.0" +MOCK_MINIMUM_VERSION = "0.101.0" # Starts stripe-mock if an OpenAPI spec override is found in `openapi/`, and # otherwise fall back to `STRIPE_MOCK_PORT` or 12111.