Skip to content

Commit

Permalink
Updated camt structure
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnaprasadmg committed Mar 6, 2018
1 parent 12864e5 commit 8935cf4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# csvToCamt
Convert CSV correction files to CAMT format

Get binaries from [release page](https://github.com/krishnaprasadmg/csvToCamt/releases/tag/v0.1.2)
Get binaries from [release page](https://github.com/krishnaprasadmg/csvToCamt/releases/tag/v0.1.3)

# Example

Expand Down
5 changes: 3 additions & 2 deletions utils/camt.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ type CamtDocument struct {

func NewCamtDocument() *CamtDocument {
camtDoc := etree.NewDocument()
camtDoc.CreateProcInst("xml", `version="1.0" encoding="UTF-8"`)
document := camtDoc.CreateElement("Document")
document.CreateAttr("xmlns", "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03")
document.CreateAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
document.CreateAttr("xsi:schemaLocation", "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03 pain.001.001.03.xsd")
document.CreateAttr("xsi:schemaLocation", "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03 pain.001.001.03_GBIC_2.xsd")

cstmrCdtTrfInitn := document.CreateElement("CstmrCdtTrfInitn")

Expand Down Expand Up @@ -85,7 +86,7 @@ func (c *CamtDocument) AddHeaders(totalAmount float64, nOfTxs int) {

func (c *CamtDocument) AddTransactionData(transactionData map[string]*Transaction) {
for _, data := range transactionData {
CdtTrfTxInf := c.cstmrCdtTrfInitn.CreateElement("CdtTrfTxInf")
CdtTrfTxInf := c.cstmrCdtTrfInitn.FindElement("PmtInf").CreateElement("CdtTrfTxInf")
PmtId := CdtTrfTxInf.CreateElement("PmtId")
EndToEndId := PmtId.CreateElement("PmtId")
EndToEndId.CreateCharData(config.GetString("camt.CamtEndToEnd") + data.endToEnd)
Expand Down

0 comments on commit 8935cf4

Please sign in to comment.