Formatting and documentation
This commit is contained in:
parent
6e6a57b304
commit
9faf897818
2 changed files with 10 additions and 5 deletions
|
@ -602,9 +602,11 @@ class OrderConfirmationView(DetailView, FormView):
|
||||||
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_year'] = card_details_response['exp_year']
|
||||||
context['cc_exp_month'] = '{:02d}'.format(card_details_response['exp_month'])
|
context['cc_exp_month'] = '{:02d}'.format(
|
||||||
|
card_details_response['exp_month'])
|
||||||
context['id_payment_method'] = payment_method
|
context['id_payment_method'] = payment_method
|
||||||
else:
|
else:
|
||||||
|
# TODO check when we go through this case (to me, it seems useless)
|
||||||
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
|
||||||
|
@ -619,7 +621,9 @@ class OrderConfirmationView(DetailView, FormView):
|
||||||
request.session["vat_validation_status"] == "not_needed"):
|
request.session["vat_validation_status"] == "not_needed"):
|
||||||
request.session['generic_payment_details']['vat_rate'] = 0
|
request.session['generic_payment_details']['vat_rate'] = 0
|
||||||
request.session['generic_payment_details']['vat_amount'] = 0
|
request.session['generic_payment_details']['vat_amount'] = 0
|
||||||
request.session['generic_payment_details']['amount'] = request.session['generic_payment_details']['amount_before_vat']
|
request.session['generic_payment_details']['amount'] = (
|
||||||
|
request.session['generic_payment_details']['amount_before_vat']
|
||||||
|
)
|
||||||
context.update({
|
context.update({
|
||||||
'generic_payment_details':
|
'generic_payment_details':
|
||||||
request.session['generic_payment_details'],
|
request.session['generic_payment_details'],
|
||||||
|
@ -642,7 +646,8 @@ class OrderConfirmationView(DetailView, FormView):
|
||||||
vm_specs["price_after_discount"] = price - discount["amount"]
|
vm_specs["price_after_discount"] = price - discount["amount"]
|
||||||
amount_to_charge = price
|
amount_to_charge = price
|
||||||
vat_number = request.session.get('billing_address_data').get("vat_number")
|
vat_number = request.session.get('billing_address_data').get("vat_number")
|
||||||
billing_address = BillingAddress.objects.get(id=request.session["billing_address_id"])
|
billing_address = BillingAddress.objects.get(
|
||||||
|
id=request.session["billing_address_id"])
|
||||||
if vat_number:
|
if vat_number:
|
||||||
validate_result = validate_vat_number(
|
validate_result = validate_vat_number(
|
||||||
stripe_customer_id=request.session['customer'],
|
stripe_customer_id=request.session['customer'],
|
||||||
|
@ -656,7 +661,6 @@ class OrderConfirmationView(DetailView, FormView):
|
||||||
return HttpResponseRedirect(
|
return HttpResponseRedirect(
|
||||||
reverse('datacenterlight:payment') + '#vat_error'
|
reverse('datacenterlight:payment') + '#vat_error'
|
||||||
)
|
)
|
||||||
|
|
||||||
request.session["vat_validation_status"] = validate_result["status"]
|
request.session["vat_validation_status"] = validate_result["status"]
|
||||||
|
|
||||||
if user_vat_country.lower() == "ch":
|
if user_vat_country.lower() == "ch":
|
||||||
|
|
|
@ -288,7 +288,8 @@ class StripeCustomer(models.Model):
|
||||||
stripe user.
|
stripe user.
|
||||||
"""
|
"""
|
||||||
stripe_utils = StripeUtils()
|
stripe_utils = StripeUtils()
|
||||||
stripe_data = stripe_utils.create_customer(token, email, customer_name)
|
stripe_data = stripe_utils.create_customer(
|
||||||
|
id_payment_method, email, customer_name)
|
||||||
if stripe_data.get('response_object'):
|
if stripe_data.get('response_object'):
|
||||||
stripe_cus_id = stripe_data.get('response_object').get('id')
|
stripe_cus_id = stripe_data.get('response_object').get('id')
|
||||||
return stripe_cus_id
|
return stripe_cus_id
|
||||||
|
|
Loading…
Reference in a new issue