Also added account for which TAN is required, if available, to TanChallenge
This commit is contained in:
parent
fe8c0fb59c
commit
4745bf0065
|
@ -373,11 +373,9 @@ open class FinTsJobExecutor(
|
||||||
|
|
||||||
|
|
||||||
protected open suspend fun handleEnteringTanRequired(context: JobContext, tanResponse: TanResponse, response: BankResponse): BankResponse {
|
protected open suspend fun handleEnteringTanRequired(context: JobContext, tanResponse: TanResponse, response: BankResponse): BankResponse {
|
||||||
val bank = context.bank // TODO: copy required data to TanChallenge
|
|
||||||
|
|
||||||
// on all platforms run on Dispatchers.Main, but on iOS skip this (or wrap in withContext(Dispatchers.IO) )
|
// on all platforms run on Dispatchers.Main, but on iOS skip this (or wrap in withContext(Dispatchers.IO) )
|
||||||
// val enteredTanResult = GlobalScope.async {
|
// val enteredTanResult = GlobalScope.async {
|
||||||
val tanChallenge = createTanChallenge(tanResponse, modelMapper.mapToActionRequiringTan(context.type), bank)
|
val tanChallenge = createTanChallenge(tanResponse, modelMapper.mapToActionRequiringTan(context.type), context.bank, context.account)
|
||||||
|
|
||||||
context.callback.enterTan(tanChallenge)
|
context.callback.enterTan(tanChallenge)
|
||||||
|
|
||||||
|
@ -395,7 +393,7 @@ open class FinTsJobExecutor(
|
||||||
return handleEnterTanResult(context, enteredTanResult, tanResponse, response)
|
return handleEnterTanResult(context, enteredTanResult, tanResponse, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun createTanChallenge(tanResponse: TanResponse, forAction: ActionRequiringTan, bank: BankData): TanChallenge {
|
protected open fun createTanChallenge(tanResponse: TanResponse, forAction: ActionRequiringTan, bank: BankData, account: AccountData? = null): TanChallenge {
|
||||||
// TODO: is this true for all tan methods?
|
// TODO: is this true for all tan methods?
|
||||||
val messageToShowToUser = tanResponse.challenge ?: ""
|
val messageToShowToUser = tanResponse.challenge ?: ""
|
||||||
val challenge = tanResponse.challengeHHD_UC ?: ""
|
val challenge = tanResponse.challengeHHD_UC ?: ""
|
||||||
|
@ -405,13 +403,13 @@ open class FinTsJobExecutor(
|
||||||
TanMethodType.ChipTanFlickercode ->
|
TanMethodType.ChipTanFlickercode ->
|
||||||
FlickerCodeTanChallenge(
|
FlickerCodeTanChallenge(
|
||||||
FlickerCodeDecoder().decodeChallenge(challenge, tanMethod.hhdVersion ?: HHDVersion.HHD_1_4), // HHD 1.4 is currently the most used version
|
FlickerCodeDecoder().decodeChallenge(challenge, tanMethod.hhdVersion ?: HHDVersion.HHD_1_4), // HHD 1.4 is currently the most used version
|
||||||
forAction, bank, messageToShowToUser, challenge, tanMethod, tanResponse.tanMediaIdentifier)
|
forAction, messageToShowToUser, challenge, tanMethod, tanResponse.tanMediaIdentifier, bank, account)
|
||||||
|
|
||||||
TanMethodType.ChipTanQrCode, TanMethodType.ChipTanPhotoTanMatrixCode,
|
TanMethodType.ChipTanQrCode, TanMethodType.ChipTanPhotoTanMatrixCode,
|
||||||
TanMethodType.QrCode, TanMethodType.photoTan ->
|
TanMethodType.QrCode, TanMethodType.photoTan ->
|
||||||
ImageTanChallenge(TanImageDecoder().decodeChallenge(challenge), forAction, bank, messageToShowToUser, challenge, tanMethod, tanResponse.tanMediaIdentifier)
|
ImageTanChallenge(TanImageDecoder().decodeChallenge(challenge), forAction, messageToShowToUser, challenge, tanMethod, tanResponse.tanMediaIdentifier, bank, account)
|
||||||
|
|
||||||
else -> TanChallenge(forAction, bank, messageToShowToUser, challenge, tanMethod, tanResponse.tanMediaIdentifier)
|
else -> TanChallenge(forAction, messageToShowToUser, challenge, tanMethod, tanResponse.tanMediaIdentifier, bank, account)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,13 @@ import net.dankito.banking.fints.tan.FlickerCode
|
||||||
open class FlickerCodeTanChallenge(
|
open class FlickerCodeTanChallenge(
|
||||||
val flickerCode: FlickerCode,
|
val flickerCode: FlickerCode,
|
||||||
forAction: ActionRequiringTan,
|
forAction: ActionRequiringTan,
|
||||||
bank: BankData,
|
|
||||||
messageToShowToUser: String,
|
messageToShowToUser: String,
|
||||||
challenge: String,
|
challenge: String,
|
||||||
tanMethod: TanMethod,
|
tanMethod: TanMethod,
|
||||||
tanMediaIdentifier: String?
|
tanMediaIdentifier: String?,
|
||||||
) : TanChallenge(forAction, bank, messageToShowToUser, challenge, tanMethod, tanMediaIdentifier) {
|
bank: BankData,
|
||||||
|
account: AccountData? = null
|
||||||
|
) : TanChallenge(forAction, messageToShowToUser, challenge, tanMethod, tanMediaIdentifier, bank, account) {
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "$tanMethod (medium: $tanMediaIdentifier) $flickerCode: $messageToShowToUser"
|
return "$tanMethod (medium: $tanMediaIdentifier) $flickerCode: $messageToShowToUser"
|
||||||
|
|
|
@ -6,12 +6,13 @@ import net.dankito.banking.fints.tan.TanImage
|
||||||
open class ImageTanChallenge(
|
open class ImageTanChallenge(
|
||||||
val image: TanImage,
|
val image: TanImage,
|
||||||
forAction: ActionRequiringTan,
|
forAction: ActionRequiringTan,
|
||||||
bank: BankData,
|
|
||||||
messageToShowToUser: String,
|
messageToShowToUser: String,
|
||||||
challenge: String,
|
challenge: String,
|
||||||
tanMethod: TanMethod,
|
tanMethod: TanMethod,
|
||||||
tanMediaIdentifier: String?
|
tanMediaIdentifier: String?,
|
||||||
) : TanChallenge(forAction, bank, messageToShowToUser, challenge, tanMethod, tanMediaIdentifier) {
|
bank: BankData,
|
||||||
|
account: AccountData? = null
|
||||||
|
) : TanChallenge(forAction, messageToShowToUser, challenge, tanMethod, tanMediaIdentifier, bank, account) {
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "$tanMethod (medium: $tanMediaIdentifier) $image: $messageToShowToUser"
|
return "$tanMethod (medium: $tanMediaIdentifier) $image: $messageToShowToUser"
|
||||||
|
|
|
@ -6,11 +6,12 @@ import net.dankito.banking.fints.response.client.FinTsClientResponse
|
||||||
|
|
||||||
open class TanChallenge(
|
open class TanChallenge(
|
||||||
val forAction: ActionRequiringTan,
|
val forAction: ActionRequiringTan,
|
||||||
val bank: BankData,
|
|
||||||
val messageToShowToUser: String,
|
val messageToShowToUser: String,
|
||||||
val challenge: String,
|
val challenge: String,
|
||||||
val tanMethod: TanMethod,
|
val tanMethod: TanMethod,
|
||||||
val tanMediaIdentifier: String?
|
val tanMediaIdentifier: String?,
|
||||||
|
val bank: BankData,
|
||||||
|
val account: AccountData? = null
|
||||||
) {
|
) {
|
||||||
|
|
||||||
var enterTanResult: EnterTanResult? = null
|
var enterTanResult: EnterTanResult? = null
|
||||||
|
|
Loading…
Reference in New Issue