diff --git a/Changelog b/Changelog index 190a7af8..6d1b57d2 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,5 @@ +2.3: 2018-10-08 + * #5690: Generic payment page - allow admin to add a onetime/monthly product and the frontend for user to pay for this product (PR #666) 2.2.2: 2018-09-28 * #5721: Set calculator OS list in alphabetical order and set `Devuan Ascii` as the default (PR #668) * bugfix: Fix some typos and correct DE translations (PR #667) diff --git a/datacenterlight/cms_plugins.py b/datacenterlight/cms_plugins.py index ebd4fb8d..c3ec974f 100644 --- a/datacenterlight/cms_plugins.py +++ b/datacenterlight/cms_plugins.py @@ -9,6 +9,7 @@ from .cms_models import ( DCLSectionPromoPluginModel, DCLCalculatorPluginModel ) from .models import VMTemplate +from datacenterlight.utils import clear_all_session_vars @plugin_pool.register_plugin @@ -85,6 +86,7 @@ class DCLCalculatorPlugin(CMSPluginBase): require_parent = True def render(self, context, instance, placeholder): + clear_all_session_vars(context['request']) context = super(DCLCalculatorPlugin, self).render( context, instance, placeholder ) diff --git a/datacenterlight/locale/de/LC_MESSAGES/django.po b/datacenterlight/locale/de/LC_MESSAGES/django.po index 1b66b640..d43e91ea 100644 --- a/datacenterlight/locale/de/LC_MESSAGES/django.po +++ b/datacenterlight/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-05 23:11+0000\n" +"POT-Creation-Date: 2018-09-26 20:44+0000\n" "PO-Revision-Date: 2018-03-30 23:22+0000\n" "Last-Translator: b'Anonymous User '\n" "Language-Team: LANGUAGE \n" @@ -293,6 +293,9 @@ msgstr "Registrieren" msgid "Billing Address" msgstr "Rechnungsadresse" +msgid "Make a payment" +msgstr "" + msgid "Your Order" msgstr "Deine Bestellung" @@ -336,9 +339,9 @@ msgid "" "database." msgstr "" "Bitte wähle eine der zuvor genutzten Kreditkarten oder gib Deine " -"Kreditkartendetails unten an. Die Bezahlung wird über " -"Stripe abgewickelt. " -"Wir speichern Deine Kreditkartendetails nicht in unserer Datenbank." +"Kreditkartendetails unten an. Die Bezahlung wird über Stripe abgewickelt. Wir speichern Deine " +"Kreditkartendetails nicht in unserer Datenbank." msgid "" "Please fill in your credit card information below. We are using
-

{%trans "Your Order" %}

-
-
-

{% trans "Cores"%} {{request.session.specs.cpu|floatformat}}

-
-

{% trans "Memory"%} {{request.session.specs.memory|floatformat}} GB

-
-

{% trans "Disk space"%} {{request.session.specs.disk_size|floatformat}} GB

-
-

{% trans "Configuration"%} {{request.session.template.name}}

-
-

- {%trans "Total" %}   - - ({% if vm_pricing.vat_inclusive %}{%trans "including VAT" %}{% else %}{%trans "excluding VAT" %}{% endif %}) - - {{request.session.specs.price|intcomma}} CHF/{% trans "Month" %} -

-
- {% if vm_pricing.discount_amount %} -

- {%trans "Discount" as discount_name %} - {{ vm_pricing.discount_name|default:discount_name }}   - - {{ vm_pricing.discount_amount }} CHF/{% trans "Month" %} -

-

- ({% trans "Will be applied at checkout" %}) -

- {% endif %} -
+ {% if generic_payment_form %} +

{%trans "Make a payment" %}

+
+
+ {% csrf_token %} + + {% for field in generic_payment_form %} + {% bootstrap_field field type='fields'%} + {% endfor %} +

{{generic_payment_form.non_field_errors|striptags}}

+
+ {% else %} +

{%trans "Your Order" %}

+
+
+

{% trans "Cores"%} {{request.session.specs.cpu|floatformat}}

+
+

{% trans "Memory"%} {{request.session.specs.memory|floatformat}} GB

+
+

{% trans "Disk space"%} {{request.session.specs.disk_size|floatformat}} GB

