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 e64bd735..ea989990 100644 --- a/fints4javaLib/src/main/kotlin/net/dankito/fints/response/ResponseParser.kt +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/response/ResponseParser.kt @@ -167,11 +167,29 @@ open class ResponseParser @JvmOverloads constructor( 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 - // TODO: parse allowed jobs - // TODO: parse extension + 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 return AccountInfo(accountNumber, subAccountAttribute, bankCountryCode, bankCode, iban, customerId, accountType, - currency, accountHolderName1, accountHolderName2, productName, limit, null, segment) + currency, accountHolderName1, accountHolderName2, productName, limit, allowedJobNames, extension, segment) + } + + protected open fun parseAllowedJobNames(dataElementGroups: List): List { + + return dataElementGroups.mapNotNull { parseAllowedJobName(it) } + } + + protected open fun parseAllowedJobName(dataElementGroup: String): String? { + val dataElements = getDataElements(dataElementGroup) + + if (dataElements.size > 0) { + val jobName = parseString(dataElements[0]) + if (jobName.startsWith("HK")) { // filter out jobs not standardized by Deutsche Kreditwirtschaft (Verbandseigene Geschaeftsvorfaelle) + return jobName + } + } + + return null } diff --git a/fints4javaLib/src/main/kotlin/net/dankito/fints/response/segments/AccountInfo.kt b/fints4javaLib/src/main/kotlin/net/dankito/fints/response/segments/AccountInfo.kt index 8e36db4a..80d9bb1f 100644 --- a/fints4javaLib/src/main/kotlin/net/dankito/fints/response/segments/AccountInfo.kt +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/response/segments/AccountInfo.kt @@ -14,6 +14,7 @@ open class AccountInfo( val accountHolderName2: String?, val productName: String?, val accountLimit: String?, // TODO: parse + val allowedJobNames: List, val extension: String?, // TODO: parse segmentString: String diff --git a/fints4javaLib/src/test/kotlin/net/dankito/fints/response/ResponseParserTest.kt b/fints4javaLib/src/test/kotlin/net/dankito/fints/response/ResponseParserTest.kt index e65fbaba..457f8c72 100644 --- a/fints4javaLib/src/test/kotlin/net/dankito/fints/response/ResponseParserTest.kt +++ b/fints4javaLib/src/test/kotlin/net/dankito/fints/response/ResponseParserTest.kt @@ -210,6 +210,9 @@ class ResponseParserTest : FinTsTestBase() { assertThat(segment.accountHolderName1).isEqualTo("Hans Dampf") assertThat(segment.accountHolderName2).isNull() assertThat(segment.productName).isEqualTo("Sichteinlagen") + assertThat(segment.accountLimit).isNull() + assertThat(segment.allowedJobNames).hasSize(44) + assertThat(segment.extension).isNotNull() } ?: run { Assert.fail("No segment of type AccountInfo found in ${result.receivedSegments}") } } @@ -236,6 +239,7 @@ class ResponseParserTest : FinTsTestBase() { assertThat(segment.accountHolderName2).isNull() assertThat(segment.productName).isNull() assertThat(segment.accountLimit).isNull() + assertThat(segment.allowedJobNames).isEmpty() assertThat(segment.extension).isNull() } ?: run { Assert.fail("No segment of type AccountInfo found in ${result.receivedSegments}") }