From d7d2702869b594b4c71aaaabf22921eb42c65140 Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 14 Oct 2024 20:44:31 +0200 Subject: [PATCH] Retrieving ChangeTanMediaParameters now from supportedJobs instead of storing it a second time --- .../net/codinux/banking/fints/model/BankData.kt | 4 +++- .../codinux/banking/fints/model/mapper/ModelMapper.kt | 4 ---- .../kotlin/net/codinux/banking/fints/FinTsTestBase.kt | 11 ++++------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/BankData.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/BankData.kt index 6e91166e..e89916ea 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/BankData.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/BankData.kt @@ -29,7 +29,6 @@ open class BankData( open var selectedTanMethod: TanMethod = TanMethodNotSelected, open var tanMedia: List = listOf(), open var selectedTanMedium: TanMedium? = null, - open var changeTanMediumParameters: ChangeTanMediaParameters? = null, open var supportedLanguages: List = listOf(), open var selectedLanguage: Dialogsprache = Dialogsprache.Default, @@ -64,6 +63,9 @@ open class BankData( open var pinInfo: PinInfo? = null + open val changeTanMediumParameters: ChangeTanMediaParameters? + get() = supportedJobs.filterIsInstance().firstOrNull() + protected open val _accounts = mutableListOf() diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/mapper/ModelMapper.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/mapper/ModelMapper.kt index 4cb37dfe..786e2015 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/mapper/ModelMapper.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/mapper/ModelMapper.kt @@ -56,10 +56,6 @@ open class ModelMapper( } } - response.getFirstSegmentById(InstituteSegmentId.ChangeTanMediaParameters)?.let { parameters -> - bank.changeTanMediumParameters = parameters - } - if (response.supportedJobs.isNotEmpty()) { bank.supportedJobs = response.supportedJobs } diff --git a/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/FinTsTestBase.kt b/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/FinTsTestBase.kt index d048aff9..2773e4ea 100644 --- a/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/FinTsTestBase.kt +++ b/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/FinTsTestBase.kt @@ -62,13 +62,10 @@ abstract class FinTsTestBase { val ClientConfig = FinTsClientConfiguration(FinTsClientOptions(version = ProductVersion, productName = ProductName)) - init { - Bank.changeTanMediumParameters = ChangeTanMediaParameters(JobParameters("", 1, 1, 1, ":0:0"), false, false, false, false, false, listOf()) - } - - fun createTestBank(): BankData { - return BankData(BankCode, CustomerId, Pin, BankFinTsServerAddress, Bic, "", BankCountryCode, selectedTanMethod = TanMethod("chipTAN-optisch", SecurityFunction, TanMethodType.ChipTanFlickercode), selectedLanguage = Language) + return BankData(BankCode, CustomerId, Pin, BankFinTsServerAddress, Bic, "", BankCountryCode, selectedTanMethod = TanMethod("chipTAN-optisch", SecurityFunction, TanMethodType.ChipTanFlickercode), selectedLanguage = Language, supportedJobs = listOf( + ChangeTanMediaParameters(JobParameters("", 1, 1, 1, ":0:0"), false, false, false, false, false, listOf()) + )) } fun createTestAccount(): AccountData { @@ -122,6 +119,7 @@ abstract class FinTsTestBase { createAllowedJob(CustomerSegmentId.CreditCardTransactions, 2), SepaAccountInfoParameters(createAllowedJob(CustomerSegmentId.SepaBankTransfer, 1), true, true, true, true, 35, listOf("pain.001.001.03")), SepaAccountInfoParameters(createAllowedJob(CustomerSegmentId.SepaRealTimeTransfer, 1), true, true, true, true, 35, listOf("pain.001.001.03")), + ChangeTanMediaParameters(changeTanMediumJob, false, false, false, false, false, listOf()) ) bank.jobsRequiringTan = setOf( CustomerSegmentId.Balance.id, @@ -130,7 +128,6 @@ abstract class FinTsTestBase { CustomerSegmentId.SepaBankTransfer.id, CustomerSegmentId.SepaRealTimeTransfer.id ) - bank.changeTanMediumParameters = ChangeTanMediaParameters(changeTanMediumJob, false, false, false, false, false, listOf()) val checkingAccount = AccountData(CustomerId, null, BankCountryCode, BankCode, "ABCDDEBBXXX", CustomerId, AccountType.Girokonto, "EUR", "", null, null, bank.supportedJobs.map { it.jobName }, bank.supportedJobs) bank.addAccount(checkingAccount)