Made all properties overridable

This commit is contained in:
dankito 2020-06-24 20:26:03 +02:00
parent 81515d1125
commit ec435c1191
2 changed files with 58 additions and 62 deletions

View File

@ -10,43 +10,43 @@ import java.util.*
@JsonIdentityInfo(property = "id", generator = ObjectIdGenerators.PropertyGenerator::class) // to avoid stack overflow due to circular references
open class AccountTransaction(
val bankAccount: BankAccount,
val amount: BigDecimal,
val currency: String,
val unparsedUsage: String,
val bookingDate: Date,
val otherPartyName: String?,
val otherPartyBankCode: String?,
val otherPartyAccountId: String?,
val bookingText: String?,
val valueDate: Date,
val statementNumber: Int,
val sequenceNumber: Int?,
val openingBalance: BigDecimal?,
val closingBalance: BigDecimal?,
open val bankAccount: BankAccount,
open val amount: BigDecimal,
open val currency: String,
open val unparsedUsage: String,
open val bookingDate: Date,
open val otherPartyName: String?,
open val otherPartyBankCode: String?,
open val otherPartyAccountId: String?,
open val bookingText: String?,
open val valueDate: Date,
open val statementNumber: Int,
open val sequenceNumber: Int?,
open val openingBalance: BigDecimal?,
open val closingBalance: BigDecimal?,
val endToEndReference: String?,
val customerReference: String?,
val mandateReference: String?,
val creditorIdentifier: String?,
val originatorsIdentificationCode: String?,
val compensationAmount: String?,
val originalAmount: String?,
val sepaUsage: String?,
val deviantOriginator: String?,
val deviantRecipient: String?,
val usageWithNoSpecialType: String?,
val primaNotaNumber: String?,
val textKeySupplement: String?,
open val endToEndReference: String?,
open val customerReference: String?,
open val mandateReference: String?,
open val creditorIdentifier: String?,
open val originatorsIdentificationCode: String?,
open val compensationAmount: String?,
open val originalAmount: String?,
open val sepaUsage: String?,
open val deviantOriginator: String?,
open val deviantRecipient: String?,
open val usageWithNoSpecialType: String?,
open val primaNotaNumber: String?,
open val textKeySupplement: String?,
val currencyType: String?,
val bookingKey: String,
val referenceForTheAccountOwner: String,
val referenceOfTheAccountServicingInstitution: String?,
val supplementaryDetails: String?,
open val currencyType: String?,
open val bookingKey: String,
open val referenceForTheAccountOwner: String,
open val referenceOfTheAccountServicingInstitution: String?,
open val supplementaryDetails: String?,
val transactionReferenceNumber: String,
val relatedReferenceNumber: String?
open val transactionReferenceNumber: String,
open val relatedReferenceNumber: String?
) {
companion object {
@ -66,14 +66,11 @@ open class AccountTransaction(
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, "", "", null, null, "", null)
open var id: String = "${bankAccount.id} ${IdDateFormat.format(bookingDate)} ${IdDateFormat.format(valueDate)} $amount $currency $unparsedUsage $otherPartyName $otherPartyBankCode $otherPartyAccountId"
var id: String = "${bankAccount.id} ${IdDateFormat.format(bookingDate)} ${IdDateFormat.format(valueDate)} $amount $currency $unparsedUsage $otherPartyName $otherPartyBankCode $otherPartyAccountId"
val showOtherPartyName: Boolean
open val showOtherPartyName: Boolean
get() = otherPartyName.isNullOrBlank() == false /* && type != "ENTGELTABSCHLUSS" && type != "AUSZAHLUNG" */ // TODO
val usage: String
open val usage: String
get() = sepaUsage ?: unparsedUsage

View File

@ -8,33 +8,32 @@ import java.util.*
@JsonIdentityInfo(property = "id", generator = ObjectIdGenerators.PropertyGenerator::class) // to avoid stack overflow due to circular references
open class BankAccount @JvmOverloads constructor(
val customer: Customer,
val identifier: String,
var accountHolderName: String,
var iban: String?,
var subAccountNumber: String?,
val customerId: String,
var balance: BigDecimal = BigDecimal.ZERO,
var currency: String = "EUR",
var type: BankAccountType = BankAccountType.Girokonto,
val productName: String? = null,
val accountLimit: String? = null,
var lastRetrievedTransactionsTimestamp: Date? = null,
var supportsRetrievingAccountTransactions: Boolean = false,
var supportsRetrievingBalance: Boolean = false,
var supportsTransferringMoney: Boolean = false,
var supportsInstantPaymentMoneyTransfer: Boolean = false,
open val customer: Customer,
open val identifier: String,
open var accountHolderName: String,
open var iban: String?,
open var subAccountNumber: String?,
open val customerId: String,
open var balance: BigDecimal = BigDecimal.ZERO,
open var currency: String = "EUR",
open var type: BankAccountType = BankAccountType.Girokonto,
open val productName: String? = null,
open val accountLimit: String? = null,
open var lastRetrievedTransactionsTimestamp: Date? = null,
open var supportsRetrievingAccountTransactions: Boolean = false,
open var supportsRetrievingBalance: Boolean = false,
open var supportsTransferringMoney: Boolean = false,
open var supportsInstantPaymentMoneyTransfer: Boolean = false,
bookedAccountTransactions: List<AccountTransaction> = listOf()
) {
internal constructor() : this(Customer(), "", "", null, null, "") // for object deserializers
var id: String = UUID.randomUUID().toString()
protected set
open var id: String = UUID.randomUUID().toString()
val displayName: String
open val displayName: String
get() {
val productName = productName ?: subAccountNumber
@ -46,14 +45,14 @@ open class BankAccount @JvmOverloads constructor(
return identifier
}
val displayNameIncludingBankName: String
open val displayNameIncludingBankName: String
get() = "${customer.bank.name} ${displayName}"
var bookedTransactions: List<AccountTransaction> = bookedAccountTransactions
open var bookedTransactions: List<AccountTransaction> = bookedAccountTransactions
protected set
var unbookedTransactions: List<Any> = listOf()
open var unbookedTransactions: List<Any> = listOf()
protected set