#53: BankAccountRecordDO.kt

plugins/org.projectforge.plugins.banking/src/main/kotlin/org/projectforge/plugins/banking/BankAccountRecordDO.kt

Path: ./plugins/.../BankAccountRecordDO.kt · Source: GitHub

181 lines · 127 code · 31 comments · 23 blank

What it does

JPA entity for individual bank account transactions (records). 15 fields covering standard bank statement data: amount, date, valueDate, type, subject, currency, SEPA fields (debteeId, mandateReference, customerReference, collectionReference), receiver/sender, IBAN, BIC. Plus a checksum field for detecting post-import manipulation.

Fields

FieldTypeDB ColumnNotes
bankAccountBankAccountDO?banking_account_fkManyToOne LAZY, IdOnlySerializer
amountBigDecimal?amount(12,2)CURRENCY type
dateLocalDate?date_col
valueDateLocalDate?value_dateValuta date (when funds become available)
typeString?LENGTH_TEXTTransaction type code (e.g. "SEPA Credit Transfer")
subjectString?LENGTH_TEXTPayment reference/purpose
...and: comment, currency, debteeId, mandateReference, customerReference, collectionReference, info, receiverSender, iban, bic, checksum

Checksum integrity

fun buildCheckSum(): String {
  sb.append(amount?.setScale(2)).append('|')
  sb.append(StringHelper.removeNonDigitsAndNonASCIILetters(subject)).append('|')
  ... // 8 fields concatenated with | separator
  return DigestUtils.sha256Hex(sb.toString())
}

buildCheckSum() computes a SHA-256 hash over 8 normalized fields. ensureChecksum (computed property) auto-generates the checksum if null. Used by BankAccountRecordPagesRest (#55) for doublet detection: two records with identical checksums but different IDs are flagged as potential duplicates. Also used to detect manual manipulation of imported records.