Changed payment error place, changed message source to Stripe errors handler

This commit is contained in:
Siarhei Puhach 2017-08-04 11:01:32 +03:00
parent 34acf2310b
commit 29fb771afb
2 changed files with 18 additions and 16 deletions

View File

@ -427,7 +427,7 @@ class OrderConfirmationView(DetailView):
stripe_utils = StripeUtils()
card_details = stripe_utils.get_card_details(customer.stripe_id, request.session.get('token'))
if not card_details.get('response_object') and not card_details.get('paid'):
msg = _('Currently its not possible to make payments. Please try later.')
msg = card_details.get('error')
messages.add_message(self.request, messages.ERROR, msg, extra_tags='failed_payment')
return HttpResponseRedirect(reverse('datacenterlight:payment'))
context = {

View File

@ -49,15 +49,6 @@
</div>
</div>
</div>
<div class="help-block with-errors">
{% for message in messages %}
{% if 'failed_payment' in message.tags %}
<ul class="list-unstyled"><li>
<p class="alert alert-danger">{{ message|safe }}</p>
</li></ul>
{% endif %}
{% endfor %}
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 dcl-billing-sec">
<div class="col-xs-12 col-sm-5 col-md-6 billing dcl-billing">
@ -139,12 +130,23 @@
<div id="card-errors" role="alert"></div>
<div class="row">
<div class="col-xs-12">
<p class="card-warning-content">
{% blocktrans %}
You are not making any payment yet. After submitting your card
information, you will be taken to the Confirm Order Page.
{% endblocktrans %}
</p>
{% if not messages %}
<p class="card-warning-content">
{% blocktrans %}
You are not making any payment yet. After submitting your card
information, you will be taken to the Confirm Order Page.
{% endblocktrans %}
</p>
{% endif %}
<div class="help-block with-errors">
{% for message in messages %}
{% if 'failed_payment' in message.tags %}
<ul class="list-unstyled"><li>
<p class="alert alert-danger">{{ message|safe }}</p>
</li></ul>
{% endif %}
{% endfor %}
</div>
</div>
<div class="col-xs-12">
<div class="col-xs-6 pull-right">