Setting jobsRequiringTan now directly, ignoring PinInfo
This commit is contained in:
parent
2a3b962af5
commit
2410504ede
|
@ -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.messages.segmente.id.ISegmentId
|
||||||
import net.codinux.banking.fints.response.segments.ChangeTanMediaParameters
|
import net.codinux.banking.fints.response.segments.ChangeTanMediaParameters
|
||||||
import net.codinux.banking.fints.response.segments.JobParameters
|
import net.codinux.banking.fints.response.segments.JobParameters
|
||||||
import net.codinux.banking.fints.response.segments.PinInfo
|
|
||||||
|
|
||||||
|
|
||||||
open class BankData(
|
open class BankData(
|
||||||
|
@ -83,14 +82,8 @@ open class BankData(
|
||||||
|
|
||||||
|
|
||||||
open var jobsRequiringTan: Set<String> = emptySet()
|
open var jobsRequiringTan: Set<String> = emptySet()
|
||||||
protected set
|
|
||||||
|
|
||||||
open var pinInfo: PinInfo? = null
|
// 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 fun doesJobRequireTan(segmentId: ISegmentId): Boolean = doesJobRequireTan(segmentId.id)
|
open fun doesJobRequireTan(segmentId: ISegmentId): Boolean = doesJobRequireTan(segmentId.id)
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,8 @@ open class ModelMapper(
|
||||||
}
|
}
|
||||||
|
|
||||||
response.getFirstSegmentById<PinInfo>(InstituteSegmentId.PinInfo)?.let { pinInfo ->
|
response.getFirstSegmentById<PinInfo>(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<TanInfo>(InstituteSegmentId.TanInfo)
|
val tanInfos = response.getSegmentsById<TanInfo>(InstituteSegmentId.TanInfo)
|
||||||
|
|
|
@ -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.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")),
|
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(
|
bank.jobsRequiringTan = setOf(
|
||||||
JobTanConfiguration(CustomerSegmentId.Balance.id, true),
|
CustomerSegmentId.Balance.id,
|
||||||
JobTanConfiguration(CustomerSegmentId.AccountTransactionsMt940.id, true),
|
CustomerSegmentId.AccountTransactionsMt940.id,
|
||||||
JobTanConfiguration(CustomerSegmentId.CreditCardTransactions.id, true),
|
CustomerSegmentId.CreditCardTransactions.id,
|
||||||
JobTanConfiguration(CustomerSegmentId.SepaBankTransfer.id, true),
|
CustomerSegmentId.SepaBankTransfer.id,
|
||||||
JobTanConfiguration(CustomerSegmentId.SepaRealTimeTransfer.id, true)
|
CustomerSegmentId.SepaRealTimeTransfer.id
|
||||||
))
|
)
|
||||||
bank.changeTanMediumParameters = ChangeTanMediaParameters(changeTanMediumJob, false, false, false, false, false, listOf())
|
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)
|
val checkingAccount = AccountData(CustomerId, null, BankCountryCode, BankCode, "ABCDDEBBXXX", CustomerId, AccountType.Girokonto, "EUR", "", null, null, bank.supportedJobs.map { it.jobName }, bank.supportedJobs)
|
||||||
|
|
|
@ -164,7 +164,7 @@ class MessageBuilderTest : FinTsTestBase() {
|
||||||
// given
|
// given
|
||||||
val getTransactionsJob = RetrieveAccountTransactionsParameters(JobParameters(CustomerSegmentId.AccountTransactionsMt940.id, 1, 1, null, "HIKAZS:73:5"), 180, true, false)
|
val getTransactionsJob = RetrieveAccountTransactionsParameters(JobParameters(CustomerSegmentId.AccountTransactionsMt940.id, 1, 1, null, "HIKAZS:73:5"), 180, true, false)
|
||||||
bank.supportedJobs = listOf(getTransactionsJob)
|
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))
|
val account = AccountData(CustomerId, null, BankCountryCode, BankCode, null, CustomerId, AccountType.Girokonto, "EUR", "", null, null, listOf(getTransactionsJob.jobName), listOf(getTransactionsJob))
|
||||||
bank.addAccount(account)
|
bank.addAccount(account)
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ class MessageBuilderTest : FinTsTestBase() {
|
||||||
// given
|
// given
|
||||||
val getTransactionsJob = RetrieveAccountTransactionsParameters(JobParameters(CustomerSegmentId.AccountTransactionsMt940.id, 1, 1, null, "HIKAZS:73:5"), 180, true, false)
|
val getTransactionsJob = RetrieveAccountTransactionsParameters(JobParameters(CustomerSegmentId.AccountTransactionsMt940.id, 1, 1, null, "HIKAZS:73:5"), 180, true, false)
|
||||||
bank.supportedJobs = listOf(getTransactionsJob)
|
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))
|
val account = AccountData(CustomerId, null, BankCountryCode, BankCode, null, CustomerId, AccountType.Girokonto, "EUR", "", null, null, listOf(getTransactionsJob.jobName), listOf(getTransactionsJob))
|
||||||
bank.addAccount(account)
|
bank.addAccount(account)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue