diff --git a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt index 2e99f5d7..800b0784 100644 --- a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt +++ b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt @@ -159,8 +159,19 @@ open class fints4kBankingClient( protected open fun restoreDataOrMapFromUiModel(customer: TypedCustomer): BankData { - return restoreData(customer) ?: - BankData(customer.bankCode, customer.customerId, customer.password, customer.finTsServerAddress, customer.bic, customer.bankName) + if (isNewAccount(customer)) { + return mapToBankData(customer) + } + + return restoreData(customer) ?: mapToBankData(customer) + } + + protected open fun isNewAccount(customer: TypedCustomer): Boolean { + return customer.accounts.isEmpty() + } + + protected open fun mapToBankData(customer: TypedCustomer): BankData { + return BankData(customer.bankCode, customer.customerId, customer.password, customer.finTsServerAddress, customer.bic, customer.bankName) } protected open fun restoreData(customer: TypedCustomer): BankData? {