Redirect to product page on error

This commit is contained in:
PCoder 2018-10-05 11:10:10 +02:00
parent 10dab1350a
commit 2b7d4bbef5

View file

@ -398,7 +398,8 @@ class PaymentOrderView(FormView):
"description": generic_payment_form.cleaned_data.get( "description": generic_payment_form.cleaned_data.get(
'description' 'description'
), ),
"product_id": product.id "product_id": product.id,
"product_slug": product.product_slug
} }
request.session["generic_payment_details"] = ( request.session["generic_payment_details"] = (
gp_details gp_details
@ -570,7 +571,12 @@ class OrderConfirmationView(DetailView):
response = { response = {
'status': False, 'status': False,
'redirect': "{url}#{section}".format( 'redirect': "{url}#{section}".format(
url=reverse('datacenterlight:payment'), url=(reverse('show_product', kwargs={
'product_slug': kwargs['product_slug']}
) if 'generic_payment_details' in
request.session else
reverse('datacenterlight:payment')
),
section='payment_error'), section='payment_error'),
'msg_title': str(_('Error.')), 'msg_title': str(_('Error.')),
'msg_body': str( 'msg_body': str(
@ -609,7 +615,12 @@ class OrderConfirmationView(DetailView):
response = { response = {
'status': False, 'status': False,
'redirect': "{url}#{section}".format( 'redirect': "{url}#{section}".format(
url=reverse('hosting:payment'), url=(reverse('show_product', kwargs={
'product_slug': kwargs['product_slug']}
) if 'generic_payment_details' in
request.session else
reverse('datacenterlight:payment')
),
section='payment_error'), section='payment_error'),
'msg_title': str(_('Error.')), 'msg_title': str(_('Error.')),
'msg_body': str( 'msg_body': str(
@ -664,8 +675,12 @@ class OrderConfirmationView(DetailView):
response = { response = {
'status': False, 'status': False,
'redirect': "{url}#{section}".format( 'redirect': "{url}#{section}".format(
url=(reverse('datacenterlight:payment') + url=(reverse('show_product', kwargs={
"?type=generic"), 'product_slug': kwargs['product_slug']}
) if 'generic_payment_details' in
request.session else
reverse('datacenterlight:payment')
),
section='payment_error'), section='payment_error'),
'msg_title': str(_('Error.')), 'msg_title': str(_('Error.')),
'msg_body': str( 'msg_body': str(
@ -736,7 +751,12 @@ class OrderConfirmationView(DetailView):
response = { response = {
'status': False, 'status': False,
'redirect': "{url}#{section}".format( 'redirect': "{url}#{section}".format(
url=reverse('datacenterlight:payment'), url=(reverse('show_product', kwargs={
'product_slug': kwargs['product_slug']}
) if 'generic_payment_details' in
request.session else
reverse('datacenterlight:payment')
),
section='payment_error'), section='payment_error'),
'msg_title': str(_('Error.')), 'msg_title': str(_('Error.')),
'msg_body': str( 'msg_body': str(