Added customerId, productName and accountLimit to BankAccount

This commit is contained in:
dankito 2020-05-23 19:32:25 +02:00
parent a16cf630b4
commit 9fa83f2685
3 changed files with 20 additions and 8 deletions

View File

@ -13,9 +13,12 @@ open class BankAccount @JvmOverloads constructor(
var accountHolderName: String, var accountHolderName: String,
var iban: String?, var iban: String?,
var subAccountNumber: String?, var subAccountNumber: String?,
val customerId: String,
var balance: BigDecimal = BigDecimal.ZERO, var balance: BigDecimal = BigDecimal.ZERO,
var currency: String = "EUR", var currency: String = "EUR",
var type: BankAccountType = BankAccountType.Girokonto, var type: BankAccountType = BankAccountType.Girokonto,
val productName: String? = null,
val accountLimit: String? = null,
var lastRetrievedTransactionsTimestamp: Date? = null, var lastRetrievedTransactionsTimestamp: Date? = null,
var supportsRetrievingAccountTransactions: Boolean = false, var supportsRetrievingAccountTransactions: Boolean = false,
var supportsRetrievingBalance: Boolean = false, var supportsRetrievingBalance: Boolean = false,
@ -24,7 +27,7 @@ open class BankAccount @JvmOverloads constructor(
bookedAccountTransactions: List<AccountTransaction> = listOf() bookedAccountTransactions: List<AccountTransaction> = listOf()
) { ) {
internal constructor() : this(Account(), "", "", null, null) // for object deserializers internal constructor() : this(Account(), "", "", null, null, "") // for object deserializers
var id: String = UUID.randomUUID().toString() var id: String = UUID.randomUUID().toString()
@ -33,12 +36,14 @@ open class BankAccount @JvmOverloads constructor(
val displayName: String val displayName: String
get() { get() {
var displayName = identifier val productName = productName ?: subAccountNumber
subAccountNumber?.let {
displayName += " ($it)" if (productName != null) {
return productName + " ($identifier)"
} }
return displayName
return identifier
} }
val displayNameIncludingBankName: String val displayNameIncludingBankName: String

View File

@ -103,8 +103,9 @@ open class fints4kModelMapper {
open fun mapBankAccount(account: Account, accountData: AccountData): BankAccount { open fun mapBankAccount(account: Account, accountData: AccountData): BankAccount {
return BankAccount(account, accountData.accountIdentifier, accountData.accountHolderName, accountData.iban, return BankAccount(account, accountData.accountIdentifier, accountData.accountHolderName, accountData.iban,
accountData.subAccountAttribute, BigDecimal.ZERO, accountData.currency ?: "EUR", accountData.subAccountAttribute, accountData.customerId, BigDecimal.ZERO, accountData.currency ?: "EUR",
mapBankAccountType(accountData.accountType), null, accountData.supportsFeature(AccountFeature.RetrieveAccountTransactions), mapBankAccountType(accountData.accountType), accountData.productName, accountData.accountLimit,
null, accountData.supportsFeature(AccountFeature.RetrieveAccountTransactions),
accountData.supportsFeature(AccountFeature.RetrieveBalance), accountData.supportsFeature(AccountFeature.TransferMoney), accountData.supportsFeature(AccountFeature.RetrieveBalance), accountData.supportsFeature(AccountFeature.TransferMoney),
accountData.supportsFeature(AccountFeature.InstantPayment)) accountData.supportsFeature(AccountFeature.InstantPayment))
} }

View File

@ -8,6 +8,7 @@ import net.dankito.banking.ui.model.parameters.TransferMoneyData
import net.dankito.banking.ui.model.tan.TanProcedureType import net.dankito.banking.ui.model.tan.TanProcedureType
import org.kapott.hbci.passport.HBCIPassport import org.kapott.hbci.passport.HBCIPassport
import org.kapott.hbci.structures.Konto import org.kapott.hbci.structures.Konto
import org.kapott.hbci.structures.Value
import java.math.BigDecimal import java.math.BigDecimal
@ -44,7 +45,8 @@ open class hbci4jModelMapper {
BankAccount(account, bankAccount.number, BankAccount(account, bankAccount.number,
if (bankAccount.name2.isNullOrBlank() == false) bankAccount.name + " " + bankAccount.name2 else bankAccount.name, if (bankAccount.name2.isNullOrBlank() == false) bankAccount.name + " " + bankAccount.name2 else bankAccount.name,
iban, bankAccount.subnumber, BigDecimal.ZERO, bankAccount.curr, mapBankAccountType(bankAccount), iban, bankAccount.subnumber, bankAccount.customerid, BigDecimal.ZERO, bankAccount.curr, mapBankAccountType(bankAccount),
null, bankAccount.limit?.value?.let { mapValue(it).toString() }, null,
bankAccount.allowedGVs.contains("HKKAZ"), bankAccount.allowedGVs.contains("HKSAL"), bankAccount.allowedGVs.contains("HKCCS")) bankAccount.allowedGVs.contains("HKKAZ"), bankAccount.allowedGVs.contains("HKSAL"), bankAccount.allowedGVs.contains("HKCCS"))
} }
} }
@ -67,6 +69,10 @@ open class hbci4jModelMapper {
} }
} }
protected open fun mapValue(value: Value): BigDecimal {
return BigDecimal.valueOf(value.longValue).divide(BigDecimal.valueOf(100))
}
open fun mapTanProcedures(tanProceduresString: String): List<net.dankito.banking.ui.model.tan.TanProcedure> { open fun mapTanProcedures(tanProceduresString: String): List<net.dankito.banking.ui.model.tan.TanProcedure> {
return tanProceduresString.split('|') return tanProceduresString.split('|')