From 4be105a0a9856e91a75dab9426327d7ecfdd4b01 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sat, 28 Oct 2017 16:48:03 +0200 Subject: [PATCH] Set default card for newly added card in hosting flow --- hosting/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hosting/views.py b/hosting/views.py index 04ae6b3b..b3267fcf 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -915,10 +915,14 @@ class OrdersHostingDetailView(LoginRequiredMixin, json.dumps(response), content_type="application/json" ) if 'token' in request.session: - UserCardDetail.get_or_create_user_card_detail( + ucd = UserCardDetail.get_or_create_user_card_detail( stripe_customer=self.request.user.stripecustomer, card_details=card_details_response ) + ucd.save_default_card( + self.request.user.stripecustomer.stripe_id, + card_details_response['card_id'] + ) user = { 'name': self.request.user.name, 'email': self.request.user.email,