Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Improve payment step

Michal Ociepka53af21ccbdd3
diff --git a/order/templates/order/payment.html b/order/templates/order/payment.html
index e66af78b72..3a9b39c3ce 100644
--- a/order/templates/order/payment.html
+++ b/order/templates/order/payment.html
@@ -6,7 +6,17 @@
{% block forms %}
<form method="post" class="form-horizontal">
{% csrf_token %}
- {{ step.forms.payment|as_bootstrap }}
+ {{ step.forms.payment.non_field_errors|as_bootstrap }}
+ {{ step.forms.payment.name|as_bootstrap }}
+ {{ step.forms.payment.number|as_bootstrap }}
+ <div class="control-group name required">
+ <label class="control-label">Expiry date</label>
+ <div class="controls controls-row">
+ {{ step.forms.payment.expiration_month }}
+ {{ step.forms.payment.expiration_year }}
+ </div>
+ </div>
+ {{ step.forms.payment.cvv2|as_bootstrap }}
<div class="form-actions">
<button type="submit" class="btn btn-primary">
Save changes
diff --git a/payment/forms.py b/payment/forms.py
index 448636a464..7f083a2c96 100644
--- a/payment/forms.py
+++ b/payment/forms.py
@@ -10,18 +10,18 @@ CVV_VALIDATOR = validators.RegexValidator('^[0-9]{1,4}$',
class PaymentForm(forms.Form):
- cc_name = forms.CharField(label=_('Name on Credit Card'), max_length=128)
- cc_number = CreditCardNumberField(label=_('Card Number'), max_length=32,
+ name = forms.CharField(label=_('Name on Credit Card'), max_length=128)
+ number = CreditCardNumberField(label=_('Card Number'), max_length=32,
required=True)
- cc_expiration_year = CreditCardExpirationYearField(label=_('Exp. date'))
- cc_expiration_month = CreditCardExpirationMonthField(label=_('Exp. date'))
- cc_cvv2 = forms.CharField(validators=[CVV_VALIDATOR], required=False,
+ expiration_year = CreditCardExpirationYearField(label=_('Exp. date'))
+ expiration_month = CreditCardExpirationMonthField(label=_('Exp. date'))
+ cvv2 = forms.CharField(validators=[CVV_VALIDATOR], required=False,
label=_('CVV2 Security Number'), max_length=4)
def clean(self):
cleaned_data = super(PaymentForm, self).clean()
- month = cleaned_data.get('cc_expiration_month')
- year = cleaned_data.get('cc_expiration_year')
+ month = cleaned_data.get('expiration_month')
+ year = cleaned_data.get('expiration_year')
try:
expiration = date(int(year), int(month), 01)
except ValueError: