From 2164bc5a946cd82e1eaffe40c1eda730198a6a5d Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 26 Sep 2024 14:23:42 +0200 Subject: [PATCH] Fixed getting fints TanMethod in existing TanMethods --- .../client/fints4k/BridgeFintTsToBankingClientCallback.kt | 3 ++- .../net/codinux/banking/client/fints4k/FinTs4kMapper.kt | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/BridgeFintTsToBankingClientCallback.kt b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/BridgeFintTsToBankingClientCallback.kt index 4ce5cf0d..bdcc2209 100644 --- a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/BridgeFintTsToBankingClientCallback.kt +++ b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/BridgeFintTsToBankingClientCallback.kt @@ -23,7 +23,8 @@ open class BridgeFintTsToBankingClientCallback( if (enterTanResult.enteredTan != null) { tanChallenge.userEnteredTan(enterTanResult.enteredTan!!) } else if (enterTanResult.changeTanMethodTo != null) { - tanChallenge.userAsksToChangeTanMethod(mapper.mapTanMethod(enterTanResult.changeTanMethodTo!!)) + val fintsTanMethod = tanChallenge.bank.tanMethodsAvailableForUser.first { it.securityFunction.code == enterTanResult.changeTanMethodTo!!.identifier } + tanChallenge.userAsksToChangeTanMethod(fintsTanMethod) } else { tanChallenge.userDidNotEnterTan() } diff --git a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kMapper.kt b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kMapper.kt index 51d1eec7..6ccecf53 100644 --- a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kMapper.kt +++ b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kMapper.kt @@ -78,10 +78,6 @@ open class FinTs4kMapper { open fun mapBankAccountIdentifier(account: BankAccountIdentifier): BankAccountIdentifierImpl = BankAccountIdentifierImpl(account.identifier, account.subAccountNumber, account.iban) - open fun mapTanMethod(method: TanMethod) = net.codinux.banking.fints.model.TanMethod( // TODO: get instance from FinTsData, don't create manually - method.displayName, Sicherheitsfunktion.entries.first { it.code == method.identifier }, mapTanMethodType(method.type), null, method.maxTanInputLength, mapAllowedTanFormat(method.allowedTanFormat) - ) - protected open fun mapTanMethodType(type: TanMethodType): net.codinux.banking.fints.model.TanMethodType = net.codinux.banking.fints.model.TanMethodType.valueOf(type.name)