Remove some commented and unnecessary code

This commit is contained in:
PCoder 2017-10-29 22:03:19 +01:00
parent edac806c11
commit 62f30bf03c
3 changed files with 0 additions and 63 deletions

View file

@ -112,44 +112,6 @@
{% endif %} {% endif %}
{% include "hosting/includes/_card_input.html" %} {% include "hosting/includes/_card_input.html" %}
</div> </div>
{% comment %}
<div>
{% if credit_card_data.last4 %}
<form role="form" id="payment-form-with-creditcard" novalidate>
<h5 class="billing-head">Credit Card</h5>
<h5 class="membership-lead">Last 4: *****{{credit_card_data.last4}}</h5>
<h5 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h5>
<input type="hidden" name="credit_card_needed" value="false"/>
</form>
{% if not messages and not form.non_field_errors %}
<p class="card-warning-content card-warning-addtional-margin">
{% 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 id="payment_button_with_creditcard" class="btn btn-vm-contact" type="submit">{%trans "SUBMIT" %}</button>
</div>
{% else %}
{% include "hosting/includes/_card_input.html" %}
{% endif %}
</div>
{% endcomment %}
{% endwith %} {% endwith %}
</div> </div>
</div> </div>

View file

@ -359,7 +359,6 @@ class PaymentOrderView(FormView):
billing_address_data = self.request.session['billing_address_data'] billing_address_data = self.request.session['billing_address_data']
else: else:
billing_address_data = {} billing_address_data = {}
if self.request.user.is_authenticated(): if self.request.user.is_authenticated():
if billing_address_data: if billing_address_data:
billing_address_form = BillingAddressForm( billing_address_form = BillingAddressForm(
@ -369,24 +368,10 @@ class PaymentOrderView(FormView):
billing_address_form = BillingAddressForm( billing_address_form = BillingAddressForm(
instance=self.request.user.billing_addresses.first() instance=self.request.user.billing_addresses.first()
) )
# Get user last order
last_hosting_order = HostingOrder.objects.filter(
customer__user=self.request.user
).last()
# If user has already an hosting order, get the credit card
# data from it
if last_hosting_order:
credit_card_data = last_hosting_order.get_cc_data()
if credit_card_data:
context['credit_card_data'] = credit_card_data
else:
context['credit_card_data'] = None
else: else:
billing_address_form = BillingAddressFormSignup( billing_address_form = BillingAddressFormSignup(
initial=billing_address_data initial=billing_address_data
) )
context.update({ context.update({
'cards_list': cards_list, 'cards_list': cards_list,
'stripe_key': settings.STRIPE_API_PUBLIC_KEY, 'stripe_key': settings.STRIPE_API_PUBLIC_KEY,

View file

@ -123,14 +123,4 @@
})(); })();
</script> </script>
{%endif%} {%endif%}
{% comment %}
{% if credit_card_data.last4 and credit_card_data.cc_brand %}
<script type="text/javascript">
(function () {
window.hasCreditcard = true;
})();
</script>
{%endif%}
{% endcomment %}
{%endblock%} {%endblock%}