libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 2a438b1e515e2dffff379c59d6e21026b5cc7294
parent fe22997387eefa9fb205384fe59f42d2480ea425
Author: ms <ms@taler.net>
Date:   Wed, 10 Nov 2021 17:08:49 +0100

pad IBAN checksum

Diffstat:
Mutil/src/main/kotlin/iban.kt | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/util/src/main/kotlin/iban.kt b/util/src/main/kotlin/iban.kt @@ -7,6 +7,9 @@ fun getIban(): String { val bban = (0..3).map { (0..9).random() }.joinToString("") // 4 digits BBAN. - val checkDigits = "98".toBigInteger().minus("$bban$ccNoCheck".toBigInteger().mod("97".toBigInteger())) + var checkDigits = "98".toBigInteger().minus("$bban$ccNoCheck".toBigInteger().mod("97".toBigInteger())).toString() + if (checkDigits.length == 1) { + checkDigits = "0${checkDigits}" + } return "DE$checkDigits$bban" } \ No newline at end of file