|
|
@@ -4,7 +4,6 @@ from oscar.checkout.views import (ShippingMethodView as CoreShippingMethodView,
|
|
4
|
4
|
PaymentMethodView as CorePaymentMethodView,
|
|
5
|
5
|
PaymentDetailsView as CorePaymentDetailsView,
|
|
6
|
6
|
OrderPreviewView as CoreOrderPreviewView,
|
|
7
|
|
- SubmitView as CoreSubmitView,
|
|
8
|
7
|
prev_steps_must_be_complete)
|
|
9
|
8
|
from oscar.payment.forms import BankcardForm, BillingAddressForm
|
|
10
|
9
|
from oscar.services import import_module
|
|
|
@@ -46,25 +45,16 @@ class PaymentDetailsView(CorePaymentMethodView):
|
|
46
|
45
|
template_file = 'checkout/payment_details.html'
|
|
47
|
46
|
|
|
48
|
47
|
def handle_GET(self):
|
|
49
|
|
-
|
|
50
|
|
- # Need a billing address form and a bankcard form
|
|
51
|
48
|
self.context['bankcard_form'] = BankcardForm()
|
|
52
|
49
|
self.context['billing_address_form'] = BillingAddressForm()
|
|
53
|
|
-
|
|
54
|
50
|
return render(self.request, self.template_file, self.context)
|
|
55
|
51
|
|
|
56
|
52
|
def handle_POST(self):
|
|
57
|
|
- assert False
|
|
58
|
|
-
|
|
59
|
|
-
|
|
60
|
|
-class SubmitView(CoreSubmitView):
|
|
61
|
|
-
|
|
62
|
|
- def _handle_payment(self, basket):
|
|
63
|
|
- u"""Handle any payment processing"""
|
|
|
53
|
+ bankcard_form = BankcardForm(self.request.POST)
|
|
|
54
|
+ billing_addr_form = BillingAddressForm(self.request.POST)
|
|
|
55
|
+ if bankcard_form.is_valid() and billing_addr_form.is_valid():
|
|
|
56
|
+ return self._submit()
|
|
|
57
|
+ self.context['bankcard_form'] = bankcard_form
|
|
|
58
|
+ self.context['billing_address_form'] = billing_addr_form
|
|
|
59
|
+ return render(self.request, self.template_file, self.context)
|
|
64
|
60
|
|
|
65
|
|
- bankcard_form = BankcardForm(request.POST)
|
|
66
|
|
- if not bankcard_form.is_valid():
|
|
67
|
|
- # Put form into the session and redirect back
|
|
68
|
|
- self.request.session['bankcard_form'] = bankcard_form
|
|
69
|
|
-
|
|
70
|
|
- assert False
|