Skip to content

Commit

Permalink
Revert "Fix SubscriptionRestView with Django Rest Framework 3.7.x"
Browse files Browse the repository at this point in the history
This reverts commit 89841c6.
  • Loading branch information
jleclanche committed Jan 8, 2018
1 parent 5c17e60 commit c3a2e95
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
6 changes: 1 addition & 5 deletions djstripe/contrib/rest_framework/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion tests/test_contrib/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c3a2e95

Please sign in to comment.