Manual merge
This commit is contained in:
commit
e6f92d9ae4
6 changed files with 130 additions and 188 deletions
|
@ -122,53 +122,7 @@
|
||||||
<button id="payment_button_with_creditcard" class="btn btn-vm-contact" type="submit">{%trans "SUBMIT" %}</button>
|
<button id="payment_button_with_creditcard" class="btn btn-vm-contact" type="submit">{%trans "SUBMIT" %}</button>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<form action="" id="payment-form-new" method="POST">
|
{% include "hosting/includes/_card_input.html" %}
|
||||||
<input type="hidden" name="token"/>
|
|
||||||
<div class="group">
|
|
||||||
<div class="credit-card-goup">
|
|
||||||
<div class="card-element card-number-element">
|
|
||||||
<label>{%trans "Card Number" %}</label>
|
|
||||||
<div id="card-number-element" class="field my-input"></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-5 card-element card-expiry-element">
|
|
||||||
<label>{%trans "Expiry Date" %}</label>
|
|
||||||
<div id="card-expiry-element" class="field my-input"></div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-3 col-xs-offset-4 card-element card-cvc-element">
|
|
||||||
<label>{%trans "CVC" %}</label>
|
|
||||||
<div id="card-cvc-element" class="field my-input"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-element brand">
|
|
||||||
<label>{%trans "Card Type" %}</label>
|
|
||||||
<i class="pf pf-credit-card" id="brand-icon"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="card-errors"></div>
|
|
||||||
{% if not messages and not form.non_field_errors %}
|
|
||||||
<p class="card-warning-content">
|
|
||||||
{% trans "You are not making any payment yet. After placing your order, you will be taken to the Submit Payment Page." %}
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
<div id='payment_error'>
|
|
||||||
{% for message in messages %}
|
|
||||||
{% if 'failed_payment' in message.tags or 'make_charge_error' in message.tags or 'error' in message.tags %}
|
|
||||||
<ul class="list-unstyled">
|
|
||||||
<li><p class="card-warning-content card-warning-error">{{ message|safe }}</p></li>
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
<div class="text-right">
|
|
||||||
<button class="btn btn-vm-contact btn-wide" type="submit">{%trans "SUBMIT" %}</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="display:none;">
|
|
||||||
<p class="payment-errors"></p>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -298,6 +298,10 @@
|
||||||
max-width: 360px;
|
max-width: 360px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-wide {
|
||||||
|
min-width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
.caps-link {
|
.caps-link {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #8da4c0;
|
color: #8da4c0;
|
||||||
|
@ -317,6 +321,18 @@
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings-container .new-card-head {
|
||||||
|
margin-top: 40px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-container .new-card-head h4 {
|
||||||
|
font-size: 15px;
|
||||||
|
margin-top: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.caps-link .svg-img {
|
.caps-link .svg-img {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
height: 13px;
|
height: 13px;
|
||||||
|
@ -333,7 +349,11 @@
|
||||||
.settings-container .btn-vm-contact {
|
.settings-container .btn-vm-contact {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
/* padding: 4px 15px; */
|
}
|
||||||
|
|
||||||
|
.settings-container .choice-btn {
|
||||||
|
letter-spacing: 1px;
|
||||||
|
min-width: 127px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-wide {
|
.btn-wide {
|
||||||
|
@ -375,6 +395,15 @@
|
||||||
fill: #999;
|
fill: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card-details-box {
|
||||||
|
border: 1px solid #eee;
|
||||||
|
padding: 5px 25px 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thick-hr {
|
||||||
|
border-top: 5px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
.locale_date {
|
.locale_date {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
59
hosting/templates/hosting/includes/_card_input.html
Normal file
59
hosting/templates/hosting/includes/_card_input.html
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
<form action="" id="payment-form-new" method="POST">
|
||||||
|
<input type="hidden" name="token"/>
|
||||||
|
<div class="group">
|
||||||
|
<div class="credit-card-goup">
|
||||||
|
<div class="card-element card-number-element">
|
||||||
|
<label>{%trans "Card Number" %}</label>
|
||||||
|
<div id="card-number-element" class="field my-input"></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-5 card-element card-expiry-element">
|
||||||
|
<label>{%trans "Expiry Date" %}</label>
|
||||||
|
<div id="card-expiry-element" class="field my-input"></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-xs-offset-4 card-element card-cvc-element">
|
||||||
|
<label>{%trans "CVC" %}</label>
|
||||||
|
<div id="card-cvc-element" class="field my-input"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-element brand">
|
||||||
|
<label>{%trans "Card Type" %}</label>
|
||||||
|
<i class="pf pf-credit-card" id="brand-icon"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="card-errors"></div>
|
||||||
|
{% if not messages and not form.non_field_errors %}
|
||||||
|
<p class="card-warning-content">
|
||||||
|
{% trans "You are not making any payment yet. After placing your order, you will be taken to the Submit Payment Page." %}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
<div id='payment_error'>
|
||||||
|
{% for message in messages %}
|
||||||
|
{% if 'failed_payment' in message.tags or 'make_charge_error' in message.tags %}
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li><p class="card-warning-content card-warning-error">{{ message|safe }}</p></li>
|
||||||
|
</ul>
|
||||||
|
{% elif not form.non_field_errors %}
|
||||||
|
<p class="card-warning-content">
|
||||||
|
{% trans "You are not making any payment yet. After placing your order, you will be taken to the Submit Payment Page." %}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% for error in form.non_field_errors %}
|
||||||
|
<p class="card-warning-content card-warning-error">
|
||||||
|
{{ error|escape }}
|
||||||
|
</p>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<div class="text-right">
|
||||||
|
<button class="btn btn-vm-contact btn-wide" type="submit">{%trans "SUBMIT" %}</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display:none;">
|
||||||
|
<p class="payment-errors"></p>
|
||||||
|
</div>
|
||||||
|
</form>
|
|
@ -105,62 +105,7 @@
|
||||||
<button id="payment_button_with_creditcard" class="btn btn-vm-contact" type="submit">{%trans "SUBMIT" %}</button>
|
<button id="payment_button_with_creditcard" class="btn btn-vm-contact" type="submit">{%trans "SUBMIT" %}</button>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<form action="" id="payment-form-new" method="POST">
|
{% include "hosting/includes/_card_input.html" %}
|
||||||
<input type="hidden" name="token"/>
|
|
||||||
<div class="group">
|
|
||||||
<div class="credit-card-goup">
|
|
||||||
<div class="card-element card-number-element">
|
|
||||||
<label>{%trans "Card Number" %}</label>
|
|
||||||
<div id="card-number-element" class="field my-input"></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-5 card-element card-expiry-element">
|
|
||||||
<label>{%trans "Expiry Date" %}</label>
|
|
||||||
<div id="card-expiry-element" class="field my-input"></div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-3 col-xs-offset-4 card-element card-cvc-element">
|
|
||||||
<label>{%trans "CVC" %}</label>
|
|
||||||
<div id="card-cvc-element" class="field my-input"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-element brand">
|
|
||||||
<label>{%trans "Card Type" %}</label>
|
|
||||||
<i class="pf pf-credit-card" id="brand-icon"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="card-errors"></div>
|
|
||||||
{% if not messages and not form.non_field_errors %}
|
|
||||||
<p class="card-warning-content">
|
|
||||||
{% trans "You are not making any payment yet. After submitting your card information, you will be taken to the Confirm Order Page." %}
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
<div id='payment_error'>
|
|
||||||
{% for message in messages %}
|
|
||||||
{% if 'failed_payment' or 'make_charge_error' in message.tags %}
|
|
||||||
<ul class="list-unstyled">
|
|
||||||
<li>
|
|
||||||
<p class="card-warning-content card-warning-error">{{ message|safe }}</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% for error in form.non_field_errors %}
|
|
||||||
<p class="card-warning-content card-warning-error">
|
|
||||||
{{ error|escape }}
|
|
||||||
</p>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
<div class="text-right">
|
|
||||||
<button class="btn btn-vm-contact btn-wide" type="submit">{%trans "SUBMIT" %}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="display:none;">
|
|
||||||
<p class="payment-errors"></p>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<div class="settings-container">
|
<div class="settings-container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-5 col-md-6 billing dcl-billing">
|
<div class="col-sm-5 col-md-6 billing dcl-billing">
|
||||||
<h3>{%trans "Billing Address"%}</h3>
|
<h3>{%trans "Billing Address" %}</h3>
|
||||||
<hr>
|
<hr>
|
||||||
<form role="form" id="billing-form" method="post" action="" novalidate>
|
<form role="form" id="billing-form" method="post" action="" novalidate>
|
||||||
{% for field in form %}
|
{% for field in form %}
|
||||||
|
@ -27,103 +27,58 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-7 col-md-6 creditcard-box dcl-creditcard">
|
<div class="col-sm-7 col-md-6 creditcard-box dcl-creditcard">
|
||||||
<h3>{%trans "Credit Card"%}</h3>
|
<h3>{%trans "Credit Card" %}</h3>
|
||||||
<hr>
|
<hr>
|
||||||
<div>
|
<div>
|
||||||
{% if credit_card_data.last4 %}
|
{% for card in cards_list %}
|
||||||
<div class="credit-card-details">
|
<div class="credit-card-details">
|
||||||
<h5 class="billing-head">{% trans "Credit Card" %}</h5>
|
<h5 class="billing-head">{% trans "Credit Card" %}</h5>
|
||||||
<h5 class="membership-lead">{% trans "Last" %} 4: *****{{credit_card_data.last4}}</h5>
|
<h5 class="membership-lead">{% trans "Last" %} 4: ***** {{card.last4}}</h5>
|
||||||
<h5 class="membership-lead">{% trans "Type" %}: {{credit_card_data.cc_brand}}</h5>
|
<h5 class="membership-lead">{% trans "Type" %}: {{card.cc_brand}}</h5>
|
||||||
{% comment %}
|
|
||||||
<div class="credit-card-details-opt">
|
<div class="credit-card-details-opt">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-6">
|
||||||
<a class="caps-link" href=""><img src="{% static 'hosting/img/delete.svg' %}" class="svg-img">{% trans "REMOVE CARD" %}</a>
|
<a class="caps-link" href=""><img src="{% static 'hosting/img/delete.svg' %}" class="svg-img">{% trans "REMOVE CARD" %}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6 text-right">
|
<div class="col-xs-6 text-right">
|
||||||
<a class="btn btn-vm-contact" href="">{% trans "EDIT CARD" %}</a>
|
<a class="btn choice-btn choice-btn-faded" href="">{% trans "SELECT" %}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endcomment %}
|
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% empty %}
|
||||||
<div class="no-cards">
|
<div class="no-cards">
|
||||||
<h4>{% trans "No Credit Cards Added" %}</h4>
|
<h4>{% trans "No Credit Cards Added" %}</h4>
|
||||||
<p>{% blocktrans %}We are using <a href="https://stripe.com">Stripe</a> for payment and do not store your information in our database.{% endblocktrans %}</p>
|
<p>{% blocktrans %}We are using <a href="https://stripe.com">Stripe</a> for payment and do not store your information in our database.{% endblocktrans %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% comment %}
|
<div class="new-card-head">
|
||||||
<h4>{% trans "Add a new Card." %}</h4>
|
<div class="row">
|
||||||
<p style="margin-bottom: 15px;">
|
<div class="col-xs-6">
|
||||||
{% blocktrans %}Please fill in your credit card information below. We are using <a href="https://stripe.com" target="_blank">Stripe</a> for payment and do not store your information in our database.{% endblocktrans %}
|
<h4>{% trans "Add a new credit card" %}</h4>
|
||||||
</p>
|
</div>
|
||||||
<form action="" id="payment-form-new" class="credit-card-form" method="POST">
|
<div class="col-xs-6 text-right">
|
||||||
<input type="hidden" name="token"/>
|
<button data-toggle="collapse" data-target="#newcard" class="btn choice-btn">
|
||||||
<div class="credit-card-goup">
|
<span class="fa fa-plus"></span> {% trans "NEW CARD" %}
|
||||||
<div class="card-element card-number-element">
|
</button>
|
||||||
<label>{%trans "Card Number" %}</label>
|
</div>
|
||||||
<div id="card-number-element" class="field my-input"></div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div id="newcard" class="collapse">
|
||||||
<div class="col-xs-6 col-sm-4 card-element card-expiry-element">
|
<hr class="thick-hr">
|
||||||
<label>{%trans "Expiry Date" %}</label>
|
<div class="card-details-box">
|
||||||
<div id="card-expiry-element" class="field my-input"></div>
|
<h3>{%trans "New Credit Card" %}</h3>
|
||||||
</div>
|
<hr>
|
||||||
<div class="col-xs-6 col-sm-4 col-sm-offset-4 card-element card-cvc-element">
|
{% include "hosting/includes/_card_input.html" %}
|
||||||
<label>{%trans "CVC" %}</label>
|
</div>
|
||||||
<div id="card-cvc-element" class="field my-input"></div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-element brand">
|
|
||||||
<label>{%trans "Card Type" %}</label>
|
|
||||||
<i class="pf pf-credit-card" id="brand-icon"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="card-errors" role="alert"></div>
|
|
||||||
<div>
|
|
||||||
{% if not messages and not form.non_field_errors %}
|
|
||||||
<p class="card-warning-content">
|
|
||||||
{% blocktrans %}You are not making any payment here.{% endblocktrans %}
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
<div id='payment_error'>
|
|
||||||
{% for message in messages %}
|
|
||||||
{% if 'failed_payment' or 'make_charge_error' in message.tags %}
|
|
||||||
<ul class="list-unstyled"><li>
|
|
||||||
<p class="card-warning-content card-warning-error">{{ message|safe }}</p>
|
|
||||||
</li></ul>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% for error in form.non_field_errors %}
|
|
||||||
<p class="card-warning-content card-warning-error">
|
|
||||||
{{ error|escape }}
|
|
||||||
</p>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-6 col-xs-offset-6 text-right">
|
|
||||||
<button class="btn btn-success stripe-payment-btn" type="submit">{%trans "Submit" %}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="display:none;">
|
|
||||||
<p class="payment-errors"></p>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endcomment %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% comment %}
|
|
||||||
<!-- stripe key data -->
|
<!-- stripe key data -->
|
||||||
{% if stripe_key %}
|
{% if stripe_key %}
|
||||||
{% get_current_language as LANGUAGE_CODE %}
|
{% get_current_language as LANGUAGE_CODE %}
|
||||||
|
@ -138,6 +93,7 @@
|
||||||
</script>
|
</script>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
|
|
||||||
|
{% comment %}
|
||||||
{% if credit_card_data.last4 and credit_card_data.cc_brand %}
|
{% if credit_card_data.last4 and credit_card_data.cc_brand %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function () {
|
(function () {
|
||||||
|
|
|
@ -551,17 +551,16 @@ class SettingsView(LoginRequiredMixin, FormView):
|
||||||
context = super(SettingsView, self).get_context_data(**kwargs)
|
context = super(SettingsView, self).get_context_data(**kwargs)
|
||||||
# Get user
|
# Get user
|
||||||
user = self.request.user
|
user = self.request.user
|
||||||
# Get user last order
|
# Get user's all orders
|
||||||
last_hosting_order = HostingOrder.objects.filter(
|
hosting_orders = HostingOrder.objects.filter(customer__user=user)
|
||||||
customer__user=user).last()
|
# If user has hosting orders, get the credit card data from it
|
||||||
# If user has already an hosting order, get the credit card data from
|
cards_list = []
|
||||||
# it
|
for order in hosting_orders:
|
||||||
if last_hosting_order:
|
credit_card_data = order.get_cc_data()
|
||||||
credit_card_data = last_hosting_order.get_cc_data()
|
if credit_card_data and (credit_card_data not in cards_list):
|
||||||
context.update({
|
cards_list.append(credit_card_data)
|
||||||
'credit_card_data': credit_card_data if credit_card_data else None,
|
|
||||||
})
|
|
||||||
context.update({
|
context.update({
|
||||||
|
'cards_list': cards_list,
|
||||||
'stripe_key': settings.STRIPE_API_PUBLIC_KEY
|
'stripe_key': settings.STRIPE_API_PUBLIC_KEY
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue