Renamed transactionsRetentionDays to serverTransactionsRetentionDays
This commit is contained in:
parent
da2bf8d469
commit
b8fe9e78e1
|
@ -238,7 +238,7 @@ open class FinTsJobExecutor(
|
||||||
val successful = response.tanRequiredButWeWereToldToAbortIfSo
|
val successful = response.tanRequiredButWeWereToldToAbortIfSo
|
||||||
|| (response.successful && (parameter.alsoRetrieveBalance == false || balance != null))
|
|| (response.successful && (parameter.alsoRetrieveBalance == false || balance != null))
|
||||||
val fromDate = parameter.fromDate
|
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
|
?: bookedTransactions.minByOrNull { it.valueDate }?.valueDate
|
||||||
val retrievedData = RetrievedAccountData(parameter.account, successful, balance, bookedTransactions, unbookedTransactions, startTime, fromDate, parameter.toDate ?: LocalDate.todayAtEuropeBerlin(), response.internalError)
|
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 {
|
open fun map(account: AccountData): BankAccount {
|
||||||
return BankAccount(account.accountIdentifier, account.subAccountAttribute, account.iban, account.accountHolderName, map(account.accountType), account.productName,
|
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)
|
account.supportsRetrievingAccountTransactions, account.supportsRetrievingBalance, account.supportsTransferringMoney, account.supportsRealTimeTransfer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ open class AccountData(
|
||||||
/**
|
/**
|
||||||
* Count days for which transactions are stored on bank server (if available).
|
* 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>()
|
protected open val _supportedFeatures = mutableSetOf<AccountFeature>()
|
||||||
|
|
|
@ -102,7 +102,7 @@ open class ModelMapper(
|
||||||
accountInfo.accountLimit, accountInfo.allowedJobNames)
|
accountInfo.accountLimit, accountInfo.allowedJobNames)
|
||||||
|
|
||||||
bank.supportedJobs.filterIsInstance<RetrieveAccountTransactionsParameters>().sortedByDescending { it.segmentVersion }.firstOrNull { newAccount.allowedJobNames.contains(it.jobName) }?.let { transactionsParameters ->
|
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)
|
bank.addAccount(newAccount)
|
||||||
|
|
|
@ -748,11 +748,11 @@ open class ResponseParser(
|
||||||
val transactionsParameterIndex = if (jobParameters.segmentVersion >= 6) 4 else 3
|
val transactionsParameterIndex = if (jobParameters.segmentVersion >= 6) 4 else 3
|
||||||
val dataElements = getDataElements(dataElementGroups[transactionsParameterIndex])
|
val dataElements = getDataElements(dataElementGroups[transactionsParameterIndex])
|
||||||
|
|
||||||
val transactionsRetentionDays = parseInt(dataElements[0])
|
val serverTransactionsRetentionDays = parseInt(dataElements[0])
|
||||||
val settingCountEntriesAllowed = parseBoolean(dataElements[1])
|
val settingCountEntriesAllowed = parseBoolean(dataElements[1])
|
||||||
val settingAllAccountAllowed = if (dataElements.size > 2) parseBoolean(dataElements[2]) else false
|
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 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 dataElements = getDataElements(dataElementGroups[transactionsParameterIndex])
|
||||||
|
|
||||||
val transactionsRetentionDays = parseInt(dataElements[0])
|
val serverTransactionsRetentionDays = parseInt(dataElements[0])
|
||||||
val settingCountEntriesAllowed = parseBoolean(dataElements[1])
|
val settingCountEntriesAllowed = parseBoolean(dataElements[1])
|
||||||
val settingAllAccountAllowed = if (dataElements.size > 2) parseBoolean(dataElements[2]) else false
|
val settingAllAccountAllowed = if (dataElements.size > 2) parseBoolean(dataElements[2]) else false
|
||||||
|
|
||||||
return RetrieveAccountTransactionsParameters(jobParameters, transactionsRetentionDays, settingCountEntriesAllowed, settingAllAccountAllowed)
|
return RetrieveAccountTransactionsParameters(jobParameters, serverTransactionsRetentionDays, settingCountEntriesAllowed, settingAllAccountAllowed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package net.codinux.banking.fints.response.segments
|
||||||
|
|
||||||
open class RetrieveAccountTransactionsParameters(
|
open class RetrieveAccountTransactionsParameters(
|
||||||
parameters: JobParameters,
|
parameters: JobParameters,
|
||||||
open val transactionsRetentionDays: Int,
|
open val serverTransactionsRetentionDays: Int,
|
||||||
open val settingCountEntriesAllowed: Boolean,
|
open val settingCountEntriesAllowed: Boolean,
|
||||||
open val settingAllAccountAllowed: Boolean
|
open val settingAllAccountAllowed: Boolean
|
||||||
) : JobParameters(parameters) {
|
) : JobParameters(parameters) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ open class BankAccount(
|
||||||
open val currency: String = Currency.DefaultCurrencyCode, // TODO: may parse to a value object
|
open val currency: String = Currency.DefaultCurrencyCode, // TODO: may parse to a value object
|
||||||
open val accountLimit: String? = null,
|
open val accountLimit: String? = null,
|
||||||
|
|
||||||
open val transactionsRetentionDays: Int? = null,
|
open val serverTransactionsRetentionDays: Int? = null,
|
||||||
open val isAccountTypeSupportedByApplication: Boolean = false,
|
open val isAccountTypeSupportedByApplication: Boolean = false,
|
||||||
// TODO: create an enum AccountCapabilities [ RetrieveBalance, RetrieveTransactions, TransferMoney / MoneyTransfer(?), InstantPayment ]
|
// TODO: create an enum AccountCapabilities [ RetrieveBalance, RetrieveTransactions, TransferMoney / MoneyTransfer(?), InstantPayment ]
|
||||||
open val supportsRetrievingTransactions: Boolean = false,
|
open val supportsRetrievingTransactions: Boolean = false,
|
||||||
|
|
|
@ -1189,16 +1189,16 @@ class ResponseParserTest : FinTsTestBase() {
|
||||||
fun parseAccountTransactionsMt940Parameters_Version4() {
|
fun parseAccountTransactionsMt940Parameters_Version4() {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
val transactionsRetentionDays = 90
|
val serverTransactionsRetentionDays = 90
|
||||||
|
|
||||||
// when
|
// 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
|
// then
|
||||||
assertSuccessfullyParsedSegment(result, InstituteSegmentId.AccountTransactionsMt940Parameters, 21, 4, 4)
|
assertSuccessfullyParsedSegment(result, InstituteSegmentId.AccountTransactionsMt940Parameters, 21, 4, 4)
|
||||||
|
|
||||||
result.getFirstSegmentById<RetrieveAccountTransactionsParameters>(InstituteSegmentId.AccountTransactionsMt940Parameters)?.let { segment ->
|
result.getFirstSegmentById<RetrieveAccountTransactionsParameters>(InstituteSegmentId.AccountTransactionsMt940Parameters)?.let { segment ->
|
||||||
assertEquals(transactionsRetentionDays, segment.transactionsRetentionDays)
|
assertEquals(serverTransactionsRetentionDays, segment.serverTransactionsRetentionDays)
|
||||||
assertFalse(segment.settingCountEntriesAllowed)
|
assertFalse(segment.settingCountEntriesAllowed)
|
||||||
assertFalse(segment.settingAllAccountAllowed)
|
assertFalse(segment.settingAllAccountAllowed)
|
||||||
}
|
}
|
||||||
|
@ -1209,16 +1209,16 @@ class ResponseParserTest : FinTsTestBase() {
|
||||||
fun parseAccountTransactionsMt940Parameters_Version6() {
|
fun parseAccountTransactionsMt940Parameters_Version6() {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
val transactionsRetentionDays = 90
|
val serverTransactionsRetentionDays = 90
|
||||||
|
|
||||||
// when
|
// 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
|
// then
|
||||||
assertSuccessfullyParsedSegment(result, InstituteSegmentId.AccountTransactionsMt940Parameters, 23, 6, 4)
|
assertSuccessfullyParsedSegment(result, InstituteSegmentId.AccountTransactionsMt940Parameters, 23, 6, 4)
|
||||||
|
|
||||||
result.getFirstSegmentById<RetrieveAccountTransactionsParameters>(InstituteSegmentId.AccountTransactionsMt940Parameters)?.let { segment ->
|
result.getFirstSegmentById<RetrieveAccountTransactionsParameters>(InstituteSegmentId.AccountTransactionsMt940Parameters)?.let { segment ->
|
||||||
assertEquals(transactionsRetentionDays, segment.transactionsRetentionDays)
|
assertEquals(serverTransactionsRetentionDays, segment.serverTransactionsRetentionDays)
|
||||||
assertFalse(segment.settingCountEntriesAllowed)
|
assertFalse(segment.settingCountEntriesAllowed)
|
||||||
assertFalse(segment.settingAllAccountAllowed)
|
assertFalse(segment.settingAllAccountAllowed)
|
||||||
}
|
}
|
||||||
|
@ -1290,16 +1290,16 @@ class ResponseParserTest : FinTsTestBase() {
|
||||||
fun parseCreditCardAccountTransactionsParameters() {
|
fun parseCreditCardAccountTransactionsParameters() {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
val transactionsRetentionDays = 9999
|
val serverTransactionsRetentionDays = 9999
|
||||||
|
|
||||||
// when
|
// 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
|
// then
|
||||||
assertSuccessfullyParsedSegment(result, InstituteSegmentId.CreditCardTransactionsParameters, 15, 2, 4)
|
assertSuccessfullyParsedSegment(result, InstituteSegmentId.CreditCardTransactionsParameters, 15, 2, 4)
|
||||||
|
|
||||||
result.getFirstSegmentById<RetrieveAccountTransactionsParameters>(InstituteSegmentId.CreditCardTransactionsParameters)?.let { segment ->
|
result.getFirstSegmentById<RetrieveAccountTransactionsParameters>(InstituteSegmentId.CreditCardTransactionsParameters)?.let { segment ->
|
||||||
assertEquals(transactionsRetentionDays, segment.transactionsRetentionDays)
|
assertEquals(serverTransactionsRetentionDays, segment.serverTransactionsRetentionDays)
|
||||||
assertTrue(segment.settingCountEntriesAllowed)
|
assertTrue(segment.settingCountEntriesAllowed)
|
||||||
assertTrue(segment.settingAllAccountAllowed)
|
assertTrue(segment.settingAllAccountAllowed)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue