Added tanMediaIdentifier to TanChallenge; added toString()

This commit is contained in:
dankl 2020-01-02 13:57:50 +01:00 committed by dankito
parent 110fc59756
commit a589fc89e2
2 changed files with 20 additions and 6 deletions

View File

@ -607,9 +607,7 @@ open class FinTsClient @JvmOverloads constructor(
protected open fun handleMayRequiredTan(response: Response, bank: BankData, customer: CustomerData, dialogData: DialogData): Response {
if (response.isStrongAuthenticationRequired) {
response.tanResponse?.let { tanResponse ->
// TODO: is this true for all tan procedures?
val enteredTanResult = callback.enterTan(customer, TanChallenge(tanResponse.challenge ?: "",
tanResponse.challengeHHD_UC ?: "", customer.selectedTanProcedure))
val enteredTanResult = callback.enterTan(customer, createTanChallenge(tanResponse, customer))
if (enteredTanResult.changeTanProcedureTo != null) {
return handleUserAsksToChangeTanProcedureAndResendLastMessage(enteredTanResult.changeTanProcedureTo,
@ -640,6 +638,15 @@ open class FinTsClient @JvmOverloads constructor(
return response
}
protected open fun createTanChallenge(tanResponse: TanResponse, customer: CustomerData): TanChallenge {
// TODO: is this true for all tan procedures?
val messageToShowToUser = tanResponse.challenge ?: ""
val challenge = tanResponse.challengeHHD_UC ?: ""
val tanProcedure = customer.selectedTanProcedure
return TanChallenge(messageToShowToUser, challenge, tanProcedure, tanResponse.tanMediaIdentifier)
}
protected open fun sendTanToBank(enteredTan: String, tanResponse: TanResponse, bank: BankData,
customer: CustomerData, dialogData: DialogData): Response {

View File

@ -3,6 +3,13 @@ package net.dankito.fints.model
open class TanChallenge(
val messageToShowToUser: String,
val tanChallenge: String,
val tanProcedure: TanProcedure
)
val challenge: String,
val tanProcedure: TanProcedure,
val tanMediaIdentifier: String?
) {
override fun toString(): String {
return "$tanProcedure (medium: $tanMediaIdentifier): $messageToShowToUser"
}
}