diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsJobExecutor.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsJobExecutor.kt index f6ed968c..9fc92d20 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsJobExecutor.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsJobExecutor.kt @@ -373,11 +373,9 @@ open class FinTsJobExecutor( 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) ) // 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) @@ -395,7 +393,7 @@ open class FinTsJobExecutor( 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? val messageToShowToUser = tanResponse.challenge ?: "" val challenge = tanResponse.challengeHHD_UC ?: "" @@ -405,13 +403,13 @@ open class FinTsJobExecutor( TanMethodType.ChipTanFlickercode -> FlickerCodeTanChallenge( 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.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) } } diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/FlickerCodeTanChallenge.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/FlickerCodeTanChallenge.kt index 031c6ba0..fc72a883 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/FlickerCodeTanChallenge.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/FlickerCodeTanChallenge.kt @@ -6,12 +6,13 @@ import net.dankito.banking.fints.tan.FlickerCode open class FlickerCodeTanChallenge( val flickerCode: FlickerCode, forAction: ActionRequiringTan, - bank: BankData, messageToShowToUser: String, challenge: String, tanMethod: TanMethod, - tanMediaIdentifier: String? -) : TanChallenge(forAction, bank, messageToShowToUser, challenge, tanMethod, tanMediaIdentifier) { + tanMediaIdentifier: String?, + bank: BankData, + account: AccountData? = null +) : TanChallenge(forAction, messageToShowToUser, challenge, tanMethod, tanMediaIdentifier, bank, account) { override fun toString(): String { return "$tanMethod (medium: $tanMediaIdentifier) $flickerCode: $messageToShowToUser" diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/ImageTanChallenge.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/ImageTanChallenge.kt index a1889a56..d0e15d17 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/ImageTanChallenge.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/ImageTanChallenge.kt @@ -6,12 +6,13 @@ import net.dankito.banking.fints.tan.TanImage open class ImageTanChallenge( val image: TanImage, forAction: ActionRequiringTan, - bank: BankData, messageToShowToUser: String, challenge: String, tanMethod: TanMethod, - tanMediaIdentifier: String? -) : TanChallenge(forAction, bank, messageToShowToUser, challenge, tanMethod, tanMediaIdentifier) { + tanMediaIdentifier: String?, + bank: BankData, + account: AccountData? = null +) : TanChallenge(forAction, messageToShowToUser, challenge, tanMethod, tanMediaIdentifier, bank, account) { override fun toString(): String { return "$tanMethod (medium: $tanMediaIdentifier) $image: $messageToShowToUser" diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/TanChallenge.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/TanChallenge.kt index feb0fe85..adc82c49 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/TanChallenge.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/TanChallenge.kt @@ -6,11 +6,12 @@ import net.dankito.banking.fints.response.client.FinTsClientResponse open class TanChallenge( val forAction: ActionRequiringTan, - val bank: BankData, val messageToShowToUser: String, val challenge: String, val tanMethod: TanMethod, - val tanMediaIdentifier: String? + val tanMediaIdentifier: String?, + val bank: BankData, + val account: AccountData? = null ) { var enterTanResult: EnterTanResult? = null