From d00f71bedd11c7d39ef861757d3fb8023e1c27a6 Mon Sep 17 00:00:00 2001 From: dankito Date: Sat, 19 Oct 2024 21:37:39 +0200 Subject: [PATCH] Fixed mapping new TanMethodType names --- .../banking/client/fints4k/FinTs4kMapper.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 e81b6400..bf12b86c 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 @@ -41,6 +41,16 @@ import kotlin.io.encoding.ExperimentalEncodingApi open class FinTs4kMapper { + companion object { + val TanMethodTypesToMigrate = mapOf( + net.codinux.banking.fints.model.TanMethodType.ChipTanManuell.name to TanMethodType.ChipTanManual.name, + net.codinux.banking.fints.model.TanMethodType.ChipTanFlickercode.name to TanMethodType.ChipTanFlickerCode.name + ) + + val TanMethodTypesToMigrateReverse = TanMethodTypesToMigrate.map { it.value to it.key }.toMap() + } + + protected val fintsModelMapper = FinTsModelMapper() protected val bankingGroupMapper = BankingGroupMapper() @@ -82,7 +92,7 @@ open class FinTs4kMapper { BankAccountIdentifierImpl(account.identifier, account.subAccountNumber, account.iban) protected open fun mapTanMethodType(type: TanMethodType): net.codinux.banking.fints.model.TanMethodType = - net.codinux.banking.fints.model.TanMethodType.valueOf(type.name) + net.codinux.banking.fints.model.TanMethodType.valueOf(TanMethodTypesToMigrateReverse[type.name] ?: type.name) protected open fun mapAllowedTanFormat(allowedTanFormat: AllowedTanFormat?): net.codinux.banking.fints.messages.datenelemente.implementierte.tan.AllowedTanFormat = allowedTanFormat?.let { net.codinux.banking.fints.messages.datenelemente.implementierte.tan.AllowedTanFormat.valueOf(it.name) } ?: net.codinux.banking.fints.messages.datenelemente.implementierte.tan.AllowedTanFormat.Alphanumeric @@ -339,7 +349,7 @@ open class FinTs4kMapper { ) protected open fun mapTanMethodType(type: net.codinux.banking.fints.model.TanMethodType): TanMethodType = - TanMethodType.valueOf(type.name) + TanMethodType.valueOf(TanMethodTypesToMigrate[type.name] ?: type.name) protected open fun mapAllowedTanFormat(allowedTanFormat: net.codinux.banking.fints.messages.datenelemente.implementierte.tan.AllowedTanFormat?): AllowedTanFormat = allowedTanFormat?.let { AllowedTanFormat.valueOf(it.name) } ?: AllowedTanFormat.Alphanumeric