Commit d6972d2b by gechengyang

修改camt107/camt108/camt109转mt的部分规则逻辑

parent 9a5dc91e
......@@ -20,9 +20,9 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
String messageId = getXmlNodeValue(grpHdrParentElementName, document, "GrpHdr.MsgId");
if (StringUtil.isEmpty(messageId)) {
/* if (StringUtil.isEmpty(messageId)) {
messageId = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.BizMsgIdr");
}
}*/
if (StringUtil.isNotEmpty(messageId)) {
if (messageId.length() > 16) {
buildSTErrorInfo(13, "Block4/:20:", messageId);
......
......@@ -33,10 +33,10 @@ public class Field32aGenerate extends AbstractMx2MtTagsGenerate {
String cheValDtValue = getXmlNodeValue(bodyHdrParentElementName, document, "Chq.ValDt.Dt");
String amt = getXmlNodeValue(bodyHdrParentElementName, document, "Chq.Amt");
String ccy = getXmlNodeValue(bodyHdrParentElementName, document, "Chq.Amt@Ccy");
if ("XAU".equalsIgnoreCase(ccy) || "XAG".equalsIgnoreCase(ccy)
/* if ("XAU".equalsIgnoreCase(ccy) || "XAG".equalsIgnoreCase(ccy)
|| "XPD".equalsIgnoreCase(ccy) || "XPT".equalsIgnoreCase(ccy)) {
buildSTErrorInfo(63, bodyHdrParentElementName+".Chq.Amt", ccy);
}
}*/
if (StringUtil.isNotEmpty(amt) && StringUtil.isNotEmpty(ccy)) {
cheAmt = NumberUtil.formatAmt(new BigDecimal(amt), ccy);
cheAmtCcy = ccy;
......
......@@ -24,14 +24,14 @@ public class Field52aGenerate extends AbstractMx2MtTagsGenerate {
List<Tag> tags = swiftMessage.getBlock4().getTags();
int cheDrwrAgt = getXmlNodeCounts(bodyHdrParentElementName, document, "Chq.DrwrAgt");
int cheDrwrAgtAcct = getXmlNodeCounts(bodyHdrParentElementName, document, "Chq.DrwrAgtAcct");
String account = "";
// String account = "";
if (cheDrwrAgt > 0 || cheDrwrAgtAcct > 0) {
String cheDrwrAgtPath = bodyHdrParentElementName + ".Chq.DrwrAgt";
String cheDrwrAgtAcctPath = bodyHdrParentElementName + ".Chq.DrwrAgtAcct";
if (cheDrwrAgt == 0 ) {
/* if (cheDrwrAgt == 0 ) {
account = mx_to_mtAccount(bodyHdrParentElementName + ".Chq.DrwrAgtAcct");
// tags.add(new Tag(name_52B, account));
} else {
} else {*/
Tag tag = mx_to_mtAgentGeneric(name, cheDrwrAgtPath, cheDrwrAgtAcctPath, true, false, false, null);
if (tag != null) {
if (name_52D.equals(tag.getName())) {
......@@ -40,7 +40,7 @@ public class Field52aGenerate extends AbstractMx2MtTagsGenerate {
}
tags.add(tag);
}
}
//}
}
}
}
......@@ -21,9 +21,9 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
String messageId = getXmlNodeValue(grpHdrParentElementName, document, "GrpHdr.MsgId");
if (StringUtil.isEmpty(messageId)) {
/* if (StringUtil.isEmpty(messageId)) {
messageId = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.BizMsgIdr");
}
}*/
if (StringUtil.isNotEmpty(messageId)) {
if (messageId.length() > 16) {
buildSTErrorInfo(13, "Block4/:20:", messageId);
......
......@@ -33,10 +33,10 @@ public class Field32aGenerate extends AbstractMx2MtTagsGenerate {
String cheValDtValue = getXmlNodeValue(bodyHdrParentElementName, document, "Chq.FctvDt.Dt");
String amt = getXmlNodeValue(bodyHdrParentElementName, document, "Chq.Amt");
String ccy = getXmlNodeValue(bodyHdrParentElementName, document, "Chq.Amt@Ccy");
if ("XAU".equalsIgnoreCase(ccy) || "XAG".equalsIgnoreCase(ccy)
/* if ("XAU".equalsIgnoreCase(ccy) || "XAG".equalsIgnoreCase(ccy)
|| "XPD".equalsIgnoreCase(ccy) || "XPT".equalsIgnoreCase(ccy)) {
buildSTErrorInfo(63, bodyHdrParentElementName+".Chq.Amt", ccy);
}
}*/
if (StringUtil.isNotEmpty(amt) && StringUtil.isNotEmpty(ccy)) {
cheAmt = NumberUtil.formatAmt(new BigDecimal(amt), ccy);
cheAmtCcy = ccy;
......
......@@ -17,9 +17,9 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
String messageId = getXmlNodeValue(grpHdrParentElementName,document,"GrpHdr.MsgId");
if ( StringUtil.isEmpty(messageId) ) {
/* if ( StringUtil.isEmpty(messageId) ) {
messageId = getXmlNodeValue(appHdrParentElementName,document,"AppHdr.BizMsgIdr");
}
}*/
if ( StringUtil.isNotEmpty(messageId) ) {
if ( messageId.length() > 16 ) {
buildSTErrorInfo(13,"Block4/:20:",messageId);
......
......@@ -20,8 +20,8 @@ public class Field76Generate extends AbstractMx2MtTagsGenerate {
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
Map<String,String > map =new Hashtable<>();
map.put("ACCP","Accepted");
map.put("REJT","Rejected");
map.put("ACCR","Accepted");
map.put("RJCR","Rejected");
String mxStatusCode = getXmlNodeValue(bodyHdrParentElementName,document,"Chq.ChqCxlOrStopSts.Sts.Cd");
String mxStatusDes = "";
String mxAddInfo = getXmlNodeValue(bodyHdrParentElementName,document,"Chq.ChqCxlOrStopSts.AddtlInf");
......
<?xml version="1.0" encoding="UTF-8" ?>
<RequestPayload>
<AppHdr xmlns="urn:iso:std:iso:20022:tech:xsd:head.001.001.02">
<AppHdr xmlns="urn:iso:std:iso:20022:tech:xsd:head.001.001.02">
<Fr>
<FIId>
<FinInstnId>
......@@ -21,51 +21,40 @@
<CreDt>2022-07-22T10:17:51.619+08:00</CreDt>
<PssblDplct>false</PssblDplct>
<Prty>NORM</Prty>
</AppHdr>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.108.001.01">
</AppHdr>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.108.001.01">
<ChqCxlOrStopReq>
<GrpHdr>
<MsgId>CSE-001</MsgId>
<CreDtTm>2022-07-22</CreDtTm>
<CreDtTm>2021-04-09T09:00:00+02:00</CreDtTm>
<NbOfChqs>1</NbOfChqs>
</GrpHdr>
<Chq>
<OrgnlInstrId>AAAAAAA</OrgnlInstrId>
<!--21-->
<ChqNb>BBBBB</ChqNb>
<!--30-->
<IsseDt>2022-09-22</IsseDt>
<!--32B-->
<Amt Ccy="USD">123131</Amt>
<!--32A-->
<OrgnlInstrId>AAAAAAA</OrgnlInstrId><!--21-->
<ChqNb>BBBBB</ChqNb><!--30-->
<IsseDt>2022-09-22</IsseDt><!--32B-->
<Amt Ccy="USD">123131</Amt><!--32A-->
<FctvDt>
<Dt>2022-10-22</Dt>
</FctvDt>
<!--52D-->
<!-- <DrwrAgt>-->
<!-- <FinInstnId>QWERTYOII</FinInstnId>-->
<!-- </DrwrAgt>-->
<!--52B-->
</FctvDt><!--52D--><!-- <DrwrAgt>--><!-- <FinInstnId>QWERTYOII</FinInstnId>--><!-- </DrwrAgt>--><!--52B-->
<DrwrAgtAcct>
<Id>
<IBAN>OBHHIO</IBAN>
<IBAN>AB1234567890</IBAN>
</Id>
</DrwrAgtAcct>
<!--59-->
</DrwrAgtAcct><!--59-->
<Pyee>
<Nm>TTTT</Nm>
<PstlAdr>
<AdrLine>PPPPPPPP</AdrLine>
</PstlAdr>
</Pyee>
<ChqCxlOrStopRsn>
<!--75-->
<ChqCxlOrStopRsn><!--75-->
<Rsn>
<Cd>NARR</Cd>
</Rsn>
<AddtlInf>REWQ</AddtlInf>
<AddtlInf>REWQ123454579789870olikuytrewsadfghjREWQ123454579789870olikuytrewsadfghjREWQ123454579789870olikuytrewsadfghj</AddtlInf>
</ChqCxlOrStopRsn>
</Chq>
</ChqCxlOrStopReq>
</Document>
</Document>
</RequestPayload>
\ No newline at end of file
......@@ -57,9 +57,9 @@
</DrwrAgtAcct>
<ChqCxlOrStopSts>
<Sts>
<Cd>ACCP</Cd>
<Cd>ACCR</Cd>
</Sts>
<AddtlInf>ABC</AddtlInf>
<AddtlInf>REWQ123454579789870olikuytrewsadfghjREWQ123454579789870olikuytrewsadfghjREWQ123454579789870olikuytrewsadfghj</AddtlInf>
</ChqCxlOrStopSts>
</Chq>
</ChqCxlOrStopRpt>
......
......@@ -29,11 +29,11 @@ Other product, service, or company names in this publication are trade names, tr
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Group: Cross Border Payments and Reporting Plus (CBPR+)
Collection: CBPRPlus_ISO 20022_Portfolio_Release 2023
Collection: CBPRPlus_SR2024
Usage Guideline: CBPRPlus-camt.109.001.01_ChequeCancellationOrStopReport
Base Message: camt.109.001.01
Date of publication: 16 December 2022
URL: https://www2.swift.com/mystandards/#/mp/mx/_UQsRECZ9EeyFELcOlo2Q4w/_J873YCZ_EeyFELcOlo2Q4w
Date of publication: 19 March 2024
URL: https://www2.swift.com/mystandards/#/mp/mx/_Hzd-0L2ZEe2VOtHXeCwa3Q/_TdEwQW5TEe6ijo6mcWmUwQ
Description: Principles:
1A) AGENTS IDENTIFICATION - Textual Rules
......@@ -59,7 +59,7 @@ All Name and Address for all actors, Related Remittance Information and Remittan
< is replaced with &lt;
> is replaced with &gt;
Generated by the MyStandards web platform [https://www.swift.com/mystandards] on 2023-06-20T04:02:36+00:00
Generated by the MyStandards web platform [https://www.swift.com/mystandards] on 2024-03-21T05:19:47+00:00
-->
<xs:schema xmlns="urn:iso:std:iso:20022:tech:xsd:camt.109.001.01" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:iso:std:iso:20022:tech:xsd:camt.109.001.01">
<xs:element name="Document" type="Document"/>
......@@ -116,8 +116,8 @@ Generated by the MyStandards web platform [https://www.swift.com/mystandards] on
</xs:complexType>
<xs:simpleType name="CBPR_ChequeCancellationOrStopStatusCode">
<xs:restriction base="xs:string">
<xs:enumeration value="REJT"/>
<xs:enumeration value="ACCP"/>
<xs:enumeration value="RJCR"/>
<xs:enumeration value="ACCR"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="CBPR_DateTime">
......@@ -127,7 +127,7 @@ Generated by the MyStandards web platform [https://www.swift.com/mystandards] on
</xs:simpleType>
<xs:simpleType name="CBPR_RestrictedFINXMax140Text">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9a-zA-Z/\-\?:\(\)\.,'\+ ]+"/>
<xs:pattern value="([0-9a-zA-Z\-\?:\(\)\.,'\+ ]([0-9a-zA-Z\-\?:\(\)\.,'\+ ]*(/[0-9a-zA-Z\-\?:\(\)\.,'\+ ])?)*)"/>
<xs:minLength value="1"/>
<xs:maxLength value="140"/>
</xs:restriction>
......@@ -279,11 +279,11 @@ Generated by the MyStandards web platform [https://www.swift.com/mystandards] on
<xs:element name="Dt" type="ISODate"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="DateAndPlaceOfBirth1">
<xs:complexType name="DateAndPlaceOfBirth1__1">
<xs:sequence>
<xs:element name="BirthDt" type="ISODate"/>
<xs:element maxOccurs="1" minOccurs="0" name="PrvcOfBirth" type="Max35Text"/>
<xs:element name="CityOfBirth" type="Max35Text"/>
<xs:element maxOccurs="1" minOccurs="0" name="PrvcOfBirth" type="CBPR_RestrictedFINXMax35Text_Extended"/>
<xs:element name="CityOfBirth" type="CBPR_RestrictedFINXMax35Text_Extended"/>
<xs:element name="CtryOfBirth" type="CountryCode"/>
</xs:sequence>
</xs:complexType>
......@@ -390,12 +390,6 @@ Generated by the MyStandards web platform [https://www.swift.com/mystandards] on
<xs:pattern value="[0-9]{1,15}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Max35Text">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="35"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="OrganisationIdentification29__1">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="AnyBIC" type="AnyBICDec2014Identifier"/>
......@@ -418,14 +412,14 @@ Generated by the MyStandards web platform [https://www.swift.com/mystandards] on
<xs:complexType name="PartyIdentification135__1">
<xs:sequence>
<xs:element name="Nm" type="CBPR_RestrictedFINXMax140Text_Extended"/>
<xs:element name="PstlAdr" type="PostalAddress24__2"/>
<xs:element name="PstlAdr" type="PostalAddress24__1"/>
<xs:element maxOccurs="1" minOccurs="0" name="Id" type="Party38Choice__1"/>
<xs:element maxOccurs="1" minOccurs="0" name="CtryOfRes" type="CountryCode"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PersonIdentification13__1">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="DtAndPlcOfBirth" type="DateAndPlaceOfBirth1"/>
<xs:element maxOccurs="1" minOccurs="0" name="DtAndPlcOfBirth" type="DateAndPlaceOfBirth1__1"/>
<xs:element maxOccurs="2" minOccurs="0" name="Othr" type="GenericPersonIdentification1__1"/>
</xs:sequence>
</xs:complexType>
......@@ -454,25 +448,6 @@ Generated by the MyStandards web platform [https://www.swift.com/mystandards] on
<xs:element maxOccurs="3" minOccurs="0" name="AdrLine" type="CBPR_RestrictedFINXMax35Text_Extended"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PostalAddress24__2">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="Dept" type="CBPR_RestrictedFINXMax70Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="SubDept" type="CBPR_RestrictedFINXMax70Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="StrtNm" type="CBPR_RestrictedFINXMax70Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="BldgNb" type="CBPR_RestrictedFINXMax16Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="BldgNm" type="CBPR_RestrictedFINXMax35Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="Flr" type="CBPR_RestrictedFINXMax70Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="PstBx" type="CBPR_RestrictedFINXMax16Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="Room" type="CBPR_RestrictedFINXMax70Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="PstCd" type="CBPR_RestrictedFINXMax16Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="TwnNm" type="CBPR_RestrictedFINXMax35Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="TwnLctnNm" type="CBPR_RestrictedFINXMax35Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="DstrctNm" type="CBPR_RestrictedFINXMax35Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="CtrySubDvsn" type="CBPR_RestrictedFINXMax35Text_Extended"/>
<xs:element maxOccurs="1" minOccurs="0" name="Ctry" type="CountryCode"/>
<xs:element maxOccurs="7" minOccurs="0" name="AdrLine" type="CBPR_RestrictedFINXMax35Text_Extended"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProxyAccountIdentification1__1">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="ProxyAccountType1Choice__1"/>
......
......@@ -7,6 +7,7 @@ import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Map;
public class Mx2ElementTest {
......@@ -44,7 +45,9 @@ public class Mx2ElementTest {
File file = new File(Mx2MessageTest.class.getResource("/swiftXml/camt11000101.xml").toURI().getPath());
String xml = new String(Files.readAllBytes(file.toPath()));
String elementStr = SwiftTransfer.mx2Element(xml);
Map<String, Object> stringObjectMap = SwiftTransfer.mx2ElementMaps(xml);
System.out.println(elementStr);
System.out.println("stringObjectMap="+stringObjectMap);
}
@Test
......
......@@ -301,8 +301,8 @@ public class Mx2MtTest {
@Test
public void testMx2MtMap() throws IOException {
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxPacs00900108_COV.xml"));
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/iso_ack.xml"));
// File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/camt10900101.xml"));
// File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/iso_ack.xml"));
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/camt10900101.xml"));
String xmlStr = FileUtils.readFileToString(file);
Map<String, String> maps = SwiftTransfer.mx2MtMap(xmlStr, null);
for (String key : maps.keySet()) {
......
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