Add error details to messages datacenterlight landing flow

This commit is contained in:
PCoder 2017-10-29 15:05:32 +01:00
parent bea3477d84
commit abe8c9efa5

View file

@ -610,7 +610,7 @@ class OrderConfirmationView(DetailView):
'card_id': card_details_response['card_id'] 'card_id': card_details_response['card_id']
} }
ucd = UserCardDetail.contains( ucd = UserCardDetail.contains(
request.user.stripecustomer, card_details_dict request.user.stripecustomer, card_details_response
) )
if not ucd: if not ucd:
acc_result = stripe_utils.associate_customer_card( acc_result = stripe_utils.associate_customer_card(
@ -618,6 +618,11 @@ class OrderConfirmationView(DetailView):
set_as_default=True set_as_default=True
) )
if acc_result['response_object'] is None: if acc_result['response_object'] is None:
msg = acc_result.get('error')
messages.add_message(
self.request, messages.ERROR, msg,
extra_tags='failed_payment'
)
response = { response = {
'status': False, 'status': False,
'redirect': "{url}#{section}".format( 'redirect': "{url}#{section}".format(