From 20f06387c57d9f81629a880e550ec743e0bc54ca Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 9 Sep 2024 02:56:34 +0200 Subject: [PATCH] Added check if tanExpirationTime is exceeded if set --- .../kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt index 9deeb625..2547819b 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt @@ -387,8 +387,10 @@ open class FinTsJobExecutor( while (tanChallenge.isEnteringTanDone == false) { delay(500) - // most TANs a valid 5 - 15 minutes. So terminate wait process after that time - if (Instant.nowExt() > tanChallenge.challengeCreationTimestamp.plusMinutes(15)) { + val now = Instant.nowExt() + if ((tanChallenge.tanExpirationTime != null && now > tanChallenge.tanExpirationTime) || + // most TANs a valid 5 - 15 minutes. So terminate wait process after that time + (tanChallenge.tanExpirationTime == null && now > tanChallenge.challengeCreationTimestamp.plusMinutes(15))) { if (tanChallenge.isEnteringTanDone == false) { tanChallenge.userDidNotEnterTan() }