Commit e8fcfa39 by lixinyi

Merge remote-tracking branch 'origin/ncbgjzf' into ncbgjzf

parents f18ed3c6 c47b1464
......@@ -312,7 +312,7 @@ Change Log
<InstdAmt Ccy="USD">555</InstdAmt>
<SttlmPrty>HIGH</SttlmPrty>
<SttlmTmIndctn>
<CdtDtTm>2020-07-16T19:20:30.45+01:00</CdtDtTm>
<CdtDtTm>2020-07-16T19:20:30.40+01:00</CdtDtTm>
<DbtDtTm>2020-07-16T19:20:30.45+01:00</DbtDtTm>
</SttlmTmIndctn>
<SttlmTmReq>
......
{1:F01RBOSGB2LXXXX0000000000}{2:O2991530210409ABNANL2AXXXX00000000002301050928N}{3:{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4:
:20:pacs002bizmsg299
:21:pacs8bizmsgid299
:79:/REJT/99
/AC01/addInfo
/MREF/pacs9bizmsgid299
/TREF/pacs009EndToEnd+
/TEXT//UETR/9a562c67-ca16-48ba-b074-65581be6f002
-}
\ No newline at end of file
......@@ -33,16 +33,51 @@ Change Log
<BizSvc>swift.cbprplus.02</BizSvc>
<CreDt>2021-04-09T09:00:00+01:00</CreDt>
</AppHdr>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08">
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08 ../xsd/pacs00800108.xsd">
<!--<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08">-->
<FIToFICstmrCdtTrf>
<GrpHdr>
<MsgId>pacs8bizmsgidr01</MsgId>
<CreDtTm>2021-04-09T09:00:00+01:00</CreDtTm>
<CreDtTm>2021-04-09T09:00:00+02:00</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<SttlmInf>
<SttlmMtd>INDA</SttlmMtd>
<SttlmAcct>
<Id>
<!--<IBAN>IK00010001</IBAN>-->
<Othr>
<Id>00001</Id>
</Othr>
</Id>
</SttlmAcct>
<InstgRmbrsmntAgt>
<FinInstnId>NYCBCNSHXXX</FinInstnId>
</InstgRmbrsmntAgt>
<InstgRmbrsmntAgtAcct>
<Id>
<!-- <IBAN>IB111</IBAN>-->
<Othr>
<Id>111</Id>
<Issr>abc</Issr>
</Othr>
</Id>
<Tp>
<Cd>cd01</Cd>
<!-- <Prtry></Prtry>-->
</Tp>
<Ccy>CNY</Ccy>
<Nm>ny</Nm>
<Prxy>
<Id></Id>
<Tp>
<Cd>cd02</Cd>
<!--<Prtry> </Prtry>-->
</Tp>
</Prxy>
</InstgRmbrsmntAgtAcct>
</SttlmInf>
</GrpHdr>
<CdtTrfTxInf>
<PmtId>
......@@ -51,6 +86,9 @@ Change Log
<UETR>8a562c67-ca16-48ba-b074-65581be6f001</UETR>
</PmtId>
<PmtTpInf>
<CtgyPurp>
<Cd>XX</Cd>
</CtgyPurp>
<SvcLvl>
<Cd>G001</Cd>
</SvcLvl>
......@@ -60,8 +98,15 @@ Change Log
</PmtTpInf>
<IntrBkSttlmAmt Ccy="EUR">15000000</IntrBkSttlmAmt>
<IntrBkSttlmDt>2021-04-09</IntrBkSttlmDt>
<SttlmTmIndctn>
<CdtDtTm>2020-07-16T19:20:30.40+01:00</CdtDtTm>
<DbtDtTm>2020-07-16T20:21:30.45+01:00</DbtDtTm>
</SttlmTmIndctn>
<InstdAmt Ccy="EUR">11111</InstdAmt>
<ChrgBr>DEBT</ChrgBr>
<Purp>
<Prtry>:26T:AAA</Prtry>
</Purp>
<InstgAgt>
<FinInstnId>
......@@ -103,12 +148,12 @@ Change Log
<RgltryRptg>
<DbtCdtRptgInd>DEBT</DbtCdtRptgInd>
<Authrty>
<Ctry>US</Ctry>
<Nm>zhangsan</Nm>
<Ctry>US</Ctry>
</Authrty>
<Dtls>
<Tp>TEST1</Tp>
<Dt>2021-04-09T09:00:00+01:00</Dt>
<Dt>2021-04-09</Dt>
<Ctry>US</Ctry>
<Cd>TEST1</Cd>
<Amt Ccy="USD">100</Amt>
......@@ -119,12 +164,12 @@ Change Log
<RgltryRptg>
<DbtCdtRptgInd>CRED</DbtCdtRptgInd>
<Authrty>
<Ctry>CN</Ctry>
<Nm>lisi</Nm>
<Ctry>CN</Ctry>
</Authrty>
<Dtls>
<Tp>TEST2</Tp>
<Dt>2022-04-09T09:00:00+01:00</Dt>
<Dt>2022-04-10</Dt>
<Ctry>US</Ctry>
<Cd>TEST2</Cd>
<Amt Ccy="USD">100</Amt>
......
......@@ -2,9 +2,11 @@ package com.brilliance;
import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftTranslationErrorInfo;
import com.brilliance.swift.vo.SwiftTranslationReport;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import org.apache.commons.io.FileUtils;
import org.junit.Test;
......@@ -48,6 +50,15 @@ public class Mt2MxTest {
public void test(String source, Map<String, Object> extraMap) {
File file = FileUtils.toFile(Mx2MtTest.class.getResource(source));
try {
String mtStr=FileUtils.readFileToString(file);
AbstractMT abstractMT = AbstractMT.parse(mtStr);
abstractMT.getSwiftMessage().getBlock4().getTagValue("50");
} catch (Exception e) {
throw new SwiftException(e.getMessage());
}
SwiftTranslationReport str = SwiftTransfer.mt2MxPlus(file, null, extraMap);
printSwiftTranslationReport(str);
}
......@@ -116,11 +127,17 @@ public class Mt2MxTest {
}
@Test
public void testPacs002001() {
public void testPacs002001_199() {
test("/swiftTxt/MT199.txt", null);
}
@Test
public void testPacs002001_299() {
test("/swiftTxt/MT299.txt", null);
}
@Test
public void testPacs004001() {
test("/swiftTxt/MT199.txt", null);
}
......
package com.brilliance;
import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.vo.SwiftTranslationReport;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import org.apache.commons.io.FileUtils;
import org.junit.Test;
......@@ -13,7 +16,7 @@ public class MxXsdValidator {
@Test
public void testPacs008001() {
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/mxjson/Pacs00800108.xml"));
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/Pacs00800108.xml"));
boolean flag = SwiftTransfer.validateMx(file);
System.out.println(flag);
}
......@@ -31,6 +34,26 @@ public class MxXsdValidator {
Pattern pattern=Pattern.compile("[A-Z0-9]{18,18}[0-9]{2,2}");
Matcher m = pattern.matcher(str);
System.out.println(m.find());
}
@Test
public void tagTest() throws IOException {
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftTxt/MT103.txt"));
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/Pacs00800108.xml"));
String s = FileUtils.readFileToString(file, "utf-8");
System.out.println(getMxInfoByTag(s,"13C"));
}
public static Object getMxInfoByTag(String swiftISOXml,String tagName) throws IOException {
SwiftTranslationReport swiftTranslationReport = SwiftTransfer.mx2MtPlus(swiftISOXml, null, null);
System.out.println(swiftTranslationReport.getMessage());
System.out.println(swiftTranslationReport.getMtType());
System.out.println(swiftTranslationReport.getMxType());
AbstractMT abstractMT= AbstractMT.parse(swiftTranslationReport.getMessage());
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(tagName);
return tag.getValue();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment