diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/BankAccount.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/BankAccount.kt index 15ad541f..4fa0ff65 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/BankAccount.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/BankAccount.kt @@ -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, diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/mapper/FinTsModelMapper.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/mapper/FinTsModelMapper.kt index c79fd6f3..5d3508fb 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/mapper/FinTsModelMapper.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/mapper/FinTsModelMapper.kt @@ -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 { diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Currency.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Currency.kt index 2d7e0db6..0f8aaf4d 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Currency.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Currency.kt @@ -5,6 +5,11 @@ open class Currency( val code: String ) { + companion object { + const val DefaultCurrencyCode = "EUR" + } + + internal constructor() : this("") // for object deserializers diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Money.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Money.kt index 0e87db7b..da1c6bbd 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Money.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Money.kt @@ -7,7 +7,7 @@ open class Money( ) { companion object { - val Zero = Money(Amount.Zero, "EUR") + val Zero = Money(Amount.Zero, Currency.DefaultCurrencyCode) }