Retrieving ChangeTanMediaParameters now from supportedJobs instead of storing it a second time

This commit is contained in:
dankito 2024-10-14 20:44:31 +02:00
parent 67b58117e1
commit d7d2702869
3 changed files with 7 additions and 12 deletions

View File

@ -29,7 +29,6 @@ open class BankData(
open var selectedTanMethod: TanMethod = TanMethodNotSelected, open var selectedTanMethod: TanMethod = TanMethodNotSelected,
open var tanMedia: List<TanMedium> = listOf(), open var tanMedia: List<TanMedium> = listOf(),
open var selectedTanMedium: TanMedium? = null, open var selectedTanMedium: TanMedium? = null,
open var changeTanMediumParameters: ChangeTanMediaParameters? = null,
open var supportedLanguages: List<Dialogsprache> = listOf(), open var supportedLanguages: List<Dialogsprache> = listOf(),
open var selectedLanguage: Dialogsprache = Dialogsprache.Default, open var selectedLanguage: Dialogsprache = Dialogsprache.Default,
@ -64,6 +63,9 @@ open class BankData(
open var pinInfo: PinInfo? = null open var pinInfo: PinInfo? = null
open val changeTanMediumParameters: ChangeTanMediaParameters?
get() = supportedJobs.filterIsInstance<ChangeTanMediaParameters>().firstOrNull()
protected open val _accounts = mutableListOf<AccountData>() protected open val _accounts = mutableListOf<AccountData>()

View File

@ -56,10 +56,6 @@ open class ModelMapper(
} }
} }
response.getFirstSegmentById<ChangeTanMediaParameters>(InstituteSegmentId.ChangeTanMediaParameters)?.let { parameters ->
bank.changeTanMediumParameters = parameters
}
if (response.supportedJobs.isNotEmpty()) { if (response.supportedJobs.isNotEmpty()) {
bank.supportedJobs = response.supportedJobs bank.supportedJobs = response.supportedJobs
} }

View File

@ -62,13 +62,10 @@ abstract class FinTsTestBase {
val ClientConfig = FinTsClientConfiguration(FinTsClientOptions(version = ProductVersion, productName = ProductName)) 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 { 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 { fun createTestAccount(): AccountData {
@ -122,6 +119,7 @@ abstract class FinTsTestBase {
createAllowedJob(CustomerSegmentId.CreditCardTransactions, 2), createAllowedJob(CustomerSegmentId.CreditCardTransactions, 2),
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")),
ChangeTanMediaParameters(changeTanMediumJob, false, false, false, false, false, listOf())
) )
bank.jobsRequiringTan = setOf( bank.jobsRequiringTan = setOf(
CustomerSegmentId.Balance.id, CustomerSegmentId.Balance.id,
@ -130,7 +128,6 @@ abstract class FinTsTestBase {
CustomerSegmentId.SepaBankTransfer.id, CustomerSegmentId.SepaBankTransfer.id,
CustomerSegmentId.SepaRealTimeTransfer.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) val checkingAccount = AccountData(CustomerId, null, BankCountryCode, BankCode, "ABCDDEBBXXX", CustomerId, AccountType.Girokonto, "EUR", "", null, null, bank.supportedJobs.map { it.jobName }, bank.supportedJobs)
bank.addAccount(checkingAccount) bank.addAccount(checkingAccount)