+
+

{% trans "Configuration"%} {{request.session.template.name}}

+
+

+ {%trans "Total" %}   + + ({% if vm_pricing.vat_inclusive %}{%trans "including VAT" %}{% else %}{%trans "excluding VAT" %}{% endif %}) + + {{request.session.specs.price|intcomma}} CHF/{% trans "Month" %} +

+
+ {% if vm_pricing.discount_amount %} +

+ {%trans "Discount" as discount_name %} + {{ vm_pricing.discount_name|default:discount_name }}   + - {{ vm_pricing.discount_amount }} CHF/{% trans "Month" %} +

+

+ ({% trans "Will be applied at checkout" %}) +

+ {% endif %} +
+ {% endif %}
diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index 49347ba2..31933e12 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -47,61 +47,88 @@

{% trans "Order summary" %}

-

- {% trans "Product" %}:  - {{ request.session.template.name }} -

-
-
+ {% if generic_payment_details %}

- {% trans "Cores" %}: - {{vm.cpu|floatformat}} + {% trans "Product" %}:  + {{ generic_payment_details.product_name }}

-

- {% trans "Memory" %}: - {{vm.memory|intcomma}} GB -

-

- {% trans "Disk space" %}: - {{vm.disk_size|intcomma}} GB -

-
-
-
-
- {% if vm.vat > 0 or vm.discount.amount > 0 %} -
-
- {% if vm.vat > 0 %} +
+
+

+ {% trans "Amount" %}: + CHF {{generic_payment_details.amount|floatformat:2|intcomma}} +

+ {% if generic_payment_details.description %}

- {% trans "Subtotal" %} - {{vm.price|floatformat:2|intcomma}} CHF -

-

- {% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%) - {{vm.vat|floatformat:2|intcomma}} CHF + {% trans "Description" %}: + {{generic_payment_details.description}}

{% endif %} - {% if vm.discount.amount > 0 %} -

- {%trans "Discount" as discount_name %} - {{ vm.discount.name|default:discount_name }} - - {{ vm.discount.amount }} CHF + {% if generic_payment_details.recurring %} +

+ {% trans "Recurring" %}: + Yes

{% endif %}
-
-
+ {% else %} +

+ {% trans "Product" %}:  + {{ request.session.template.name }} +

+
+
+

+ {% trans "Cores" %}: + {{vm.cpu|floatformat}} +

+

+ {% trans "Memory" %}: + {{vm.memory|intcomma}} GB +

+

+ {% trans "Disk space" %}: + {{vm.disk_size|intcomma}} GB +

+
+
+
+
+ {% if vm.vat > 0 or vm.discount.amount > 0 %} +
+
+ {% if vm.vat > 0 %} +

+ {% trans "Subtotal" %} + {{vm.price|floatformat:2|intcomma}} CHF +

+

+ {% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%) + {{vm.vat|floatformat:2|intcomma}} CHF +

+ {% endif %} + {% if vm.discount.amount > 0 %} +

+ {%trans "Discount" as discount_name %} + {{ vm.discount.name|default:discount_name }} + - {{ vm.discount.amount }} CHF +

+ {% endif %} +
+
+
+
+
+ {% endif %} +
+

+ {% trans "Total" %} + {{vm.total_price|floatformat:2|intcomma}} CHF +

+
{% endif %} -
-

- {% trans "Total" %} - {{vm.total_price|floatformat:2|intcomma}} CHF -

-
-

@@ -109,7 +136,15 @@ {% csrf_token %}
-
{% blocktrans with vm_total_price=vm.total_price|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{vm_total_price}} CHF/month{% endblocktrans %}.
+ {% if generic_payment_details %} + {% if generic_payment_details.recurring %} +
{% blocktrans with total_price=generic_payment_details.amount|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{total_price}} CHF/month{% endblocktrans %}.
+ {% else %} +
{% blocktrans with total_price=generic_payment_details.amount|floatformat:2|intcomma %}By clicking "Place order" this payment will charge your credit card account with a one time amount of {{total_price}} CHF{% endblocktrans %}.
+ {% endif %} + {% else %} +
{% blocktrans with vm_total_price=vm.total_price|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{vm_total_price}} CHF/month{% endblocktrans %}.
+ {% endif %}