Extracted Currency.DefaultCurrencyCode

This commit is contained in:
dankito 2022-02-20 23:22:18 +01:00
parent 52de5a2956
commit 73a98eea67
4 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package net.dankito.banking.client.model
import kotlinx.datetime.LocalDate
import net.dankito.banking.fints.model.Currency
import net.dankito.banking.fints.model.Money
@ -11,7 +12,7 @@ open class BankAccount(
val accountHolderName: String,
val type: BankAccountType = BankAccountType.CheckingAccount,
val productName: String? = null,
val currency: String = "EUR", // TODO: may parse to a value object
val currency: String = Currency.DefaultCurrencyCode, // TODO: may parse to a value object
val accountLimit: String? = null,
// TODO: create an enum AccountCapabilities [ RetrieveBalance, RetrieveTransactions, TransferMoney / MoneyTransfer(?), InstantPayment ]
val supportsRetrievingTransactions: Boolean = false,

View File

@ -36,7 +36,7 @@ open class FinTsModelMapper {
open fun map(account: AccountData): BankAccount {
return BankAccount(account.accountIdentifier, account.subAccountAttribute, account.iban, account.accountHolderName, map(account.accountType), account.productName,
account.currency ?: "EUR", account.accountLimit, account.supportsRetrievingAccountTransactions, account.supportsRetrievingBalance, account.supportsTransferringMoney, account.supportsRealTimeTransfer)
account.currency ?: Currency.DefaultCurrencyCode, account.accountLimit, account.supportsRetrievingAccountTransactions, account.supportsRetrievingBalance, account.supportsTransferringMoney, account.supportsRealTimeTransfer)
}
open fun map(accountType: AccountType?): BankAccountType {

View File

@ -5,6 +5,11 @@ open class Currency(
val code: String
) {
companion object {
const val DefaultCurrencyCode = "EUR"
}
internal constructor() : this("") // for object deserializers

View File

@ -7,7 +7,7 @@ open class Money(
) {
companion object {
val Zero = Money(Amount.Zero, "EUR")
val Zero = Money(Amount.Zero, Currency.DefaultCurrencyCode)
}