Do not use UserCardDetail to save card
This commit is contained in:
parent
a5c83dd589
commit
d46deaa23a
1 changed files with 29 additions and 31 deletions
|
@ -698,12 +698,10 @@ class SettingsView(LoginRequiredMixin, FormView):
|
||||||
email=request.user.email, id_payment_method=id_payment_method
|
email=request.user.email, id_payment_method=id_payment_method
|
||||||
)
|
)
|
||||||
card = card_details['response_object']
|
card = card_details['response_object']
|
||||||
if UserCardDetail.get_user_card_details(stripe_customer, card):
|
|
||||||
msg = _('You seem to have already added this card')
|
|
||||||
messages.add_message(request, messages.ERROR, msg)
|
|
||||||
else:
|
|
||||||
acc_result = stripe_utils.associate_customer_card(
|
acc_result = stripe_utils.associate_customer_card(
|
||||||
request.user.stripecustomer.stripe_id, id_payment_method
|
request.user.stripecustomer.stripe_id,
|
||||||
|
id_payment_method,
|
||||||
|
set_as_default=True
|
||||||
)
|
)
|
||||||
if acc_result['response_object'] is None:
|
if acc_result['response_object'] is None:
|
||||||
msg = _(
|
msg = _(
|
||||||
|
|
Loading…
Reference in a new issue