Renamed countDaysForWhichTransactionsAreKept to transactionsRetentionDays
This commit is contained in:
parent
30e9a57b96
commit
70c1082531
|
@ -240,7 +240,7 @@ open class FinTsJobExecutor(
|
|||
val successful = response.tanRequiredButWeWereToldToAbortIfSo
|
||||
|| (response.successful && (parameter.alsoRetrieveBalance == false || balance != null))
|
||||
val fromDate = parameter.fromDate
|
||||
?: parameter.account.countDaysForWhichTransactionsAreKept?.let { LocalDate.todayAtSystemDefaultTimeZone().minusDays(it) }
|
||||
?: parameter.account.transactionsRetentionDays?.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)
|
||||
|
||||
|
|
|
@ -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.countDaysForWhichTransactionsAreKept, account.isAccountTypeSupportedByApplication,
|
||||
account.currency ?: Currency.DefaultCurrencyCode, account.accountLimit, account.transactionsRetentionDays, account.isAccountTypeSupportedByApplication,
|
||||
account.supportsRetrievingAccountTransactions, account.supportsRetrievingBalance, account.supportsTransferringMoney, account.supportsRealTimeTransfer)
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,11 @@ open class AccountData(
|
|||
|| allowedJobNames.contains(CustomerSegmentId.AccountTransactionsMt940.id)
|
||||
|
||||
|
||||
open var countDaysForWhichTransactionsAreKept: Int? = null
|
||||
|
||||
/**
|
||||
* Count days for which transactions are stored on bank server (if available).
|
||||
*/
|
||||
open var transactionsRetentionDays: Int? = null
|
||||
|
||||
|
||||
protected open val _supportedFeatures = mutableSetOf<AccountFeature>()
|
||||
|
|
|
@ -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.countDaysForWhichTransactionsAreKept = transactionsParameters.countDaysForWhichTransactionsAreKept
|
||||
newAccount.transactionsRetentionDays = transactionsParameters.transactionsRetentionDays
|
||||
}
|
||||
|
||||
bank.addAccount(newAccount)
|
||||
|
|
|
@ -748,11 +748,11 @@ open class ResponseParser(
|
|||
val transactionsParameterIndex = if (jobParameters.segmentVersion >= 6) 4 else 3
|
||||
val dataElements = getDataElements(dataElementGroups[transactionsParameterIndex])
|
||||
|
||||
val countDaysForWhichTransactionsAreKept = parseInt(dataElements[0])
|
||||
val transactionsRetentionDays = parseInt(dataElements[0])
|
||||
val settingCountEntriesAllowed = parseBoolean(dataElements[1])
|
||||
val settingAllAccountAllowed = if (dataElements.size > 2) parseBoolean(dataElements[2]) else false
|
||||
|
||||
return RetrieveAccountTransactionsParameters(jobParameters, countDaysForWhichTransactionsAreKept, settingCountEntriesAllowed, settingAllAccountAllowed)
|
||||
return RetrieveAccountTransactionsParameters(jobParameters, transactionsRetentionDays, 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 countDaysForWhichTransactionsAreKept = parseInt(dataElements[0])
|
||||
val transactionsRetentionDays = parseInt(dataElements[0])
|
||||
val settingCountEntriesAllowed = parseBoolean(dataElements[1])
|
||||
val settingAllAccountAllowed = if (dataElements.size > 2) parseBoolean(dataElements[2]) else false
|
||||
|
||||
return RetrieveAccountTransactionsParameters(jobParameters, countDaysForWhichTransactionsAreKept, settingCountEntriesAllowed, settingAllAccountAllowed)
|
||||
return RetrieveAccountTransactionsParameters(jobParameters, transactionsRetentionDays, settingCountEntriesAllowed, settingAllAccountAllowed)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package net.codinux.banking.fints.response.segments
|
|||
|
||||
open class RetrieveAccountTransactionsParameters(
|
||||
parameters: JobParameters,
|
||||
open val countDaysForWhichTransactionsAreKept: Int,
|
||||
open val transactionsRetentionDays: Int,
|
||||
open val settingCountEntriesAllowed: Boolean,
|
||||
open val settingAllAccountAllowed: Boolean
|
||||
) : JobParameters(parameters) {
|
||||
|
|
|
@ -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 countDaysForWhichTransactionsAreKept: Int? = null,
|
||||
open val transactionsRetentionDays: Int? = null,
|
||||
open val isAccountTypeSupportedByApplication: Boolean = false,
|
||||
// TODO: create an enum AccountCapabilities [ RetrieveBalance, RetrieveTransactions, TransferMoney / MoneyTransfer(?), InstantPayment ]
|
||||
open val supportsRetrievingTransactions: Boolean = false,
|
||||
|
|
|
@ -1189,16 +1189,16 @@ class ResponseParserTest : FinTsTestBase() {
|
|||
fun parseAccountTransactionsMt940Parameters_Version4() {
|
||||
|
||||
// given
|
||||
val countDaysForWhichTransactionsAreKept = 90
|
||||
val transactionsRetentionDays = 90
|
||||
|
||||
// when
|
||||
val result = underTest.parse("HIKAZS:21:4:4+20+1+$countDaysForWhichTransactionsAreKept:N'")
|
||||
val result = underTest.parse("HIKAZS:21:4:4+20+1+$transactionsRetentionDays:N'")
|
||||
|
||||
// then
|
||||
assertSuccessfullyParsedSegment(result, InstituteSegmentId.AccountTransactionsMt940Parameters, 21, 4, 4)
|
||||
|
||||
result.getFirstSegmentById<RetrieveAccountTransactionsParameters>(InstituteSegmentId.AccountTransactionsMt940Parameters)?.let { segment ->
|
||||
assertEquals(countDaysForWhichTransactionsAreKept, segment.countDaysForWhichTransactionsAreKept)
|
||||
assertEquals(transactionsRetentionDays, segment.transactionsRetentionDays)
|
||||
assertFalse(segment.settingCountEntriesAllowed)
|
||||
assertFalse(segment.settingAllAccountAllowed)
|
||||
}
|
||||
|
@ -1209,16 +1209,16 @@ class ResponseParserTest : FinTsTestBase() {
|
|||
fun parseAccountTransactionsMt940Parameters_Version6() {
|
||||
|
||||
// given
|
||||
val countDaysForWhichTransactionsAreKept = 90
|
||||
val transactionsRetentionDays = 90
|
||||
|
||||
// when
|
||||
val result = underTest.parse("HIKAZS:23:6:4+20+1+1+$countDaysForWhichTransactionsAreKept:N:N'")
|
||||
val result = underTest.parse("HIKAZS:23:6:4+20+1+1+$transactionsRetentionDays:N:N'")
|
||||
|
||||
// then
|
||||
assertSuccessfullyParsedSegment(result, InstituteSegmentId.AccountTransactionsMt940Parameters, 23, 6, 4)
|
||||
|
||||
result.getFirstSegmentById<RetrieveAccountTransactionsParameters>(InstituteSegmentId.AccountTransactionsMt940Parameters)?.let { segment ->
|
||||
assertEquals(countDaysForWhichTransactionsAreKept, segment.countDaysForWhichTransactionsAreKept)
|
||||
assertEquals(transactionsRetentionDays, segment.transactionsRetentionDays)
|
||||
assertFalse(segment.settingCountEntriesAllowed)
|
||||
assertFalse(segment.settingAllAccountAllowed)
|
||||
}
|
||||
|
@ -1290,16 +1290,16 @@ class ResponseParserTest : FinTsTestBase() {
|
|||
fun parseCreditCardAccountTransactionsParameters() {
|
||||
|
||||
// given
|
||||
val countDaysForWhichTransactionsAreKept = 9999
|
||||
val transactionsRetentionDays = 9999
|
||||
|
||||
// when
|
||||
val result = underTest.parse("DIKKUS:15:2:4+999+1+0+$countDaysForWhichTransactionsAreKept:J:J'")
|
||||
val result = underTest.parse("DIKKUS:15:2:4+999+1+0+$transactionsRetentionDays:J:J'")
|
||||
|
||||
// then
|
||||
assertSuccessfullyParsedSegment(result, InstituteSegmentId.CreditCardTransactionsParameters, 15, 2, 4)
|
||||
|
||||
result.getFirstSegmentById<RetrieveAccountTransactionsParameters>(InstituteSegmentId.CreditCardTransactionsParameters)?.let { segment ->
|
||||
assertEquals(countDaysForWhichTransactionsAreKept, segment.countDaysForWhichTransactionsAreKept)
|
||||
assertEquals(transactionsRetentionDays, segment.transactionsRetentionDays)
|
||||
assertTrue(segment.settingCountEntriesAllowed)
|
||||
assertTrue(segment.settingAllAccountAllowed)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue