From db129863e67f570690eac5a7592047e4b5490a2d Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 30 Apr 2020 02:25:06 +0200 Subject: [PATCH] Added case insensitive detection of appTAN and mobileTAN; added detection for 'mTAN' as mobileTAN; logging if a ZkaTanProcedure couldn't get mapped; not trying to map empty values --- .../dankito/fints/response/ResponseParser.kt | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/fints4javaLib/src/main/kotlin/net/dankito/fints/response/ResponseParser.kt b/fints4javaLib/src/main/kotlin/net/dankito/fints/response/ResponseParser.kt index 28f32c07..f0cb70b7 100644 --- a/fints4javaLib/src/main/kotlin/net/dankito/fints/response/ResponseParser.kt +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/response/ResponseParser.kt @@ -379,9 +379,28 @@ open class ResponseParser @JvmOverloads constructor( } protected open fun tryToParseZkaTanProcedure(mayZkaTanProcedure: String): ZkaTanProcedure? { + if (mayZkaTanProcedure.isBlank()) { + return null + } + try { + val lowerCaseMayZkaTanProcedure = mayZkaTanProcedure.toLowerCase() + + if (lowerCaseMayZkaTanProcedure == "mobiletan" || lowerCaseMayZkaTanProcedure == "mtan") { + return ZkaTanProcedure.mobileTAN + } + + if (lowerCaseMayZkaTanProcedure == "apptan") { + return ZkaTanProcedure.appTAN + } + + // TODO: what about these values, all returned by banks in anonymous dialog initialization: + // BestSign, HHDUSB1, Secoder_UC, ZkaTANMode, photoTAN, QRTAN, 1822TAN+ + return ZkaTanProcedure.valueOf(mayZkaTanProcedure) - } catch (ignored: Exception) { } + } catch (e: Exception) { + log.warn("'$mayZkaTanProcedure' could not be mapped to ZkaTanProcedure") + } return null }