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 ->
|
response.getFirstSegmentById<ReceivedCreditCardTransactionsAndBalance>(InstituteSegmentId.CreditCardTransactions)?.let { transactionsSegment ->
|
||||||
balance = Money(transactionsSegment.balance.amount, transactionsSegment.balance.currency ?: "EUR")
|
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(
|
open class CreditCardTransaction(
|
||||||
val amount: Money,
|
open val amount: Money,
|
||||||
val otherPartyName: String,
|
open val transactionDescriptionBase: String?,
|
||||||
val bookingDate: Date,
|
open val transactionDescriptionSupplement: String?,
|
||||||
val valueDate: Date,
|
open val bookingDate: Date,
|
||||||
val isCleared: Boolean
|
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 {
|
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 bookingDate = parseDate(dataElements[1])
|
||||||
val valueDate = parseDate(dataElements[2])
|
val valueDate = parseDate(dataElements[2])
|
||||||
val amount = parseCreditCardAmount(dataElements.subList(8, 11))
|
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])
|
val isCleared = parseBoolean(dataElements[20])
|
||||||
|
|
||||||
return CreditCardTransaction(amount, otherPartyName, bookingDate, valueDate, isCleared)
|
return CreditCardTransaction(amount, transactionDescriptionBase, transactionDescriptionSupplement, bookingDate, valueDate, isCleared)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
log.error("Could not parse Credit card transaction '$transactionDataElementGroup'", e)
|
log.error("Could not parse Credit card transaction '$transactionDataElementGroup'", e)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue