Implemented that errors when retrieving account transactions get displayed in UI

This commit is contained in:
dankito 2020-12-20 16:48:54 +01:00
parent 17110a794c
commit c5bddd94b0
3 changed files with 8 additions and 2 deletions

View File

@ -423,7 +423,7 @@ open class FinTsClient(
val fromDate = parameter.fromDate val fromDate = parameter.fromDate
?: parameter.account.countDaysForWhichTransactionsAreKept?.let { Date(Date.today.millisSinceEpoch - it * OneDayMillis) } ?: parameter.account.countDaysForWhichTransactionsAreKept?.let { Date(Date.today.millisSinceEpoch - it * OneDayMillis) }
?: bookedTransactions.map { it.valueDate }.sortedBy { it.millisSinceEpoch }.firstOrNull() ?: bookedTransactions.map { it.valueDate }.sortedBy { it.millisSinceEpoch }.firstOrNull()
val retrievedData = RetrievedAccountData(parameter.account, successful, balance, bookedTransactions, unbookedTransactions, fromDate, parameter.toDate ?: Date.today) val retrievedData = RetrievedAccountData(parameter.account, successful, balance, bookedTransactions, unbookedTransactions, fromDate, parameter.toDate ?: Date.today, response.errorMessage)
callback(GetTransactionsResponse(response, listOf(retrievedData), callback(GetTransactionsResponse(response, listOf(retrievedData),
if (parameter.maxCountEntries != null) parameter.isSettingMaxCountEntriesAllowedByBank else null if (parameter.maxCountEntries != null) parameter.isSettingMaxCountEntriesAllowedByBank else null

View File

@ -10,7 +10,8 @@ open class RetrievedAccountData(
open var bookedTransactions: Collection<AccountTransaction>, open var bookedTransactions: Collection<AccountTransaction>,
open var unbookedTransactions: Collection<Any>, open var unbookedTransactions: Collection<Any>,
open val retrievedTransactionsFrom: Date?, open val retrievedTransactionsFrom: Date?,
open val retrievedTransactionsTo: Date? open val retrievedTransactionsTo: Date?,
open val errorMessage: String? = null
) { ) {
companion object { companion object {

View File

@ -18,4 +18,9 @@ open class GetTransactionsResponse(
&& retrievedData.isNotEmpty() && retrievedData.isNotEmpty()
&& retrievedData.none { it.account.supportsRetrievingAccountTransactions && it.successfullyRetrievedData == false } && retrievedData.none { it.account.supportsRetrievingAccountTransactions && it.successfullyRetrievedData == false }
// TODO: remove again if then in AddAccountResponse errors get displayed that should or extract getRetrievingTransactionsError() and override in AddAccountResponse
override val errorMessage: String?
get() = super.errorMessage
?: retrievedData.mapNotNull { it.errorMessage }.firstOrNull()
} }