Add expiry year and month in the settings and order payment pages

This commit is contained in:
PCoder 2019-07-09 18:40:41 +05:30
parent 3c63f26d31
commit 59c45492a9
5 changed files with 11 additions and 0 deletions

View file

@ -41,6 +41,7 @@
<h4>{% trans "Payment method" %}:</h4> <h4>{% trans "Payment method" %}:</h4>
<p> <p>
{{cc_brand|default:_('Credit Card')}} {% trans "ending in" %} ****{{cc_last4}}<br> {{cc_brand|default:_('Credit Card')}} {% trans "ending in" %} ****{{cc_last4}}<br>
{% trans "Expiry" %} {{cc_exp_year}}/{{cc_exp_month}}<br/>
{{request.user.email}} {{request.user.email}}
</p> </p>
</div> </div>

View file

@ -568,11 +568,15 @@ class OrderConfirmationView(DetailView, FormView):
card_details_response = card_details['response_object'] card_details_response = card_details['response_object']
context['cc_last4'] = card_details_response['last4'] context['cc_last4'] = card_details_response['last4']
context['cc_brand'] = card_details_response['brand'] context['cc_brand'] = card_details_response['brand']
context['cc_exp_year'] = card_details_response['exp_year']
context['cc_exp_month'] = card_details_response['exp_month']
else: else:
card_id = self.request.session.get('card_id') card_id = self.request.session.get('card_id')
card_detail = UserCardDetail.objects.get(id=card_id) card_detail = UserCardDetail.objects.get(id=card_id)
context['cc_last4'] = card_detail.last4 context['cc_last4'] = card_detail.last4
context['cc_brand'] = card_detail.brand context['cc_brand'] = card_detail.brand
context['cc_exp_year'] = card_detail.exp_year
context['cc_exp_month'] = card_detail.exp_month
if ('generic_payment_type' in request.session and if ('generic_payment_type' in request.session and
self.request.session['generic_payment_type'] == 'generic'): self.request.session['generic_payment_type'] == 'generic'):

View file

@ -82,6 +82,7 @@
{{user.email}} {{user.email}}
{% else %} {% else %}
{{cc_brand|default:_('Credit Card')}} {% trans "ending in" %} ****{{cc_last4}}<br> {{cc_brand|default:_('Credit Card')}} {% trans "ending in" %} ****{{cc_last4}}<br>
{% trans "Expiry" %} {{cc_exp_year}}/{{cc_exp_month}}<br/>
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
{{request.user.email}} {{request.user.email}}
{% else %} {% else %}

View file

@ -37,6 +37,7 @@
<h5 class="billing-head">{% trans "Credit Card" %}</h5> <h5 class="billing-head">{% trans "Credit Card" %}</h5>
<h5 class="membership-lead">{% trans "Last" %} 4: ***** {{card.last4}}</h5> <h5 class="membership-lead">{% trans "Last" %} 4: ***** {{card.last4}}</h5>
<h5 class="membership-lead">{% trans "Type" %}: {{card.brand}}</h5> <h5 class="membership-lead">{% trans "Type" %}: {{card.brand}}</h5>
<h5 class="membership-lead">{% trans "Expiry" %}: {{card.exp_month}}/{{card.exp_year}}</h5>
<div class="credit-card-details-opt"> <div class="credit-card-details-opt">
<div class="row"> <div class="row">
{% if card_list_len > 1 %} {% if card_list_len > 1 %}

View file

@ -906,11 +906,15 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView, FormView):
card_details_response = card_details['response_object'] card_details_response = card_details['response_object']
context['cc_last4'] = card_details_response['last4'] context['cc_last4'] = card_details_response['last4']
context['cc_brand'] = card_details_response['brand'] context['cc_brand'] = card_details_response['brand']
context['cc_exp_year'] = card_details_response['exp_year']
context['cc_exp_month'] = card_details_response['exp_month']
else: else:
card_id = self.request.session.get('card_id') card_id = self.request.session.get('card_id')
card_detail = UserCardDetail.objects.get(id=card_id) card_detail = UserCardDetail.objects.get(id=card_id)
context['cc_last4'] = card_detail.last4 context['cc_last4'] = card_detail.last4
context['cc_brand'] = card_detail.brand context['cc_brand'] = card_detail.brand
context['cc_exp_year'] = card_detail.exp_year
context['cc_exp_month'] = card_detail.exp_month
context['site_url'] = reverse('hosting:create_virtual_machine') context['site_url'] = reverse('hosting:create_virtual_machine')
context['vm'] = self.request.session.get('specs') context['vm'] = self.request.session.get('specs')
return context return context