diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 10e2d791..7dd2a76f 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -426,6 +426,10 @@ class OrderConfirmationView(DetailView): customer = StripeCustomer.objects.filter(id=stripe_customer_id).first() 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.') + messages.add_message(self.request, messages.ERROR, msg, extra_tags='failed_payment') + return HttpResponseRedirect(reverse('datacenterlight:payment')) context = { 'site_url': reverse('datacenterlight:index'), 'cc_last4': card_details.get('response_object').get('last4'), diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html index d03713c1..5ef7f1ce 100644 --- a/hosting/templates/hosting/payment.html +++ b/hosting/templates/hosting/payment.html @@ -49,6 +49,15 @@ +
+ {% for message in messages %} + {% if 'failed_payment' in message.tags %} + + {% endif %} + {% endfor %} +