Added error hash in url, added payment error handler to hosting/views
This commit is contained in:
parent
4cd3d6a4aa
commit
a71ccbc566
3 changed files with 37 additions and 35 deletions
|
|
@ -557,15 +557,12 @@ class PaymentVMView(LoginRequiredMixin, FormView):
|
|||
stripe_utils = StripeUtils()
|
||||
charge_response = stripe_utils.make_charge(amount=final_price,
|
||||
customer=customer.stripe_id)
|
||||
charge = charge_response.get('response_object')
|
||||
|
||||
# Check if the payment was approved
|
||||
if not charge:
|
||||
context.update({
|
||||
'paymentError': charge_response.get('error'),
|
||||
'form': form
|
||||
})
|
||||
return render(request, self.template_name, context)
|
||||
if not charge_response.get('response_object') and not charge_response.get('paid'):
|
||||
msg = charge_response.get('error')
|
||||
messages.add_message(self.request, messages.ERROR, msg, extra_tags='make_charge_error')
|
||||
return HttpResponseRedirect(reverse('hosting:payment') + '#hosting_payment_error')
|
||||
|
||||
charge = charge_response.get('response_object')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue