From c48ecd78fd16cc665efb2a67c313749b7fc188e8 Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Tue, 5 Nov 2019 19:29:11 -0800 Subject: [PATCH] Add support for `Mandate` --- .travis.yml | 2 +- stripe/api_resources/__init__.py | 1 + stripe/api_resources/mandate.py | 6 ++++++ stripe/object_classes.py | 1 + tests/api_resources/test_mandate.py | 15 +++++++++++++++ tests/conftest.py | 2 +- 6 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 stripe/api_resources/mandate.py create mode 100644 tests/api_resources/test_mandate.py diff --git a/.travis.yml b/.travis.yml index 3abd3f669..620342d66 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ cache: env: global: # If changing this number, please also change it in `tests/conftest.py`. - - STRIPE_MOCK_VERSION=0.63.0 + - STRIPE_MOCK_VERSION=0.72.0 before_install: # Unpack and start stripe-mock so that the test suite can talk to it diff --git a/stripe/api_resources/__init__.py b/stripe/api_resources/__init__.py index 21d381c6d..ee000ba29 100644 --- a/stripe/api_resources/__init__.py +++ b/stripe/api_resources/__init__.py @@ -45,6 +45,7 @@ from stripe.api_resources.invoice_line_item import InvoiceLineItem from stripe.api_resources.issuer_fraud_record import IssuerFraudRecord from stripe.api_resources.login_link import LoginLink +from stripe.api_resources.mandate import Mandate from stripe.api_resources.order import Order from stripe.api_resources.order_return import OrderReturn from stripe.api_resources.payment_intent import PaymentIntent diff --git a/stripe/api_resources/mandate.py b/stripe/api_resources/mandate.py new file mode 100644 index 000000000..3ca6ded59 --- /dev/null +++ b/stripe/api_resources/mandate.py @@ -0,0 +1,6 @@ +from __future__ import absolute_import, division, print_function + +from stripe.api_resources.abstract import APIResource + +class Mandate(APIResource): + OBJECT_NAME = "mandate" diff --git a/stripe/object_classes.py b/stripe/object_classes.py index e414145ce..bca415323 100644 --- a/stripe/object_classes.py +++ b/stripe/object_classes.py @@ -45,6 +45,7 @@ api_resources.issuing.Dispute.OBJECT_NAME: api_resources.issuing.Dispute, api_resources.issuing.Transaction.OBJECT_NAME: api_resources.issuing.Transaction, api_resources.LoginLink.OBJECT_NAME: api_resources.LoginLink, + api_resources.Mandate.OBJECT_NAME: api_resources.Mandate, api_resources.Order.OBJECT_NAME: api_resources.Order, api_resources.OrderReturn.OBJECT_NAME: api_resources.OrderReturn, api_resources.PaymentIntent.OBJECT_NAME: api_resources.PaymentIntent, diff --git a/tests/api_resources/test_mandate.py b/tests/api_resources/test_mandate.py new file mode 100644 index 000000000..6a36e7e70 --- /dev/null +++ b/tests/api_resources/test_mandate.py @@ -0,0 +1,15 @@ +from __future__ import absolute_import, division, print_function + +import stripe + + +TEST_RESOURCE_ID = "mandate_123" + + +class TestMandateSchedule(object): + def test_is_retrievable(self, request_mock): + resource = stripe.Mandate.retrieve(TEST_RESOURCE_ID) + request_mock.assert_requested( + "get", "/v1/mandates/%s" % TEST_RESOURCE_ID + ) + assert isinstance(resource, stripe.Mandate) diff --git a/tests/conftest.py b/tests/conftest.py index eb0f3783a..6b8aac574 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.63.0" +MOCK_MINIMUM_VERSION = "0.72.0" # Starts stripe-mock if an OpenAPI spec override is found in `openapi/`, and # otherwise fall back to `STRIPE_MOCK_PORT` or 12111.