diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MtExample1.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MtExample1.java new file mode 100644 index 0000000..99e213d --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MtExample1.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2025 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.prowidesoftware.swift.myformat.FileFormat; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; + +import java.io.IOException; +import java.util.Objects; + +/** + * Test creating an MT from a simple JSON. + */ +class Json2MtExample1 { + + public static void main(String[] args) throws IOException { + final String jsonInput = "{" + " 'Document': {" + + " 'GnlInf': {" + + " 'SndrMsgRef': 12345," + + " 'FuncOfMsg': 'NEWM'," + + " 'CreDtTm': {" + + " 'DtTm': '2015-08-27T08:59:00'" + + " }" + + " }," + + " 'PmtInf': {" + + " 'PmtRef': {" + + " 'PmtId': 20150827000000" + + " }," + + " 'DbtrDtls': {" + + " 'MmbId': 99," + + " 'PngAgt': {" + + " 'CshAcct': '12345-67890-12345'," + + " 'BIC': 'FOOOUSPAXXX'" + + " }" + + " }," + + " 'CdtrDtls': {" + + " 'MmbId': 123," + + " 'PngAgt': {" + + " 'BIC': 'FOOPUSPW'" + + " }" + + " }," + + " 'PmtDtls': {" + + " 'SttlmDt': '2015-08-27'," + + " 'StsCd': 21," + + " 'CshTxTp': 19," + + " 'SttlmAmt': 1234.56," + + " 'Ccy': 'USD'," + + " 'AddnlInf': 'FOO text ZYX8764'" + + " }" + + " }" + + " }" + + "}"; + + + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Json2MtExample1.class.getResourceAsStream("/myformat/json2mt.xls"))); + MappingTable table = loader.load("SIMPLE", FileFormat.JSON, FileFormat.MT); + final String mt = MyFormatEngine.translate(jsonInput, table); + System.out.println(mt); + } +} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MtExample2.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MtExample2.java new file mode 100644 index 0000000..7b4b681 --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MtExample2.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2025 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.prowidesoftware.swift.myformat.FileFormat; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; + +import java.io.IOException; +import java.util.Objects; + +/** + * Test creating an MT from a JSON source with an array of elements. + */ +class Json2MtExample2 { + + public static void main(String[] args) throws IOException { + String jsonInput = "{" + " 'type': 'MT'," + + " 'basicHeaderBlock': {" + + " 'applicationId': 'F'," + + " 'serviceId': '01'," + + " 'logicalTerminal': 'FOOTHKHHAXXX'," + + " 'sessionNumber': '0000'," + + " 'sequenceNumber': '000000'" + + " }," + + " 'applicationHeaderBlock': {" + + " 'receiverAddress': 'EXMTHKHHXXXX'," + + " 'senderInputTime': null," + + " 'MIRDate': null," + + " 'MIRLogicalTerminal': null," + + " 'MIRSessionNumber': null," + + " 'MIRSequenceNumber': null," + + " 'receiverOutputDate': null," + + " 'receiverOutputTime': null," + + " 'messagePriority': 'N'," + + " 'messageType': '202'," + + " 'direction': 'I'" + + " }," + + " 'textBlock': {" + + " 'fields': [" + + " {" + + " 'name': '20'," + + " 'reference': 'TEST2021234'" + + " }," + + " {" + + " 'name': '21'," + + " 'reference': 'TEST202123233'" + + " }," + + " {" + + " 'name': '32A'," + + " 'date': '230131'," + + " 'currency': 'USD'," + + " 'amount': '7878778,'" + + " }," + + " {" + + " 'name': '58A'," + + " 'account': '898989'," + + " 'bIC': 'EXMTHKHH'" + + " }," + + " {" + + " 'name': '72'," + + " 'narrative': ' /INS/PURPOSE CODE 1670'," + + " 'narrative2': '//SERVICES, SELF COMPANY FUNDING'" + + " }" + + " ]" + + " }" + + "}"; + + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Json2MtExample2.class.getResourceAsStream("/myformat/json2mt.xls"))); + MappingTable table = loader.load("INDEX", FileFormat.JSON, FileFormat.MT); + final String mt = MyFormatEngine.translate(jsonInput, table); + System.out.println(mt); + } +} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MtExample3.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MtExample3.java new file mode 100644 index 0000000..f5f394e --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MtExample3.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2025 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.prowidesoftware.swift.model.mt.mt5xx.MT540; +import com.prowidesoftware.swift.myformat.FileFormat; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; +import com.prowidesoftware.swift.myformat.json.JsonReader; +import com.prowidesoftware.swift.myformat.mt.MtWriter; + +import java.io.IOException; +import java.util.Objects; + +/** + * Each "party" element should generate an instance of sequence E. + * Either attribute "type" or "price" in the "party" element should generate a field 95Q in the corresponding + * sequence E, the attribute value goes to component 1 in the field. + * The "id" attribute in the party element must be mapped to component 2 in the corresponding 95Q field instance. + */ +class Json2MtExample3 { + + public static void main(String[] args) throws IOException { + String jsonInput = "{ 'riskPledgeAllocation': {" + " 'taskId': 1111," + + " 'bussinessDate': '2019-01-03'," + + " 'strategyId': 'XXXXXXX'," + + " 'fundId': 'XXXXX'," + + " 'sscSecId': 999999," + + " 'assetType': 'EQUITY'," + + " 'settlementLoc': 'AAA'," + + " 'allocatedQty': 0," + + " 'availableQty': 9999," + + " 'memoPledgeQty': 0," + + " 'allocatedMarketVal': 0," + + " 'calculatedDelta': 99," + + " 'eligibilityFlag': false," + + " 'price': 99," + + " 'priceCcy': 'USD'," + + " 'lastModifiedBy': 'XXXXX'," + + " 'pricingBasis': 1," + + " 'parties': {" + + " 'party': [" + + " {" + + " 'id': 'AA'," + + " 'type': 'SELLER'" + + " }," + + " {" + + " 'id': 'BB'," + + " 'type': 'BUYER'" + + " }" + + " ]" + + " }" + + " }" + + "}"; + + + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Json2MtExample2.class.getResourceAsStream("/myformat/json2mt.xls"))); + MappingTable t = loader.load("SEQUENCE", FileFormat.JSON, FileFormat.MT); + assert (t.validate().isEmpty()); + + MtWriter writer = new MtWriter(new MT540()); + MyFormatEngine.translate(new JsonReader(jsonInput), writer, t.getRules()); + + MT540 mt = (MT540) writer.mt(); + + System.out.println(mt.message()); + } +} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MtExample4.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MtExample4.java new file mode 100644 index 0000000..9cec3c4 --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MtExample4.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2025 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.prowidesoftware.swift.model.mt.mt5xx.MT535; +import com.prowidesoftware.swift.myformat.FileFormat; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; +import com.prowidesoftware.swift.myformat.json.JsonReader; +import com.prowidesoftware.swift.myformat.mt.MtWriter; + +import java.io.IOException; +import java.util.Objects; + +/** + * Complex test creating real MT535 nested sequences from several foreach. + */ +class Json2MtExample4 { + + public static void main(String[] args) throws IOException { + String jsonInput = "{" + " 'M': {" + + " 'B': [" + + " {" + + " 'T95P': 'F1F1//ABCDARXXXXX'," + + " 'T97A': 'F2F2//1'," + + " 'B1': {" + + " 'T35B': 'F3'," + + " 'B1b': [" + + " {" + + " 'T22F': 'F4F4//1'," + + " 'T94B': 'F5F5//1'" + + " }," + + " {" + + " 'T22F': 'F4F4//2'," + + " 'T94B': 'F5F5//2'" + + " }" + + " ]," + + " 'T99A': 'F6F6//103'," + + " 'B1c': {" + + " 'T13B': 'F7F7//1'," + + " 'T90A': 'F8F8//F8F/1,'" + + " }" + + " }" + + " }," + + " {" + + " 'T97A': 'F2F2//2'," + + " 'B1': {" + + " 'B1c': [" + + " {" + + " 'T13B': 'F7F7//2'," + + " 'T90A': 'F8F8//F8F/2,'" + + " }," + + " {" + + " 'T13B': 'F7F7//3'," + + " 'T90A': 'F8F8//F8F/3,'" + + " }" + + " ]" + + " }" + + " }" + + " ]" + + " }" + + "}"; + + System.out.println(jsonInput); + + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Json2MtExample2.class.getResourceAsStream("/myformat/json2mt.xls"))); + MappingTable t = loader.load("REP_SEQ", FileFormat.JSON, FileFormat.MT); + assert (t.validate().isEmpty()); + + MtWriter writer = new MtWriter(new MT535()); + MyFormatEngine.translate(new JsonReader(jsonInput), writer, t.getRules()); + + MT535 mt = (MT535) writer.mt(); + System.out.println(mt.message()); + } +} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MxExample1.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MxExample1.java new file mode 100644 index 0000000..26d3178 --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MxExample1.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2025 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.prowidesoftware.swift.model.mx.MxPain00100103; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; + +import java.util.Objects; + +class Json2MxExample1 { + + public static void main(String[] args) { + + String json = "{" + " 'root': {" + + " 'GRP_HDR': {" + + " 'CUSTREF': 'FILEREF123'," + + " 'NO_OF_PAYMENTS': 4," + + " 'TOTAL_AMOUNT': 100" + + " }," + + " 'PAYMENT': [" + + " {" + + " 'VALUE_DATE': '2019-03-11'," + + " 'TRANSFER_CCY_CODE': 'USD'," + + " 'TRANSFER_AMOUNT': 30," + + " 'CREDIT': [" + + " {" + + " 'DBTR_BANK_ACC_NUM': 5948198," + + " 'CDTR_REF_NUM': 71237456," + + " 'CDTR_NAME': 'Venkat'" + + " }," + + " {" + + " 'DBTR_BANK_ACC_NUM': 5948199," + + " 'CDTR_REF_NUM': 71237457," + + " 'CDTR_NAME': 'Gourab'" + + " }" + + " ]" + + " }," + + " {" + + " 'VALUE_DATE': '2019-03-11'," + + " 'TRANSFER_CCY_CODE': 'KWD'," + + " 'TRANSFER_AMOUNT': 20," + + " 'CREDIT': [" + + " {" + + " 'DBTR_BANK_ACC_NUM': 5948198," + + " 'CDTR_REF_NUM': 71237456," + + " 'CDTR_NAME': 'Venkat'" + + " }," + + " {" + + " 'DBTR_BANK_ACC_NUM': 5948199," + + " 'CDTR_REF_NUM': 71237457," + + " 'CDTR_NAME': 'Gourab'" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + "}"; + + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Json2MxExample1.class.getResourceAsStream("/myformat/json2mx.xls"))); + MappingTable table = loader.load("SIMPLE"); + String out = MyFormatEngine.translate(json, table); + MxPain00100103 mx = MxPain00100103.parse(out); + System.out.println(mx.message()); + } + +} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MxExample2.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MxExample2.java new file mode 100644 index 0000000..930dc30 --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MxExample2.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.prowidesoftware.swift.model.mx.MxPain00100103; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; + +import java.util.Objects; + +class Json2MxExample2 { + + public static void main(String[] args) { + String json = "{" + + " 'root': {" + + " 'GRP_HDR': {" + + " 'CUSTREF': 'FILEREF123'," + + " 'NO_OF_PAYMENTS': 4," + + " 'TOTAL_AMOUNT': 100" + + " }" + + " }" + + "}"; + + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Json2MxExample2.class.getResourceAsStream("/myformat/json2mx.xls"))); + MappingTable table = loader.load("PATH"); + String out = MyFormatEngine.translate(json, table); + MxPain00100103 mx = MxPain00100103.parse(out); + System.out.println(mx.message()); + } + +} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MxExample3.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MxExample3.java new file mode 100644 index 0000000..76f3edd --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MxExample3.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2025 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.prowidesoftware.swift.model.mx.MxPain00100103; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; + +import java.util.Objects; + +class Json2MxExample3 { + + public static void main(String[] args) { + String json = "{" + " 'root': {" + + " 'GRP_HDR': {" + + " 'CUSTREF': 'CUSTREF'," + + " 'NO_OF_PAYMENTS': 2" + + " }," + + " 'PAYMENT': [" + + " {" + + " 'BANK_ACCOUNT_NUM': 11111111," + + " 'VALUE_DATE': '2019-03-05'," + + " 'CREDIT': {" + + " 'CDTR_REF_NUM': 22222222," + + " 'CURRENCY_CODE': 'INR'" + + " }" + + " }," + + " {" + + " 'BANK_ACCOUNT_NUM': 33333333," + + " 'VALUE_DATE': '2019-03-06'," + + " 'CREDIT': [" + + " {" + + " 'CDTR_REF_NUM': 44444444," + + " 'CURRENCY_CODE': 'USD'" + + " }," + + " {" + + " 'CDTR_REF_NUM': 55555555," + + " 'CURRENCY_CODE': 'EUR'" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + "}"; + + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Json2MxExample3.class.getResourceAsStream("/myformat/json2mx.xls"))); + MappingTable table = loader.load("REPLICATED"); + String out = MyFormatEngine.translate(json, table); + MxPain00100103 mx = MxPain00100103.parse(out); + System.out.println(mx.message()); + } + +} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MxExample4.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MxExample4.java new file mode 100644 index 0000000..fdc4840 --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Json2MxExample4.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2025 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.prowidesoftware.swift.model.mx.MxPain00100103; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; + +import java.util.Objects; + +class Json2MxExample4 { + + public static void main(String[] args) { + String json = "{" + " 'root': {" + + " 'GRP_HDR': {" + + " 'CUSTREF': 'CUSTREF'," + + " 'NO_OF_PAYMENTS': 2" + + " }," + + " 'PAYMENT': [" + + " {" + + " 'BANK_ACCOUNT_NUM': 11111111," + + " 'VALUE_DATE': '2019-03-05'," + + " 'CURRENCY_CODE': 'EUR'," + + " 'AMOUNT': 2000," + + " 'CREDIT': {" + + " 'CDTR_REF_NUM': 22222222" + + " }" + + " }," + + " {" + + " 'BANK_ACCOUNT_NUM': 33333333," + + " 'VALUE_DATE': '2019-03-06'," + + " 'CURRENCY_CODE': 'USD'," + + " 'AMOUNT': 3000," + + " 'CREDIT': [" + + " {" + + " 'CDTR_REF_NUM': 44444444" + + " }," + + " {" + + " 'CDTR_REF_NUM': 55555555" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + "}"; + + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Json2MxExample4.class.getResourceAsStream("/myformat/json2mx.xls"))); + MappingTable table = loader.load("REP_VALUESET"); + String out = MyFormatEngine.translate(json, table); + MxPain00100103 mx = MxPain00100103.parse(out); + System.out.println(mx.message()); + } + +} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mt2JsonExample.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mt2JsonExample.java deleted file mode 100644 index 126b690..0000000 --- a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mt2JsonExample.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2023 Prowide Inc. - * All rights reserved. This program and the accompanying materials are made available under the terms of private - * license agreements between Prowide Inc. and its commercial customers and partners. - */ - -package com.prowidesoftware.swift.samples.integrator.myformat; - -import com.prowidesoftware.swift.myformat.*; - -public class Mt2JsonExample { - - public static void main(String[] args) { - // Mapping definition - MappingTable t = new MappingTable(FileFormat.MT, FileFormat.JSON); - - t.add(new MappingRule("20", "document.header.foo", WriteMode.CREATE)); - t.add(new MappingRule("32A/3", "document.transaction.amount", new Transformation(Transformation.Key.formatDecimal))); - - // sample source message - final String source = "{1:F01FOOXXXG0AXXX0000000000}{2:I202FOOXXXG0XXXXN}{3:{108:MXX2108235411166}{121:4f2f1ac3-c435-ddd2a-b81b-a6ac2ee00b89}}{4:\n" + - ":20:DEF5240030930382\n" + - ":21:ABCX2X0737SCXXGX\n" + - ":32A:234705BWP68608,55\n" + - ":53D:/12345678890\n" + - "FOO BANK XXX\n" + - ":57A:AAAAXXXG0XXX\n" + - ":58A:/0987654321\n" + - "BBBBXX20TSY\n" + - "-}"; - - // translation call passing a pre-filled JSON writer instance - String json = MyFormatEngine.translate(source, t); - System.out.println(json); - } -} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mt2JsonExample1.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mt2JsonExample1.java new file mode 100644 index 0000000..4a47101 --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mt2JsonExample1.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2023 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; + +import java.util.List; +import java.util.Objects; + +public class Mt2JsonExample1 { + + public static void main(String[] args) { + // Mapping definition + String fin = "{1:F01TESTARZZAXXX1204000001}{2:I740FOOYATSWXXXXN}{3:{108:1912041035060802}}{4:\n" + + ":20:REFERENCE1234\n" + + ":40F:URR LATEST VERSION\n" + + ":31D:191219Singapore\n" + + ":59:/123412341234123\n" + + "Joe Doe\n" + + "10 Street 123 of 9383\n" + + "1000001 NY\n" + + ":32B:USD15000,23\n" + + ":39A:12/15\n" + + ":39C:Test Text for Narrative\n" + + "More Lines in Narrative\n" + + ":41A:HGFDUSXXXXX\n" + + "BY ACCEPTANCE\n" + + ":42M:Mixed Payment details\n" + + "Another line of payment details\n" + + "Yet another line of test text\n" + + ":71A:CLM\n" + + ":71D:Narrative for other charges\n" + + ":72Z:Sender to receiver Information\n" + + "More info for receiver\n" + + "-}"; + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Mt2JsonExample1.class.getResourceAsStream("/myformat/mt2json.xls"))); + List tables = loader.load(); + assert (tables.size() == 1); + String json = MyFormatEngine.translate(fin, tables.get(0)); + JsonElement jsonElement = JsonParser.parseString(json); + String formattedJson = new GsonBuilder().setPrettyPrinting().create().toJson(jsonElement); + System.out.println(formattedJson); + } +} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mx2JsonExample1.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mx2JsonExample1.java new file mode 100644 index 0000000..3610789 --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mx2JsonExample1.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2025 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; + +import java.util.Objects; + +class Mx2JsonExample1 { + + public static void main(String[] args) { + + String mx = "" + + "" + + " " + + + + // PAYMENT 1 + " " + + " " + + " " + + " DE12345678901234567890" + + " " + + " " + + + + // PAYMENT 1 - TRANSACTION 1 + " " + + " " + + " 1111.11" + + " " + + " " + + " " + + " US12345678901234567890" + + " " + + " " + + " " + + " " + + + + // PAYMENT 2 + " " + + " " + + " " + + " ES12345678901234567890" + + " " + + " " + + + + // PAYMENT 2 - TRANSACTION 1 + " " + + " " + + " 2222.11" + + " " + + " " + + " " + + " CA12345678901234567890" + + " " + + " " + + " " + + + + // PAYMENT 2 - TRANSACTION 2 + " " + + " " + + " 2222.22" + + " " + + " " + + " " + + " JP12345678901234567890" + + " " + + " " + + " " + + " " + + " " + + ""; + + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Mx2JsonExample1.class.getResourceAsStream("/myformat/mx2json.xls"))); + MappingTable table = loader.load("SIMPLE"); + String json = MyFormatEngine.translate(mx, table); + JsonElement jsonElement = JsonParser.parseString(json); + String formattedJson = new GsonBuilder().setPrettyPrinting().create().toJson(jsonElement); + System.out.println(formattedJson); + } + +} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mx2JsonExample2.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mx2JsonExample2.java new file mode 100644 index 0000000..b016995 --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mx2JsonExample2.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2025 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; + +import java.util.Objects; + +class Mx2JsonExample2 { + + public static void main(String[] args) { + + String mx = "" + + "" + + " " + + " " + + " 12345" + + " 3" + + " 5555.55" + + " " + + + // PAYMENT 1 + " " + + " " + + " " + + " DE12345678901234567890" + + " " + + " " + + + // PAYMENT 1 - TRANSACTION 1 + " " + + " " + + " 11" + + " " + + " " + + " 1111.11" + + " " + + " " + + " " + + " US12345678901234567890" + + " " + + " " + + " " + + " " + + + // PAYMENT 2 + " " + + " " + + " " + + " " + + " 9999" + + " " + + " " + + " " + + + // PAYMENT 2 - TRANSACTION 1 + " " + + " " + + " 21" + + " " + + " " + + " 2222.11" + + " " + + " " + + " " + + " CA12345678901234567890" + + " " + + " " + + " " + + + // PAYMENT 2 - TRANSACTION 2 + " " + + " " + + " 22" + + " " + + " " + + " 2222.22" + + " " + + " " + + " " + + " JP12345678901234567890" + + " " + + " " + + " " + + " " + + " " + + ""; + + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Mx2JsonExample2.class.getResourceAsStream("/myformat/mx2json.xls"))); + MappingTable table = loader.load("RELATIVE"); + String json = MyFormatEngine.translate(mx, table); + JsonElement jsonElement = JsonParser.parseString(json); + String formattedJson = new GsonBuilder().setPrettyPrinting().create().toJson(jsonElement); + System.out.println(formattedJson); + } + +} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mx2JsonExample3.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mx2JsonExample3.java new file mode 100644 index 0000000..b4d4fa7 --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mx2JsonExample3.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2025 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; + +import java.util.Objects; + +class Mx2JsonExample3 { + + public static void main(String[] args) { + + String mx = "" + + "" + + " " + + + + // PAYMENT 1 + " " + + " " + + " " + + " DE12345678901234567890" + + " " + + " " + + + + // PAYMENT 1 - TRANSACTION 1 + " " + + " " + + " 1111.11" + + " " + + " " + + " " + + " US12345678901234567890" + + " " + + " " + + " " + + " " + + + + // PAYMENT 2 + " " + + " " + + " " + + " ES12345678901234567890" + + " " + + " " + + + + // PAYMENT 2 - TRANSACTION 1 + " " + + " " + + " 2222.11" + + " " + + " " + + " " + + " CA12345678901234567890" + + " " + + " " + + " " + + + + // PAYMENT 2 - TRANSACTION 2 + " " + + " " + + " 2222.22" + + " " + + " " + + " " + + " JP12345678901234567890" + + " " + + " " + + " " + + " " + + " " + + ""; + + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Mx2JsonExample3.class.getResourceAsStream("/myformat/mx2json.xls"))); + MappingTable table = loader.load("FOREACH"); + String json = MyFormatEngine.translate(mx, table); + JsonElement jsonElement = JsonParser.parseString(json); + String formattedJson = new GsonBuilder().setPrettyPrinting().create().toJson(jsonElement); + System.out.println(formattedJson); + } + +} diff --git a/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mx2JsonExample4.java b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mx2JsonExample4.java new file mode 100644 index 0000000..6bc7f9b --- /dev/null +++ b/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mx2JsonExample4.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2025 Prowide Inc. + * All rights reserved. This program and the accompanying materials are made available under the terms of private + * license agreements between Prowide Inc. and its commercial customers and partners. + */ + +package com.prowidesoftware.swift.samples.integrator.myformat; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import com.prowidesoftware.swift.myformat.MappingTable; +import com.prowidesoftware.swift.myformat.MappingTableExcelLoader; +import com.prowidesoftware.swift.myformat.MyFormatEngine; + +import java.util.Objects; + +class Mx2JsonExample4 { + + public static void main(String[] args) { + + String mx = "" + + "" + + " " + + " " + + " 12345" + + " 3" + + " 5555.55" + + " " + + + // PAYMENT 1 + " " + + " " + + " " + + " DE12345678901234567890" + + " " + + " " + + + // PAYMENT 1 - TRANSACTION 1 + " " + + " " + + " 11" + + " " + + " " + + " 1111.11" + + " " + + " " + + " " + + " US12345678901234567890" + + " " + + " " + + " " + + " " + + + // PAYMENT 2 + " " + + " " + + " " + + " " + + " 9999" + + " " + + " " + + " " + + + // PAYMENT 2 - TRANSACTION 1 + " " + + " " + + " 21" + + " " + + " " + + " 2222.11" + + " " + + " " + + " " + + " CA12345678901234567890" + + " " + + " " + + " " + + + // PAYMENT 2 - TRANSACTION 2 + " " + + " " + + " 22" + + " " + + " " + + " 2222.22" + + " " + + " " + + " " + + " JP12345678901234567890" + + " " + + " " + + " " + + " " + + " " + + ""; + + MappingTableExcelLoader loader = new MappingTableExcelLoader(Objects.requireNonNull(Mx2JsonExample4.class.getResourceAsStream("/myformat/mx2json.xls"))); + MappingTable table = loader.load("FOREACH_REL"); + String json = MyFormatEngine.translate(mx, table); + JsonElement jsonElement = JsonParser.parseString(json); + String formattedJson = new GsonBuilder().setPrettyPrinting().create().toJson(jsonElement); + System.out.println(formattedJson); + } + +} diff --git a/src/main/resources/myformat/json2mt.xls b/src/main/resources/myformat/json2mt.xls new file mode 100644 index 0000000..e7cacd1 Binary files /dev/null and b/src/main/resources/myformat/json2mt.xls differ diff --git a/src/main/resources/myformat/json2mt_samples.txt b/src/main/resources/myformat/json2mt_samples.txt new file mode 100644 index 0000000..87dfad1 --- /dev/null +++ b/src/main/resources/myformat/json2mt_samples.txt @@ -0,0 +1,256 @@ +FILE: json2mt.xls + +Sheet name: SIMPLE +-------------------- +Input message: +{ + "Document": { + "GnlInf": { + "SndrMsgRef": 12345, + "FuncOfMsg": "NEWM", + "CreDtTm": { + "DtTm": "2015-08-27T08:59:00" + } + }, + "PmtInf": { + "PmtRef": { + "PmtId": 20150827000000 + }, + "DbtrDtls": { + "MmbId": 99, + "PngAgt": { + "CshAcct": "12345-67890-12345", + "BIC": "FOOOUSPAXXX" + } + }, + "CdtrDtls": { + "MmbId": 123, + "PngAgt": { + "BIC": "FOOPUSPW" + } + }, + "PmtDtls": { + "SttlmDt": "2015-08-27", + "StsCd": 21, + "CshTxTp": 19, + "SttlmAmt": 1234.56, + "Ccy": "USD", + "AddnlInf": "FOO text ZYX8764" + } + } + } +} + +Converted message: +{1:F01TESTARZZXXXX0000000000}{2:I202TESTARZZXXXXN}{4: +:20:RE20150827000000 +:21:NOREF +:32A:150827USD1234,56 +:52A:/123456789012345 +FOOOUSPAXXX +:58A:FOOPUSPW +:72:/NBPSTAT/19 +//FOO text ZYX8764 +-} + +------------------------------- + + +Sheet name: INDEX +-------------------- +Input message: +{ + "type": "MT", + "basicHeaderBlock": { + "applicationId": "F", + "serviceId": "01", + "logicalTerminal": "FOOTHKHHAXXX", + "sessionNumber": "0000", + "sequenceNumber": "000000" + }, + "applicationHeaderBlock": { + "receiverAddress": "EXMTHKHHXXXX", + "messagePriority": "N", + "messageType": "202", + "direction": "I" + }, + "textBlock": { + "fields": [ + { + "name": "20", + "reference": "TEST2021234" + }, + { + "name": "21", + "reference": "TEST202123233" + }, + { + "name": "32A", + "date": "230131", + "currency": "USD", + "amount": "7878778," + }, + { + "name": "58A", + "account": "898989", + "bIC": "EXMTHKHH" + }, + { + "name": "72", + "narrative": " /INS/PURPOSE CODE 1670", + "narrative2": "//SERVICES, SELF COMPANY FUNDING" + } + ] + } +} + +Converted message: +{1:F01FOOTHKHHAXXX0000000000}{2:I202EXMTHKHHXXXXN}{4: +:20:TEST2021234 +:21:TEST202123233 +:32A:230131 +:32A:USD +:32A:7878778, +:58A:/898989 +:58A:EXMTHKHH +:72:/INS/PURPOSE CODE 1670 +//SERVICES, SELF COMPANY FUNDING +-} + +----------------------------------- + +Sheet name: SEQUENCE +-------------------- +Input message: +{ + "riskPledgeAllocation": { + "taskId": 1111, + "bussinessDate": "2019-01-03", + "strategyId": "XXXXXXX", + "fundId": "XXXXX", + "sscSecId": 999999, + "assetType": "EQUITY", + "settlementLoc": "AAA", + "allocatedQty": 0, + "availableQty": 9999, + "memoPledgeQty": 0, + "allocatedMarketVal": 0, + "calculatedDelta": 99, + "eligibilityFlag": false, + "price": 99, + "priceCcy": "USD", + "lastModifiedBy": "XXXXX", + "pricingBasis": 1, + "parties": { + "party": [ + { + "id": "AA", + "type": "SELLER" + }, + { + "id": "BB", + "type": "BUYER" + } + ] + } + } +} + +Converted message: +{1:F01TESTARZZXXXX0000000000}{2:I540TESTARZZXXXXN}{4: +:16R:SETDET +:16R:SETPRTY +:95Q::SELL//AA +:16S:SETPRTY +:16R:SETPRTY +:95Q::BUYR//BB +:16S:SETPRTY +:16S:SETDET +:47A:BB +-} + +-------------------------------- + +Sheet name: REP_SEQ +-------------------- +Input message: +{ + "M": { + "B": [ + { + "T95P": "F1F1//ABCDARXXXXX", + "T97A": "F2F2//1", + "B1": { + "T35B": "F3", + "B1b": [ + { + "T22F": "F4F4//1", + "T94B": "F5F5//1" + }, + { + "T22F": "F4F4//2", + "T94B": "F5F5//2" + } + ], + "T99A": "F6F6//103", + "B1c": { + "T13B": "F7F7//1", + "T90A": "F8F8//F8F/1," + } + } + }, + { + "T97A": "F2F2//2", + "B1": { + "B1c": [ + { + "T13B": "F7F7//2", + "T90A": "F8F8//F8F/2," + }, + { + "T13B": "F7F7//3", + "T90A": "F8F8//F8F/3," + } + ] + } + } + ] + } +} + +Converted message: +{1:F01TESTARZZXXXX0000000000}{2:I535TESTARZZXXXXN}{4: +:16R:SUBSAFE +:95P::F1F1//ABCDARXXXXX +:97A::F2F2//1 +:16R:FIN +:35B:F3 +:16R:SUBBAL +:22F::F4F4//1 +:94B::F5F5//1 +:16S:SUBBAL +:16R:SUBBAL +:22F::F4F4//2 +:94B::F5F5//2 +:16S:SUBBAL +:99A::F6F6//103 +:16R:BREAK +:13B::F7F7//1 +:90A::F8F8//F8F/1, +:16S:BREAK +:16S:FIN +:16S:SUBSAFE +:16R:SUBSAFE +:97A::F2F2//2 +:16R:FIN +:16R:BREAK +:13B::F7F7//2 +:90A::F8F8//F8F/2, +:16S:BREAK +:16R:BREAK +:13B::F7F7//3 +:90A::F8F8//F8F/3, +:16S:BREAK +:16S:FIN +:16S:SUBSAFE +-} diff --git a/src/main/resources/myformat/json2mx.xls b/src/main/resources/myformat/json2mx.xls new file mode 100644 index 0000000..96dfaa1 Binary files /dev/null and b/src/main/resources/myformat/json2mx.xls differ diff --git a/src/main/resources/myformat/json2mx_samples.txt b/src/main/resources/myformat/json2mx_samples.txt new file mode 100644 index 0000000..9acd9b6 --- /dev/null +++ b/src/main/resources/myformat/json2mx_samples.txt @@ -0,0 +1,297 @@ +FILE: json2mx.xls + +Sheet name: SIMPLE +-------------------- +Input message: +{ + "root": { + "GRP_HDR": { + "CUSTREF": "FILEREF123", + "NO_OF_PAYMENTS": 4, + "TOTAL_AMOUNT": 100 + }, + "PAYMENT": [ + { + "VALUE_DATE": "2019-03-11", + "TRANSFER_CCY_CODE": "USD", + "TRANSFER_AMOUNT": 30, + "CREDIT": [ + { + "DBTR_BANK_ACC_NUM": 5948198, + "CDTR_REF_NUM": 71237456, + "CDTR_NAME": "Venkat" + }, + { + "DBTR_BANK_ACC_NUM": 5948199, + "CDTR_REF_NUM": 71237457, + "CDTR_NAME": "Gourab" + } + ] + }, + { + "VALUE_DATE": "2019-03-11", + "TRANSFER_CCY_CODE": "KWD", + "TRANSFER_AMOUNT": 20, + "CREDIT": [ + { + "DBTR_BANK_ACC_NUM": 5948198, + "CDTR_REF_NUM": 71237456, + "CDTR_NAME": "Venkat" + }, + { + "DBTR_BANK_ACC_NUM": 5948199, + "CDTR_REF_NUM": 71237457, + "CDTR_NAME": "Gourab" + } + ] + } + ] + } +} + +Converted message: + + + + + FILEREF123 + 4 + 100 + + + 2019-03-11 + + + + 5948199 + + + + + + 71237456 + + + 30 + + + Venkat + + + + + 71237457 + + + Gourab + + + + + + + 20 + + + + + +----------------------- + +Sheet name: PATH +------------------ +Input message: +{ + "root": { + "GRP_HDR": { + "CUSTREF": "FILEREF123", + "NO_OF_PAYMENTS": 4, + "TOTAL_AMOUNT": 100 + } + } +} + +Converted message: + + + + + FILEREF123 + 4 + + + +----------------------- + +Sheet name: REPLICATED +------------------------ +Input message: +{ + "root": { + "GRP_HDR": { + "CUSTREF": "CUSTREF", + "NO_OF_PAYMENTS": 2 + }, + "PAYMENT": [ + { + "BANK_ACCOUNT_NUM": 11111111, + "VALUE_DATE": "2019-03-05", + "CREDIT": { + "CDTR_REF_NUM": 22222222, + "CURRENCY_CODE": "INR" + } + }, + { + "BANK_ACCOUNT_NUM": 33333333, + "VALUE_DATE": "2019-03-06", + "CREDIT": [ + { + "CDTR_REF_NUM": 44444444, + "CURRENCY_CODE": "USD" + }, + { + "CDTR_REF_NUM": 55555555, + "CURRENCY_CODE": "EUR" + } + ] + } + ] + } +} + +Converted message: + + + + + 2019-03-05 + + + + 11111111 + + + + + + 22222222 + + + + + + + + 2019-03-06 + + + + 33333333 + + + + + + 44444444 + + + + + + + + 55555555 + + + + + + + + +----------------------- + +Sheet name: REP_VALUESET +------------------------ +Input message: +{ + "root": { + "GRP_HDR": { + "CUSTREF": "CUSTREF", + "NO_OF_PAYMENTS": 2 + }, + "PAYMENT": [ + { + "BANK_ACCOUNT_NUM": 11111111, + "VALUE_DATE": "2019-03-05", + "CURRENCY_CODE": "EUR", + "AMOUNT": 2000, + "CREDIT": { + "CDTR_REF_NUM": 22222222 + } + }, + { + "BANK_ACCOUNT_NUM": 33333333, + "VALUE_DATE": "2019-03-06", + "CURRENCY_CODE": "USD", + "AMOUNT": 3000, + "CREDIT": [ + { + "CDTR_REF_NUM": 44444444 + }, + { + "CDTR_REF_NUM": 55555555 + } + ] + } + ] + } +} + +Converted message: + + + + + 2019-03-05 + + + + 11111111 + + + + + + 22222222 + + + 2000 + + + + + 2019-03-06 + + + + 33333333 + + + + + + 44444444 + + + 3000 + + + + + 55555555 + + + + + \ No newline at end of file diff --git a/src/main/resources/myformat/mt2json.xls b/src/main/resources/myformat/mt2json.xls new file mode 100644 index 0000000..8cb2a47 Binary files /dev/null and b/src/main/resources/myformat/mt2json.xls differ diff --git a/src/main/resources/myformat/mt2json_samples.txt b/src/main/resources/myformat/mt2json_samples.txt new file mode 100644 index 0000000..48fa210 --- /dev/null +++ b/src/main/resources/myformat/mt2json_samples.txt @@ -0,0 +1,55 @@ +FILE: mt2json.xls + +Sheet name: SIMPLE +-------------------- +Input message: +{1:F01TESTARZZAXXX1204000001}{2:I740FOOYATSWXXXXN}{3:{108:1912041035060802}}{4: +:20:REFERENCE1234 +:40F:URR LATEST VERSION +:31D:191219Singapore +:59:/123412341234123 +Joe Doe +10 Street 123 of 9383 +1000001 NY +:32B:USD15000,23 +:39A:12/15 +:39C:Test Text for Narrative +More Lines in Narrative +:41A:HGFDUSXXXXX +BY ACCEPTANCE +:42M:Mixed Payment details +Another line of payment details +Yet another line of test text +:71A:CLM +:71D:Narrative for other charges +:72Z:Sender to receiver Information +More info for receiver +-} + +Converted message: +{ + "reqMT": { + "Sender": "TESTARZZAXXX", + "MessageType": "740", + "Receiver": "FOOYATSWXXXX", + "TransactionReferenceNumber": "PROVIDED", + "DocumentaryCreditNumber": "REFERENCE1234", + "ApplicableRules": "URR LATEST VERSION", + "DateandPlaceofExpiry": "191219Singapore", + "Beneficiary": "/123412341234123\r\nJoe Doe\r\n10 Street 123 of 9383\r\n1000001 NY", + "CreditAmount": "USD15000,23", + "Currency": "Dollar", + "Amount": "15000", + "Cents": "23", + "PercentageCreditAmountTolerance": "12/15", + "AdditionalAmountsCovered": "Test Text for Narrative\r\nMore Lines in Narrative", + "AvailableWithBy": "HGFDUSXXXXX\r\nBY ACCEPTANCE", + "MixedPaymentDetails": "Mixed Payment details\r\nAnother line of payment details\r\nYet another line of test text", + "ReimbursingBanksCharges": "CLM - Cash and Liquidity Management", + "CurrentDateTime": "2025-10-22T23:32:40.457-03:00", + "UTCDateTime": "2025-10-23T12:32:40.460+10:00", + "UETR": "68f84a16-c0b3-48bf-b0d7-5bfa28aaf429", + "ZonedDateTime": "2023-02-03 08:23" + } +} + diff --git a/src/main/resources/myformat/mx2json.xls b/src/main/resources/myformat/mx2json.xls new file mode 100644 index 0000000..082944a Binary files /dev/null and b/src/main/resources/myformat/mx2json.xls differ diff --git a/src/main/resources/myformat/mx2json_samples.txt b/src/main/resources/myformat/mx2json_samples.txt new file mode 100644 index 0000000..286b05f --- /dev/null +++ b/src/main/resources/myformat/mx2json_samples.txt @@ -0,0 +1,467 @@ +FILE: mx2json.xls + +Sheet name: SIMPLE +-------------------- +Input message: + + + + + + + DE12345678901234567890 + + + + + 1111.11 + + + + US12345678901234567890 + + + + + + + + ES12345678901234567890 + + + + + 2222.11 + + + + CA12345678901234567890 + + + + + + 2222.22 + + + + JP12345678901234567890 + + + + + + + +Converted message: +{ + "Document": { + "CstmrCdtTrfInitn": { + "PmtInf": [ + { + "CdtTrfTxInf": [ + { + "Amt": { + "InstdAmt": [ + { + "Ccy": "USD" + }, + "1111.11" + ] + }, + "CdtrAcct": { + "Id": { + "IBAN": "US12345678901234567890" + } + } + }, + { + "Amt": { + "InstdAmt": { + "Ccy": "USDEUR" + } + } + } + ] + }, + { + "CdtTrfTxInf": { + "Amt": { + "InstdAmt": [ + "2222.11", + "2222.22" + ] + }, + "CdtrAcct": { + "Id": { + "IBAN": "CA12345678901234567890JP12345678901234567890" + } + } + } + } + ] + } + } +} + +---------------------------------- + +Sheet name: RELATIVE +-------------------- +Input message: + + + + + 12345 + 3 + 5555.55 + + + + + DE12345678901234567890 + + + + + 11 + + + 1111.11 + + + + US12345678901234567890 + + + + + + + + + 9999 + + + + + + 21 + + + 2222.11 + + + + CA12345678901234567890 + + + + + + 22 + + + 2222.22 + + + + JP12345678901234567890 + + + + + + + +Converted message: +{ + "Document": { + "CstmrCdtTrfInitn": { + "GrpHdr": { + "MsgId": "12345", + "NbOfTxs": "3", + "CtrlSum": "5555.55" + }, + "PmtInf": [ + { + "CdtTrfTxInf": [ + { + "PmtId": { + "EndToEndId": "11" + }, + "Amt": { + "InstdAmt": [ + { + "Ccy": "USD" + }, + "1111.11" + ] + }, + "CdtrAcct": { + "Id": { + "IBAN": "US12345678901234567890" + } + } + }, + { + "Amt": { + "InstdAmt": { + "Ccy": "USDEUR" + } + } + } + ] + }, + { + "CdtTrfTxInf": { + "PmtId": { + "EndToEndId": "2122" + }, + "Amt": { + "InstdAmt": [ + "2222.11", + "2222.22" + ] + }, + "CdtrAcct": { + "Id": { + "IBAN": "CA12345678901234567890JP12345678901234567890" + } + } + } + } + ] + } + } +} + +----------------------------- + +Sheet name: FOREACH +-------------------- +Input message: + + + + + + + DE12345678901234567890 + + + + + 1111.11 + + + + US12345678901234567890 + + + + + + + + ES12345678901234567890 + + + + + 2222.11 + + + + CA12345678901234567890 + + + + + + 2222.22 + + + + JP12345678901234567890 + + + + + + + +Converted message: +{ + "Document": { + "CstmrCdtTrfInitn": { + "PmtInf": [ + { + "CdtTrfTxInf": { + "DbtrAcct": { + "Id": { + "IBAN": "DE12345678901234567890" + } + }, + "CdtrAcct": { + "Id": { + "IBAN": "US12345678901234567890" + } + }, + "Amt": { + "InstdAmt": [ + "1111.11USD" + ] + } + } + }, + { + "CdtTrfTxInf": { + "DbtrAcct": { + "Id": { + "IBAN": [ + "ES12345678901234567890", + "ES12345678901234567890" + ] + } + }, + "CdtrAcct": { + "Id": { + "IBAN": [ + "CA12345678901234567890", + "JP12345678901234567890" + ] + } + }, + "Amt": { + "InstdAmt": [ + "2222.11USD", + "2222.22EUR" + ] + } + } + } + ] + } + } +} + +---------------------------- + + +Sheet name: FOREACH_REL +-------------------- +Input message: + + + + + 12345 + 3 + 5555.55 + + + + + DE12345678901234567890 + + + + + 11 + + + 1111.11 + + + + US12345678901234567890 + + + + + + + + + 9999 + + + + + + 21 + + + 2222.11 + + + + CA12345678901234567890 + + + + + + 22 + + + 2222.22 + + + + JP12345678901234567890 + + + + + + + +Converted message: +{ + "Document": { + "CstmrCdtTrfInitn": { + "PmtInf": [ + { + "CdtTrfTxInf": { + "DbtrAcct": { + "Id": { + "IBAN": "DE12345678901234567890" + } + }, + "CdtrAcct": { + "Id": { + "IBAN": "US12345678901234567890" + } + }, + "Amt": { + "InstdAmt": [ + "1111.11USD" + ] + } + } + }, + { + "CdtTrfTxInf": { + "CdtrAcct": { + "Id": { + "IBAN": [ + "CA12345678901234567890", + "JP12345678901234567890" + ] + } + }, + "Amt": { + "InstdAmt": [ + "2222.11USD", + "2222.22EUR" + ] + } + } + } + ] + } + } +} \ No newline at end of file