Fixed that for a new account may an old (undeleted) file with may an old, wrong password got used

This commit is contained in:
dankito 2020-09-14 00:10:13 +02:00
parent d14afbcd2c
commit 8cac7b52ee
1 changed files with 13 additions and 2 deletions

View File

@ -159,8 +159,19 @@ open class fints4kBankingClient(
protected open fun restoreDataOrMapFromUiModel(customer: TypedCustomer): BankData { protected open fun restoreDataOrMapFromUiModel(customer: TypedCustomer): BankData {
return restoreData(customer) ?: if (isNewAccount(customer)) {
BankData(customer.bankCode, customer.customerId, customer.password, customer.finTsServerAddress, customer.bic, customer.bankName) 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? { protected open fun restoreData(customer: TypedCustomer): BankData? {