diff --git a/sipa/blueprints/usersuite.py b/sipa/blueprints/usersuite.py index cdb99716..017ddf3a 100644 --- a/sipa/blueprints/usersuite.py +++ b/sipa/blueprints/usersuite.py @@ -4,6 +4,7 @@ import logging from datetime import datetime from decimal import Decimal +from functools import partial from schwifty import IBAN from babel.numbers import format_currency @@ -669,20 +670,16 @@ def request_repayment_confirm(): """ beneficiary = request.args.get("beneficiary", None) - iban = request.args.get("iban", None, lambda x: IBAN(x, validate_bban=True)) - amount = request.args.get("amount", None, lambda x: Decimal(x)) + iban = request.args.get("iban", None, partial(IBAN, validate_bban=True)) + amount = request.args.get("amount", None, Decimal) form = RequestRepaymentConfirmForm() if None not in (beneficiary, iban, amount): balance = current_user.finance_information.balance.raw_value - iban_str = str(iban) form.beneficiary.data = beneficiary - # Insert a space every 4 characters of the IBAN - form.iban.data = " ".join( - iban_str[i : i + 4] for i in range(0, len(iban_str), 4) - ) + form.iban.data = iban.formatted form.bic.data = str(iban.bic) form.bank.data = iban.bank_name form.amount.data = amount