From bf6d7b98965bbbfe1ea99681f2ffa9897e74240a Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 4 May 2020 13:33:18 +0200 Subject: [PATCH] Re-added TAN procedure types photoTan and QrCode as we need to display their images (TODO: how to decode their images?) --- .../net/dankito/banking/ui/model/tan/TanProcedureType.kt | 7 ++++++- .../fints4java/android/ui/dialogs/EnterTanDialog.kt | 3 ++- .../net/dankito/banking/mapper/fints4javaModelMapper.kt | 4 ++++ .../src/main/kotlin/net/dankito/fints/FinTsClient.kt | 9 ++++++--- .../kotlin/net/dankito/fints/model/TanProcedureType.kt | 6 +++++- .../kotlin/net/dankito/banking/util/hbci4jModelMapper.kt | 1 + 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/BankingUiCommon/src/main/java/net/dankito/banking/ui/model/tan/TanProcedureType.kt b/BankingUiCommon/src/main/java/net/dankito/banking/ui/model/tan/TanProcedureType.kt index 2672afbb..4c2a971c 100644 --- a/BankingUiCommon/src/main/java/net/dankito/banking/ui/model/tan/TanProcedureType.kt +++ b/BankingUiCommon/src/main/java/net/dankito/banking/ui/model/tan/TanProcedureType.kt @@ -17,5 +17,10 @@ enum class TanProcedureType { SmsTan, - AppTan + AppTan, + + photoTan, + + QrCode + } \ No newline at end of file diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterTanDialog.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterTanDialog.kt index b09d63e8..11bdb30f 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterTanDialog.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterTanDialog.kt @@ -30,7 +30,8 @@ import javax.inject.Inject open class EnterTanDialog : DialogFragment() { companion object { - val OpticalTanProcedures = listOf(TanProcedureType.ChipTanFlickercode, TanProcedureType.ChipTanQrCode, TanProcedureType.ChipTanPhotoTanMatrixCode) + val OpticalTanProcedures = listOf(TanProcedureType.ChipTanFlickercode, TanProcedureType.ChipTanQrCode, + TanProcedureType.ChipTanPhotoTanMatrixCode, TanProcedureType.photoTan, TanProcedureType.QrCode) const val DialogTag = "EnterTanDialog" } diff --git a/fints4javaBankingClient/src/main/kotlin/net/dankito/banking/mapper/fints4javaModelMapper.kt b/fints4javaBankingClient/src/main/kotlin/net/dankito/banking/mapper/fints4javaModelMapper.kt index e1f14ce8..b426a916 100644 --- a/fints4javaBankingClient/src/main/kotlin/net/dankito/banking/mapper/fints4javaModelMapper.kt +++ b/fints4javaBankingClient/src/main/kotlin/net/dankito/banking/mapper/fints4javaModelMapper.kt @@ -223,6 +223,8 @@ open class fints4javaModelMapper { net.dankito.fints.model.TanProcedureType.ChipTanPhotoTanMatrixCode -> TanProcedureType.ChipTanPhotoTanMatrixCode net.dankito.fints.model.TanProcedureType.SmsTan -> TanProcedureType.SmsTan net.dankito.fints.model.TanProcedureType.AppTan -> TanProcedureType.AppTan + net.dankito.fints.model.TanProcedureType.photoTan -> TanProcedureType.photoTan + net.dankito.fints.model.TanProcedureType.QrCode -> TanProcedureType.QrCode } } @@ -332,6 +334,8 @@ open class fints4javaModelMapper { TanProcedureType.ChipTanPhotoTanMatrixCode -> net.dankito.fints.model.TanProcedureType.ChipTanPhotoTanMatrixCode TanProcedureType.SmsTan -> net.dankito.fints.model.TanProcedureType.SmsTan TanProcedureType.AppTan -> net.dankito.fints.model.TanProcedureType.AppTan + TanProcedureType.photoTan -> net.dankito.fints.model.TanProcedureType.photoTan + TanProcedureType.QrCode -> net.dankito.fints.model.TanProcedureType.QrCode } } diff --git a/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt b/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt index 1679f445..a51cf8fd 100644 --- a/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt @@ -695,12 +695,15 @@ open class FinTsClient @JvmOverloads constructor( val tanProcedure = customer.selectedTanProcedure return when (tanProcedure.type) { - TanProcedureType.ChipTanFlickercode, TanProcedureType.ChipTanManuell -> + TanProcedureType.ChipTanFlickercode, TanProcedureType.ChipTanManuell, TanProcedureType.ChipTanUsb -> FlickerCodeTanChallenge(FlickerCodeDecoder().decodeChallenge(challenge), messageToShowToUser, challenge, tanProcedure, tanResponse.tanMediaIdentifier) TanProcedureType.ChipTanQrCode, TanProcedureType.ChipTanPhotoTanMatrixCode -> ImageTanChallenge(TanImageDecoder().decodeChallenge(challenge), messageToShowToUser, challenge, tanProcedure, tanResponse.tanMediaIdentifier) + TanProcedureType.QrCode, TanProcedureType.photoTan -> // TODO: how do these TAN procedures work? i don't think they use the HHD format + ImageTanChallenge(TanImageDecoder().decodeChallenge(challenge), messageToShowToUser, challenge, tanProcedure, tanResponse.tanMediaIdentifier) + else -> TanChallenge(messageToShowToUser, challenge, tanProcedure, tanResponse.tanMediaIdentifier) } } @@ -935,7 +938,7 @@ open class FinTsClient @JvmOverloads constructor( // QRTAN+ from 1822 direct has nothing to do with chipTAN QR. name.contains("qr") -> { if (tanProcedureNameContains(name, "chipTAN", "Smart")) TanProcedureType.ChipTanQrCode - else TanProcedureType.AppTan + else TanProcedureType.QrCode } // photoTAN from Commerzbank (comdirect), Deutsche Bank, norisbank has nothing to do with chipTAN photo @@ -943,7 +946,7 @@ open class FinTsClient @JvmOverloads constructor( // e.g. 'Smart-TAN photo' / description 'Challenge' if (tanProcedureNameContains(name, "chipTAN", "Smart")) TanProcedureType.ChipTanPhotoTanMatrixCode // e.g. 'photoTAN-Verfahren', description 'Freigabe durch photoTAN' - else TanProcedureType.AppTan + else TanProcedureType.photoTan } tanProcedureNameContains(name, "SMS", "mobile", "mTAN") -> TanProcedureType.SmsTan diff --git a/fints4javaLib/src/main/kotlin/net/dankito/fints/model/TanProcedureType.kt b/fints4javaLib/src/main/kotlin/net/dankito/fints/model/TanProcedureType.kt index bad52a35..0082d765 100644 --- a/fints4javaLib/src/main/kotlin/net/dankito/fints/model/TanProcedureType.kt +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/model/TanProcedureType.kt @@ -17,6 +17,10 @@ enum class TanProcedureType { SmsTan, - AppTan + AppTan, + + photoTan, + + QrCode } \ No newline at end of file diff --git a/hbci4jBankingClient/src/main/kotlin/net/dankito/banking/util/hbci4jModelMapper.kt b/hbci4jBankingClient/src/main/kotlin/net/dankito/banking/util/hbci4jModelMapper.kt index c1b48688..4c4790b7 100644 --- a/hbci4jBankingClient/src/main/kotlin/net/dankito/banking/util/hbci4jModelMapper.kt +++ b/hbci4jBankingClient/src/main/kotlin/net/dankito/banking/util/hbci4jModelMapper.kt @@ -83,6 +83,7 @@ open class hbci4jModelMapper { val displayNameLowerCase = displayName.toLowerCase() return when { + // TODO: implement all TAN procedures displayNameLowerCase.contains("chiptan") -> { if (displayNameLowerCase.contains("qr")) { net.dankito.banking.ui.model.tan.TanProcedure(displayName, TanProcedureType.ChipTanQrCode, code)