Implemented changing TAN method (but better find instance in FinTsData instead of creating a new instance)
This commit is contained in:
parent
aa7b7afaf0
commit
97604d59c9
|
@ -5,7 +5,7 @@ import net.codinux.banking.client.model.config.NoArgConstructor
|
|||
@NoArgConstructor
|
||||
open class EnterTanResult(
|
||||
val enteredTan: String?,
|
||||
// val changeTanMethodTo: TanMethod? = null,
|
||||
val changeTanMethodTo: TanMethod? = null,
|
||||
// val changeTanMediumTo: TanMedium? = null,
|
||||
// val changeTanMediumResultCallback: ((BankingClientResponse) -> Unit)? = null
|
||||
)
|
|
@ -22,6 +22,8 @@ open class BridgeFintTsToBankingClientCallback(
|
|||
bankingClientCallback.enterTan(mapper.mapTanChallenge(tanChallenge)) { enterTanResult ->
|
||||
if (enterTanResult.enteredTan != null) {
|
||||
tanChallenge.userEnteredTan(enterTanResult.enteredTan!!)
|
||||
} else if (enterTanResult.changeTanMethodTo != null) {
|
||||
tanChallenge.userAsksToChangeTanMethod(mapper.mapTanMethod(enterTanResult.changeTanMethodTo!!))
|
||||
} else {
|
||||
tanChallenge.userDidNotEnterTan()
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import net.dankito.banking.client.model.parameter.GetAccountDataParameter
|
|||
import net.dankito.banking.client.model.parameter.RetrieveTransactions
|
||||
import net.dankito.banking.client.model.response.ErrorCode
|
||||
import net.codinux.banking.fints.mapper.FinTsModelMapper
|
||||
import net.codinux.banking.fints.messages.datenelemente.implementierte.signatur.Sicherheitsfunktion
|
||||
import net.codinux.banking.fints.model.*
|
||||
import net.codinux.banking.fints.messages.datenelemente.implementierte.tan.TanMedium
|
||||
import net.codinux.banking.fints.messages.datenelemente.implementierte.tan.MobilePhoneTanMedium
|
||||
|
@ -74,9 +75,16 @@ open class FinTs4kMapper {
|
|||
open fun mapBankAccountIdentifier(account: BankAccountIdentifier): BankAccountIdentifierImpl =
|
||||
BankAccountIdentifierImpl(account.identifier, account.subAccountNumber, account.iban)
|
||||
|
||||
open fun mapTanMethod(method: TanMethod) = net.codinux.banking.fints.model.TanMethod( // TODO: get instance from FinTsData, don't create manually
|
||||
method.displayName, Sicherheitsfunktion.entries.first { it.code == method.identifier }, mapTanMethodType(method.type), null, method.maxTanInputLength, mapAllowedTanFormat(method.allowedTanFormat)
|
||||
)
|
||||
|
||||
protected open fun mapTanMethodType(type: TanMethodType): net.codinux.banking.fints.model.TanMethodType =
|
||||
net.codinux.banking.fints.model.TanMethodType.valueOf(type.name)
|
||||
|
||||
protected open fun mapAllowedTanFormat(allowedTanFormat: AllowedTanFormat?): net.codinux.banking.fints.messages.datenelemente.implementierte.tan.AllowedTanFormat =
|
||||
allowedTanFormat?.let { net.codinux.banking.fints.messages.datenelemente.implementierte.tan.AllowedTanFormat.valueOf(it.name) } ?: net.codinux.banking.fints.messages.datenelemente.implementierte.tan.AllowedTanFormat.Alphanumeric
|
||||
|
||||
|
||||
open fun map(response: net.dankito.banking.client.model.response.GetAccountDataResponse, bank: BankInfo? = null): Response<GetAccountDataResponse> =
|
||||
if (response.successful && response.customerAccount != null) {
|
||||
|
@ -242,7 +250,7 @@ open class FinTs4kMapper {
|
|||
protected open fun mapActionRequiringTan(action: net.codinux.banking.fints.model.ActionRequiringTan): ActionRequiringTan =
|
||||
ActionRequiringTan.valueOf(action.name)
|
||||
|
||||
protected open fun mapTanMethod(method: net.codinux.banking.fints.model.TanMethod): TanMethod = TanMethod(
|
||||
open fun mapTanMethod(method: net.codinux.banking.fints.model.TanMethod): TanMethod = TanMethod(
|
||||
method.displayName, mapTanMethodType(method.type), method.securityFunction.code, method.maxTanInputLength, mapAllowedTanFormat(method.allowedTanFormat)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue