Commit b36afcb8 authored by PCoder's avatar PCoder

Simplify code for logged in one-time payments with SCA

parent a823efd8
......@@ -469,34 +469,9 @@ class PaymentOrderView(FormView):
return self.render_to_response(context)
id_payment_method = self.request.POST.get('id_payment_method',
if id_payment_method is None:
card_id = address_form.cleaned_data.get('card')
logger.debug("token is empty and card_id is %s" % card_id)
user_card_detail = UserCardDetail.objects.get(id=card_id)
if not request.user.has_perm(
'view_usercarddetail', user_card_detail
raise UserCardDetail.DoesNotExist(
_("{user} does not have permission to access the "
except UserCardDetail.DoesNotExist as e:
ex = str(e)
logger.error("Card Id: {card_id}, Exception: {ex}".format(
card_id=card_id, ex=ex
msg = _("An error occurred. Details: {}".format(ex))
self.request, messages.ERROR, msg,
return HttpResponseRedirect(
reverse('datacenterlight:payment') + '#payment_error'
request.session['card_id'] =
if id_payment_method == 'undefined':
# Probably user chose one of the previously saved cards
id_payment_method = address_form.cleaned_data.get('card')
request.session["id_payment_method"] = id_payment_method
logger.debug("id_payment_method is %s" % id_payment_method)
if request.user.is_authenticated():
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment