From fb70bcd443621c74505af8c8ac4ba1e9cc8ed106 Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 2 Sep 2024 03:23:19 +0200 Subject: [PATCH] Fixed mapping multiple HITANS segments in a message --- .../net/codinux/banking/fints/model/mapper/ModelMapper.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/mapper/ModelMapper.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/mapper/ModelMapper.kt index 66c1c327..e797f550 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/mapper/ModelMapper.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/mapper/ModelMapper.kt @@ -37,8 +37,9 @@ open class ModelMapper( bank.pinInfo = pinInfo } - response.getFirstSegmentById(InstituteSegmentId.TanInfo)?.let { tanInfo -> - bank.tanMethodsSupportedByBank = mapToTanMethods(tanInfo) + val tanInfos = response.getSegmentsById(InstituteSegmentId.TanInfo) + if (tanInfos.isNotEmpty()) { + bank.tanMethodsSupportedByBank = tanInfos.flatMap { tanInfo -> mapToTanMethods(tanInfo) } } response.getFirstSegmentById(InstituteSegmentId.CommunicationInfo)?.let { communicationInfo ->