Implemented setting preferred TanMethodTypes and set it to NonVisualOrImageBase by default
This commit is contained in:
parent
ea1c184abc
commit
5ff2714512
|
@ -3,16 +3,43 @@ package net.codinux.banking.client.model.options
|
|||
import kotlinx.datetime.LocalDate
|
||||
import net.codinux.banking.client.model.BankAccountIdentifier
|
||||
import net.codinux.banking.client.model.config.NoArgConstructor
|
||||
import net.codinux.banking.client.model.tan.TanMethodType
|
||||
|
||||
@NoArgConstructor
|
||||
open class GetAccountDataOptions(
|
||||
val retrieveBalance: Boolean = true,
|
||||
val retrieveTransactions: RetrieveTransactions = RetrieveTransactions.OfLast90Days,
|
||||
val retrieveTransactionsFrom: LocalDate? = null,
|
||||
val retrieveTransactionsTo: LocalDate? = null,
|
||||
|
||||
val retrieveBalance: Boolean = true,
|
||||
|
||||
/**
|
||||
* Account(s) may should be excluded from data retrieval, so this option enabled to set for which accounts data
|
||||
* should be retrieved.
|
||||
*/
|
||||
val accounts: List<BankAccountIdentifier> = emptyList(),
|
||||
|
||||
/**
|
||||
* Specifies which [TanMethodType] should be preferred when having to choose between multiple available for user
|
||||
* without requesting the user to choose one.
|
||||
*
|
||||
* By default we don't ask the user which TanMethod she prefers but choose one that could match best. If she really
|
||||
* likes to use a different one, she can select another one in EnterTanDialog.
|
||||
*
|
||||
* By default we prefer non visual TanMethods (like AppTan and SMS) over image based TanMethods (like QR-code and
|
||||
* photoTan) and exclude ChipTanUsb, which is not supported by application, and Flickercode, which is hard to
|
||||
* implement and therefore most applications have not implemented.
|
||||
*
|
||||
* Console apps can only handle non visual TanMethods.
|
||||
* But also graphical applications prefer non visual TanMethods as then they only have to display a text field to input
|
||||
* TAN, and then image based TanMethods as then they additionally only have to display an image.
|
||||
*/
|
||||
val preferredTanMethods: List<TanMethodType>? = TanMethodType.NonVisualOrImageBased,
|
||||
|
||||
val abortIfTanIsRequired: Boolean = false,
|
||||
// account(s) may should get excluded from data retrieval, so add option to set for which accounts data should be retrieved
|
||||
val accounts: List<BankAccountIdentifier> = emptyList()
|
||||
|
||||
// there's also the option preferredTanMedium, but can hardly find a use case for it as we
|
||||
// cannot know the TanMedium name upfront. In most cases there's only one TanMedium (per TanMethod) anyway.
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return "retrieveBalance=$retrieveBalance, retrieveTransactions=$retrieveTransactions, abortIfTanIsRequired=$abortIfTanIsRequired"
|
||||
|
|
|
@ -20,4 +20,21 @@ enum class TanMethodType {
|
|||
photoTan,
|
||||
|
||||
QrCode
|
||||
;
|
||||
|
||||
|
||||
companion object {
|
||||
|
||||
val NonVisual = listOf(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(ImageBased)
|
||||
addAll(listOf(TanMethodType.ChipTanManuell)) // this is quite inconvenient for user, so i added it at last
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue