Skip to content

Commit 54756f0

Browse files
fixup! Enable submission of repayment requests
1 parent ec24e8e commit 54756f0

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

sipa/blueprints/usersuite.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
from datetime import datetime
66
from decimal import Decimal
7+
from functools import partial
78
from schwifty import IBAN
89

910
from babel.numbers import format_currency
@@ -669,20 +670,16 @@ def request_repayment_confirm():
669670
"""
670671

671672
beneficiary = request.args.get("beneficiary", None)
672-
iban = request.args.get("iban", None, lambda x: IBAN(x, validate_bban=True))
673-
amount = request.args.get("amount", None, lambda x: Decimal(x))
673+
iban = request.args.get("iban", None, partial(IBAN, validate_bban=True))
674+
amount = request.args.get("amount", None, Decimal)
674675

675676
form = RequestRepaymentConfirmForm()
676677

677678
if None not in (beneficiary, iban, amount):
678679
balance = current_user.finance_information.balance.raw_value
679-
iban_str = str(iban)
680680

681681
form.beneficiary.data = beneficiary
682-
# Insert a space every 4 characters of the IBAN
683-
form.iban.data = " ".join(
684-
iban_str[i : i + 4] for i in range(0, len(iban_str), 4)
685-
)
682+
form.iban.data = iban.formatted
686683
form.bic.data = str(iban.bic)
687684
form.bank.data = iban.bank_name
688685
form.amount.data = amount

0 commit comments

Comments
 (0)