Updating lastAccountUpdateTime also when have been retrieved

This commit is contained in:
dankito 2024-09-11 23:18:27 +02:00
parent 3aa0edfb34
commit 62aa04a667
2 changed files with 7 additions and 3 deletions

View File

@ -92,9 +92,9 @@ open class FinTsModelMapper {
bankAccount.retrievedTransactionsFrom = accountTransactionsResponse.retrievedTransactionsFrom
}
val retrievalTime = if (retrieveTransactionsTo == null) accountTransactionsResponse.retrievalTime
else retrieveTransactionsTo.atTime(0, 0).toInstant(TimeZone.EuropeBerlin)
if (bankAccount.lastAccountUpdateTime == null || bankAccount.lastAccountUpdateTime!! <= retrievalTime) { // if retrieveTransactionsTo is set it may is older than current account's lastTransactionsRetrievalTime
val retrievalTime = accountTransactionsResponse.retrievalTime
if (retrieveTransactionsTo == null && (bankAccount.lastAccountUpdateTime == null || bankAccount.lastAccountUpdateTime!! <= retrievalTime || // if retrieveTransactionsTo is set, then we don't retrieve all current transactions -> don't set lastAccountUpdateTime
(bankAccount.supportsRetrievingTransactions == false && accountTransactionsResponse.statementOfHoldings.isNotEmpty()))) { // TODO: really check for supportsRetrievingTransactions == false if statementOfHoldings are set? Are there really accounts that support HKWPD and HKKAZ?
bankAccount.lastAccountUpdateTime = retrievalTime
}

View File

@ -37,6 +37,10 @@ open class BankAccount(
open var retrievedTransactionsFrom: LocalDate? = null
/**
* Gibt wider, wann zuletzt aktuelle Kontoumsätze, d.h. [net.dankito.banking.client.model.parameter.GetAccountDataParameter.retrieveTransactionsTo]
* war nicht gesetzt, oder aktuelle [StatementOfHoldings] empfangen wurden.
*/
open var lastAccountUpdateTime: Instant? = null
open var bookedTransactions: List<AccountTransaction> = listOf()