From e6aec071a2bf8e3f6fc6744e97544e4bf195a149 Mon Sep 17 00:00:00 2001 From: dankito Date: Sun, 8 Sep 2024 21:56:51 +0200 Subject: [PATCH] Using the default values from GetAccountDataOptions. Fixes that otherwise fints4k uses other preferred TAN methods than BankingClient --- .../net/codinux/banking/client/fints4k/FinTs4kMapper.kt | 6 ++++-- 1 file changed, 4 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 d9959d9b..8b8459e8 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 @@ -48,11 +48,13 @@ open class FinTs4kMapper { ) open fun mapToUpdateAccountTransactionsParameter(user: User, account: BankAccount, finTsModel: BankData?): GetAccountDataParameter { + val defaults = GetAccountDataOptions() + val accountIdentifier = BankAccountIdentifierImpl(account.identifier, account.subAccountNumber, account.iban) val from = account.lastTransactionsRetrievalTime?.toLocalDateTime(TimeZone.EuropeBerlin)?.date // TODO: in case lastTransactionsUpdateTime is not set, this would retrieve all transactions (and require a TAN im most cases) - val retrieveTransactions = if (from != null) RetrieveTransactions.AccordingToRetrieveFromAndTo else RetrieveTransactions.OfLast90Days + val retrieveTransactions = if (from != null) RetrieveTransactions.AccordingToRetrieveFromAndTo else RetrieveTransactions.valueOf(defaults.retrieveTransactions.name) // val preferredTanMethods = listOf(mapTanMethodType(user.selectedTanMethod.type)) // TODO: currently we aren't saving TanMethods in database, re-enable as soon as TanMethods get saved - val preferredTanMethods = emptyList() + val preferredTanMethods = defaults.preferredTanMethods?.map { mapTanMethodType(it) } return GetAccountDataParameter(user.bankCode, user.loginName, user.password!!, listOf(accountIdentifier), true, retrieveTransactions, from,