From 9b1a5fa9298102f9a6404079d800713a2a06e53f Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 9 Sep 2024 17:01:32 +0200 Subject: [PATCH] Fixed not continuing to next account if user cancelled process --- .../kotlin/net/codinux/banking/fints/FinTsClient.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsClient.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsClient.kt index e0a237e4..a18fc39c 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsClient.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsClient.kt @@ -63,8 +63,13 @@ open class FinTsClient( return GetAccountDataResponse(ErrorCode.NoneOfTheAccountsSupportsRetrievingData, errorMessage, mapper.map(bank), previousJobMessageLog ?: listOf(), bank) } - accountsSupportingRetrievingTransactions.forEach { account -> - retrievedTransactionsResponses.add(getAccountTransactions(param, bank, account)) + for (account in accountsSupportingRetrievingTransactions) { + val response = getAccountTransactions(param, bank, account) + retrievedTransactionsResponses.add(response) + + if (response.tanRequiredButWeWereToldToAbortIfSo || response.userCancelledAction) { // if user cancelled action or TAN is required but we were told to abort then, then don't continue with next account + break + } } val unsuccessfulJob = retrievedTransactionsResponses.firstOrNull { it.successful == false }