Implemented detecting a chipTAN's HHD version

This commit is contained in:
dankito 2020-05-16 13:07:48 +02:00
parent 5e57d2a490
commit 827fd7bc92
3 changed files with 24 additions and 2 deletions

View File

@ -938,7 +938,7 @@ open class FinTsClient @JvmOverloads constructor(
}
return TanProcedure(procedureName, parameters.securityFunction,
mapToTanProcedureType(parameters) ?: TanProcedureType.EnterTan)
mapToTanProcedureType(parameters) ?: TanProcedureType.EnterTan, mapHhdVersion(parameters))
}
protected open fun mapToTanProcedureType(parameters: TanProcedureParameters): TanProcedureType? {
@ -987,6 +987,16 @@ open class FinTsClient @JvmOverloads constructor(
}
}
protected open fun mapHhdVersion(parameters: TanProcedureParameters): HHDVersion? {
return when {
technicalTanProcedureIdentificationContains(parameters, "HHD1.4") -> HHDVersion.HHD_1_4
technicalTanProcedureIdentificationContains(parameters, "HHD1.3") -> HHDVersion.HHD_1_3
parameters.versionZkaTanProcedure?.contains("1.4") == true -> HHDVersion.HHD_1_4
parameters.versionZkaTanProcedure?.contains("1.3") == true -> HHDVersion.HHD_1_4
else -> null
}
}
protected open fun tanProcedureNameContains(name: String, vararg namesToTest: String): Boolean {
namesToTest.forEach { nameToTest ->
if (name.contains(nameToTest.toLowerCase())) {
@ -1007,6 +1017,7 @@ open class FinTsClient @JvmOverloads constructor(
return false
}
protected open fun isJobSupported(account: AccountData, supportedJob: JobParameters): Boolean {
for (allowedJobName in account.allowedJobNames) {
if (allowedJobName == supportedJob.jobName) {

View File

@ -0,0 +1,10 @@
package net.dankito.fints.model
enum class HHDVersion {
HHD_1_3,
HHD_1_4
}

View File

@ -6,7 +6,8 @@ import net.dankito.fints.messages.datenelemente.implementierte.signatur.Sicherhe
open class TanProcedure(
val displayName: String,
val securityFunction: Sicherheitsfunktion,
val type: TanProcedureType
val type: TanProcedureType,
val hhdVersion: HHDVersion? = null
) {