diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/responses/GetTransactionsResponse.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/responses/GetTransactionsResponse.kt index 6fbfee0b..d8148950 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/responses/GetTransactionsResponse.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/responses/GetTransactionsResponse.kt @@ -13,6 +13,10 @@ open class GetTransactionsResponse( constructor(account: TypedBankAccount, errorToShowToUser: String) : this(errorToShowToUser, listOf(RetrievedAccountData(account, false, null, listOf(), listOf()))) + constructor(retrievedData: RetrievedAccountData) : this(listOf(retrievedData)) + + constructor(retrievedData: List) : this(null, retrievedData) + override val isSuccessful: Boolean get() = errorToShowToUser == null && retrievedData.isNotEmpty() && retrievedData.none { it.successfullyRetrievedData == false } diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt index 8f56c8e1..027dbf62 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt @@ -161,7 +161,7 @@ open class BankingPresenter( persistAccountOffUiThread(account) response.retrievedData.forEach { retrievedData -> - retrievedAccountTransactions(GetTransactionsResponse(null, listOf(retrievedData)), startDate, false) + retrievedAccountTransactions(GetTransactionsResponse(retrievedData), startDate, false) } findIconForBankAsync(account) @@ -353,7 +353,7 @@ open class BankingPresenter( asyncRunner.runAsync { // don't block retrieving next chunk by blocked saving to db / json updateAccountTransactions(bankAccount, accountTransactionsChunk) - callRetrievedAccountTransactionsResponseListener(GetTransactionsResponse(null, listOf(RetrievedAccountData(bankAccount, true, null, accountTransactionsChunk, listOf())))) + callRetrievedAccountTransactionsResponseListener(GetTransactionsResponse(RetrievedAccountData(bankAccount, true, null, accountTransactionsChunk, listOf()))) } } } diff --git a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt index b8641454..8b9f80de 100644 --- a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt +++ b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt @@ -78,7 +78,7 @@ open class fints4kBankingClient( override fun getTransactionsAsync(bankAccount: TypedBankAccount, parameter: GetTransactionsParameter, callback: (GetTransactionsResponse) -> Unit) { findAccountForBankAccount(bankAccount) { account, errorMessage -> if (account == null) { - callback(GetTransactionsResponse(errorMessage)) + callback(GetTransactionsResponse(bankAccount, errorMessage ?: "")) } else { val mappedParameter = GetTransactionsParameter(parameter.alsoRetrieveBalance, parameter.fromDate, diff --git a/ui/hbci4jBankingClient/src/main/kotlin/net/dankito/banking/hbci4jBankingClient.kt b/ui/hbci4jBankingClient/src/main/kotlin/net/dankito/banking/hbci4jBankingClient.kt index d49931a2..972326dd 100644 --- a/ui/hbci4jBankingClient/src/main/kotlin/net/dankito/banking/hbci4jBankingClient.kt +++ b/ui/hbci4jBankingClient/src/main/kotlin/net/dankito/banking/hbci4jBankingClient.kt @@ -178,8 +178,8 @@ open class hbci4jBankingClient( return GetTransactionsResponse(account,"Could not fetch account transactions of bank account $account: $result") } - return GetTransactionsResponse(null, listOf(RetrievedAccountData(account, true, balance.toBigDecimal(), - accountTransactionMapper.mapAccountTransactions(account, result), listOf()))) + return GetTransactionsResponse(RetrievedAccountData(account, true, balance.toBigDecimal(), + accountTransactionMapper.mapAccountTransactions(account, result), listOf())) } catch(e: Exception) { log.error("Could not get accounting details for bank ${credentials.bankCode}", e)