Renamed transactionsRetentionDays to serverTransactionsRetentionDays

This commit is contained in:
dankito 2024-09-08 22:01:28 +02:00
parent da2bf8d469
commit b8fe9e78e1
8 changed files with 19 additions and 19 deletions

View File

@ -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)

View File

@ -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)
}

View File

@ -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<AccountFeature>()

View File

@ -102,7 +102,7 @@ open class ModelMapper(
accountInfo.accountLimit, accountInfo.allowedJobNames)
bank.supportedJobs.filterIsInstance<RetrieveAccountTransactionsParameters>().sortedByDescending { it.segmentVersion }.firstOrNull { newAccount.allowedJobNames.contains(it.jobName) }?.let { transactionsParameters ->
newAccount.transactionsRetentionDays = transactionsParameters.transactionsRetentionDays
newAccount.serverTransactionsRetentionDays = transactionsParameters.serverTransactionsRetentionDays
}
bank.addAccount(newAccount)

View File

@ -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)
}

View File

@ -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) {

View File

@ -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,

View File

@ -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<RetrieveAccountTransactionsParameters>(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<RetrieveAccountTransactionsParameters>(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<RetrieveAccountTransactionsParameters>(InstituteSegmentId.CreditCardTransactionsParameters)?.let { segment ->
assertEquals(transactionsRetentionDays, segment.transactionsRetentionDays)
assertEquals(serverTransactionsRetentionDays, segment.serverTransactionsRetentionDays)
assertTrue(segment.settingCountEntriesAllowed)
assertTrue(segment.settingAllAccountAllowed)
}