From 4ec82a44d7ca21b275508bbd53eaadcf130538b4 Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 1 Nov 2021 19:14:39 +0100 Subject: [PATCH] Added selectedTanMedium --- .../kotlin/net/dankito/banking/fints/FinTsJobExecutor.kt | 3 +++ .../net/dankito/banking/fints/messages/MessageBuilder.kt | 2 +- .../kotlin/net/dankito/banking/fints/model/BankData.kt | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) 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 27e07fee..1cec8e06 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsJobExecutor.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsJobExecutor.kt @@ -332,6 +332,9 @@ open class FinTsJobExecutor( tanMediaList?.let { bank.tanMedia = it.tanMedia + + bank.selectedTanMedium = bank.selectedTanMedium?.let { selected -> bank.tanMedia.firstOrNull { it.mediumName == selected.mediumName } } // try to find selectedTanMedium in new TanMedia instances + ?: bank.tanMedia.firstOrNull { it.mediumName != null } } callback(GetTanMediaListResponse(response, tanMediaList)) diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/MessageBuilder.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/MessageBuilder.kt index a2e9c525..9ba8f85c 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/MessageBuilder.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/MessageBuilder.kt @@ -525,7 +525,7 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg val bank = dialogContext.bank if (bank.isTanMethodSelected && bank.selectedTanMethod.nameOfTanMediumRequired) { - return bank.tanMedia.firstOrNull { it.mediumName != null }?.mediumName + return bank.selectedTanMedium?.mediumName } return null diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/BankData.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/BankData.kt index dd2099f1..da437994 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/BankData.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/BankData.kt @@ -28,6 +28,7 @@ open class BankData( open var tanMethodsAvailableForUser: List = listOf(), open var selectedTanMethod: TanMethod = TanMethodNotSelected, open var tanMedia: List = listOf(), + open var selectedTanMedium: TanMedium? = null, open var changeTanMediumParameters: ChangeTanMediaParameters? = null, open var pinInfo: PinInfo? = null,