From c3a2e9507181afef1ff59e782ca1c261a8a5f4a6 Mon Sep 17 00:00:00 2001 From: Jerome Leclanche Date: Tue, 9 Jan 2018 01:21:11 +0200 Subject: [PATCH] Revert "Fix SubscriptionRestView with Django Rest Framework 3.7.x" This reverts commit 89841c66a03e2dca183da376fb3e8b69b22c25d2. --- djstripe/contrib/rest_framework/views.py | 6 +----- tests/test_contrib/test_views.py | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/djstripe/contrib/rest_framework/views.py b/djstripe/contrib/rest_framework/views.py index defb3ece36..e7750560a0 100644 --- a/djstripe/contrib/rest_framework/views.py +++ b/djstripe/contrib/rest_framework/views.py @@ -52,13 +52,9 @@ def post(self, request, **kwargs): subscriber=subscriber_request_callback(self.request) ) customer.add_card(serializer.data["stripe_token"]) - charge_immediately = serializer.data.get("charge_immediately") - if charge_immediately is None: - charge_immediately = True - customer.subscribe( serializer.data["plan"], - charge_immediately + serializer.data.get("charge_immediately", True) ) return Response(serializer.data, status=status.HTTP_201_CREATED) except Exception: diff --git a/tests/test_contrib/test_views.py b/tests/test_contrib/test_views.py index f173cb7645..6d93f62ecf 100644 --- a/tests/test_contrib/test_views.py +++ b/tests/test_contrib/test_views.py @@ -60,7 +60,6 @@ def test_create_subscription(self, add_card_mock, subscribe_mock): add_card_mock.assert_called_once_with(customer, "cake") subscribe_mock.assert_called_once_with(customer, "test0", True) self.assertEqual(response.status_code, status.HTTP_201_CREATED) - data["charge_immediately"] = None self.assertEqual(response.data, data) @patch("djstripe.models.Customer.subscribe", autospec=True)