Commit 9faf8978 authored by PCoder's avatar PCoder

Formatting and documentation

parent 6e6a57b3
......@@ -602,9 +602,11 @@ class OrderConfirmationView(DetailView, FormView):
context['cc_last4'] = card_details_response['last4']
context['cc_brand'] = card_details_response['brand']
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
else:
# TODO check when we go through this case (to me, it seems useless)
card_id = self.request.session.get('card_id')
card_detail = UserCardDetail.objects.get(id=card_id)
context['cc_last4'] = card_detail.last4
......@@ -619,7 +621,9 @@ class OrderConfirmationView(DetailView, FormView):
request.session["vat_validation_status"] == "not_needed"):
request.session['generic_payment_details']['vat_rate'] = 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({
'generic_payment_details':
request.session['generic_payment_details'],
......@@ -642,7 +646,8 @@ class OrderConfirmationView(DetailView, FormView):
vm_specs["price_after_discount"] = price - discount["amount"]
amount_to_charge = price
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:
validate_result = validate_vat_number(
stripe_customer_id=request.session['customer'],
......@@ -656,7 +661,6 @@ class OrderConfirmationView(DetailView, FormView):
return HttpResponseRedirect(
reverse('datacenterlight:payment') + '#vat_error'
)
request.session["vat_validation_status"] = validate_result["status"]
if user_vat_country.lower() == "ch":
......
......@@ -288,7 +288,8 @@ class StripeCustomer(models.Model):
stripe user.
"""
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'):
stripe_cus_id = stripe_data.get('response_object').get('id')
return stripe_cus_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment