libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 5413a5f64cd06ac5b420e4c9be07de241fe886a6
parent 2b0915e3b03474b4ed9315338ae8749815900207
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Thu,  5 Mar 2020 16:35:49 +0100

Default namespace for CAMT.053.

Diffstat:
Msandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt | 23++++++++++++-----------
Mutil/src/main/kotlin/XmlCombinators.kt | 3+++
2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt @@ -263,19 +263,20 @@ private fun balance(base: XmlElementBuilder) { */ private fun constructCamtResponse(type: Int, customerId: Int, header: EbicsRequest.Header): String { val camt = constructXml(indent = true) { - namespace("foo", "bar") // FIXME: set right namespace! - root("foo:BkToCstmrAcctRpt") { - element("GrpHdr") { - element("MsgId") { - // unique identifier for a message - text("id under group header") + root("Document") { + attribute("xmlns", "urn:iso:std:iso:20022:tech:xsd:camt.053.001.08") + element("BkToCstmrAcctRpt") { + element("GrpHdr") { + element("MsgId") { + // unique identifier for a message + text("id under group header") + } } - } + element(if (type == 52) "Rpt" else "Stmt") { - element(if (type == 52) "Rpt" else "Stmt") { - - balance(this) - iterHistory(customerId, header, this) + balance(this) + iterHistory(customerId, header, this) + } } } } diff --git a/util/src/main/kotlin/XmlCombinators.kt b/util/src/main/kotlin/XmlCombinators.kt @@ -46,6 +46,9 @@ class XmlDocumentBuilder { maybeWriter = w } + fun namespace(uri: String) { + writer.setDefaultNamespace(uri) + } fun namespace(prefix: String, uri: String) { writer.setPrefix(prefix, uri) }