summaryrefslogtreecommitdiff
path: root/nexus/src/main/kotlin
diff options
context:
space:
mode:
authorAntoine A <>2024-04-30 11:53:15 +0900
committerAntoine A <>2024-04-30 11:53:56 +0900
commitc928ab9e189020c2d150d42ecb51ceb618412c19 (patch)
treed2b3f5666e89b9df7705281d09603616216ef5b2 /nexus/src/main/kotlin
parent4725b87198c315c57a2d1f0f4a917715a69b4928 (diff)
downloadlibeufin-c928ab9e189020c2d150d42ecb51ceb618412c19.tar.gz
libeufin-c928ab9e189020c2d150d42ecb51ceb618412c19.tar.bz2
libeufin-c928ab9e189020c2d150d42ecb51ceb618412c19.zip
Parse camt052 files for GLS bankros-security-audit-2024
Diffstat (limited to 'nexus/src/main/kotlin')
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt15
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/Iso20022.kt8
2 files changed, 15 insertions, 8 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt
index 96710648..9394e4e7 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt
@@ -156,7 +156,7 @@ private suspend fun ingestDocument(
whichDocument: SupportedDocument
) {
when (whichDocument) {
- SupportedDocument.CAMT_053, SupportedDocument.CAMT_054 -> {
+ SupportedDocument.CAMT_052, SupportedDocument.CAMT_053, SupportedDocument.CAMT_054 -> {
try {
parseTx(xml, cfg.currency, cfg.dialect).forEach {
if (cfg.fetch.ignoreBefore != null && it.executionTime < cfg.fetch.ignoreBefore) {
@@ -212,10 +212,6 @@ private suspend fun ingestDocument(
db.initiated.bankMessage(status.msgId, msg)
}
}
- SupportedDocument.CAMT_052 -> {
- // TODO parsing
- // TODO ingesting
- }
}
}
@@ -307,15 +303,18 @@ enum class EbicsDocument {
acknowledgement,
/// Payment status - CustomerPaymentStatusReport pain.002
status,
- /// Debit & credit notifications - BankToCustomerDebitCreditNotification camt.054
- notification,
+ /// Account intraday reports - BankToCustomerAccountReport camt.052
+ report,
/// Account statements - BankToCustomerStatement camt.053
statement,
+ /// Debit & credit notifications - BankToCustomerDebitCreditNotification camt.054
+ notification,
;
fun shortDescription(): String = when (this) {
acknowledgement -> "EBICS acknowledgement"
status -> "Payment status"
+ report -> "Account intraday reports"
statement -> "Account statements"
notification -> "Debit & credit notifications"
}
@@ -323,6 +322,7 @@ enum class EbicsDocument {
fun fullDescription(): String = when (this) {
acknowledgement -> "EBICS acknowledgement - CustomerAcknowledgement HAC pain.002"
status -> "Payment status - CustomerPaymentStatusReport pain.002"
+ report -> "Account intraday reports - BankToCustomerAccountReport camt.052"
statement -> "Account statements - BankToCustomerStatement camt.053"
notification -> "Debit & credit notifications - BankToCustomerDebitCreditNotification camt.054"
}
@@ -330,6 +330,7 @@ enum class EbicsDocument {
fun doc(): SupportedDocument = when (this) {
acknowledgement -> SupportedDocument.PAIN_002_LOGS
status -> SupportedDocument.PAIN_002
+ report -> SupportedDocument.CAMT_052
statement -> SupportedDocument.CAMT_053
notification -> SupportedDocument.CAMT_054
}
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Iso20022.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Iso20022.kt
index 192d7375..5eb9bfb1 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Iso20022.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Iso20022.kt
@@ -385,7 +385,7 @@ fun parseTx(
XmlDestructor.fromStream(notifXml, "Document") { when (dialect) {
Dialect.gls -> {
- opt("BkToCstmrStmt")?.each("Stmt") { // Camt.053
+ fun XmlDestructor.parseGlsInner() {
opt("Acct") {
// Sanity check on currency and IBAN ?
}
@@ -440,6 +440,12 @@ fun parseTx(
}
}
}
+ opt("BkToCstmrAcctRpt")?.each("Rpt") { // Camt.052
+ parseGlsInner()
+ }
+ opt("BkToCstmrStmt")?.each("Stmt") { // Camt.053
+ parseGlsInner()
+ }
}
Dialect.postfinance -> {
opt("BkToCstmrStmt")?.each("Stmt") { // Camt.053