Added to fallbacks to find bank name from BIC or IBAN
This commit is contained in:
parent
7cd7678542
commit
d01074e070
|
@ -533,14 +533,35 @@ open class BankingPresenter constructor(
|
||||||
|
|
||||||
open fun findRemitteesForName(name: String): List<Remittee> {
|
open fun findRemitteesForName(name: String): List<Remittee> {
|
||||||
return remitteeSearcher.findRemittees(name).map { remittee ->
|
return remitteeSearcher.findRemittees(name).map { remittee ->
|
||||||
remittee.bic?.let { bic ->
|
remittee.bankName = tryToFindBankName(remittee)
|
||||||
remittee.bankName = bankFinder.findBankByBic(bic)?.name
|
|
||||||
}
|
|
||||||
|
|
||||||
remittee
|
remittee
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected open fun tryToFindBankName(remittee: Remittee): String? {
|
||||||
|
remittee.bic?.let { bic ->
|
||||||
|
bankFinder.findBankByBic(bic)?.name?.let {
|
||||||
|
return it
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bic.length == 8) {
|
||||||
|
bankFinder.findBankByBic(bic + "XXX")?.name?.let {
|
||||||
|
return it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
remittee.iban?.let { iban ->
|
||||||
|
if (iban.length > 12) {
|
||||||
|
val bankCode = iban.substring(4, 12)
|
||||||
|
return bankFinder.findBankByBankCode(bankCode).firstOrNull()?.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
open fun searchSelectedAccountTransactions(query: String): List<IAccountTransaction> {
|
open fun searchSelectedAccountTransactions(query: String): List<IAccountTransaction> {
|
||||||
return searchAccountTransactions(query, selectedBankAccountsAccountTransactions)
|
return searchAccountTransactions(query, selectedBankAccountsAccountTransactions)
|
||||||
|
|
Loading…
Reference in New Issue