From 62aa04a667fa80ddcc396b8d2d3032c283fa4b7d Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 11 Sep 2024 23:18:27 +0200 Subject: [PATCH] Updating lastAccountUpdateTime also when have been retrieved --- .../net/codinux/banking/fints/mapper/FinTsModelMapper.kt | 6 +++--- .../kotlin/net/dankito/banking/client/model/BankAccount.kt | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/mapper/FinTsModelMapper.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/mapper/FinTsModelMapper.kt index 7c20fbeb..c74b7781 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/mapper/FinTsModelMapper.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/mapper/FinTsModelMapper.kt @@ -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 } diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/BankAccount.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/BankAccount.kt index c33d0f2a..dfb9808a 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/BankAccount.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/BankAccount.kt @@ -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 = listOf()