Set default card for newly added card in hosting flow

This commit is contained in:
PCoder 2017-10-28 16:48:03 +02:00
parent a17a5f66bc
commit 4be105a0a9

View file

@ -915,10 +915,14 @@ class OrdersHostingDetailView(LoginRequiredMixin,
json.dumps(response), content_type="application/json" json.dumps(response), content_type="application/json"
) )
if 'token' in request.session: 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, stripe_customer=self.request.user.stripecustomer,
card_details=card_details_response card_details=card_details_response
) )
ucd.save_default_card(
self.request.user.stripecustomer.stripe_id,
card_details_response['card_id']
)
user = { user = {
'name': self.request.user.name, 'name': self.request.user.name,
'email': self.request.user.email, 'email': self.request.user.email,