Fixed that BankData didn't contain bank name

This commit is contained in:
dankito 2021-01-02 22:49:05 +01:00
parent f7fe09ecd9
commit 78cb96b8dc
1 changed files with 4 additions and 1 deletions

View File

@ -117,7 +117,10 @@ class fints4kService {
protected fun mapToBankData(accessData: BankAccessData): Pair<BankData, String?> { protected fun mapToBankData(accessData: BankAccessData): Pair<BankData, String?> {
val bankSearchResult = bankFinder.findBankByBankCode(accessData.bankCode) val bankSearchResult = bankFinder.findBankByBankCode(accessData.bankCode)
val fintsServerAddress = accessData.finTsServerAddress ?: bankSearchResult.firstOrNull { it.pinTanAddress != null }?.pinTanAddress val fintsServerAddress = accessData.finTsServerAddress ?: bankSearchResult.firstOrNull { it.pinTanAddress != null }?.pinTanAddress
val bank = BankData(accessData.bankCode, accessData.loginName, accessData.password, fintsServerAddress ?: "", bankSearchResult.firstOrNull()?.bic ?: "") val potentialBankInfo = bankSearchResult.firstOrNull()
val bank = BankData(accessData.bankCode, accessData.loginName, accessData.password, fintsServerAddress ?: "",
potentialBankInfo?.bic ?: "", potentialBankInfo?.name ?: "")
if (fintsServerAddress == null) { if (fintsServerAddress == null) {
val errorMessage = if (bankSearchResult.isEmpty()) "No bank found for bank code '${accessData.bankCode}'" else "Bank '${bankSearchResult.firstOrNull()?.name} does not support FinTS 3.0" val errorMessage = if (bankSearchResult.isEmpty()) "No bank found for bank code '${accessData.bankCode}'" else "Bank '${bankSearchResult.firstOrNull()?.name} does not support FinTS 3.0"