From a64e0b94270d0ed6b4d8dbf1091c4bf714c7ce63 Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 18 Sep 2020 18:48:38 +0200 Subject: [PATCH] Fixed that last allowed job was discarded when extension isn't set --- .../net/dankito/banking/fints/response/ResponseParser.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt index 78696491..658a7078 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt @@ -247,8 +247,9 @@ open class ResponseParser( val productName = if (dataElementGroups.size > 8) parseStringToNullIfEmpty(dataElementGroups[8]) else null val limit = if (dataElementGroups.size > 9) parseStringToNullIfEmpty(dataElementGroups[9]) else null // TODO: parse limit - val allowedJobNames = if (dataElementGroups.size > 10) parseAllowedJobNames(dataElementGroups.subList(10, dataElementGroups.size - 1)) else listOf() - val extension = if (dataElementGroups.size > 11) parseStringToNullIfEmpty(dataElementGroups[dataElementGroups.size - 1]) else null + val isExtensionSet = dataElementGroups.size > 11 && dataElementGroups.last().endsWith('}') + val allowedJobNames = if (dataElementGroups.size > 10) parseAllowedJobNames(dataElementGroups.subList(10, if (isExtensionSet) dataElementGroups.size - 1 else dataElementGroups.size)) else listOf() + val extension = if (isExtensionSet) parseStringToNullIfEmpty(dataElementGroups[dataElementGroups.size - 1]) else null return AccountInfo(accountNumber, subAccountAttribute, bankCountryCode, bankCode, iban, customerId, accountType, currency, accountHolderName1, accountHolderName2, productName, limit, allowedJobNames, extension, segment)