Parsing now also isCleared

This commit is contained in:
dankito 2020-09-23 04:20:27 +02:00
parent 94dd1aaff8
commit d0910b7180
3 changed files with 5 additions and 2 deletions

View File

@ -7,5 +7,6 @@ open class CreditCardTransaction(
val amount: Money, val amount: Money,
val otherPartyName: String, val otherPartyName: String,
val bookingDate: Date, val bookingDate: Date,
val valueDate: Date val valueDate: Date,
val isCleared: Boolean
) )

View File

@ -700,8 +700,9 @@ open class ResponseParser(
val valueDate = parseDate(dataElements[2]) val valueDate = parseDate(dataElements[2])
val amount = parseCreditCardAmount(dataElements.subList(4, 7)) val amount = parseCreditCardAmount(dataElements.subList(4, 7))
val otherPartyName = parseString(dataElements[11]) 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<String>): Money { private fun parseCreditCardAmount(amountDataElements: List<String>): Money {

View File

@ -1113,6 +1113,7 @@ class ResponseParserTest : FinTsTestBase() {
expect(transaction.valueDate).toBe(Date(2020, 8, 20)) expect(transaction.valueDate).toBe(Date(2020, 8, 20))
expect(transaction.amount.amount.string).toBe("-" + amount) expect(transaction.amount.amount.string).toBe("-" + amount)
expect(transaction.amount.currency.code).toBe("EUR") expect(transaction.amount.currency.code).toBe("EUR")
expect(transaction.isCleared).isTrue()
} }
} }
?: run { fail("No segment of type ReceivedCreditCardTransactionsAndBalance found in ${result.receivedSegments}") } ?: run { fail("No segment of type ReceivedCreditCardTransactionsAndBalance found in ${result.receivedSegments}") }