Mapping PinInfo

This commit is contained in:
dankito 2024-10-14 20:20:51 +02:00
parent 66801a1c7a
commit 67b58117e1
3 changed files with 18 additions and 6 deletions

View File

@ -43,7 +43,8 @@ open class BankData(
open var countMaxJobsPerMessage: Int = 0, open var countMaxJobsPerMessage: Int = 0,
open var supportedHbciVersions: List<HbciVersion> = listOf(), open var supportedHbciVersions: List<HbciVersion> = listOf(),
open var supportedJobs: List<JobParameters> = listOf() open var supportedJobs: List<JobParameters> = listOf(),
open var jobsRequiringTan: Set<String> = emptySet()
) { ) {
companion object { companion object {
@ -61,6 +62,8 @@ open class BankData(
internal constructor() : this("", "", "", "", "") // for object deserializers internal constructor() : this("", "", "", "", "") // for object deserializers
open var pinInfo: PinInfo? = null
protected open val _accounts = mutableListOf<AccountData>() protected open val _accounts = mutableListOf<AccountData>()
@ -81,10 +84,6 @@ open class BankData(
} }
open var jobsRequiringTan: Set<String> = emptySet()
// open var pinInfo: PinInfo? = null
open fun doesJobRequireTan(segmentId: ISegmentId): Boolean = doesJobRequireTan(segmentId.id) open fun doesJobRequireTan(segmentId: ISegmentId): Boolean = doesJobRequireTan(segmentId.id)
open fun doesJobRequireTan(segmentId: String): Boolean = open fun doesJobRequireTan(segmentId: String): Boolean =

View File

@ -0,0 +1,12 @@
package net.codinux.banking.fints.model
import kotlinx.serialization.Serializable
@Serializable
open class PinInfo(
val minPinLength: Int?,
val maxPinLength: Int?,
val minTanLength: Int?,
val userIdHint: String?,
val customerIdHint: String?
)

View File

@ -11,6 +11,7 @@ import net.codinux.banking.fints.model.*
import net.codinux.banking.fints.response.BankResponse import net.codinux.banking.fints.response.BankResponse
import net.codinux.banking.fints.response.InstituteSegmentId import net.codinux.banking.fints.response.InstituteSegmentId
import net.codinux.banking.fints.response.segments.* import net.codinux.banking.fints.response.segments.*
import net.codinux.banking.fints.response.segments.PinInfo
open class ModelMapper( open class ModelMapper(
@ -34,7 +35,7 @@ open class ModelMapper(
} }
response.getFirstSegmentById<PinInfo>(InstituteSegmentId.PinInfo)?.let { pinInfo -> response.getFirstSegmentById<PinInfo>(InstituteSegmentId.PinInfo)?.let { pinInfo ->
// TODO: save min/maxPinLength, minTanLength, user/customerIdHint on BankData (or in BankFinderResult object?) bank.pinInfo = net.codinux.banking.fints.model.PinInfo(pinInfo.minPinLength, pinInfo.maxPinLength, pinInfo.minTanLength, pinInfo.userIdHint, pinInfo.customerIdHint)
bank.jobsRequiringTan = pinInfo.jobTanConfiguration.filter { it.tanRequired }.map { it.segmentId }.toHashSet() bank.jobsRequiringTan = pinInfo.jobTanConfiguration.filter { it.tanRequired }.map { it.segmentId }.toHashSet()
} }