Mapped Decoupled TAN methods to their own types

This commit is contained in:
dankito 2024-09-02 13:23:34 +02:00
parent 504fbaf13b
commit 3f9921a62e
4 changed files with 13 additions and 5 deletions

View File

@ -19,6 +19,10 @@ enum class TanMethodType {
AppTan,
DecoupledTan,
DecoupledPushTan,
photoTan,
QrCode

View File

@ -230,6 +230,10 @@ open class ModelMapper(
tanMethodNameContains(name, "SMS", "mobile", "mTAN") -> TanMethodType.SmsTan
parameters.dkTanMethod == DkTanMethod.Decoupled -> TanMethodType.DecoupledTan
parameters.dkTanMethod == DkTanMethod.DecoupledPush -> TanMethodType.DecoupledPushTan
// 'flateXSecure' identifies itself as 'PPTAN' instead of 'AppTAN'
// 'activeTAN-Verfahren' can actually be used either with an app or a reader; it's like chipTAN QR but without a chip card
parameters.dkTanMethod == DkTanMethod.App

View File

@ -8,7 +8,7 @@ open class TanMethodSelector {
companion object {
val NonVisual = listOf(TanMethodType.AppTan, TanMethodType.SmsTan, TanMethodType.ChipTanManuell, TanMethodType.EnterTan)
val NonVisual = listOf(TanMethodType.DecoupledTan, TanMethodType.DecoupledPushTan, TanMethodType.AppTan, TanMethodType.SmsTan, TanMethodType.ChipTanManuell, TanMethodType.EnterTan)
val ImageBased = listOf(TanMethodType.QrCode, TanMethodType.ChipTanQrCode, TanMethodType.photoTan, TanMethodType.ChipTanPhotoTanMatrixCode)
@ -16,7 +16,7 @@ open class TanMethodSelector {
open fun getSuggestedTanMethod(tanMethods: List<TanMethod>): TanMethod? {
return tanMethods.firstOrNull { it.decoupledParameters != null } // decoupled TAN method is the most simplistic TAN method, user only has to confirm the action in her TAN app, no manual TAN entering required
return tanMethods.firstOrNull { it.type == TanMethodType.DecoupledPushTan || it.type == TanMethodType.DecoupledTan } // decoupled TAN method is the most simplistic TAN method, user only has to confirm the action in her TAN app, no manual TAN entering required
?: tanMethods.firstOrNull { it.type == TanMethodType.AppTan } // that's the second most simplistic TAN method: user has to confirm action in her TAN app and then enter the displayed TAN
?: tanMethods.firstOrNull { it.type != TanMethodType.ChipTanUsb && it.type != TanMethodType.SmsTan && it.type != TanMethodType.ChipTanManuell }
?: tanMethods.firstOrNull { it.type != TanMethodType.ChipTanUsb && it.type != TanMethodType.SmsTan }

View File

@ -941,10 +941,10 @@ class ResponseParserTest : FinTsTestBase() {
assertEquals(2, decoupledPushTanMethod.countSupportedActiveTanMedia)
assertEquals(180, decoupledPushTanMethod.maxNumberOfStateRequestsForDecoupled)
assertEquals(1, decoupledPushTanMethod.initialDelayInSecondsForStateRequestsForDecoupled)
assertEquals(1, decoupledPushTanMethod.delayInSecondsForNextStateRequestsForDecoupled)
assertEquals(1, decoupledPushTanMethod.initialDelayInSecondsForDecoupledStateRequest)
assertEquals(1, decoupledPushTanMethod.delayInSecondsForNextDecoupledStateRequests)
assertEquals(true, decoupledPushTanMethod.manualConfirmationAllowedForDecoupled)
assertEquals(true, decoupledPushTanMethod.periodicStateRequestsAllowedForDecoupled)
assertEquals(true, decoupledPushTanMethod.periodicDecoupledStateRequestsAllowed)
}
?: run { fail("No segment of type TanInfo found in ${result.receivedSegments}") }
}