libeufin

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

commit fbb9d7a0011b461d07b3d411c79552331f976e95
parent 8e08920fcc91487ce923570e50159ba47dc6c3e9
Author: Antoine A <>
Date:   Mon, 26 Feb 2024 16:32:21 +0100

Better TAN message

Diffstat:
Mbank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt | 5+++--
Mbank/src/test/kotlin/helpers.kt | 5++---
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt b/bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt @@ -1,6 +1,6 @@ /* * This file is part of LibEuFin. - * Copyright (C) 2023 Taler Systems S.A. + * Copyright (C) 2023-2024 Taler Systems S.A. * LibEuFin is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -663,6 +663,7 @@ private fun Routing.coreBankTanApi(db: Database, ctx: BankConfig) { res.tanCode?.run { val (tanScript, tanEnv) = ctx.tanChannels.get(res.tanChannel) ?: throw unsupportedTanChannel(res.tanChannel) + val msg = "${res.tanCode} is your bank verification code" val exitValue = withContext(Dispatchers.IO) { val builder = ProcessBuilder(tanScript.toString(), res.tanInfo) builder.redirectErrorStream(true) @@ -671,7 +672,7 @@ private fun Routing.coreBankTanApi(db: Database, ctx: BankConfig) { } val process = builder.start() try { - process.outputWriter().use { it.write(res.tanCode) } + process.outputWriter().use { it.write(msg) } process.onExit().await() } catch (e: Exception) { process.destroy() diff --git a/bank/src/test/kotlin/helpers.kt b/bank/src/test/kotlin/helpers.kt @@ -1,6 +1,6 @@ /* * This file is part of LibEuFin. - * Copyright (C) 2023 Taler Systems S.A. + * Copyright (C) 2023-2024 Taler Systems S.A. * LibEuFin is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -189,7 +189,6 @@ suspend fun ApplicationTestBuilder.tanInfo(account: String): Pair<TanChannel?, S TanChannel.sms -> res.contact_data!!.phone.get() TanChannel.email -> res.contact_data!!.email.get() null -> null - else -> null }) } @@ -304,7 +303,7 @@ suspend fun ApplicationTestBuilder.convert(amount: String): TalerAmount { suspend fun tanCode(info: String): String? { try { val file = Path("/tmp/tan-$info.txt") - val code = file.readText() + val code = file.readText().split(" ", limit=2).first() file.deleteExisting() return code } catch (e: Exception) {