Fixed checking active status of subscription + redirection to payment page on error
This commit is contained in:
parent
506b5a904a
commit
83df42b5df
1 changed files with 4 additions and 6 deletions
|
@ -467,12 +467,10 @@ class OrderConfirmationView(DetailView):
|
||||||
'response_object').stripe_plan_id}])
|
'response_object').stripe_plan_id}])
|
||||||
response_object = subscription_result.get('response_object')
|
response_object = subscription_result.get('response_object')
|
||||||
# Check if the subscription was approved and is active
|
# Check if the subscription was approved and is active
|
||||||
if response_object is None or response_object.status is not 'active':
|
if response_object is None or response_object.status != 'active':
|
||||||
context = {}
|
msg = subscription_result.get('error')
|
||||||
context.update({
|
messages.add_message(self.request, messages.ERROR, msg, extra_tags='failed_payment')
|
||||||
'paymentError': response_object.get('error')
|
return HttpResponseRedirect(reverse('datacenterlight:payment') + '#payment_error')
|
||||||
})
|
|
||||||
return render(request, self.payment_template_name, context)
|
|
||||||
create_vm_task.delay(vm_template_id, user, specs, template, stripe_customer_id, billing_address_data,
|
create_vm_task.delay(vm_template_id, user, specs, template, stripe_customer_id, billing_address_data,
|
||||||
billing_address_id,
|
billing_address_id,
|
||||||
response_object)
|
response_object)
|
||||||
|
|
Loading…
Reference in a new issue