Added a check to determine HHD version

This commit is contained in:
dankito 2024-09-26 14:20:12 +02:00
parent 9aad2a5101
commit 65d983a5e7
1 changed files with 9 additions and 1 deletions

View File

@ -444,7 +444,7 @@ Log.info { "Terminating waiting for TAN input" } // TODO: remove again
return when (tanMethod.type) { return when (tanMethod.type) {
TanMethodType.ChipTanFlickercode -> TanMethodType.ChipTanFlickercode ->
FlickerCodeTanChallenge( FlickerCodeTanChallenge(
FlickerCodeDecoder().decodeChallenge(challenge, tanMethod.hhdVersion ?: HHDVersion.HHD_1_4), // HHD 1.4 is currently the most used version FlickerCodeDecoder().decodeChallenge(challenge, tanMethod.hhdVersion ?: getFallbackHhdVersion(challenge)),
forAction, messageToShowToUser, challenge, tanMethod, tanResponse.tanMediaIdentifier, bank, account, tanResponse.tanExpirationTime) forAction, messageToShowToUser, challenge, tanMethod, tanResponse.tanMediaIdentifier, bank, account, tanResponse.tanExpirationTime)
TanMethodType.ChipTanQrCode, TanMethodType.ChipTanPhotoTanMatrixCode, TanMethodType.ChipTanQrCode, TanMethodType.ChipTanPhotoTanMatrixCode,
@ -455,6 +455,14 @@ Log.info { "Terminating waiting for TAN input" } // TODO: remove again
} }
} }
protected open fun getFallbackHhdVersion(challenge: String): HHDVersion {
if (challenge.length <= 35) { // is this true in all circumstances?
return HHDVersion.HHD_1_3
}
return HHDVersion.HHD_1_4 // HHD 1.4 is currently the most used version
}
protected open suspend fun mayRetrieveAutomaticallyIfUserEnteredDecoupledTan(context: JobContext, tanChallenge: TanChallenge, tanResponse: TanResponse) { protected open suspend fun mayRetrieveAutomaticallyIfUserEnteredDecoupledTan(context: JobContext, tanChallenge: TanChallenge, tanResponse: TanResponse) {
context.bank.selectedTanMethod.decoupledParameters?.let { decoupledTanMethodParameters -> context.bank.selectedTanMethod.decoupledParameters?.let { decoupledTanMethodParameters ->
if (decoupledTanMethodParameters.periodicStateRequestsAllowed) { if (decoupledTanMethodParameters.periodicStateRequestsAllowed) {