summaryrefslogtreecommitdiff
path: root/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsOrder.kt
diff options
context:
space:
mode:
authorAntoine A <>2024-04-12 00:38:47 +0200
committerAntoine A <>2024-04-12 00:38:47 +0200
commita40c7c3bb738a5948aef31778766e3b657cab4fa (patch)
tree63d19b33383ffd92eac902f56ca33f37e3aae17d /nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsOrder.kt
parent4f413b40ca6e4974e005299ef239d1e96c353501 (diff)
downloadlibeufin-a40c7c3bb738a5948aef31778766e3b657cab4fa.tar.gz
libeufin-a40c7c3bb738a5948aef31778766e3b657cab4fa.tar.bz2
libeufin-a40c7c3bb738a5948aef31778766e3b657cab4fa.zip
Add gls dialect and bounce reserve pub reuse
Diffstat (limited to 'nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsOrder.kt')
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsOrder.kt60
1 files changed, 41 insertions, 19 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsOrder.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsOrder.kt
index 3c73fff0..ba63a115 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsOrder.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsOrder.kt
@@ -32,28 +32,50 @@ sealed class EbicsOrder(val schema: String) {
val messageName: String? = null,
val messageVersion: String? = null,
val container: String? = null,
+ val option: String? = null
): EbicsOrder("H005")
}
-fun downloadDocService(doc: SupportedDocument, ebics2: Boolean): EbicsOrder {
- return if (ebics2) {
- when (doc) {
- SupportedDocument.PAIN_002 -> EbicsOrder.V2_5("Z01", "DZHNN")
- SupportedDocument.CAMT_052 -> EbicsOrder.V2_5("Z52", "DZHNN")
- SupportedDocument.CAMT_053 -> EbicsOrder.V2_5("Z53", "DZHNN")
- SupportedDocument.CAMT_054 -> EbicsOrder.V2_5("Z54", "DZHNN")
- SupportedDocument.PAIN_002_LOGS -> EbicsOrder.V2_5("HAC", "DZHNN")
- }
- } else {
- when (doc) {
- SupportedDocument.PAIN_002 -> EbicsOrder.V3("BTD", "PSR", "CH", "pain.002", "10", "ZIP")
- SupportedDocument.CAMT_052 -> EbicsOrder.V3("BTD", "STM", "CH", "camt.052", "08", "ZIP")
- SupportedDocument.CAMT_053 -> EbicsOrder.V3("BTD", "EOP", "CH", "camt.053", "08", "ZIP")
- SupportedDocument.CAMT_054 -> EbicsOrder.V3("BTD", "REP", "CH", "camt.054", "08", "ZIP")
- SupportedDocument.PAIN_002_LOGS -> EbicsOrder.V3("HAC")
+enum class Dialect {
+ postfinance,
+ gls;
+
+ fun downloadDoc(doc: SupportedDocument, ebics2: Boolean): EbicsOrder {
+ return when (this) {
+ postfinance -> {
+ // TODO test platform need EBICS2 for HAC, should we use a separate dialect ?
+ if (ebics2 || doc == SupportedDocument.PAIN_002_LOGS) {
+ when (doc) {
+ SupportedDocument.PAIN_002 -> EbicsOrder.V2_5("Z01", "DZHNN")
+ SupportedDocument.CAMT_052 -> EbicsOrder.V2_5("Z52", "DZHNN")
+ SupportedDocument.CAMT_053 -> EbicsOrder.V2_5("Z53", "DZHNN")
+ SupportedDocument.CAMT_054 -> EbicsOrder.V2_5("Z54", "DZHNN")
+ SupportedDocument.PAIN_002_LOGS -> EbicsOrder.V2_5("HAC", "DZHNN")
+ }
+ } else {
+ when (doc) {
+ SupportedDocument.PAIN_002 -> EbicsOrder.V3("BTD", "PSR", "CH", "pain.002", "10", "ZIP")
+ SupportedDocument.CAMT_052 -> EbicsOrder.V3("BTD", "STM", "CH", "camt.052", "08", "ZIP")
+ SupportedDocument.CAMT_053 -> EbicsOrder.V3("BTD", "EOP", "CH", "camt.053", "08", "ZIP")
+ SupportedDocument.CAMT_054 -> EbicsOrder.V3("BTD", "REP", "CH", "camt.054", "08", "ZIP")
+ SupportedDocument.PAIN_002_LOGS -> EbicsOrder.V3("HAC")
+ }
+ }
+ }
+ gls -> when (doc) {
+ SupportedDocument.PAIN_002 -> EbicsOrder.V3("BTD", "REP", "DE", "pain.002", null, "ZIP", "SCT")
+ SupportedDocument.CAMT_052 -> EbicsOrder.V3("BTD", "STM", "DE", "camt.052", null, "ZIP")
+ SupportedDocument.CAMT_053 -> EbicsOrder.V3("BTD", "EOP", "DE", "camt.053", null, "ZIP")
+ SupportedDocument.CAMT_054 -> EbicsOrder.V3("BTD", "STM", "DE", "camt.054", null, "ZIP")
+ SupportedDocument.PAIN_002_LOGS -> EbicsOrder.V3("HAC")
+ }
}
}
-}
-fun uploadPaymentService(): EbicsOrder =
- EbicsOrder.V3("BTU", "MCT", "CH", "pain.001", "09")
+ fun directDebit(): EbicsOrder {
+ return when (this) {
+ postfinance -> EbicsOrder.V3("BTU", "MCT", "CH", "pain.001", "09")
+ gls -> EbicsOrder.V3("BTU", "SCT", "DE", "pain.001", null, "XML")
+ }
+ }
+} \ No newline at end of file