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 58f6fb41..cc91c66e 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 @@ -7,7 +7,6 @@ import net.codinux.banking.fints.messages.datenelemente.implementierte.tan.TanMe import net.codinux.banking.fints.messages.segmente.id.ISegmentId import net.codinux.banking.fints.response.segments.ChangeTanMediaParameters import net.codinux.banking.fints.response.segments.JobParameters -import net.codinux.banking.fints.response.segments.PinInfo open class BankData( @@ -83,14 +82,8 @@ open class BankData( open var jobsRequiringTan: Set = emptySet() - protected set - open var pinInfo: PinInfo? = null - set(value) { - field = value - // TODO: in case of null: actually in this case it's not allowed to execute job via PIN/TAN at all - jobsRequiringTan = value?.jobTanConfiguration.orEmpty().filter { it.tanRequired }.map { it.segmentId }.toSet() - } +// open var pinInfo: PinInfo? = null open fun doesJobRequireTan(segmentId: ISegmentId): Boolean = doesJobRequireTan(segmentId.id) 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 c63f5747..48f0c633 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 @@ -34,7 +34,8 @@ open class ModelMapper( } response.getFirstSegmentById(InstituteSegmentId.PinInfo)?.let { pinInfo -> - bank.pinInfo = pinInfo + // TODO: save min/maxPinLength, minTanLength, user/customerIdHint on BankData (or in BankFinderResult object?) + bank.jobsRequiringTan = pinInfo.jobTanConfiguration.filter { it.tanRequired }.map { it.segmentId }.toHashSet() } val tanInfos = response.getSegmentsById(InstituteSegmentId.TanInfo) 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 6f5ae0f2..d048aff9 100644 --- a/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/FinTsTestBase.kt +++ b/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/FinTsTestBase.kt @@ -123,13 +123,13 @@ abstract class FinTsTestBase { 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")), ) - bank.pinInfo = PinInfo(getTransactionsJob, null, null, null, null, null, listOf( - JobTanConfiguration(CustomerSegmentId.Balance.id, true), - JobTanConfiguration(CustomerSegmentId.AccountTransactionsMt940.id, true), - JobTanConfiguration(CustomerSegmentId.CreditCardTransactions.id, true), - JobTanConfiguration(CustomerSegmentId.SepaBankTransfer.id, true), - JobTanConfiguration(CustomerSegmentId.SepaRealTimeTransfer.id, true) - )) + bank.jobsRequiringTan = setOf( + CustomerSegmentId.Balance.id, + CustomerSegmentId.AccountTransactionsMt940.id, + CustomerSegmentId.CreditCardTransactions.id, + 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) diff --git a/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/messages/MessageBuilderTest.kt b/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/messages/MessageBuilderTest.kt index 2bfe6a58..1cc102b9 100644 --- a/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/messages/MessageBuilderTest.kt +++ b/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/messages/MessageBuilderTest.kt @@ -164,7 +164,7 @@ class MessageBuilderTest : FinTsTestBase() { // given val getTransactionsJob = RetrieveAccountTransactionsParameters(JobParameters(CustomerSegmentId.AccountTransactionsMt940.id, 1, 1, null, "HIKAZS:73:5"), 180, true, false) bank.supportedJobs = listOf(getTransactionsJob) - bank.pinInfo = PinInfo(getTransactionsJob, null, null, null, null, null, listOf(JobTanConfiguration(CustomerSegmentId.AccountTransactionsMt940.id, true))) + bank.jobsRequiringTan = setOf(CustomerSegmentId.AccountTransactionsMt940.id) val account = AccountData(CustomerId, null, BankCountryCode, BankCode, null, CustomerId, AccountType.Girokonto, "EUR", "", null, null, listOf(getTransactionsJob.jobName), listOf(getTransactionsJob)) bank.addAccount(account) @@ -198,7 +198,7 @@ class MessageBuilderTest : FinTsTestBase() { // given val getTransactionsJob = RetrieveAccountTransactionsParameters(JobParameters(CustomerSegmentId.AccountTransactionsMt940.id, 1, 1, null, "HIKAZS:73:5"), 180, true, false) bank.supportedJobs = listOf(getTransactionsJob) - bank.pinInfo = PinInfo(getTransactionsJob, null, null, null, null, null, listOf(JobTanConfiguration(CustomerSegmentId.AccountTransactionsMt940.id, true))) + bank.jobsRequiringTan = setOf(CustomerSegmentId.AccountTransactionsMt940.id) val account = AccountData(CustomerId, null, BankCountryCode, BankCode, null, CustomerId, AccountType.Girokonto, "EUR", "", null, null, listOf(getTransactionsJob.jobName), listOf(getTransactionsJob)) bank.addAccount(account)