Mapping PinInfo
This commit is contained in:
parent
66801a1c7a
commit
67b58117e1
|
@ -43,7 +43,8 @@ open class BankData(
|
|||
open var countMaxJobsPerMessage: Int = 0,
|
||||
|
||||
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 {
|
||||
|
@ -61,6 +62,8 @@ open class BankData(
|
|||
internal constructor() : this("", "", "", "", "") // for object deserializers
|
||||
|
||||
|
||||
open var pinInfo: PinInfo? = null
|
||||
|
||||
|
||||
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: String): Boolean =
|
||||
|
|
|
@ -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?
|
||||
)
|
|
@ -11,6 +11,7 @@ import net.codinux.banking.fints.model.*
|
|||
import net.codinux.banking.fints.response.BankResponse
|
||||
import net.codinux.banking.fints.response.InstituteSegmentId
|
||||
import net.codinux.banking.fints.response.segments.*
|
||||
import net.codinux.banking.fints.response.segments.PinInfo
|
||||
|
||||
|
||||
open class ModelMapper(
|
||||
|
@ -34,7 +35,7 @@ open class ModelMapper(
|
|||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue