Implemented parsing HICAZS
This commit is contained in:
parent
2410504ede
commit
66801a1c7a
|
@ -41,6 +41,10 @@ enum class InstituteSegmentId(override val id: String) : ISegmentId {
|
|||
|
||||
AccountTransactionsMt940Parameters(AccountTransactionsMt940.id + "S"),
|
||||
|
||||
AccountTransactionsCamt("HICAZ"),
|
||||
|
||||
AccountTransactionsCamtParameters(AccountTransactionsCamt.id + "S"),
|
||||
|
||||
CreditCardTransactions("DIKKU"),
|
||||
|
||||
CreditCardTransactionsParameters(CreditCardTransactions.id + "S"),
|
||||
|
|
|
@ -124,6 +124,9 @@ open class ResponseParser(
|
|||
InstituteSegmentId.AccountTransactionsMt940.id -> parseMt940AccountTransactions(segment, dataElementGroups)
|
||||
InstituteSegmentId.AccountTransactionsMt940Parameters.id -> parseMt940AccountTransactionsParameters(segment, segmentId, dataElementGroups)
|
||||
|
||||
// InstituteSegmentId.AccountTransactionsCamt.id -> parseCamtAccountTransactions(segment, dataElementGroups)
|
||||
InstituteSegmentId.AccountTransactionsCamtParameters.id -> parseCamtAccountTransactionsParameters(segment, segmentId, dataElementGroups)
|
||||
|
||||
InstituteSegmentId.CreditCardTransactions.id -> parseCreditCardTransactions(segment, dataElementGroups)
|
||||
InstituteSegmentId.CreditCardTransactionsParameters.id -> parseCreditCardTransactionsParameters(segment, segmentId, dataElementGroups)
|
||||
|
||||
|
@ -766,6 +769,20 @@ open class ResponseParser(
|
|||
return RetrieveAccountTransactionsParameters(jobParameters, serverTransactionsRetentionDays, settingCountEntriesAllowed, settingAllAccountAllowed)
|
||||
}
|
||||
|
||||
protected open fun parseCamtAccountTransactionsParameters(segment: String, segmentId: String, dataElementGroups: List<String>): RetrieveAccountTransactionsParameters {
|
||||
val jobParameters = parseJobParameters(segment, segmentId, dataElementGroups)
|
||||
|
||||
val dataElements = getDataElements(dataElementGroups[4])
|
||||
|
||||
val serverTransactionsRetentionDays = parseInt(dataElements[0])
|
||||
val settingCountEntriesAllowed = parseBoolean(dataElements[1])
|
||||
val settingAllAccountAllowed = parseBoolean(dataElements[2])
|
||||
|
||||
val supportedCamtDataFormats = dataElements.subList(3, dataElements.size)
|
||||
|
||||
return RetrieveAccountTransactionsParameters(jobParameters, serverTransactionsRetentionDays, settingCountEntriesAllowed, settingAllAccountAllowed, supportedCamtDataFormats)
|
||||
}
|
||||
|
||||
|
||||
protected open fun parseCreditCardTransactions(segment: String, dataElementGroups: List<String>): ReceivedCreditCardTransactionsAndBalance {
|
||||
val balance = parseBalance(dataElementGroups[3])
|
||||
|
|
|
@ -5,9 +5,14 @@ open class RetrieveAccountTransactionsParameters(
|
|||
parameters: JobParameters,
|
||||
open val serverTransactionsRetentionDays: Int,
|
||||
open val settingCountEntriesAllowed: Boolean,
|
||||
open val settingAllAccountAllowed: Boolean
|
||||
open val settingAllAccountAllowed: Boolean,
|
||||
open val supportedCamtDataFormats: List<String> = emptyList()
|
||||
) : JobParameters(parameters) {
|
||||
|
||||
internal constructor() : this(JobParameters(), -1, false, false) // for object deserializers
|
||||
|
||||
// for languages not supporting default parameters
|
||||
constructor(parameters: JobParameters, serverTransactionsRetentionDays: Int, settingCountEntriesAllowed: Boolean, settingAllAccountAllowed: Boolean) :
|
||||
this(parameters, serverTransactionsRetentionDays, settingCountEntriesAllowed, settingAllAccountAllowed, emptyList())
|
||||
|
||||
}
|
|
@ -1226,6 +1226,24 @@ class ResponseParserTest : FinTsTestBase() {
|
|||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun parseAccountTransactionsCamtParameters() {
|
||||
val result = underTest.parse("HICAZS:56:1:3+1+1+1+740:N:N:urn?:iso?:std?:iso?:20022?:tech?:xsd?:camt.052.001.02:urn?:iso?:std?:iso?:20022?:tech?:xsd?:camt.052.001.08'")
|
||||
|
||||
// then
|
||||
assertSuccessfullyParsedSegment(result, InstituteSegmentId.AccountTransactionsCamtParameters, 56, 1, 3)
|
||||
|
||||
result.getFirstSegmentById<RetrieveAccountTransactionsParameters>(InstituteSegmentId.AccountTransactionsCamtParameters)?.let { segment ->
|
||||
assertEquals(740, segment.serverTransactionsRetentionDays)
|
||||
assertFalse(segment.settingCountEntriesAllowed)
|
||||
assertFalse(segment.settingAllAccountAllowed)
|
||||
|
||||
assertContainsExactly(segment.supportedCamtDataFormats, "urn:iso:std:iso:20022:tech:xsd:camt.052.001.02", "urn:iso:std:iso:20022:tech:xsd:camt.052.001.08")
|
||||
}
|
||||
?: run { fail("No segment of type AccountTransactionsCamtParameters found in ${result.receivedSegments}") }
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun parseCreditCardAccountTransactions() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue