From b8fe9e78e114fc7d9bfcc499816e195be7edc8fb Mon Sep 17 00:00:00 2001 From: dankito Date: Sun, 8 Sep 2024 22:01:28 +0200 Subject: [PATCH] Renamed transactionsRetentionDays to serverTransactionsRetentionDays --- .../codinux/banking/fints/FinTsJobExecutor.kt | 2 +- .../banking/fints/mapper/FinTsModelMapper.kt | 2 +- .../codinux/banking/fints/model/AccountData.kt | 2 +- .../banking/fints/model/mapper/ModelMapper.kt | 2 +- .../banking/fints/response/ResponseParser.kt | 8 ++++---- .../RetrieveAccountTransactionsParameters.kt | 2 +- .../banking/client/model/BankAccount.kt | 2 +- .../fints/response/ResponseParserTest.kt | 18 +++++++++--------- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt index 94c8e44d..fdaef270 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt @@ -238,7 +238,7 @@ open class FinTsJobExecutor( val successful = response.tanRequiredButWeWereToldToAbortIfSo || (response.successful && (parameter.alsoRetrieveBalance == false || balance != null)) val fromDate = parameter.fromDate - ?: parameter.account.transactionsRetentionDays?.let { LocalDate.todayAtSystemDefaultTimeZone().minusDays(it) } + ?: parameter.account.serverTransactionsRetentionDays?.let { LocalDate.todayAtSystemDefaultTimeZone().minusDays(it) } ?: bookedTransactions.minByOrNull { it.valueDate }?.valueDate val retrievedData = RetrievedAccountData(parameter.account, successful, balance, bookedTransactions, unbookedTransactions, startTime, fromDate, parameter.toDate ?: LocalDate.todayAtEuropeBerlin(), response.internalError) 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 153ad98e..bb369b0f 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 @@ -55,7 +55,7 @@ open class FinTsModelMapper { open fun map(account: AccountData): BankAccount { return BankAccount(account.accountIdentifier, account.subAccountAttribute, account.iban, account.accountHolderName, map(account.accountType), account.productName, - account.currency ?: Currency.DefaultCurrencyCode, account.accountLimit, account.transactionsRetentionDays, account.isAccountTypeSupportedByApplication, + account.currency ?: Currency.DefaultCurrencyCode, account.accountLimit, account.serverTransactionsRetentionDays, account.isAccountTypeSupportedByApplication, account.supportsRetrievingAccountTransactions, account.supportsRetrievingBalance, account.supportsTransferringMoney, account.supportsRealTimeTransfer) } diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/AccountData.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/AccountData.kt index 5aef0b22..636a8579 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/AccountData.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/AccountData.kt @@ -36,7 +36,7 @@ open class AccountData( /** * Count days for which transactions are stored on bank server (if available). */ - open var transactionsRetentionDays: Int? = null + open var serverTransactionsRetentionDays: Int? = null protected open val _supportedFeatures = mutableSetOf() diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/mapper/ModelMapper.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/mapper/ModelMapper.kt index 5c1dc466..adaa4cea 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/mapper/ModelMapper.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/mapper/ModelMapper.kt @@ -102,7 +102,7 @@ open class ModelMapper( accountInfo.accountLimit, accountInfo.allowedJobNames) bank.supportedJobs.filterIsInstance().sortedByDescending { it.segmentVersion }.firstOrNull { newAccount.allowedJobNames.contains(it.jobName) }?.let { transactionsParameters -> - newAccount.transactionsRetentionDays = transactionsParameters.transactionsRetentionDays + newAccount.serverTransactionsRetentionDays = transactionsParameters.serverTransactionsRetentionDays } bank.addAccount(newAccount) diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/response/ResponseParser.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/response/ResponseParser.kt index e0329aca..a56494d4 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/response/ResponseParser.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/response/ResponseParser.kt @@ -748,11 +748,11 @@ open class ResponseParser( val transactionsParameterIndex = if (jobParameters.segmentVersion >= 6) 4 else 3 val dataElements = getDataElements(dataElementGroups[transactionsParameterIndex]) - val transactionsRetentionDays = parseInt(dataElements[0]) + val serverTransactionsRetentionDays = parseInt(dataElements[0]) val settingCountEntriesAllowed = parseBoolean(dataElements[1]) val settingAllAccountAllowed = if (dataElements.size > 2) parseBoolean(dataElements[2]) else false - return RetrieveAccountTransactionsParameters(jobParameters, transactionsRetentionDays, settingCountEntriesAllowed, settingAllAccountAllowed) + return RetrieveAccountTransactionsParameters(jobParameters, serverTransactionsRetentionDays, settingCountEntriesAllowed, settingAllAccountAllowed) } @@ -805,11 +805,11 @@ open class ResponseParser( val transactionsParameterIndex = if (jobParameters.segmentVersion >= 2) 4 else 3 // TODO: check if at segment version 1 the transactions parameter are the third data elements group val dataElements = getDataElements(dataElementGroups[transactionsParameterIndex]) - val transactionsRetentionDays = parseInt(dataElements[0]) + val serverTransactionsRetentionDays = parseInt(dataElements[0]) val settingCountEntriesAllowed = parseBoolean(dataElements[1]) val settingAllAccountAllowed = if (dataElements.size > 2) parseBoolean(dataElements[2]) else false - return RetrieveAccountTransactionsParameters(jobParameters, transactionsRetentionDays, settingCountEntriesAllowed, settingAllAccountAllowed) + return RetrieveAccountTransactionsParameters(jobParameters, serverTransactionsRetentionDays, settingCountEntriesAllowed, settingAllAccountAllowed) } diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/response/segments/RetrieveAccountTransactionsParameters.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/response/segments/RetrieveAccountTransactionsParameters.kt index b4dfbd12..2acff059 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/response/segments/RetrieveAccountTransactionsParameters.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/response/segments/RetrieveAccountTransactionsParameters.kt @@ -3,7 +3,7 @@ package net.codinux.banking.fints.response.segments open class RetrieveAccountTransactionsParameters( parameters: JobParameters, - open val transactionsRetentionDays: Int, + open val serverTransactionsRetentionDays: Int, open val settingCountEntriesAllowed: Boolean, open val settingAllAccountAllowed: Boolean ) : JobParameters(parameters) { 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 9b828012..9ff01f8f 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 @@ -18,7 +18,7 @@ open class BankAccount( open val currency: String = Currency.DefaultCurrencyCode, // TODO: may parse to a value object open val accountLimit: String? = null, - open val transactionsRetentionDays: Int? = null, + open val serverTransactionsRetentionDays: Int? = null, open val isAccountTypeSupportedByApplication: Boolean = false, // TODO: create an enum AccountCapabilities [ RetrieveBalance, RetrieveTransactions, TransferMoney / MoneyTransfer(?), InstantPayment ] open val supportsRetrievingTransactions: Boolean = false, diff --git a/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/response/ResponseParserTest.kt b/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/response/ResponseParserTest.kt index f44beecb..9f4c17f9 100644 --- a/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/response/ResponseParserTest.kt +++ b/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/response/ResponseParserTest.kt @@ -1189,16 +1189,16 @@ class ResponseParserTest : FinTsTestBase() { fun parseAccountTransactionsMt940Parameters_Version4() { // given - val transactionsRetentionDays = 90 + val serverTransactionsRetentionDays = 90 // when - val result = underTest.parse("HIKAZS:21:4:4+20+1+$transactionsRetentionDays:N'") + val result = underTest.parse("HIKAZS:21:4:4+20+1+$serverTransactionsRetentionDays:N'") // then assertSuccessfullyParsedSegment(result, InstituteSegmentId.AccountTransactionsMt940Parameters, 21, 4, 4) result.getFirstSegmentById(InstituteSegmentId.AccountTransactionsMt940Parameters)?.let { segment -> - assertEquals(transactionsRetentionDays, segment.transactionsRetentionDays) + assertEquals(serverTransactionsRetentionDays, segment.serverTransactionsRetentionDays) assertFalse(segment.settingCountEntriesAllowed) assertFalse(segment.settingAllAccountAllowed) } @@ -1209,16 +1209,16 @@ class ResponseParserTest : FinTsTestBase() { fun parseAccountTransactionsMt940Parameters_Version6() { // given - val transactionsRetentionDays = 90 + val serverTransactionsRetentionDays = 90 // when - val result = underTest.parse("HIKAZS:23:6:4+20+1+1+$transactionsRetentionDays:N:N'") + val result = underTest.parse("HIKAZS:23:6:4+20+1+1+$serverTransactionsRetentionDays:N:N'") // then assertSuccessfullyParsedSegment(result, InstituteSegmentId.AccountTransactionsMt940Parameters, 23, 6, 4) result.getFirstSegmentById(InstituteSegmentId.AccountTransactionsMt940Parameters)?.let { segment -> - assertEquals(transactionsRetentionDays, segment.transactionsRetentionDays) + assertEquals(serverTransactionsRetentionDays, segment.serverTransactionsRetentionDays) assertFalse(segment.settingCountEntriesAllowed) assertFalse(segment.settingAllAccountAllowed) } @@ -1290,16 +1290,16 @@ class ResponseParserTest : FinTsTestBase() { fun parseCreditCardAccountTransactionsParameters() { // given - val transactionsRetentionDays = 9999 + val serverTransactionsRetentionDays = 9999 // when - val result = underTest.parse("DIKKUS:15:2:4+999+1+0+$transactionsRetentionDays:J:J'") + val result = underTest.parse("DIKKUS:15:2:4+999+1+0+$serverTransactionsRetentionDays:J:J'") // then assertSuccessfullyParsedSegment(result, InstituteSegmentId.CreditCardTransactionsParameters, 15, 2, 4) result.getFirstSegmentById(InstituteSegmentId.CreditCardTransactionsParameters)?.let { segment -> - assertEquals(transactionsRetentionDays, segment.transactionsRetentionDays) + assertEquals(serverTransactionsRetentionDays, segment.serverTransactionsRetentionDays) assertTrue(segment.settingCountEntriesAllowed) assertTrue(segment.settingAllAccountAllowed) }