From 030a0cd501a2d9929f55fe8723ee061a1b012e2e Mon Sep 17 00:00:00 2001 From: Amal Elshihaby Date: Mon, 2 Aug 2021 11:24:19 +0200 Subject: [PATCH] Implement the Success page of the order --- .../static/matrixhosting/js/order.js | 7 +- .../static/matrixhosting/js/payment.js | 2 +- .../matrixhosting/includes/_navbar.html | 8 +- .../templates/matrixhosting/invoice.html | 49 +++++++ .../matrixhosting/order_confirmation.html | 17 +-- .../matrixhosting/order_details.html | 4 +- .../matrixhosting/order_success.html | 56 ++++++++ .../templates/matrixhosting/payments.html | 124 ++++++++++++++++++ matrixhosting/urls.py | 5 +- matrixhosting/utils.py | 19 +++ matrixhosting/views.py | 81 ++++++++---- requirements.txt | 1 + uncloud_pay/models.py | 2 +- 13 files changed, 328 insertions(+), 47 deletions(-) create mode 100644 matrixhosting/templates/matrixhosting/invoice.html create mode 100644 matrixhosting/templates/matrixhosting/order_success.html create mode 100644 matrixhosting/templates/matrixhosting/payments.html create mode 100644 matrixhosting/utils.py diff --git a/matrixhosting/static/matrixhosting/js/order.js b/matrixhosting/static/matrixhosting/js/order.js index f910ba4..abf1973 100644 --- a/matrixhosting/static/matrixhosting/js/order.js +++ b/matrixhosting/static/matrixhosting/js/order.js @@ -26,9 +26,10 @@ $( document ).ready(function() { } else { // The payment has succeeded // Display a success message - modal_btn.attr('href', data.redirect).removeClass('sr-only sr-only-focusable'); - $('#createvm-modal-title').text("Order Succeeded"); - $('#createvm-modal-body').html("Order has been added and the instance will be ready soon"); + window.location.href = '/order/success/'; + // modal_btn.attr('href', data.redirect).removeClass('sr-only sr-only-focusable'); + // $('#createvm-modal-title').text("Order Succeeded"); + // $('#createvm-modal-body').html("Order has been added and the instance will be ready soon"); } } }); diff --git a/matrixhosting/static/matrixhosting/js/payment.js b/matrixhosting/static/matrixhosting/js/payment.js index dd4f70d..14d806e 100644 --- a/matrixhosting/static/matrixhosting/js/payment.js +++ b/matrixhosting/static/matrixhosting/js/payment.js @@ -10,7 +10,7 @@ function setBrandIcon(brand) { $(document).ready(function () { var hasCreditcard = window.hasCreditcard || false; - if (!hasCreditcard && window.stripeKey) { + if (hasCreditcard && window.stripeKey) { var stripe = Stripe(window.stripeKey); if (window.pm_id == undefined) { var element_style = { diff --git a/matrixhosting/templates/matrixhosting/includes/_navbar.html b/matrixhosting/templates/matrixhosting/includes/_navbar.html index 9c11b8b..4aa8c71 100644 --- a/matrixhosting/templates/matrixhosting/includes/_navbar.html +++ b/matrixhosting/templates/matrixhosting/includes/_navbar.html @@ -16,16 +16,18 @@ + {% url 'matrix:index' as index_url %} + {% url 'matrix:payments' as payments_url %}