Implemented adding message log of accounts that could not be added to message log

This commit is contained in:
dankito 2020-11-16 22:16:12 +01:00
parent bc49b4ee20
commit 83e8b7b882
1 changed files with 14 additions and 3 deletions

View File

@ -87,6 +87,8 @@ open class BankingPresenter(
protected val bankingClientsForBanks = mutableMapOf<TypedBankData, IBankingClient>()
protected val messageLogsOfFailedAccountAdditions = mutableListOf<MessageLogEntry>()
protected var _selectedAccounts = mutableListOf<TypedBankAccount>()
protected var selectedAccountType = SelectedAccountType.AllAccounts
@ -189,6 +191,9 @@ open class BankingPresenter(
log.error(e) { "Could not save successfully added bank" }
}
}
else {
messageLogsOfFailedAccountAdditions.addAll(newClient.messageLogWithoutSensitiveData)
}
callback(response)
}
@ -777,11 +782,17 @@ open class BankingPresenter(
}
open fun getMessageLogForAccounts(banks: List<TypedBankData>): List<String> {
val logEntries = banks.flatMap {
getBankingClientForBank(it)?.messageLogWithoutSensitiveData ?: listOf()
open fun getMessageLogForAccounts(banks: List<TypedBankData>, includeFailedAccountAdditions: Boolean = true): List<String> {
val logEntries = mutableListOf<MessageLogEntry>()
if (includeFailedAccountAdditions) {
logEntries.addAll(messageLogsOfFailedAccountAdditions)
}
logEntries.addAll(banks.flatMap {
getBankingClientForBank(it)?.messageLogWithoutSensitiveData ?: listOf()
})
return logEntries.map { entry ->
MessageLogEntryDateFormatter.format(entry.time) + " " + entry.bank.bankCode + " " + entry.message
}