Rearrange code

This commit is contained in:
PCoder 2017-10-29 21:41:54 +01:00
parent af1690b846
commit 618d0004f2

View file

@ -451,12 +451,11 @@ class PaymentOrderView(FormView):
user_card_detail = UserCardDetail.objects.get( user_card_detail = UserCardDetail.objects.get(
id=card_id) id=card_id)
if not request.user.has_perm( if not request.user.has_perm(
'view_usercarddetail', user_card_detail 'view_usercarddetail', user_card_detail
): ):
raise UserCardDetail.DoesNotExist( raise UserCardDetail.DoesNotExist(
_( _("{user} does not have permission to access"
"{user} does not have permission to access the " " the card").format(user=request.user.email)
"card").format(user=request.user.email)
) )
except UserCardDetail.DoesNotExist as e: except UserCardDetail.DoesNotExist as e:
ex = str(e) ex = str(e)
@ -496,9 +495,9 @@ class PaymentOrderView(FormView):
) )
) )
customer = StripeCustomer.create_stripe_api_customer( customer = StripeCustomer.create_stripe_api_customer(
email=user_email, email=user_email, token=token,
token=token, customer_name=user_name
customer_name=user_name) )
except CustomUser.DoesNotExist: except CustomUser.DoesNotExist:
logger.debug( logger.debug(
("StripeCustomer does not exist for {email}." ("StripeCustomer does not exist for {email}."
@ -597,8 +596,8 @@ class OrderConfirmationView(DetailView):
'msg_title': str(_('Error.')), 'msg_title': str(_('Error.')),
'msg_body': str( 'msg_body': str(
_('There was a payment related error.' _('There was a payment related error.'
' On close of this popup, you will be redirected back to' ' On close of this popup, you will be redirected '
' the payment page.')) 'back to the payment page.'))
} }
return HttpResponse(json.dumps(response), return HttpResponse(json.dumps(response),
content_type="application/json") content_type="application/json")