Do not use UserCardDetail to save card

This commit is contained in:
PCoder 2021-02-07 15:58:03 +05:30
parent a5c83dd589
commit d46deaa23a

View file

@ -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 = _(