From cc5eaa40472b73f9931d050858141bbf82e80dce Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Fri, 1 Sep 2017 23:06:57 +0530 Subject: [PATCH] new template for datacenterlight/payment --- .../datacenterlight/landing_payment.html | 217 ++++++++++++++++++ datacenterlight/views.py | 6 +- 2 files changed, 220 insertions(+), 3 deletions(-) create mode 100644 datacenterlight/templates/datacenterlight/landing_payment.html diff --git a/datacenterlight/templates/datacenterlight/landing_payment.html b/datacenterlight/templates/datacenterlight/landing_payment.html new file mode 100644 index 00000000..f4974a56 --- /dev/null +++ b/datacenterlight/templates/datacenterlight/landing_payment.html @@ -0,0 +1,217 @@ +{% extends "hosting/base_short.html" %} +{% load staticfiles bootstrap3 i18n %} + +{% block navbar %} + {% include "datacenterlight/includes/_navbar.html" %} +{% endblock navbar %} + +{% block content %} + + +
+
+
+
+

{%trans "Your Order" %}

+
+
+ {%trans "Cores" %} +
+
+ {%trans "Memory" %} +
+
+ {%trans "Disk space" %} +
+
+ {%trans "Configuration" %} +
+
+
+
+ {{request.session.specs.cpu|floatformat}} +
+
+ {{request.session.specs.memory|floatformat}} GB +
+
+ {{request.session.specs.disk_size|floatformat}} GB +
+
+ {{request.session.template.name}} +
+
+
+
+ {%trans "Total" %} {%trans "including VAT" %} +
+
+
+
{{request.session.specs.price}} + CHF/{% trans "Month" %} +
+
+
+
+
+
+
+
+

{%trans "Billing Address"%}

+
+
+ {% for field in form %} + {% csrf_token %} + {% bootstrap_field field show_label=False type='fields'%} + {% endfor %} +
+
+
+

{%trans "Credit Card"%}

+
+
+
+

+ {% blocktrans %} + Please fill in your credit card information below. We are using Stripe for payment and do not store + your information in our database. + {% endblocktrans %} +

+
+
+
+ {% if credit_card_data.last4 %} +
+
Credit Card
+
Last 4: *****{{credit_card_data.last4}}
+
Type: {{credit_card_data.cc_brand}}
+ +
+
+
+ {% if not messages and not form.non_field_errors %} +

+ {% trans "You are not making any payment yet. After submitting your card information, you will be taken to the Confirm Order Page." %} +

+ {% endif %} +
+ {% for message in messages %} + {% if 'failed_payment' or 'make_charge_error' in message.tags %} +
  • +

    {{ message|safe }}

    +
+ {% endif %} + {% endfor %} + {% for error in form.non_field_errors %} +

+ {{ error|escape }} +

+ {% endfor %} +
+
+
+
+ +
+
+
+ + {% else %} +
+ +
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+ + +
+
+
+ +
+
+ {% if not messages and not form.non_field_errors %} +

+ {% trans "You are not making any payment yet. After submitting your card information, you will be taken to the Confirm Order Page." %} +

+ {% endif %} +
+ {% for message in messages %} + {% if 'failed_payment' or 'make_charge_error' in message.tags %} +
  • +

    {{ message|safe }}

    +
+ {% endif %} + {% endfor %} + + {% for error in form.non_field_errors %} +

+ {{ error|escape }} +

+ {% endfor %} +
+
+
+
+ +
+
+
+ + +
+ + {% endif %} +
+
+
+
+
+
+
+ + +{% if stripe_key %} +{% get_current_language as LANGUAGE_CODE %} + +{%endif%} + +{% if credit_card_data.last4 and credit_card_data.cc_brand %} + +{%endif%} + +{%endblock%} diff --git a/datacenterlight/views.py b/datacenterlight/views.py index b6a644e4..8b4e20ef 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -406,7 +406,7 @@ class WhyDataCenterLightView(IndexView): class PaymentOrderView(FormView): - template_name = 'hosting/payment.html' + template_name = 'datacenterlight/landing_payment.html' form_class = BillingAddressForm def get_form_kwargs(self): @@ -434,8 +434,8 @@ class PaymentOrderView(FormView): @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): - if 'specs' not in request.session or 'user' not in request.session: - return HttpResponseRedirect(reverse('datacenterlight:index')) + # if 'specs' not in request.session or 'user' not in request.session: + # return HttpResponseRedirect(reverse('datacenterlight:index')) return self.render_to_response(self.get_context_data()) def post(self, request, *args, **kwargs):