Implemented mapping DecoupledTanMethodParameters

This commit is contained in:
dankito 2020-12-20 16:44:10 +01:00
parent 5af1557642
commit ef1c927d27
3 changed files with 34 additions and 2 deletions

View File

@ -1132,7 +1132,8 @@ open class FinTsClient(
return TanMethod(methodName, parameters.securityFunction,
mapToTanMethodType(parameters) ?: TanMethodType.EnterTan, mapHhdVersion(parameters),
parameters.maxTanInputLength, parameters.allowedTanFormat,
parameters.nameOfTanMediumRequired == BezeichnungDesTanMediumsErforderlich.BezeichnungDesTanMediumsMussAngegebenWerden)
parameters.nameOfTanMediumRequired == BezeichnungDesTanMediumsErforderlich.BezeichnungDesTanMediumsMussAngegebenWerden,
mapDecoupledTanMethodParameters(parameters))
}
protected open fun mapToTanMethodType(parameters: TanMethodParameters): TanMethodType? {
@ -1212,6 +1213,20 @@ open class FinTsClient(
return false
}
protected open fun mapDecoupledTanMethodParameters(parameters: TanMethodParameters): DecoupledTanMethodParameters? {
parameters.manualConfirmationAllowedForDecoupled?.let { manualConfirmationAllowed ->
return DecoupledTanMethodParameters(
manualConfirmationAllowed,
parameters.periodicStateRequestsAllowedForDecoupled ?: false, // this and the following values are all set when manualConfirmationAllowedForDecoupled is set
parameters.maxNumberOfStateRequestsForDecoupled ?: 0,
parameters.initialDelayInSecondsForStateRequestsForDecoupled ?: Int.MAX_VALUE,
parameters.delayInSecondsForNextStateRequestsForDecoupled ?: Int.MAX_VALUE
)
}
return null
}
protected open fun isJobSupported(bank: BankData, segmentId: ISegmentId): Boolean {
return bank.supportedJobs.map { it.jobName }.contains(segmentId.id)

View File

@ -0,0 +1,16 @@
package net.dankito.banking.fints.model
open class DecoupledTanMethodParameters(
open val manualConfirmationAllowed: Boolean,
open val periodicStateRequestsAllowed: Boolean,
open val maxNumberOfStateRequests: Int,
open val initialDelayInSecondsForStateRequests: Int,
open val delayInSecondsForNextStateRequests: Int
) {
override fun toString(): String {
return "DecoupledTanMethodParameters(manualConfirmationAllowed=$manualConfirmationAllowed, periodicStateRequestsAllowed=$periodicStateRequestsAllowed, maxNumberOfStateRequests=$maxNumberOfStateRequests, initialDelayInSecondsForStateRequests=$initialDelayInSecondsForStateRequests, delayInSecondsForNextStateRequests=$delayInSecondsForNextStateRequests)"
}
}

View File

@ -11,7 +11,8 @@ open class TanMethod(
open val hhdVersion: HHDVersion? = null,
open val maxTanInputLength: Int? = null,
open val allowedTanFormat: AllowedTanFormat? = null,
open val nameOfTanMediumRequired: Boolean = false
open val nameOfTanMediumRequired: Boolean = false,
open val decoupledParameters: DecoupledTanMethodParameters? = null
) {