From f8f5ca96ef7b96ffd875e224791e3f2b40e08d99 Mon Sep 17 00:00:00 2001 From: Gerdriaan Mulder Date: Mon, 20 Jan 2020 22:33:24 +0100 Subject: [PATCH] Fixes for exporting --- cmd/createbatch/main.go | 4 ++-- pain/api.go | 5 +++-- pain/pain.go | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/createbatch/main.go b/cmd/createbatch/main.go index f54297f..fa81385 100644 --- a/cmd/createbatch/main.go +++ b/cmd/createbatch/main.go @@ -18,10 +18,10 @@ func main() { log.Fatalf("finalizing failed: %v", err) } - xml, err := xml.Marshal(d) + xmlBytes, err := xml.Marshal(d) if err != nil { log.Fatalf("marshaling failed: %v", err) } - fmt.Printf("%v", string(xml)) + fmt.Printf("%v%v", xml.Header, string(xmlBytes)) } diff --git a/pain/api.go b/pain/api.go index 20681bd..686b10a 100644 --- a/pain/api.go +++ b/pain/api.go @@ -10,8 +10,8 @@ func NewDocument(initParty string) *Document { XmlnsXsi: PAIN_XMLNS_XSI, Namespace: PAIN_XMLNS, Contents: &PainXML{ - GroupHeader: NewGrpHdr(initParty), - PaymentInformation: make([]PmtInf, 0), + GroupHeader: NewGrpHdr(initParty), + PaymentInformation: make([]PmtInf, 0), }, } } @@ -81,6 +81,7 @@ func (d *Document) Finalize(msgId string) error { */ //csum := 0.0 + d.Contents.GroupHeader.MessageId = msgId return d.Valid() } diff --git a/pain/pain.go b/pain/pain.go index 28a484f..04345cd 100644 --- a/pain/pain.go +++ b/pain/pain.go @@ -6,8 +6,8 @@ import ( ) const ( + PAIN_XMLNS = "urn:iso:std:iso:20022:tech:xsd:pain.008.002.02" PAIN_XMLNS_XSI = "http://www.w3.org/2001/XMLSchema-instance" - PAIN_XMLNS = "urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" ) type Document struct { @@ -35,8 +35,8 @@ func (d *Document) Valid() error { } type PainXML struct { - GroupHeader *GrpHdr `xml:"GrpHdr"` - PaymentInformation []PmtInf `xml:"PmtInf"` + GroupHeader *GrpHdr `xml:"GrpHdr"` + PaymentInformation []PmtInf `xml:"PmtInf"` } func (p *PainXML) Valid() error {