Prefill cc info on landing for logged in case
Attention: We still support only one card
This commit is contained in:
parent
86c931cde1
commit
b44948b277
1 changed files with 13 additions and 0 deletions
|
@ -357,6 +357,19 @@ 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
|
||||||
|
|
Loading…
Reference in a new issue