Added parsing transactionDescriptionSupplement
This commit is contained in:
parent
26cc2088ad
commit
ae37442d86
|
@ -399,7 +399,7 @@ open class FinTsClient(
|
|||
|
||||
response.getFirstSegmentById<ReceivedCreditCardTransactionsAndBalance>(InstituteSegmentId.CreditCardTransactions)?.let { transactionsSegment ->
|
||||
balance = Money(transactionsSegment.balance.amount, transactionsSegment.balance.currency ?: "EUR")
|
||||
bookedTransactions.addAll(transactionsSegment.transactions.map { AccountTransaction(parameter.account, it.amount, it.otherPartyName, it.bookingDate, it.otherPartyName, null, null, "", it.valueDate) })
|
||||
bookedTransactions.addAll(transactionsSegment.transactions.map { AccountTransaction(parameter.account, it.amount, it.description, it.bookingDate, it.transactionDescriptionBase ?: "", null, null, "", it.valueDate) })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,15 +5,31 @@ import net.dankito.utils.multiplatform.format
|
|||
|
||||
|
||||
open class CreditCardTransaction(
|
||||
val amount: Money,
|
||||
val otherPartyName: String,
|
||||
val bookingDate: Date,
|
||||
val valueDate: Date,
|
||||
val isCleared: Boolean
|
||||
open val amount: Money,
|
||||
open val transactionDescriptionBase: String?,
|
||||
open val transactionDescriptionSupplement: String?,
|
||||
open val bookingDate: Date,
|
||||
open val valueDate: Date,
|
||||
open val isCleared: Boolean
|
||||
) {
|
||||
|
||||
|
||||
open val description: String
|
||||
get() {
|
||||
transactionDescriptionBase?.let { transactionDescriptionBase ->
|
||||
if (transactionDescriptionSupplement != null) {
|
||||
return transactionDescriptionBase + " " + transactionDescriptionSupplement
|
||||
}
|
||||
|
||||
return transactionDescriptionBase
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
override fun toString(): String {
|
||||
return "${valueDate.format("dd.MM.yy")} $amount $otherPartyName"
|
||||
return "${valueDate.format("dd.MM.yy")} $amount $description"
|
||||
}
|
||||
|
||||
}
|
|
@ -702,10 +702,11 @@ open class ResponseParser(
|
|||
val bookingDate = parseDate(dataElements[1])
|
||||
val valueDate = parseDate(dataElements[2])
|
||||
val amount = parseCreditCardAmount(dataElements.subList(8, 11))
|
||||
val otherPartyName = parseString(dataElements[11])
|
||||
val transactionDescriptionBase = parseStringToNullIfEmpty(dataElements[11])
|
||||
val transactionDescriptionSupplement = parseStringToNullIfEmpty(dataElements[12])
|
||||
val isCleared = parseBoolean(dataElements[20])
|
||||
|
||||
return CreditCardTransaction(amount, otherPartyName, bookingDate, valueDate, isCleared)
|
||||
return CreditCardTransaction(amount, transactionDescriptionBase, transactionDescriptionSupplement, bookingDate, valueDate, isCleared)
|
||||
} catch (e: Exception) {
|
||||
log.error("Could not parse Credit card transaction '$transactionDataElementGroup'", e)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue