Bank transfer refund: Allow to enter BIC

This commit is contained in:
Raphael Michel
2021-01-27 10:04:31 +01:00
parent e33d15429e
commit 9722e76e5f
2 changed files with 12 additions and 4 deletions

View File

@@ -322,6 +322,10 @@ class BankTransfer(BasePaymentProvider):
iban = IBANFormField(
label=_('IBAN'),
)
bic = BICFormField(
label=_('BIC (optional)'),
required=False,
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -359,14 +363,17 @@ class BankTransfer(BasePaymentProvider):
)
if not f.is_valid():
raise ValidationError(_('Your input was invalid, please see below for details.'))
d = {
'payer': f.cleaned_data['payer'],
'iban': self.norm(f.cleaned_data['iban']),
}
if f.cleaned_data.get('bic'):
d['bic'] = f.cleaned_data['bic']
return OrderRefund(
order=order,
payment=None,
state=OrderRefund.REFUND_STATE_CREATED,
amount=amount,
provider=self.identifier,
info=json.dumps({
'payer': f.cleaned_data['payer'],
'iban': self.norm(f.cleaned_data['iban']),
})
info=json.dumps(d)
)

View File

@@ -5,4 +5,5 @@
{% trans "to" %}
{% bootstrap_field form.payer layout="inline" %}
{% bootstrap_field form.iban layout="inline" %}
{% bootstrap_field form.bic layout="inline" %}
{% bootstrap_form_errors form error_types="all" %}