Mapped fints4k Decoupled TAN model
This commit is contained in:
parent
62276e2a02
commit
f1dad3bc26
|
@ -54,6 +54,17 @@ open class TanChallenge(
|
|||
get() = availableTanMedia.firstOrNull { it.mediumName == selectedTanMediumName }
|
||||
|
||||
|
||||
/**
|
||||
* Principally a no-op method, not implemented for all client, only implementing client for not: FinTs4jBankingClient.
|
||||
*
|
||||
* If a TAN is requested for a decoupled TAN method like [TanMethodType.DecoupledTan] or [TanMethodType.DecoupledPushTan],
|
||||
* you can add a callback to get notified when user approved TAN in her app e.g. to close a EnterTanDialog.
|
||||
*/
|
||||
open fun addUserApprovedDecoupledTanCallback(callback: () -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun toString(): String {
|
||||
return "$selectedTanMethod $forAction: $messageToShowToUser" + when (type) {
|
||||
TanChallengeType.EnterTan -> ""
|
||||
|
|
|
@ -17,22 +17,30 @@ enum class TanMethodType {
|
|||
|
||||
AppTan,
|
||||
|
||||
DecoupledTan,
|
||||
|
||||
DecoupledPushTan,
|
||||
|
||||
photoTan,
|
||||
|
||||
QrCode
|
||||
;
|
||||
|
||||
|
||||
val isDecoupledMethod: Boolean
|
||||
get() = this == DecoupledTan || this == DecoupledPushTan
|
||||
|
||||
|
||||
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)
|
||||
|
||||
val NonVisualOrImageBased = buildList {
|
||||
addAll(listOf(TanMethodType.AppTan, TanMethodType.SmsTan, TanMethodType.EnterTan))
|
||||
addAll(listOf(TanMethodType.DecoupledTan, TanMethodType.DecoupledPushTan, TanMethodType.AppTan, TanMethodType.SmsTan, TanMethodType.EnterTan))
|
||||
addAll(ImageBased)
|
||||
addAll(listOf(TanMethodType.ChipTanManuell)) // this is quite inconvenient for user, so i added it at last
|
||||
addAll(listOf(TanMethodType.ChipTanManuell)) // this is quite inconvenient for user, so i added it as last
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -152,7 +152,11 @@ open class FinTs4kMapper {
|
|||
val tanImage = if (challenge is ImageTanChallenge) mapTanImage(challenge.image) else null
|
||||
val flickerCode = if (challenge is FlickerCodeTanChallenge) mapFlickerCode(challenge.flickerCode) else null
|
||||
|
||||
return TanChallenge(type, action, challenge.messageToShowToUser, selectedTanMethodId, tanMethods, selectedTanMediumName, tanMedia, tanImage, flickerCode, user, account)
|
||||
return object : TanChallenge(type, action, challenge.messageToShowToUser, selectedTanMethodId, tanMethods, selectedTanMediumName, tanMedia, tanImage, flickerCode, user, account) {
|
||||
override fun addUserApprovedDecoupledTanCallback(callback: () -> Unit) {
|
||||
challenge.addUserApprovedDecoupledTanCallback(callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun mapTanChallengeType(challenge: net.codinux.banking.fints.model.TanChallenge): TanChallengeType = when {
|
||||
|
|
Loading…
Reference in New Issue