Using now English names for BankAccountTypes

This commit is contained in:
dankito 2020-10-04 21:56:54 +02:00
parent bc180f68ab
commit f053b2728d
7 changed files with 58 additions and 60 deletions

View File

@ -20,7 +20,7 @@ open class BankAccount(
override var subAccountNumber: String?, override var subAccountNumber: String?,
override var balance: BigDecimal = BigDecimal.Zero, override var balance: BigDecimal = BigDecimal.Zero,
override var currency: String = "EUR", override var currency: String = "EUR",
override var type: BankAccountType = BankAccountType.Girokonto, override var type: BankAccountType = BankAccountType.CheckingAccount,
override var productName: String? = null, override var productName: String? = null,
override var accountLimit: String? = null, override var accountLimit: String? = null,
override var retrievedTransactionsFromOn: Date? = null, override var retrievedTransactionsFromOn: Date? = null,
@ -41,9 +41,9 @@ open class BankAccount(
/* convenience constructors for languages not supporting default values */ /* convenience constructors for languages not supporting default values */
constructor(bank: TypedBankData, productName: String?, identifier: String) : this(bank, productName, identifier, BankAccountType.Girokonto) constructor(bank: TypedBankData, productName: String?, identifier: String) : this(bank, productName, identifier, BankAccountType.CheckingAccount)
constructor(bank: TypedBankData, productName: String?, identifier: String, type: BankAccountType = BankAccountType.Girokonto, balance: BigDecimal = BigDecimal.Zero) constructor(bank: TypedBankData, productName: String?, identifier: String, type: BankAccountType = BankAccountType.CheckingAccount, balance: BigDecimal = BigDecimal.Zero)
: this(bank, identifier, "", null, null, balance, "EUR", type, productName) : this(bank, identifier, "", null, null, balance, "EUR", type, productName)

View File

@ -18,7 +18,7 @@ open class BankAccountEntity(
override var subAccountNumber: String?, override var subAccountNumber: String?,
override var balance: BigDecimal = BigDecimal.Zero, override var balance: BigDecimal = BigDecimal.Zero,
override var currency: String = "EUR", override var currency: String = "EUR",
override var type: BankAccountType = BankAccountType.Girokonto, override var type: BankAccountType = BankAccountType.CheckingAccount,
override var productName: String? = null, override var productName: String? = null,
override var accountLimit: String? = null, override var accountLimit: String? = null,
override var retrievedTransactionsFromOn: Date? = null, override var retrievedTransactionsFromOn: Date? = null,

View File

@ -14,7 +14,7 @@ open class BankAccount @JvmOverloads constructor(
override var subAccountNumber: String?, override var subAccountNumber: String?,
override var balance: BigDecimal = BigDecimal.Zero, override var balance: BigDecimal = BigDecimal.Zero,
override var currency: String = "EUR", override var currency: String = "EUR",
override var type: BankAccountType = BankAccountType.Girokonto, override var type: BankAccountType = BankAccountType.CheckingAccount,
override var productName: String? = null, override var productName: String? = null,
override var accountLimit: String? = null, override var accountLimit: String? = null,
override var retrievedTransactionsFromOn: Date? = null, override var retrievedTransactionsFromOn: Date? = null,
@ -31,9 +31,9 @@ open class BankAccount @JvmOverloads constructor(
/* convenience constructors for languages not supporting default values */ /* convenience constructors for languages not supporting default values */
constructor(bank: TypedBankData, productName: String?, identifier: String) : this(bank, productName, identifier, BankAccountType.Girokonto) constructor(bank: TypedBankData, productName: String?, identifier: String) : this(bank, productName, identifier, BankAccountType.CheckingAccount)
constructor(bank: TypedBankData, productName: String?, identifier: String, type: BankAccountType = BankAccountType.Girokonto, balance: BigDecimal = BigDecimal.Zero) constructor(bank: TypedBankData, productName: String?, identifier: String, type: BankAccountType = BankAccountType.CheckingAccount, balance: BigDecimal = BigDecimal.Zero)
: this(bank, identifier, "", null, null, balance, "EUR", type, productName) : this(bank, identifier, "", null, null, balance, "EUR", type, productName)

View File

@ -3,24 +3,24 @@ package net.dankito.banking.ui.model
enum class BankAccountType { enum class BankAccountType {
Girokonto, CheckingAccount,
Sparkonto, SavingsAccount,
Festgeldkonto, FixedTermDepositAccount,
Wertpapierdepot, SecuritiesAccount,
Darlehenskonto, LoanAccount,
Kreditkartenkonto, CreditCardAccount,
FondsDepot, FundDeposit,
Bausparvertrag, BuildingLoanContract,
Versicherungsvertrag, InsuranceContract,
Sonstige Other
} }

View File

@ -126,28 +126,26 @@ class Mapper {
func map(_ type: String?) -> BankAccountType { func map(_ type: String?) -> BankAccountType {
switch type { switch type {
case BankAccountType.girokonto.name: case BankAccountType.checkingaccount.name:
return BankAccountType.girokonto return .checkingaccount
case BankAccountType.sparkonto.name: case BankAccountType.savingsaccount.name:
return BankAccountType.sparkonto return .savingsaccount
case BankAccountType.festgeldkonto.name: case BankAccountType.fixedtermdepositaccount.name:
return BankAccountType.festgeldkonto return .fixedtermdepositaccount
case BankAccountType.wertpapierdepot.name: case BankAccountType.securitiesaccount.name:
return BankAccountType.wertpapierdepot return .securitiesaccount
case BankAccountType.darlehenskonto.name: case BankAccountType.loanaccount.name:
return BankAccountType.darlehenskonto return .loanaccount
case BankAccountType.kreditkartenkonto.name: case BankAccountType.creditcardaccount.name:
return BankAccountType.kreditkartenkonto return .creditcardaccount
case BankAccountType.fondsdepot.name: case BankAccountType.funddeposit.name:
return BankAccountType.fondsdepot return .funddeposit
case BankAccountType.bausparvertrag.name: case BankAccountType.buildingloancontract.name:
return BankAccountType.bausparvertrag return .buildingloancontract
case BankAccountType.versicherungsvertrag.name: case BankAccountType.insurancecontract.name:
return BankAccountType.versicherungsvertrag return .insurancecontract
case BankAccountType.sonstige.name:
return BankAccountType.sonstige
default: default:
return BankAccountType.girokonto return .other
} }
} }

View File

@ -131,16 +131,16 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) {
open fun mapBankAccountType(type: AccountType?): BankAccountType { open fun mapBankAccountType(type: AccountType?): BankAccountType {
return when (type) { return when (type) {
AccountType.Girokonto -> BankAccountType.Girokonto AccountType.Girokonto -> BankAccountType.CheckingAccount
AccountType.Sparkonto -> BankAccountType.Sparkonto AccountType.Sparkonto -> BankAccountType.SavingsAccount
AccountType.Festgeldkonto -> BankAccountType.Festgeldkonto AccountType.Festgeldkonto -> BankAccountType.FixedTermDepositAccount
AccountType.Wertpapierdepot -> BankAccountType.Wertpapierdepot AccountType.Wertpapierdepot -> BankAccountType.SecuritiesAccount
AccountType.Darlehenskonto -> BankAccountType.Darlehenskonto AccountType.Darlehenskonto -> BankAccountType.LoanAccount
AccountType.Kreditkartenkonto -> BankAccountType.Kreditkartenkonto AccountType.Kreditkartenkonto -> BankAccountType.CreditCardAccount
AccountType.FondsDepot -> BankAccountType.FondsDepot AccountType.FondsDepot -> BankAccountType.FundDeposit
AccountType.Bausparvertrag -> BankAccountType.Bausparvertrag AccountType.Bausparvertrag -> BankAccountType.BuildingLoanContract
AccountType.Versicherungsvertrag -> BankAccountType.Versicherungsvertrag AccountType.Versicherungsvertrag -> BankAccountType.InsuranceContract
else -> BankAccountType.Sonstige else -> BankAccountType.Other
} }
} }

View File

@ -54,7 +54,7 @@ open class hbci4jModelMapper(
result.currency = account.curr result.currency = account.curr
result.type = mapBankAccountType(account) result.type = mapBankAccountType(account)
result.isAccountTypeSupportedByApplication = result.type == BankAccountType.Girokonto || result.type == BankAccountType.Festgeldkonto result.isAccountTypeSupportedByApplication = result.type == BankAccountType.CheckingAccount || result.type == BankAccountType.FixedTermDepositAccount
result.accountLimit = account.limit?.value?.let { mapValue(it).toString() } result.accountLimit = account.limit?.value?.let { mapValue(it).toString() }
result.supportsRetrievingBalance = account.allowedGVs.contains("HKSAL") result.supportsRetrievingBalance = account.allowedGVs.contains("HKSAL")
@ -69,17 +69,17 @@ open class hbci4jModelMapper(
val type = account.acctype val type = account.acctype
return when { return when {
type.length == 1 -> BankAccountType.Girokonto type.length == 1 -> BankAccountType.CheckingAccount
type.startsWith("1") -> BankAccountType.Sparkonto type.startsWith("1") -> BankAccountType.SavingsAccount
type.startsWith("2") -> BankAccountType.Festgeldkonto type.startsWith("2") -> BankAccountType.FixedTermDepositAccount
type.startsWith("3") -> BankAccountType.Wertpapierdepot type.startsWith("3") -> BankAccountType.SecuritiesAccount
type.startsWith("4") -> BankAccountType.Darlehenskonto type.startsWith("4") -> BankAccountType.LoanAccount
type.startsWith("5") -> BankAccountType.Kreditkartenkonto type.startsWith("5") -> BankAccountType.CreditCardAccount
type.startsWith("6") -> BankAccountType.FondsDepot type.startsWith("6") -> BankAccountType.FundDeposit
type.startsWith("7") -> BankAccountType.Bausparvertrag type.startsWith("7") -> BankAccountType.BuildingLoanContract
type.startsWith("8") -> BankAccountType.Versicherungsvertrag type.startsWith("8") -> BankAccountType.InsuranceContract
type.startsWith("9") -> BankAccountType.Sonstige type.startsWith("9") -> BankAccountType.Other
else -> BankAccountType.Sonstige else -> BankAccountType.Other
} }
} }