Passing known bank data on to BankingClient (as e.g. bank names returned from bank server are often quite bad, e.g. DB24 for Deutsche Bank)
This commit is contained in:
parent
91ccfc1844
commit
025b91d318
|
@ -21,7 +21,6 @@ import net.codinux.banking.fints.config.FinTsClientOptions
|
|||
import net.codinux.banking.ui.IOorDefault
|
||||
import net.codinux.banking.ui.model.AccountTransactionViewModel
|
||||
import net.codinux.banking.ui.model.BankInfo
|
||||
import net.codinux.banking.ui.model.TanChallengeReceived
|
||||
import net.codinux.banking.ui.model.error.*
|
||||
import net.codinux.banking.ui.model.events.AccountTransactionsRetrievedEvent
|
||||
import net.codinux.banking.ui.model.events.TransferredMoneyEvent
|
||||
|
@ -74,7 +73,7 @@ class BankingService(
|
|||
suspend fun addAccount(bank: BankInfo, loginName: String, password: String, retrieveAllTransactions: Boolean = false): Boolean {
|
||||
try {
|
||||
val retrieveTransactions = if (retrieveAllTransactions) RetrieveTransactions.All else RetrieveTransactions.OfLast90Days
|
||||
val response = client.getAccountDataAsync(GetAccountDataRequest(bank.bankCode, loginName, password, GetAccountDataOptions(retrieveTransactions)))
|
||||
val response = client.getAccountDataAsync(GetAccountDataRequest(bank.bankCode, loginName, password, GetAccountDataOptions(retrieveTransactions), mapBankInfo(bank)))
|
||||
|
||||
if (response.type == ResponseType.Success && response.data != null) {
|
||||
handleSuccessfulGetAccountDataResponse(response.data!!)
|
||||
|
@ -92,6 +91,15 @@ class BankingService(
|
|||
}
|
||||
}
|
||||
|
||||
private fun mapBankInfo(bank: BankInfo): net.codinux.banking.client.model.BankInfo? =
|
||||
if (bank.pinTanAddress != null) {
|
||||
net.codinux.banking.client.model.BankInfo(
|
||||
bank.name, bank.bic, bank.pinTanAddress, bank.bankingGroup
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
private suspend fun handleSuccessfulGetAccountDataResponse(response: GetAccountDataResponse) {
|
||||
try {
|
||||
val newUser = response.user
|
||||
|
|
Loading…
Reference in New Issue