From d0910b7180c3c1c9fcf9c933e32872eac0a26326 Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 23 Sep 2020 04:20:27 +0200 Subject: [PATCH] Parsing now also isCleared --- .../net/dankito/banking/fints/model/CreditCardTransaction.kt | 3 ++- .../net/dankito/banking/fints/response/ResponseParser.kt | 3 ++- .../net/dankito/banking/fints/response/ResponseParserTest.kt | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/CreditCardTransaction.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/CreditCardTransaction.kt index 1170f8c4..1d6d76de 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/CreditCardTransaction.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/CreditCardTransaction.kt @@ -7,5 +7,6 @@ open class CreditCardTransaction( val amount: Money, val otherPartyName: String, val bookingDate: Date, - val valueDate: Date + val valueDate: Date, + val isCleared: Boolean ) \ No newline at end of file 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 ae130773..b039c7b5 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 @@ -700,8 +700,9 @@ open class ResponseParser( val valueDate = parseDate(dataElements[2]) val amount = parseCreditCardAmount(dataElements.subList(4, 7)) val otherPartyName = parseString(dataElements[11]) + val isCleared = parseBoolean(dataElements[20]) - return CreditCardTransaction(amount, otherPartyName, bookingDate, valueDate) + return CreditCardTransaction(amount, otherPartyName, bookingDate, valueDate, isCleared) } private fun parseCreditCardAmount(amountDataElements: List): Money { diff --git a/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/response/ResponseParserTest.kt b/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/response/ResponseParserTest.kt index 0afc8cf7..17eae53b 100644 --- a/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/response/ResponseParserTest.kt +++ b/fints4k/src/commonTest/kotlin/net/dankito/banking/fints/response/ResponseParserTest.kt @@ -1113,6 +1113,7 @@ class ResponseParserTest : FinTsTestBase() { expect(transaction.valueDate).toBe(Date(2020, 8, 20)) expect(transaction.amount.amount.string).toBe("-" + amount) expect(transaction.amount.currency.code).toBe("EUR") + expect(transaction.isCleared).isTrue() } } ?: run { fail("No segment of type ReceivedCreditCardTransactionsAndBalance found in ${result.receivedSegments}") }