diff --git a/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/AccountTransaction.kt b/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/AccountTransaction.kt index 318e4dab..906e7728 100644 --- a/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/AccountTransaction.kt +++ b/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/AccountTransaction.kt @@ -1,8 +1,10 @@ package net.codinux.banking.client.model import kotlinx.datetime.LocalDate +import net.codinux.banking.client.model.config.JsonIgnore import net.codinux.banking.client.model.config.NoArgConstructor +@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED") @NoArgConstructor open class AccountTransaction( val amount: Amount = Amount.Zero, // TODO: a string is really bad in UI, find a better solution @@ -134,5 +136,18 @@ open class AccountTransaction( "$amount $currency $bookingDate $valueDate $reference $otherPartyName $otherPartyBankId $otherPartyAccountId" } + @get:JsonIgnore + open val displayedReference: String? + get() = userSetReference ?: referenceNumber + + @get:JsonIgnore + open val displayedOtherPartyName: String? + get() = userSetOtherPartyName ?: otherPartyName + + @get:JsonIgnore + open val displayedOtherPartyNameOrPostingText: String? + get() = displayedOtherPartyName ?: postingText + + override fun toString() = "${valueDate.dayOfMonth}.${valueDate.monthNumber}.${valueDate.year} ${amount.toString().padStart(4, ' ')} ${if (currency == "EUR") "€" else currency} ${otherPartyName ?: ""} - $reference" } \ No newline at end of file