Commit be410ce5 by chengzhuoshen

1.增加SwiftHeader,类似于ISO20022 AppHdr

2.增加TransactionReference,包含uetr,endToEndId等
parent 5c0f7831
......@@ -74,5 +74,15 @@
<artifactId>spring-core</artifactId>
<version>5.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>com.brilliance.swift</groupId>
<artifactId>eibs-container</artifactId>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>com.brilliance.swift</groupId>
<artifactId>eibs-ext</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -7,6 +7,7 @@ import com.brilliance.swift.swiftdto2mt.SwiftDto2MtCreatorManager;
import com.brilliance.swift.swiftdto2mx.SwiftDto2MxCreatorManager;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftDto;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import org.apache.commons.io.FileUtils;
import java.io.File;
......@@ -109,8 +110,7 @@ public class SwiftTransfer {
public static String mx2Mt(File file, String outPutFilePath, Map<String, Object> extraMap) throws SwiftException {
try{
String xmlStr = FileUtils.readFileToString(file);
SwiftDto swiftDto = new Mx2SwiftDtoCreatorManager().convert(xmlStr, outPutFilePath, extraMap);
return new SwiftDto2MtCreatorManager().swiftDto2Mt(swiftDto, outPutFilePath, null);
return mx2Mt(xmlStr, outPutFilePath, extraMap);
} catch (IOException e) {
throw new SwiftException("ERROR", e.getMessage());
}
......@@ -119,7 +119,17 @@ public class SwiftTransfer {
public static String mx2Mt(String xmlStr, String outPutFilePath, Map<String, Object> extraMap) throws SwiftException {
SwiftDto swiftDto = new Mx2SwiftDtoCreatorManager().convert(xmlStr, outPutFilePath, extraMap);
return new SwiftDto2MtCreatorManager().swiftDto2Mt(swiftDto, outPutFilePath, null);
String bnkBic = null;
String mtIoType = "O";//代表是收报,默认值
if (extraMap != null) {
bnkBic = (String)extraMap.get("bnkBic");
}
if (StringUtil.isNotEmpty(bnkBic)) {
if (bnkBic.equals(swiftDto.getSwiftHeader().getSenderBic())) {
mtIoType = "I";//如果发报行和本行bic一样,表示是发报
}
}
return new SwiftDto2MtCreatorManager().swiftDto2Mt(swiftDto, outPutFilePath, mtIoType);
}
/**
......@@ -140,4 +150,34 @@ public class SwiftTransfer {
return new SwiftDto2MxCreatorManager().swiftDto2Mx(swiftDto, outPutFilePath);
}
/**
* swift xml输出mt 相关的map
* 用于邮储版本
* @param xmlStr
* @param extraMap
* @return
* @throws SwiftException
*/
public static Map<String, String> mx2MtMap(String xmlStr, Map<String, Object> extraMap) throws SwiftException {
SwiftDto swiftDto = new Mx2SwiftDtoCreatorManager().convert(xmlStr, null, null);
String bnkBic = null;
String mtIoType = "O";//代表是收报,默认值
if (extraMap != null) {
bnkBic = (String)extraMap.get("bnkBic");//得到本行的bicCode
}
if (StringUtil.isNotEmpty(bnkBic)) {
if (bnkBic.equals(swiftDto.getSwiftHeader().getSenderBic())) {
mtIoType = "I";//如果发报行和本行bic一样,表示是发报
}
}
String mtStr = new SwiftDto2MtCreatorManager().swiftDto2Mt(swiftDto, null, mtIoType);
Map<String, String> maps = MessageReader.getSwfMsgInfoViaMsg(mtStr);
maps.put("std", "MX");
AbstractMX abstractMx = AbstractMX.parse(xmlStr);
if (abstractMx != null) {
maps.put("xty", abstractMx.getMxId().id());//ISO20022类型
}
return maps;
}
}
......@@ -3,8 +3,9 @@ package com.brilliance.swift.mt2SwiftDto;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftDto;
import com.brilliance.swift.vo.SwiftHeader;
import com.brilliance.swift.vo.common.MessagePriority;
import com.brilliance.swift.vo.common.TransactionReference;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.Date;
......@@ -21,40 +22,41 @@ public abstract class AbstractMt2SwiftDtoCreator implements Mt2SwiftDtoCreator {
this.context = context;
}
@Override
public void preProcess() throws SwiftException {
try {
SwiftDto swiftDto = new SwiftDto();
AbstractMT abstractMT = context.get(AbstractMT.class);
String senderBic = abstractMT.getSender();
if (senderBic.endsWith(Mx2MtConstants.BICSUFFIX)) {
senderBic = senderBic.substring(0, 8);
} else {
senderBic = senderBic.substring(0, 8) + senderBic.substring(9, 12);
}
swiftDto.setSenderBic(senderBic);
String receiverBic = abstractMT.getReceiver();
if (receiverBic.endsWith(Mx2MtConstants.BICSUFFIX)) {
receiverBic = receiverBic.substring(0, 8);
} else {
receiverBic = receiverBic.substring(0, 8) + receiverBic.substring(9, 12);
}
swiftDto.setReceiverBic(receiverBic);
swiftDto.setCreateDate(new Date());
String priority = abstractMT.getMessagePriority();
if ("N".equals(priority)) {
swiftDto.setMessagePriority(MessagePriority.NORM);
} else if ("U".equals(priority) || "S".equals(priority)) {
swiftDto.setMessagePriority(MessagePriority.HIGH);
}
String uetr = abstractMT.getSwiftMessage().getUETR();
if (StringUtil.isNotEmpty(uetr)) {
swiftDto.setUetr(uetr);
}
context.set(swiftDto);
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
public SwiftHeader buildSwiftHeader() throws SwiftException {
SwiftHeader swiftHeader = new SwiftHeader();
AbstractMT abstractMT = context.get(AbstractMT.class);
String senderBic = abstractMT.getSender();
if (senderBic.endsWith(Mx2MtConstants.BICSUFFIX)) {
senderBic = senderBic.substring(0, 8);
} else {
senderBic = senderBic.substring(0, 8) + senderBic.substring(9, 12);
}
swiftHeader.setSenderBic(senderBic);
String receiverBic = abstractMT.getReceiver();
if (receiverBic.endsWith(Mx2MtConstants.BICSUFFIX)) {
receiverBic = receiverBic.substring(0, 8);
} else {
receiverBic = receiverBic.substring(0, 8) + receiverBic.substring(9, 12);
}
swiftHeader.setReceiverBic(receiverBic);
swiftHeader.setCreateDate(new Date());
String priority = abstractMT.getMessagePriority();
if ("N".equals(priority)) {
swiftHeader.setMessagePriority(MessagePriority.NORM);
} else if ("U".equals(priority) || "S".equals(priority)) {
swiftHeader.setMessagePriority(MessagePriority.HIGH);
}
return swiftHeader;
}
public TransactionReference buildTxnRef() throws SwiftException {
TransactionReference txnRef = new TransactionReference();
AbstractMT abstractMT = context.get(AbstractMT.class);
String uetr = abstractMT.getSwiftMessage().getUETR();
if (StringUtil.isNotEmpty(uetr)) {
txnRef.setUetr(uetr);
}
return txnRef;
}
}
......@@ -70,7 +70,9 @@ public abstract class AbstractMt2SwiftDtoParseFields implements Mt2SwiftDtoParse
if (account.length() > 3 && (account.startsWith("/C/") || account.startsWith("/D/"))) {
account = account.substring(3);
} else {
account = account.substring(1);
if (account.startsWith("/")) {
account = account.substring(1);
}
}
if (SwiftTransferUtil.checkIbanAccount(account)) {
partyAcct.setIbanAcct(account);
......
......@@ -7,7 +7,8 @@ import com.brilliance.swift.mt2SwiftDto.Mt2SwiftDtoParseFields;
import com.brilliance.swift.mt2SwiftDto.camt053001.impl.*;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.BankToCustomerStatement;
import com.brilliance.swift.vo.SwiftDto;
import com.brilliance.swift.vo.SwiftHeader;
import com.brilliance.swift.vo.common.TransactionReference;
import java.io.File;
import java.util.ArrayList;
......@@ -20,21 +21,16 @@ import java.util.List;
public class Mt2SwiftDtoPCamt053001Creator extends AbstractMt2SwiftDtoCreator {
@Override
public void preProcess() throws SwiftException {
try {
super.preProcess();
SwiftDto swiftDto = context.get(SwiftDto.class);
BankToCustomerStatement bankToCustomerStatement = new BankToCustomerStatement();
bankToCustomerStatement.setSenderBic(swiftDto.getSenderBic());
bankToCustomerStatement.setReceiverBic(swiftDto.getReceiverBic());
bankToCustomerStatement.setCreateDate(swiftDto.getCreateDate());
bankToCustomerStatement.setMessagePriority(swiftDto.getMessagePriority());
bankToCustomerStatement.setUetr(swiftDto.getUetr());
bankToCustomerStatement.setMessageType("camt.053.001");
bankToCustomerStatement.setVersion("08");
context.set(bankToCustomerStatement);
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
}
SwiftHeader swiftHeader = buildSwiftHeader();
swiftHeader.setMessageDefId("camt.053.001.09");
swiftHeader.setBusinessService("swift.cbprplus.02");
swiftHeader.setMessageType("camt.053.001");
swiftHeader.setVersion("08");
BankToCustomerStatement bankToCustomerStatement = new BankToCustomerStatement();
bankToCustomerStatement.setSwiftHeader(swiftHeader);
TransactionReference txnRef = buildTxnRef();
bankToCustomerStatement.setTxnRef(txnRef);
context.set(bankToCustomerStatement);
}
@Override
public List<Mt2SwiftDtoParseFields> getParseFieldsList() throws SwiftException {
......
......@@ -19,7 +19,7 @@ public class Camt053001Parse20Field extends AbstractMt2SwiftDtoParseFields {
BankToCustomerStatement bankToCustomerStatement = context.get(BankToCustomerStatement.class);
Field20 field20 = getField20();
if (field20 != null) {
bankToCustomerStatement.setMessageId(field20.getValue());
bankToCustomerStatement.getSwiftHeader().setMessageId(field20.getValue());
}
}catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
......
......@@ -7,7 +7,8 @@ import com.brilliance.swift.mt2SwiftDto.Mt2SwiftDtoParseFields;
import com.brilliance.swift.mt2SwiftDto.camt054001.impl.*;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.BankToCustomerDebitCreditNotification;
import com.brilliance.swift.vo.SwiftDto;
import com.brilliance.swift.vo.SwiftHeader;
import com.brilliance.swift.vo.common.TransactionReference;
import java.io.File;
import java.util.ArrayList;
......@@ -21,21 +22,16 @@ public class Mt2SwiftDtoPCamt054001Creator extends AbstractMt2SwiftDtoCreator {
@Override
public void preProcess() throws SwiftException {
try {
super.preProcess();
SwiftDto swiftDto = context.get(SwiftDto.class);
BankToCustomerDebitCreditNotification bankToCustomerDebitCreditNotification = new BankToCustomerDebitCreditNotification();
bankToCustomerDebitCreditNotification.setSenderBic(swiftDto.getSenderBic());
bankToCustomerDebitCreditNotification.setReceiverBic(swiftDto.getReceiverBic());
bankToCustomerDebitCreditNotification.setCreateDate(swiftDto.getCreateDate());
bankToCustomerDebitCreditNotification.setMessagePriority(swiftDto.getMessagePriority());
bankToCustomerDebitCreditNotification.setUetr(swiftDto.getUetr());
bankToCustomerDebitCreditNotification.setMessageType("camt.054.001");
bankToCustomerDebitCreditNotification.setVersion("08");
context.set(bankToCustomerDebitCreditNotification);
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
}
SwiftHeader swiftHeader = buildSwiftHeader();
swiftHeader.setMessageDefId("camt.054.001.09");
swiftHeader.setBusinessService("swift.cbprplus.02");
swiftHeader.setMessageType("camt.054.001");
swiftHeader.setVersion("08");
BankToCustomerDebitCreditNotification bankToCustomerDebitCreditNotification = new BankToCustomerDebitCreditNotification();
bankToCustomerDebitCreditNotification.setSwiftHeader(swiftHeader);
TransactionReference txnRef = buildTxnRef();
bankToCustomerDebitCreditNotification.setTxnRef(txnRef);
context.set(bankToCustomerDebitCreditNotification);
}
@Override
public List<Mt2SwiftDtoParseFields> getParseFieldsList() throws SwiftException {
......
......@@ -21,14 +21,14 @@ public class Camt054001Parse20Field extends AbstractMt2SwiftDtoParseFields {
MT900 mt900 = (MT900) context.get(AbstractMT.class);
Field20 field20 = mt900.getField20();
if(field20!=null){
bankToCustomerDebitCreditNotification.setMessageId(field20.getValue());
bankToCustomerDebitCreditNotification.getSwiftHeader().setMessageId(field20.getValue());
bankToCustomerDebitCreditNotification.setCdtDbtCode("DBIT");
}
}else {
MT910 mt910 = (MT910) context.get(AbstractMT.class);
Field20 field20 = mt910.getField20();
if(field20!=null){
bankToCustomerDebitCreditNotification.setMessageId(field20.getValue());
bankToCustomerDebitCreditNotification.getSwiftHeader().setMessageId(field20.getValue());
bankToCustomerDebitCreditNotification.setCdtDbtCode("CRDT");
}
}
......
......@@ -21,13 +21,13 @@ public class Camt054001Parse21Field extends AbstractMt2SwiftDtoParseFields {
MT900 mt900 = (MT900) context.get(AbstractMT.class);
Field21 field21 = mt900.getField21();
if(field21!=null){
bankToCustomerDebitCreditNotification.setEndToEndId(field21.getValue());
bankToCustomerDebitCreditNotification.getTxnRef().setEndToEndId(field21.getValue());
}
}else {
MT910 mt910 = (MT910) context.get(AbstractMT.class);
Field21 field21 = mt910.getField21();
if(field21!=null){
bankToCustomerDebitCreditNotification.setEndToEndId(field21.getValue());
bankToCustomerDebitCreditNotification.getTxnRef().setEndToEndId(field21.getValue());
}
}
}catch (Exception e){
......
......@@ -6,8 +6,9 @@ import com.brilliance.swift.mt2SwiftDto.Mt2SwiftDtoContextIdentifier;
import com.brilliance.swift.mt2SwiftDto.Mt2SwiftDtoParseFields;
import com.brilliance.swift.mt2SwiftDto.pacs008001.impl.*;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftDto;
import com.brilliance.swift.vo.SwiftHeader;
import com.brilliance.swift.vo.VoCustomerCreditTransfer;
import com.brilliance.swift.vo.common.TransactionReference;
import java.io.File;
import java.util.ArrayList;
......@@ -19,21 +20,16 @@ public class Mt2SwiftDtoPacs008001Creator extends AbstractMt2SwiftDtoCreator {
@Override
public void preProcess() throws SwiftException {
try {
super.preProcess();
SwiftDto swiftDto = context.get(SwiftDto.class);
VoCustomerCreditTransfer customerCreditTransfer = new VoCustomerCreditTransfer();
customerCreditTransfer.setSenderBic(swiftDto.getSenderBic());
customerCreditTransfer.setReceiverBic(swiftDto.getReceiverBic());
customerCreditTransfer.setCreateDate(swiftDto.getCreateDate());
customerCreditTransfer.setMessagePriority(swiftDto.getMessagePriority());
customerCreditTransfer.setUetr(swiftDto.getUetr());
customerCreditTransfer.setMessageType("pacs.008.001");
customerCreditTransfer.setVersion("09");
context.set(customerCreditTransfer);
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
}
SwiftHeader swiftHeader = buildSwiftHeader();
swiftHeader.setMessageDefId("pacs.008.001.09");
swiftHeader.setBusinessService("swift.cbprplus.02");
swiftHeader.setMessageType("pacs.008.001");
swiftHeader.setVersion("09");
VoCustomerCreditTransfer customerCreditTransfer = new VoCustomerCreditTransfer();
customerCreditTransfer.setSwiftHeader(swiftHeader);
TransactionReference txnRef = buildTxnRef();
customerCreditTransfer.setTxnRef(txnRef);
context.set(customerCreditTransfer);
}
@Override
......
......@@ -15,7 +15,8 @@ public class Pacs00801Parse20Field extends AbstractMt2SwiftDtoParseFields {
MT103 mt103 = (MT103)context.get(AbstractMT.class);
Field20 field20 = mt103.getField20();
if (field20 != null) {
customerCreditTransfer.setMessageId(field20.getValue());
customerCreditTransfer.getSwiftHeader().setMessageId(field20.getValue());
customerCreditTransfer.getTxnRef().setInstructionId(field20.getValue());
}
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
......
......@@ -5,6 +5,7 @@ import com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields;
import com.brilliance.swift.vo.VoCustomerCreditTransfer;
import com.brilliance.swift.vo.common.CcyFormatAmount;
import com.brilliance.swift.vo.common.ChargeForEnum;
import com.brilliance.swift.vo.common.ChargeInfo;
import com.prowidesoftware.swift.model.field.Field71A;
import com.prowidesoftware.swift.model.field.Field71F;
import com.prowidesoftware.swift.model.field.Field71G;
......@@ -30,21 +31,28 @@ public class Pacs00801Parse71Field extends AbstractMt2SwiftDtoParseFields {
customerCreditTransfer.setChargeFor(ChargeForEnum.SHAR);
}
}
CcyFormatAmount cfa = null;
List<Field71F> field71FList = mt103.getField71F();
if (field71FList.size() > 0) {
cfa = new CcyFormatAmount();
cfa.setCcy(field71FList.get(0).getCurrency());
cfa.setAmt(field71FList.get(0).amount());
for (Field71F field71F : field71FList) {
ChargeInfo chargeInfo = new ChargeInfo();
CcyFormatAmount cfa = new CcyFormatAmount();
cfa.setCcy(field71F.getCurrency());
cfa.setAmt(field71F.amount());
chargeInfo.setAmt(cfa);
chargeInfo.setPartyDto(customerCreditTransfer.getInstgAgtParty());
customerCreditTransfer.addChargeInfo(chargeInfo);
}
}
Field71G field71G = mt103.getField71G();
if (field71G != null) {
cfa = new CcyFormatAmount();
ChargeInfo chargeInfo = new ChargeInfo();
CcyFormatAmount cfa = new CcyFormatAmount();
cfa.setCcy(field71G.getCurrency());
cfa.setAmt(field71G.amount());
}
if (cfa != null) {
customerCreditTransfer.setChargeCcyFormatAmount(cfa);
chargeInfo.setAmt(cfa);
chargeInfo.setPartyDto(customerCreditTransfer.getInstdAgtParty());
customerCreditTransfer.addChargeInfo(chargeInfo);
}
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
......
......@@ -7,8 +7,10 @@ import com.brilliance.swift.mt2SwiftDto.Mt2SwiftDtoParseFields;
import com.brilliance.swift.mt2SwiftDto.pacs009001.impl.*;
import com.brilliance.swift.mt2SwiftDto.pacs009001.impl.cov.*;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftDto;
import com.brilliance.swift.vo.SwiftHeader;
import com.brilliance.swift.vo.VoFinancialInstitutionCreditTransfer;
import com.brilliance.swift.vo.common.TransactionReference;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.io.File;
import java.util.ArrayList;
......@@ -18,21 +20,21 @@ public class Mt2SwiftDtoPacs009001Creator extends AbstractMt2SwiftDtoCreator {
@Override
public void preProcess() throws SwiftException {
try {
super.preProcess();
SwiftDto swiftDto = context.get(SwiftDto.class);
VoFinancialInstitutionCreditTransfer financialInstitutionCreditTransfer = new VoFinancialInstitutionCreditTransfer();
financialInstitutionCreditTransfer.setSenderBic(swiftDto.getSenderBic());
financialInstitutionCreditTransfer.setReceiverBic(swiftDto.getReceiverBic());
financialInstitutionCreditTransfer.setCreateDate(swiftDto.getCreateDate());
financialInstitutionCreditTransfer.setMessagePriority(swiftDto.getMessagePriority());
financialInstitutionCreditTransfer.setUetr(swiftDto.getUetr());
financialInstitutionCreditTransfer.setMessageType("pacs.009.001");
financialInstitutionCreditTransfer.setVersion("09");
context.set(financialInstitutionCreditTransfer);
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
SwiftHeader swiftHeader = buildSwiftHeader();
swiftHeader.setMessageDefId("pacs.009.001.09");
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
swiftHeader.setBusinessService("swift.cbprplus.cov.02");
} else {
swiftHeader.setBusinessService("swift.cbprplus.02");
}
swiftHeader.setMessageType("pacs.009.001");
swiftHeader.setVersion("09");
VoFinancialInstitutionCreditTransfer financialInstitutionCreditTransfer = new VoFinancialInstitutionCreditTransfer();
financialInstitutionCreditTransfer.setSwiftHeader(swiftHeader);
TransactionReference txnRef = buildTxnRef();
financialInstitutionCreditTransfer.setTxnRef(txnRef);
context.set(financialInstitutionCreditTransfer);
}
@Override
......
......@@ -15,7 +15,8 @@ public class Pacs009001Parse20Field extends AbstractMt2SwiftDtoParseFields {
VoFinancialInstitutionCreditTransfer financialInstitutionCreditTransfer = context.get(VoFinancialInstitutionCreditTransfer.class);
Field20 field20 = getField20();
if (field20 != null) {
financialInstitutionCreditTransfer.setMessageId(field20.getValue());
financialInstitutionCreditTransfer.getSwiftHeader().setMessageId(field20.getValue());
financialInstitutionCreditTransfer.getTxnRef().setInstructionId(field20.getValue());
}
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
......
......@@ -17,9 +17,9 @@ public class Pacs009001Parse21Field extends AbstractMt2SwiftDtoParseFields {
Field21 field21 = getField21();
if (field21 != null) {
if (Mx2MtConstants.MT_21_DEFAULT_VALUE.equals(field21.getValue())) {
financialInstitutionCreditTransfer.setEndToEndId(Mx2MtConstants.MX_END_TO_END_ID_DEFAULT_VALUE);
financialInstitutionCreditTransfer.getTxnRef().setEndToEndId(Mx2MtConstants.MX_END_TO_END_ID_DEFAULT_VALUE);
} else {
financialInstitutionCreditTransfer.setEndToEndId(field21.getValue());
financialInstitutionCreditTransfer.getTxnRef().setEndToEndId(field21.getValue());
}
}
} catch (Exception e) {
......
......@@ -4,9 +4,13 @@ import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.util.DateUtil;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.XmlUtil;
import com.brilliance.swift.vo.SwiftHeader;
import com.brilliance.swift.vo.common.*;
import org.dom4j.Document;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList;
......@@ -29,10 +33,42 @@ public abstract class AbstractMx2SwiftDtoCreator implements Mx2SwiftDtoCreator{
protected String bodyHdrParentElementName;
protected SwiftHeader swiftHeader;
protected String defaultFormate = "yyyy-MM-dd HH:mm:ss,SSS";
protected String defaultDateFormate = "yyyy-MM-dd";
@Override
public void appHeader() throws SwiftException {
try {
swiftHeader = new SwiftHeader();
String sendBicCode = getBicCode(appHdrParentElementName, document, "AppHdr.Fr.FIId.FinInstnId");
swiftHeader.setSenderBic(sendBicCode);
String receiverBicCode = getBicCode(appHdrParentElementName, document, "AppHdr.To.FIId.FinInstnId");
swiftHeader.setReceiverBic(receiverBicCode);
String createDateStr = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.CreDt");
if (StringUtil.isNotEmpty(createDateStr)) {
XMLGregorianCalendar createDt = DatatypeFactory.newInstance().newXMLGregorianCalendar(createDateStr);
Date createDate = DateUtil.formatAndParseDate(createDt.toGregorianCalendar().getTime(), defaultFormate);
swiftHeader.setCreateDate(createDate);
}
String messageId = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.BizMsgIdr");
swiftHeader.setMessageId(messageId);
String priority = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.Prty");
if (StringUtil.isNotEmpty(priority)) {
swiftHeader.setMessagePriority(MessagePriority.fromValue(priority));
}
String messageDefId = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.MsgDefIdr");
swiftHeader.setMessageDefId(messageDefId);
String businessService = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.BizSvc");
swiftHeader.setBusinessService(businessService);
} catch (DatatypeConfigurationException e) {
throw new SwiftException("ERROR", e.getMessage());
} catch (ParseException e) {
throw new SwiftException("ERROR", e.getMessage());
}
}
protected String getXmlNodeValue(String parentPath, Document document, String path) {
if (StringUtil.isNotEmpty(parentPath)) {
......
......@@ -34,35 +34,15 @@ public class Mx2SwiftDtoBTCDCNCreator extends AbstractMx2SwiftDtoCreator {
grpHdrParentElementName = parentElementMaps.get("GrpHdr");
bodyHdrParentElementName = parentElementMaps.get("Ntfctn");
bankToCustomerDebitCreditNotification = new BankToCustomerDebitCreditNotification();
bankToCustomerDebitCreditNotification.setMessageType("camt.054.001");
String version = (String)context.get(Mx2SwiftDtoContextIdentifier.MX_VERSION, true);
bankToCustomerDebitCreditNotification.setVersion(StringUtil.isEmpty(version)?"08":version);
}
@Override
public void appHeader() throws SwiftException {
try {
String sendBicCode = getBicCode(appHdrParentElementName, document, "AppHdr.Fr.FIId.FinInstnId");
String receiverBicCode = getBicCode(appHdrParentElementName, document, "AppHdr.To.FIId.FinInstnId");
String createDateStr = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.CreDt");
if (StringUtil.isNotEmpty(createDateStr)) {
XMLGregorianCalendar createDt = DatatypeFactory.newInstance().newXMLGregorianCalendar(createDateStr);
Date createDate = DateUtil.formatAndParseDate(createDt.toGregorianCalendar().getTime(), defaultFormate);
bankToCustomerDebitCreditNotification.setCreateDate(createDate);
}
String messageId = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.BizMsgIdr");
String priority = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.Prty");
if (StringUtil.isNotEmpty(priority)) {
bankToCustomerDebitCreditNotification.setMessagePriority(MessagePriority.fromValue(priority));
}
bankToCustomerDebitCreditNotification.setMessageId(messageId);
bankToCustomerDebitCreditNotification.setSenderBic(sendBicCode);
bankToCustomerDebitCreditNotification.setReceiverBic(receiverBicCode);
} catch (DatatypeConfigurationException e) {
throw new SwiftException("ERROR", e.getMessage());
} catch (ParseException e) {
throw new SwiftException("ERROR", e.getMessage());
}
super.appHeader();
swiftHeader.setMessageType("camt.054.001");
String version = (String)context.get(Mx2SwiftDtoContextIdentifier.MX_VERSION, true);
swiftHeader.setVersion(StringUtil.isEmpty(version)?"08":version);
bankToCustomerDebitCreditNotification.setSwiftHeader(swiftHeader);
}
@Override
......@@ -75,14 +55,12 @@ public class Mx2SwiftDtoBTCDCNCreator extends AbstractMx2SwiftDtoCreator {
try {
String cdtDbtInd = getXmlNodeValue(bodyHdrParentElementName,document,"Ntfctn.Ntry.CdtDbtInd");
bankToCustomerDebitCreditNotification.setCdtDbtCode(cdtDbtInd);
//UETR
String uetr = getXmlNodeValue(bodyHdrParentElementName, document, "Ntfctn.Ntry.NtryDtls.TxDtls.Refs.UETR");
if (StringUtil.isNotEmpty(uetr)) {
bankToCustomerDebitCreditNotification.setUetr(uetr);
}
//<Ntfctn><Ntry><NtryDtls><TxDtls><Refs><EndToEndId>
String endToEndId = getXmlNodeValue(bodyHdrParentElementName,document,"Ntfctn.Ntry.NtryDtls.TxDtls.Refs.EndToEndId");
bankToCustomerDebitCreditNotification.setEndToEndId(endToEndId);
TransactionReference txnRef = new TransactionReference();
txnRef.setInstructionId(getXmlNodeValue(bodyHdrParentElementName, document, "Ntfctn.Ntry.NtryDtls.TxDtls.Refs.InstrId"));
txnRef.setEndToEndId(getXmlNodeValue(bodyHdrParentElementName, document, "Ntfctn.Ntry.NtryDtls.TxDtls.Refs.EndToEndId"));
txnRef.setUetr(getXmlNodeValue(bodyHdrParentElementName, document, "Ntfctn.Ntry.NtryDtls.TxDtls.Refs.UETR"));
bankToCustomerDebitCreditNotification.setTxnRef(txnRef);
//<Ntfctn><Acct><Id><IBAN>
//<Ntfctn><Acct><Id><<Othr><Id>
String iban = getXmlNodeValue(bodyHdrParentElementName,document,"Ntfctn.Acct.Id.IBAN");
......
......@@ -10,14 +10,10 @@ import com.brilliance.swift.vo.BankToCustomerStatement;
import com.brilliance.swift.vo.common.*;
import org.dom4j.Document;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -34,35 +30,15 @@ public class Mx2SwiftDtoBTCSCreator extends AbstractMx2SwiftDtoCreator {
grpHdrParentElementName = parentElementMaps.get("GrpHdr");
bodyHdrParentElementName = parentElementMaps.get("Stmt");
bankToCustomerStatement = new BankToCustomerStatement();
bankToCustomerStatement.setMessageType("camt.053.001");
String version = (String)context.get(Mx2SwiftDtoContextIdentifier.MX_VERSION, true);
bankToCustomerStatement.setVersion(StringUtil.isEmpty(version)?"08":version);
}
@Override
public void appHeader() throws SwiftException {
try {
String sendBicCode = getBicCode(appHdrParentElementName, document, "AppHdr.Fr.FIId.FinInstnId");
String receiverBicCode = getBicCode(appHdrParentElementName, document, "AppHdr.To.FIId.FinInstnId");
String createDateStr = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.CreDt");
if (StringUtil.isNotEmpty(createDateStr)) {
XMLGregorianCalendar createDt = DatatypeFactory.newInstance().newXMLGregorianCalendar(createDateStr);
Date createDate = DateUtil.formatAndParseDate(createDt.toGregorianCalendar().getTime(), defaultFormate);
bankToCustomerStatement.setCreateDate(createDate);
}
String messageId = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.BizMsgIdr");
String priority = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.Prty");
if (StringUtil.isNotEmpty(priority)) {
bankToCustomerStatement.setMessagePriority(MessagePriority.fromValue(priority));
}
bankToCustomerStatement.setMessageId(messageId);
bankToCustomerStatement.setSenderBic(sendBicCode);
bankToCustomerStatement.setReceiverBic(receiverBicCode);
} catch (DatatypeConfigurationException e) {
throw new SwiftException("ERROR", e.getMessage());
} catch (ParseException e) {
throw new SwiftException("ERROR", e.getMessage());
}
super.appHeader();
swiftHeader.setMessageType("camt.053.001");
String version = (String)context.get(Mx2SwiftDtoContextIdentifier.MX_VERSION, true);
swiftHeader.setVersion(StringUtil.isEmpty(version)?"08":version);
bankToCustomerStatement.setSwiftHeader(swiftHeader);
}
@Override
......@@ -74,12 +50,12 @@ public class Mx2SwiftDtoBTCSCreator extends AbstractMx2SwiftDtoCreator {
@Override
public void messageBody() throws SwiftException {
try {
//UETR
String uetr = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Ntry.NtryDtls.TxDtls.Refs.UETR");
bankToCustomerStatement.setUetr(uetr);
//EndToEndId
//String endToEndId = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Ntry.NtryDtls.TxDtls.Refs.EndToEndId");
//bankToCustomerStatement.setEndToEndId(endToEndId);
TransactionReference txnRef = new TransactionReference();
txnRef.setInstructionId(getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Ntry.NtryDtls.TxDtls.Refs.InstrId"));
txnRef.setEndToEndId(getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Ntry.NtryDtls.TxDtls.Refs.EndToEndId"));
txnRef.setUetr(getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Ntry.NtryDtls.TxDtls.Refs.UETR"));
bankToCustomerStatement.setTxnRef(txnRef);
PartyAccount account = acctConvertPartyAcct(bodyHdrParentElementName, document, "Stmt.Acct");
bankToCustomerStatement.setAccount(account);
......
......@@ -37,35 +37,15 @@ public class Mx2SwiftDtoCCTCreator extends AbstractMx2SwiftDtoCreator {
grpHdrParentElementName = parentElementMaps.get("GrpHdr");
bodyHdrParentElementName = parentElementMaps.get("CdtTrfTxInf");
customerCreditTransfer = new VoCustomerCreditTransfer();
customerCreditTransfer.setMessageType("pacs.008.001");
String version = (String)context.get(Mx2SwiftDtoContextIdentifier.MX_VERSION, true);
customerCreditTransfer.setVersion(StringUtil.isEmpty(version)?"09":version);
}
@Override
public void appHeader() throws SwiftException {
try {
String sendBicCode = getBicCode(appHdrParentElementName, document, "AppHdr.Fr.FIId.FinInstnId");
String receiverBicCode = getBicCode(appHdrParentElementName, document, "AppHdr.To.FIId.FinInstnId");
String createDateStr = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.CreDt");
if (StringUtil.isNotEmpty(createDateStr)) {
XMLGregorianCalendar createDt = DatatypeFactory.newInstance().newXMLGregorianCalendar(createDateStr);
Date createDate = DateUtil.formatAndParseDate(createDt.toGregorianCalendar().getTime(), defaultFormate);
customerCreditTransfer.setCreateDate(createDate);
}
String messageId = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.BizMsgIdr");
String priority = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.Prty");
if (StringUtil.isNotEmpty(priority)) {
customerCreditTransfer.setMessagePriority(MessagePriority.fromValue(priority));
}
customerCreditTransfer.setMessageId(messageId);
customerCreditTransfer.setSenderBic(sendBicCode);
customerCreditTransfer.setReceiverBic(receiverBicCode);
} catch (DatatypeConfigurationException e) {
throw new SwiftException("ERROR", e.getMessage());
} catch (ParseException e) {
throw new SwiftException("ERROR", e.getMessage());
}
super.appHeader();
swiftHeader.setMessageType("pacs.008.001");
String version = (String)context.get(Mx2SwiftDtoContextIdentifier.MX_VERSION, true);
swiftHeader.setVersion(StringUtil.isEmpty(version)?"09":version);
customerCreditTransfer.setSwiftHeader(swiftHeader);
}
@Override
......@@ -83,11 +63,12 @@ public class Mx2SwiftDtoCCTCreator extends AbstractMx2SwiftDtoCreator {
@Override
public void messageBody() throws SwiftException {
try {
//UETR
String uetr = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.PmtId.UETR");
if (StringUtil.isNotEmpty(uetr)) {
customerCreditTransfer.setUetr(uetr);
}
TransactionReference txnRef = new TransactionReference();
txnRef.setInstructionId(getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.PmtId.InstrId"));
txnRef.setEndToEndId(getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.PmtId.EndToEndId"));
txnRef.setUetr(getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.PmtId.UETR"));
customerCreditTransfer.setTxnRef(txnRef);
//party
PartyDto debitParty = convertPartyDto(bodyHdrParentElementName, document, "CdtTrfTxInf.Dbtr", "CdtTrfTxInf.DbtrAcct");
PartyDto debitAgtParty = agtConvertPartyDto(bodyHdrParentElementName, document, "CdtTrfTxInf.DbtrAgt", "CdtTrfTxInf.DbtrAgtAcct");
......@@ -198,13 +179,21 @@ public class Mx2SwiftDtoCCTCreator extends AbstractMx2SwiftDtoCreator {
if (StringUtil.isNotEmpty(chrgBr)) {
customerCreditTransfer.setChargeFor(ChargeForEnum.valueOf(chrgBr));
}
String chrgAmtStr = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.ChrgsInf");
String chrgCcy = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.ChrgsInf@Ccy");
if (StringUtil.isNotEmpty(chrgCcy) && StringUtil.isNotEmpty(chrgAmtStr)) {
CcyFormatAmount chrgCfa = new CcyFormatAmount();
chrgCfa.setCcy(chrgCcy);
chrgCfa.setAmt(new BigDecimal(chrgAmtStr));
customerCreditTransfer.setChargeCcyFormatAmount(chrgCfa);
int chargeInfoCount = getXmlNodeCounts(bodyHdrParentElementName, document, "CdtTrfTxInf.ChrgsInf");
if (chargeInfoCount > 0) {
for (int i=0; i<chargeInfoCount; i++) {
ChargeInfo chargeInfo = new ChargeInfo();
String chrgAmtStr = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.ChrgsInf("+i+").Amt");
String chrgCcy = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.ChrgsInf("+i+").Amt@Ccy");
if (StringUtil.isNotEmpty(chrgCcy) && StringUtil.isNotEmpty(chrgAmtStr)) {
CcyFormatAmount chrgCfa = new CcyFormatAmount();
chrgCfa.setCcy(chrgCcy);
chrgCfa.setAmt(new BigDecimal(chrgAmtStr));
chargeInfo.setAmt(chrgCfa);
}
chargeInfo.setPartyDto(agtConvertPartyDto(bodyHdrParentElementName, document, "CdtTrfTxInf.ChrgsInf("+i+").Agt", null));
customerCreditTransfer.addChargeInfo(chargeInfo);
}
}
//InstructionForCreditAgent
String instForCdtAgentCode = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.InstrForCdtrAgt.Cd");
......
......@@ -33,35 +33,15 @@ public class Mx2SwiftDtoFICTCreator extends AbstractMx2SwiftDtoCreator {
grpHdrParentElementName = parentElementMaps.get("GrpHdr");
bodyHdrParentElementName = parentElementMaps.get("CdtTrfTxInf");
financialInstitutionCreditTransfer = new VoFinancialInstitutionCreditTransfer();
financialInstitutionCreditTransfer.setMessageType("pacs.009.001");
String version = (String)context.get(Mx2SwiftDtoContextIdentifier.MX_VERSION, true);
financialInstitutionCreditTransfer.setVersion(StringUtil.isEmpty(version)?"09":version);
}
@Override
public void appHeader() throws SwiftException {
try {
String sendBicCode = getBicCode(appHdrParentElementName, document, "AppHdr.Fr.FIId.FinInstnId");
String receiverBicCode = getBicCode(appHdrParentElementName, document, "AppHdr.To.FIId.FinInstnId");
String createDateStr = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.CreDt");
if (StringUtil.isNotEmpty(createDateStr)) {
XMLGregorianCalendar createDt = DatatypeFactory.newInstance().newXMLGregorianCalendar(createDateStr);
Date createDate = DateUtil.formatAndParseDate(createDt.toGregorianCalendar().getTime(), defaultFormate);
financialInstitutionCreditTransfer.setCreateDate(createDate);
}
String messageId = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.BizMsgIdr");
String priority = getXmlNodeValue(appHdrParentElementName, document, "AppHdr.Prty");
if (StringUtil.isNotEmpty(priority)) {
financialInstitutionCreditTransfer.setMessagePriority(MessagePriority.fromValue(priority));
}
financialInstitutionCreditTransfer.setMessageId(messageId);
financialInstitutionCreditTransfer.setSenderBic(sendBicCode);
financialInstitutionCreditTransfer.setReceiverBic(receiverBicCode);
} catch (DatatypeConfigurationException e) {
throw new SwiftException("ERROR", e.getMessage());
} catch (ParseException e) {
throw new SwiftException("ERROR", e.getMessage());
}
super.appHeader();
swiftHeader.setMessageType("pacs.009.001");
String version = (String)context.get(Mx2SwiftDtoContextIdentifier.MX_VERSION, true);
swiftHeader.setVersion(StringUtil.isEmpty(version)?"09":version);
financialInstitutionCreditTransfer.setSwiftHeader(swiftHeader);
}
@Override
......@@ -77,16 +57,11 @@ public class Mx2SwiftDtoFICTCreator extends AbstractMx2SwiftDtoCreator {
@Override
public void messageBody() throws SwiftException {
try {
//UETR
String uetr = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.PmtId.UETR");
if (StringUtil.isNotEmpty(uetr)) {
financialInstitutionCreditTransfer.setUetr(uetr);
}
//EndToEndId
String endToEndId = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.PmtId.EndToEndId");
if (StringUtil.isNotEmpty(uetr)) {
financialInstitutionCreditTransfer.setEndToEndId(endToEndId);
}
TransactionReference txnRef = new TransactionReference();
txnRef.setInstructionId(getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.PmtId.InstrId"));
txnRef.setEndToEndId(getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.PmtId.EndToEndId"));
txnRef.setUetr(getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.PmtId.UETR"));
financialInstitutionCreditTransfer.setTxnRef(txnRef);
//party
PartyDto debitParty = agtConvertPartyDto(bodyHdrParentElementName, document, "CdtTrfTxInf.Dbtr", "CdtTrfTxInf.DbtrAcct");
PartyDto intrmyAgtParty = agtConvertPartyDto(bodyHdrParentElementName, document, "CdtTrfTxInf.IntrmyAgt1", "CdtTrfTxInf.IntrmyAgt1Acct");
......
......@@ -71,9 +71,9 @@ public abstract class AbstractSwiftDto2MtCreator implements SwiftDto2MtCreator{
SwiftDto swiftDto = (SwiftDto)context.get(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ);
String mtIoType = (String)context.get(SwiftDto2MtContextIdentifier.MT_IO_TYPE, true);
if ("O".equalsIgnoreCase(mtIoType)) {
block1.setLogicalTerminal(processBicCode(swiftDto.getReceiverBic()));
block1.setLogicalTerminal(processBicCode(swiftDto.getSwiftHeader().getReceiverBic()));
} else {
block1.setLogicalTerminal(processBicCode(swiftDto.getSenderBic()));
block1.setLogicalTerminal(processBicCode(swiftDto.getSwiftHeader().getSenderBic()));
}
block1.setSessionNumber(getRandomNumber(4));
block1.setSequenceNumber(getRandomNumber(6));
......@@ -84,13 +84,13 @@ public abstract class AbstractSwiftDto2MtCreator implements SwiftDto2MtCreator{
public void withBlock2() throws SwiftException {
SwiftDto swiftDto = (SwiftDto)context.get(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ);
String mtIoType = (String)context.get(SwiftDto2MtContextIdentifier.MT_IO_TYPE, true);
String messagePriority = MessagePriority.NORM.equals(swiftDto.getMessagePriority()) ? "N" : "U";
String messagePriority = MessagePriority.NORM.equals(swiftDto.getSwiftHeader().getMessagePriority()) ? "N" : "U";
if ("O".equalsIgnoreCase(mtIoType)) {
SwiftBlock2Output block2 = new SwiftBlock2Output();
block2.setMessageType(getMtType());
block2.setSenderInputTime(DateUtil.format(swiftDto.getCreateDate(), "HHmm"));
block2.setMIRDate(DateUtil.format(swiftDto.getCreateDate(), "yyMMdd"));
block2.setMIRLogicalTerminal(processBicCode(swiftDto.getSenderBic()));
block2.setSenderInputTime(DateUtil.format(swiftDto.getSwiftHeader().getCreateDate(), "HHmm"));
block2.setMIRDate(DateUtil.format(swiftDto.getSwiftHeader().getCreateDate(), "yyMMdd"));
block2.setMIRLogicalTerminal(processBicCode(swiftDto.getSwiftHeader().getSenderBic()));
block2.setMIRSessionNumber(getRandomNumber(4));
block2.setMIRSequenceNumber(getRandomNumber(6));
Calendar calendar = Calendar.getInstance();
......@@ -101,7 +101,7 @@ public abstract class AbstractSwiftDto2MtCreator implements SwiftDto2MtCreator{
} else {
SwiftBlock2Input block2 = new SwiftBlock2Input();
block2.setMessageType(getMtType());
block2.setReceiverAddress(processBicCode(swiftDto.getReceiverBic()));
block2.setReceiverAddress(processBicCode(swiftDto.getSwiftHeader().getReceiverBic()));
block2.setMessagePriority(messagePriority);
context.get(SwiftMessage.class).setBlock2(block2);
}
......@@ -113,9 +113,6 @@ public abstract class AbstractSwiftDto2MtCreator implements SwiftDto2MtCreator{
List<Tag> tags = new ArrayList<>();
SwiftBlock3 block3 = new SwiftBlock3();
tags.add(new Tag("108", new SimpleDateFormat("yyMMddHHmmssSSSS").format(Calendar.getInstance().getTime())));
if (StringUtil.isNotEmpty(swiftDto.getUetr())) {
tags.add(new Tag("121", swiftDto.getUetr()));
}
block3.setTags(tags);
context.get(SwiftMessage.class).setBlock3(block3);
}
......
......@@ -15,7 +15,7 @@ public class SwiftDto2MtCreatorManager {
context.set(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ, swiftDto);
context.set(SwiftDto2MtContextIdentifier.MT_OUTPUT_FILE_PATH, fileOutputPath);
context.set(SwiftDto2MtContextIdentifier.MT_IO_TYPE, StringUtil.isEmpty(mtIoType)?"O":mtIoType);
AbstractSwiftDto2MtCreator creator = getCreator(swiftDto.getMessageType());
AbstractSwiftDto2MtCreator creator = getCreator(swiftDto.getSwiftHeader().getMessageType());
creator.setContext(context);
creator.preProcess();
creator.withBlock1();
......
package com.brilliance.swift.swiftdto2mt.mt103;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtCreator;
import com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier;
import com.brilliance.swift.swiftdto2mt.SwiftDto2MtTagGenerate;
import com.brilliance.swift.swiftdto2mt.mt103.impl.*;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.VoCustomerCreditTransfer;
import com.brilliance.swift.vo.common.TransactionReference;
import com.prowidesoftware.swift.model.SwiftBlock3;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.Tag;
import java.util.ArrayList;
import java.util.List;
public class SwiftDto2Mt103Creator extends AbstractSwiftDto2MtCreator {
@Override
public void withBlock3() throws SwiftException {
super.withBlock3();
SwiftBlock3 block3 = context.get(SwiftMessage.class).getBlock3();
VoCustomerCreditTransfer customerCreditTransfer = (VoCustomerCreditTransfer)context.get(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ, true);
TransactionReference txnRef = customerCreditTransfer.getTxnRef();
if (txnRef != null && StringUtil.isNotEmpty(txnRef.getUetr())) {
block3.getTags().add(new Tag("121", txnRef.getUetr()));
}
}
@Override
public List<SwiftDto2MtTagGenerate> getGenerateTagList() {
List<SwiftDto2MtTagGenerate> list = new ArrayList<>();
......
......@@ -20,8 +20,8 @@ public class Tag20Generate extends AbstractSwiftDto2MtTagGenerate {
VoCustomerCreditTransfer customerCreditTransfer = (VoCustomerCreditTransfer)context.get(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ, true);
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
if (StringUtil.isNotEmpty(customerCreditTransfer.getMessageId())) {
tags.add(new Tag(name, customerCreditTransfer.getMessageId()));
if (StringUtil.isNotEmpty(customerCreditTransfer.getSwiftHeader().getMessageId())) {
tags.add(new Tag(name, customerCreditTransfer.getSwiftHeader().getMessageId()));
}
}
}
......@@ -6,6 +6,7 @@ import com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier;
import com.brilliance.swift.util.NumberUtil;
import com.brilliance.swift.vo.VoCustomerCreditTransfer;
import com.brilliance.swift.vo.common.CcyFormatAmount;
import com.brilliance.swift.vo.common.ChargeInfo;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.mx.dic.ChargeBearerType1Code;
......@@ -35,14 +36,19 @@ public class Tag71Generate extends AbstractSwiftDto2MtTagGenerate {
value = "SHA";
}
tags.add(new Tag(name_A, value));
if (customerCreditTransfer.getChargeCcyFormatAmount() != null) {
CcyFormatAmount chargeCcyFormatAmount = customerCreditTransfer.getChargeCcyFormatAmount();
String ccy = chargeCcyFormatAmount.getCcy();
String amt = NumberUtil.formatAmt(chargeCcyFormatAmount.getAmt(), ccy);
if ("SHA".equals(value) || "BEN".equals(value)) {
tags.add(new Tag(name_F, ccy+amt));
} else if ("OUR".equals(value)) {
tags.add(new Tag(name_G, ccy+amt));
List<ChargeInfo> chargeInfos = customerCreditTransfer.getChargeInfoList();
if (chargeInfos.size() > 0) {
for (ChargeInfo chargeInfo : chargeInfos) {
CcyFormatAmount chargeCcyFormatAmount = chargeInfo.getAmt();
if (chargeCcyFormatAmount != null) {
String ccy = chargeCcyFormatAmount.getCcy();
String amt = NumberUtil.formatAmt(chargeCcyFormatAmount.getAmt(), ccy);
if ("SHA".equals(value) || "BEN".equals(value)) {
tags.add(new Tag(name_F, ccy+amt));
} else if ("OUR".equals(value)) {
tags.add(new Tag(name_G, ccy+amt));
}
}
}
}
}
......
......@@ -5,7 +5,9 @@ import com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtCreator;
import com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier;
import com.brilliance.swift.swiftdto2mt.SwiftDto2MtTagGenerate;
import com.brilliance.swift.swiftdto2mt.mt202.impl.*;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.VoFinancialInstitutionCreditTransfer;
import com.brilliance.swift.vo.common.TransactionReference;
import com.prowidesoftware.swift.model.SwiftBlock3;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.Tag;
......@@ -18,12 +20,16 @@ public class SwiftDto2Mt202Creator extends AbstractSwiftDto2MtCreator {
@Override
public void withBlock3() throws SwiftException {
super.withBlock3();
SwiftBlock3 block3 = context.get(SwiftMessage.class).getBlock3();
VoFinancialInstitutionCreditTransfer financialInstitutionCreditTransfer = (VoFinancialInstitutionCreditTransfer)context.get(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ, true);
if (financialInstitutionCreditTransfer != null
&& financialInstitutionCreditTransfer.getUnderCustomerCreditTransfer() != null) {
SwiftBlock3 block3 = context.get(SwiftMessage.class).getBlock3();
block3.getTags().add(new Tag("119", "COV"));
}
TransactionReference txnRef = financialInstitutionCreditTransfer.getTxnRef();
if (txnRef != null && StringUtil.isNotEmpty(txnRef.getUetr())) {
block3.getTags().add(new Tag("121", txnRef.getUetr()));
}
}
@Override
......
......@@ -20,8 +20,8 @@ public class Tag20Generate extends AbstractSwiftDto2MtTagGenerate {
VoFinancialInstitutionCreditTransfer financialInstitutionCreditTransfer = (VoFinancialInstitutionCreditTransfer)context.get(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ, true);
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
if (StringUtil.isNotEmpty(financialInstitutionCreditTransfer.getMessageId())) {
tags.add(new Tag(name, financialInstitutionCreditTransfer.getMessageId()));
if (StringUtil.isNotEmpty(financialInstitutionCreditTransfer.getSwiftHeader().getMessageId())) {
tags.add(new Tag(name, financialInstitutionCreditTransfer.getSwiftHeader().getMessageId()));
}
}
}
......@@ -5,6 +5,7 @@ import com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate;
import com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.VoFinancialInstitutionCreditTransfer;
import com.brilliance.swift.vo.common.TransactionReference;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.Tag;
......@@ -20,8 +21,9 @@ public class Tag21Generate extends AbstractSwiftDto2MtTagGenerate {
VoFinancialInstitutionCreditTransfer financialInstitutionCreditTransfer = (VoFinancialInstitutionCreditTransfer)context.get(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ, true);
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
if (StringUtil.isNotEmpty(financialInstitutionCreditTransfer.getEndToEndId())) {
tags.add(new Tag(name, financialInstitutionCreditTransfer.getEndToEndId()));
TransactionReference txnRef = financialInstitutionCreditTransfer.getTxnRef();
if (txnRef != null && StringUtil.isNotEmpty(txnRef.getEndToEndId())) {
tags.add(new Tag(name, txnRef.getEndToEndId()));
} else {
tags.add(new Tag(name, "NONREF"));
}
......
package com.brilliance.swift.swiftdto2mt.mt900910;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtCreator;
import com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier;
import com.brilliance.swift.swiftdto2mt.SwiftDto2MtTagGenerate;
import com.brilliance.swift.swiftdto2mt.mt900910.impl.*;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.BankToCustomerDebitCreditNotification;
import com.brilliance.swift.vo.common.TransactionReference;
import com.prowidesoftware.swift.model.SwiftBlock3;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.Tag;
import java.util.ArrayList;
import java.util.List;
......@@ -13,6 +19,18 @@ import static com.brilliance.swift.constants.Mx2MtConstants.MT_TYPE_900;
import static com.brilliance.swift.constants.Mx2MtConstants.MT_TYPE_910;
public class SwiftDto2Mt900910Creator extends AbstractSwiftDto2MtCreator {
@Override
public void withBlock3() throws SwiftException {
super.withBlock3();
SwiftBlock3 block3 = context.get(SwiftMessage.class).getBlock3();
BankToCustomerDebitCreditNotification bankToCustomerDebitCreditNotification = (BankToCustomerDebitCreditNotification)context.get(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ, true);
TransactionReference txnRef = bankToCustomerDebitCreditNotification.getTxnRef();
if (txnRef != null && StringUtil.isNotEmpty(txnRef.getUetr())) {
block3.getTags().add(new Tag("121", txnRef.getUetr()));
}
}
@Override
public List<SwiftDto2MtTagGenerate> getGenerateTagList() {
List<SwiftDto2MtTagGenerate> list = new ArrayList<>();
......
......@@ -21,8 +21,8 @@ public class Tag20Generate extends AbstractSwiftDto2MtTagGenerate {
BankToCustomerDebitCreditNotification bankToCustomerDebitCreditNotification = (BankToCustomerDebitCreditNotification)context.get(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ, true);
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
if (StringUtil.isNotEmpty(bankToCustomerDebitCreditNotification.getMessageId())) {
tags.add(new Tag(name, bankToCustomerDebitCreditNotification.getMessageId()));
if (StringUtil.isNotEmpty(bankToCustomerDebitCreditNotification.getSwiftHeader().getMessageId())) {
tags.add(new Tag(name, bankToCustomerDebitCreditNotification.getSwiftHeader().getMessageId()));
}
}catch (Exception e){
throw new SwiftException("ERROR", e.getMessage());
......
......@@ -5,6 +5,7 @@ import com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate;
import com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.BankToCustomerDebitCreditNotification;
import com.brilliance.swift.vo.common.TransactionReference;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.Tag;
......@@ -21,8 +22,9 @@ public class Tag21Generate extends AbstractSwiftDto2MtTagGenerate {
BankToCustomerDebitCreditNotification bankToCustomerDebitCreditNotification = (BankToCustomerDebitCreditNotification)context.get(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ, true);
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
if (StringUtil.isNotEmpty(bankToCustomerDebitCreditNotification.getEndToEndId())) {
tags.add(new Tag(name, bankToCustomerDebitCreditNotification.getEndToEndId()));
TransactionReference txnRef = bankToCustomerDebitCreditNotification.getTxnRef();
if (txnRef != null && StringUtil.isNotEmpty(txnRef.getEndToEndId())) {
tags.add(new Tag(name, txnRef.getEndToEndId()));
}
}catch (Exception e){
throw new SwiftException("ERROR", e.getMessage());
......
package com.brilliance.swift.swiftdto2mt.mt940950;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtCreator;
import com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier;
import com.brilliance.swift.swiftdto2mt.SwiftDto2MtTagGenerate;
......@@ -7,11 +8,27 @@ import com.brilliance.swift.swiftdto2mt.mt940950.impl.*;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.BankToCustomerStatement;
import com.brilliance.swift.vo.common.ReportEntry;
import com.brilliance.swift.vo.common.TransactionReference;
import com.prowidesoftware.swift.model.SwiftBlock3;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.Tag;
import java.util.ArrayList;
import java.util.List;
public class SwiftDto2Mt940950Creator extends AbstractSwiftDto2MtCreator {
@Override
public void withBlock3() throws SwiftException {
super.withBlock3();
SwiftBlock3 block3 = context.get(SwiftMessage.class).getBlock3();
BankToCustomerStatement bankToCustomerStatement = (BankToCustomerStatement)context.get(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ, true);
TransactionReference txnRef = bankToCustomerStatement.getTxnRef();
if (txnRef != null && StringUtil.isNotEmpty(txnRef.getUetr())) {
block3.getTags().add(new Tag("121", txnRef.getUetr()));
}
}
@Override
public List<SwiftDto2MtTagGenerate> getGenerateTagList() {
List<SwiftDto2MtTagGenerate> list = new ArrayList<>();
......
......@@ -4,7 +4,6 @@ import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate;
import com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.BankToCustomerDebitCreditNotification;
import com.brilliance.swift.vo.BankToCustomerStatement;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.Tag;
......@@ -22,8 +21,8 @@ public class Tag20Generate extends AbstractSwiftDto2MtTagGenerate {
BankToCustomerStatement bankToCustomerStatement = (BankToCustomerStatement)context.get(SwiftDto2MtContextIdentifier.SWIFT_DTO_OBJ, true);
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
if (StringUtil.isNotEmpty(bankToCustomerStatement.getMessageId())) {
tags.add(new Tag(name, bankToCustomerStatement.getMessageId()));
if (StringUtil.isNotEmpty(bankToCustomerStatement.getSwiftHeader().getMessageId())) {
tags.add(new Tag(name, bankToCustomerStatement.getSwiftHeader().getMessageId()));
}
}catch (Exception e){
throw new SwiftException("ERROR", e.getMessage());
......
......@@ -13,7 +13,7 @@ public class SwiftDto2MxCreatorManager {
SwiftDto2MxContext context = new SwiftDto2MxContext();
context.set(SwiftDto2MxContextIdentifier.SWIFT_DTO_OBJ, swiftDto);
context.set(SwiftDto2MxContextIdentifier.MX_OUTPUT_FILE_PATH, fileOutputPath);
AbstractSwiftDto2MxCreator creator = getCreator(swiftDto.getMessageType());
AbstractSwiftDto2MxCreator creator = getCreator(swiftDto.getSwiftHeader().getMessageType());
creator.setContext(context).create();
String xmlStr = (String)context.get(SwiftDto2MxContextIdentifier.MX_XML);
return xmlStr;
......
......@@ -6,6 +6,7 @@ import com.brilliance.swift.swiftdto2mx.SwiftDto2MxContextIdentifier;
import com.brilliance.swift.util.DateUtil;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.BankToCustomerStatement;
import com.brilliance.swift.vo.SwiftHeader;
import com.brilliance.swift.vo.common.*;
import com.prowidesoftware.swift.model.mx.BusinessAppHdrV02;
import com.prowidesoftware.swift.model.mx.MxCamt05300108;
......@@ -28,6 +29,7 @@ public class SwiftDto2MxCamt053001Creator extends AbstractSwiftDto2MxCreator {
if (bankToCustomerStatement == null) {
return;
}
SwiftHeader swiftHeader = bankToCustomerStatement.getSwiftHeader();
MxCamt05300108 mxCamt05300108 = new MxCamt05300108();
//set AppHdr
BusinessAppHdrV02 businessAppHdrV02 = new BusinessAppHdrV02();
......@@ -35,7 +37,7 @@ public class SwiftDto2MxCamt053001Creator extends AbstractSwiftDto2MxCreator {
Party44Choice fr = new Party44Choice();
BranchAndFinancialInstitutionIdentification6 fiId = new BranchAndFinancialInstitutionIdentification6();
FinancialInstitutionIdentification18 finInstnId = new FinancialInstitutionIdentification18();
finInstnId.setBICFI(bankToCustomerStatement.getSenderBic());
finInstnId.setBICFI(swiftHeader.getSenderBic());
fiId.setFinInstnId(finInstnId);
fr.setFIId(fiId);
businessAppHdrV02.setFr(fr);
......@@ -43,28 +45,29 @@ public class SwiftDto2MxCamt053001Creator extends AbstractSwiftDto2MxCreator {
Party44Choice to = new Party44Choice();
BranchAndFinancialInstitutionIdentification6 toFiId = new BranchAndFinancialInstitutionIdentification6();
FinancialInstitutionIdentification18 toFinInstnId = new FinancialInstitutionIdentification18();
toFinInstnId.setBICFI(bankToCustomerStatement.getReceiverBic());
toFinInstnId.setBICFI(swiftHeader.getReceiverBic());
toFiId.setFinInstnId(toFinInstnId);
to.setFIId(toFiId);
businessAppHdrV02.setTo(to);
//
XMLGregorianCalendar creDt = DateUtil.parseXMLGregorianCalendar(bankToCustomerStatement.getCreateDate());
XMLGregorianCalendar creDt = DateUtil.parseXMLGregorianCalendar(swiftHeader.getCreateDate());
businessAppHdrV02.setCreDt(creDt);
if (MessagePriority.NORM.equals(bankToCustomerStatement.getMessagePriority())) {
if (MessagePriority.NORM.equals(swiftHeader.getMessagePriority())) {
businessAppHdrV02.setPrty(Priority2Code.NORM.value());
} else if (MessagePriority.HIGH.equals(bankToCustomerStatement.getMessagePriority())) {
} else if (MessagePriority.HIGH.equals(swiftHeader.getMessagePriority())) {
businessAppHdrV02.setPrty(Priority2Code.HIGH.value());
}
businessAppHdrV02.setMsgDefIdr("camt.053.001.08");
businessAppHdrV02.setBizMsgIdr(bankToCustomerStatement.getMessageId());
businessAppHdrV02.setMsgDefIdr(swiftHeader.getMessageDefId());
businessAppHdrV02.setBizMsgIdr(swiftHeader.getMessageId());
businessAppHdrV02.setBizSvc(swiftHeader.getBusinessService());
mxCamt05300108.setAppHdr(businessAppHdrV02);
//grpHdr
BankToCustomerStatementV08 bkToCstmrStmt = new BankToCustomerStatementV08();
mxCamt05300108.setBkToCstmrStmt(bkToCstmrStmt);
GroupHeader81 grpHdr = new GroupHeader81();
grpHdr.setMsgId(bankToCustomerStatement.getMessageId());
grpHdr.setCreDtTm(DateUtil.parseXMLGregorianCalendar(bankToCustomerStatement.getCreateDate()));
grpHdr.setMsgId(swiftHeader.getMessageId());
grpHdr.setCreDtTm(DateUtil.parseXMLGregorianCalendar(swiftHeader.getCreateDate()));
bkToCstmrStmt.setGrpHdr(grpHdr);
//AccountStatement
AccountStatement9 stmt = new AccountStatement9();
......@@ -191,9 +194,12 @@ public class SwiftDto2MxCamt053001Creator extends AbstractSwiftDto2MxCreator {
EntryTransaction10 txDtls = new EntryTransaction10();
ntryDtls.addTxDtls(txDtls);
TransactionReferences6 refs = new TransactionReferences6();
refs.setUETR(bankToCustomerStatement.getUetr());
txDtls.setRefs(refs);
TransactionReference txnRef = bankToCustomerStatement.getTxnRef();
if (txnRef != null) {
refs.setUETR(txnRef.getUetr());
}
refs.setEndToEndId(reportEntry.getEndToEndId());
txDtls.setRefs(refs);
ntry.setAcctSvcrRef(reportEntry.getAcctSvcrRef());
txDtls.setAddtlTxInf(reportEntry.getAddtlTxInf());
ntry.setAddtlNtryInf(reportEntry.getAddtlNtryInf());
......
......@@ -6,18 +6,18 @@ import com.brilliance.swift.swiftdto2mx.SwiftDto2MxContextIdentifier;
import com.brilliance.swift.util.DateUtil;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.BankToCustomerDebitCreditNotification;
import com.brilliance.swift.vo.SwiftHeader;
import com.brilliance.swift.vo.common.CcyFormatAmount;
import com.brilliance.swift.vo.common.MessagePriority;
import com.brilliance.swift.vo.common.PartyDto;
import com.brilliance.swift.vo.common.TransactionReference;
import com.prowidesoftware.swift.model.mx.BusinessAppHdrV02;
import com.prowidesoftware.swift.model.mx.MxCamt05400102;
import com.prowidesoftware.swift.model.mx.MxCamt05400108;
import com.prowidesoftware.swift.model.mx.dic.*;
import javax.xml.datatype.XMLGregorianCalendar;
import java.io.File;
import java.util.Date;
import java.util.List;
/**
* @author zh
......@@ -31,6 +31,7 @@ public class SwiftDto2MxCamt054001Creator extends AbstractSwiftDto2MxCreator {
if (bankToCustomerDebitCreditNotification == null) {
return;
}
SwiftHeader swiftHeader = bankToCustomerDebitCreditNotification.getSwiftHeader();
MxCamt05400108 mxCamt05400108 = new MxCamt05400108();
//set AppHdr
BusinessAppHdrV02 businessAppHdrV02 = new BusinessAppHdrV02();
......@@ -38,7 +39,7 @@ public class SwiftDto2MxCamt054001Creator extends AbstractSwiftDto2MxCreator {
Party44Choice fr = new Party44Choice();
BranchAndFinancialInstitutionIdentification6 fiId = new BranchAndFinancialInstitutionIdentification6();
FinancialInstitutionIdentification18 finInstnId = new FinancialInstitutionIdentification18();
finInstnId.setBICFI(bankToCustomerDebitCreditNotification.getSenderBic());
finInstnId.setBICFI(swiftHeader.getSenderBic());
fiId.setFinInstnId(finInstnId);
fr.setFIId(fiId);
businessAppHdrV02.setFr(fr);
......@@ -46,34 +47,36 @@ public class SwiftDto2MxCamt054001Creator extends AbstractSwiftDto2MxCreator {
Party44Choice to = new Party44Choice();
BranchAndFinancialInstitutionIdentification6 toFiId = new BranchAndFinancialInstitutionIdentification6();
FinancialInstitutionIdentification18 toFinInstnId = new FinancialInstitutionIdentification18();
toFinInstnId.setBICFI(bankToCustomerDebitCreditNotification.getReceiverBic());
toFinInstnId.setBICFI(swiftHeader.getReceiverBic());
toFiId.setFinInstnId(toFinInstnId);
to.setFIId(toFiId);
businessAppHdrV02.setTo(to);
//
XMLGregorianCalendar creDt = DateUtil.parseXMLGregorianCalendar(bankToCustomerDebitCreditNotification.getCreateDate());
XMLGregorianCalendar creDt = DateUtil.parseXMLGregorianCalendar(swiftHeader.getCreateDate());
businessAppHdrV02.setCreDt(creDt);
if (MessagePriority.NORM.equals(bankToCustomerDebitCreditNotification.getMessagePriority())) {
if (MessagePriority.NORM.equals(swiftHeader.getMessagePriority())) {
businessAppHdrV02.setPrty(Priority2Code.NORM.value());
} else if (MessagePriority.HIGH.equals(bankToCustomerDebitCreditNotification.getMessagePriority())) {
} else if (MessagePriority.HIGH.equals(swiftHeader.getMessagePriority())) {
businessAppHdrV02.setPrty(Priority2Code.HIGH.value());
}
businessAppHdrV02.setMsgDefIdr("camt.054.001.08");
businessAppHdrV02.setBizMsgIdr(bankToCustomerDebitCreditNotification.getMessageId());
businessAppHdrV02.setMsgDefIdr(swiftHeader.getMessageDefId());
businessAppHdrV02.setBizMsgIdr(swiftHeader.getMessageId());
businessAppHdrV02.setBizSvc(swiftHeader.getBusinessService());
mxCamt05400108.setAppHdr(businessAppHdrV02);
//grpHdr
BankToCustomerDebitCreditNotificationV08 bkToCstmrDbtCdtNtfctn = new BankToCustomerDebitCreditNotificationV08();
mxCamt05400108.setBkToCstmrDbtCdtNtfctn(bkToCstmrDbtCdtNtfctn);
GroupHeader81 grpHdr = new GroupHeader81();
grpHdr.setMsgId(bankToCustomerDebitCreditNotification.getMessageId());
grpHdr.setCreDtTm(DateUtil.parseXMLGregorianCalendar(bankToCustomerDebitCreditNotification.getCreateDate()));
grpHdr.setMsgId(swiftHeader.getMessageId());
grpHdr.setCreDtTm(DateUtil.parseXMLGregorianCalendar(swiftHeader.getCreateDate()));
grpHdr.setAddtlInf("");
bkToCstmrDbtCdtNtfctn.setGrpHdr(grpHdr);
//ntfcn
AccountNotification17 ntfctn = new AccountNotification17();
bkToCstmrDbtCdtNtfctn.addNtfctn(ntfctn);
String endToEndId = bankToCustomerDebitCreditNotification.getEndToEndId();//21
TransactionReference txnRef = bankToCustomerDebitCreditNotification.getTxnRef();
String endToEndId = txnRef.getEndToEndId();//21
String account = bankToCustomerDebitCreditNotification.getAccount().getAccount();//25
String ibanAcct = bankToCustomerDebitCreditNotification.getAccount().getIbanAcct();//25
Date valueDate = bankToCustomerDebitCreditNotification.getValueDate();//25a
......@@ -101,7 +104,7 @@ public class SwiftDto2MxCamt054001Creator extends AbstractSwiftDto2MxCreator {
rltdPties.setDbtr(dbtr);
TransactionReferences6 refs =new TransactionReferences6();
refs.setEndToEndId(endToEndId);
refs.setUETR(bankToCustomerDebitCreditNotification.getUetr());
refs.setUETR(txnRef.getUetr());
txDtls.setRefs(refs);
//IBAN Othr/Id
if(account!=null||ibanAcct!=null){
......
......@@ -5,6 +5,7 @@ import com.brilliance.swift.swiftdto2mx.AbstractSwiftDto2MxCreator;
import com.brilliance.swift.swiftdto2mx.SwiftDto2MxContextIdentifier;
import com.brilliance.swift.util.DateUtil;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftHeader;
import com.brilliance.swift.vo.VoCustomerCreditTransfer;
import com.brilliance.swift.vo.common.*;
import com.brilliance.swift.vo.common.PurposeChoice;
......@@ -38,11 +39,12 @@ public class SwiftDto2MxPacs008001Creator extends AbstractSwiftDto2MxCreator {
PartyDto cdtrAgtParty = customerCreditTransfer.getCreditAgtParty();//57
PartyDto cdtrParty = customerCreditTransfer.getCreditParty();//59
//set AppHdr
SwiftHeader swiftHeader = customerCreditTransfer.getSwiftHeader();
BusinessAppHdrV02 businessAppHdrV02 = new BusinessAppHdrV02();
Party44Choice fr = new Party44Choice();
BranchAndFinancialInstitutionIdentification6 frFiId = new BranchAndFinancialInstitutionIdentification6();
FinancialInstitutionIdentification18 frFinInstnId = new FinancialInstitutionIdentification18();
frFinInstnId.setBICFI(customerCreditTransfer.getSenderBic());
frFinInstnId.setBICFI(swiftHeader.getSenderBic());
frFiId.setFinInstnId(frFinInstnId);
fr.setFIId(frFiId);
businessAppHdrV02.setFr(fr);
......@@ -50,28 +52,29 @@ public class SwiftDto2MxPacs008001Creator extends AbstractSwiftDto2MxCreator {
Party44Choice to = new Party44Choice();
BranchAndFinancialInstitutionIdentification6 toFiId = new BranchAndFinancialInstitutionIdentification6();
FinancialInstitutionIdentification18 toFinInstnId = new FinancialInstitutionIdentification18();
toFinInstnId.setBICFI(customerCreditTransfer.getSenderBic());
toFinInstnId.setBICFI(swiftHeader.getSenderBic());
toFiId.setFinInstnId(toFinInstnId);
to.setFIId(toFiId);
businessAppHdrV02.setTo(to);
XMLGregorianCalendar creDt = DateUtil.parseXMLGregorianCalendar(customerCreditTransfer.getCreateDate());
XMLGregorianCalendar creDt = DateUtil.parseXMLGregorianCalendar(swiftHeader.getCreateDate());
businessAppHdrV02.setCreDt(creDt);
if (MessagePriority.NORM.equals(customerCreditTransfer.getMessagePriority())) {
if (MessagePriority.NORM.equals(swiftHeader.getMessagePriority())) {
businessAppHdrV02.setPrty(Priority2Code.NORM.value());
} else if (MessagePriority.HIGH.equals(customerCreditTransfer.getMessagePriority())) {
} else if (MessagePriority.HIGH.equals(swiftHeader.getMessagePriority())) {
businessAppHdrV02.setPrty(Priority2Code.HIGH.value());
}
businessAppHdrV02.setMsgDefIdr("pacs.008.001.09");
businessAppHdrV02.setBizMsgIdr(customerCreditTransfer.getMessageId());
businessAppHdrV02.setMsgDefIdr(swiftHeader.getMessageDefId());
businessAppHdrV02.setBizMsgIdr(swiftHeader.getMessageId());
businessAppHdrV02.setBizSvc(swiftHeader.getBusinessService());
mxPacs00800109.setAppHdr(businessAppHdrV02);
FIToFICustomerCreditTransferV09 fiToFICstmrCdtTrf = new FIToFICustomerCreditTransferV09();
mxPacs00800109.setFIToFICstmrCdtTrf(fiToFICstmrCdtTrf);
//set GroupHeader
GroupHeader93 grpHdr = new GroupHeader93();
grpHdr.setMsgId(customerCreditTransfer.getMessageId());
grpHdr.setCreDtTm(DateUtil.parseXMLGregorianCalendar(customerCreditTransfer.getCreateDate()));
grpHdr.setMsgId(swiftHeader.getMessageId());
grpHdr.setCreDtTm(DateUtil.parseXMLGregorianCalendar(swiftHeader.getCreateDate()));
grpHdr.setNbOfTxs("1");
SettlementInstruction7 sttlmInf = new SettlementInstruction7();
sttlmInf.setSttlmMtd(SettlementMethod1Code.INDA);
......@@ -99,10 +102,11 @@ public class SwiftDto2MxPacs008001Creator extends AbstractSwiftDto2MxCreator {
CreditTransferTransaction43 cdtTrfTxInf = new CreditTransferTransaction43();
fiToFICstmrCdtTrf.addCdtTrfTxInf(cdtTrfTxInf);
//PmtId
TransactionReference txnRef = customerCreditTransfer.getTxnRef();
PaymentIdentification13 pmtId = new PaymentIdentification13();
pmtId.setInstrId(customerCreditTransfer.getMessageId());
pmtId.setInstrId(txnRef.getInstructionId());
pmtId.setEndToEndId("NOTPROVIDED");
pmtId.setUETR(customerCreditTransfer.getUetr());
pmtId.setUETR(txnRef.getUetr());
cdtTrfTxInf.setPmtId(pmtId);
//SttlmTmIndctn SttlmTmReq
......@@ -241,22 +245,19 @@ public class SwiftDto2MxPacs008001Creator extends AbstractSwiftDto2MxCreator {
ChargeForEnum chargeForEnum = customerCreditTransfer.getChargeFor();
if (chargeForEnum != null) {
cdtTrfTxInf.setChrgBr(ChargeBearerType1Code.fromValue(chargeForEnum.value()));
CcyFormatAmount cfa = customerCreditTransfer.getChargeCcyFormatAmount();
if (cfa != null) {
}
List<ChargeInfo> chargeInfos = customerCreditTransfer.getChargeInfoList();
if (chargeInfos.size() > 0) {
for (ChargeInfo chargeInfo : chargeInfos) {
Charges7 chrgsInf = new Charges7();
CcyFormatAmount ccyFormatAmount = chargeInfo.getAmt();
if (ccyFormatAmount != null) {
ActiveOrHistoricCurrencyAndAmount amt = new ActiveOrHistoricCurrencyAndAmount();
amt.setCcy(cfa.getCcy());
amt.setValue(cfa.getAmt());
chrgsInf.setAmt(amt);
if (ChargeBearerType1Code.CRED.equals(cdtTrfTxInf.getChrgBr()) || ChargeBearerType1Code.SHAR.equals(cdtTrfTxInf.getChrgBr())) {
if (instructingReimbursementParty != null) {
chrgsInf.setAgt(partyDtoConvertAgt(instructingReimbursementParty));
}
} else if (ChargeBearerType1Code.DEBT.equals(cdtTrfTxInf.getChrgBr())) {
if (instructedReimbursementParty != null) {
chrgsInf.setAgt(partyDtoConvertAgt(instructedReimbursementParty));
}
amt.setCcy(ccyFormatAmount.getCcy());
amt.setValue(ccyFormatAmount.getAmt());
chrgsInf.setAmt(amt);
}
chrgsInf.setAgt(partyDtoConvertAgt(chargeInfo.getPartyDto()));
cdtTrfTxInf.addChrgsInf(chrgsInf);
}
}
......
......@@ -5,6 +5,7 @@ import com.brilliance.swift.swiftdto2mx.AbstractSwiftDto2MxCreator;
import com.brilliance.swift.swiftdto2mx.SwiftDto2MxContextIdentifier;
import com.brilliance.swift.util.DateUtil;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.SwiftHeader;
import com.brilliance.swift.vo.VoCustomerCreditTransfer;
import com.brilliance.swift.vo.VoFinancialInstitutionCreditTransfer;
import com.brilliance.swift.vo.common.*;
......@@ -34,11 +35,12 @@ public class SwiftDto2MxPacs009001Creator extends AbstractSwiftDto2MxCreator {
PartyDto cdtrAgtParty = financialInstitutionCreditTransfer.getCreditAgtParty();//57
PartyDto cdtrParty = financialInstitutionCreditTransfer.getCreditParty();//58
//set AppHdr
SwiftHeader swiftHeader = financialInstitutionCreditTransfer.getSwiftHeader();
BusinessAppHdrV02 businessAppHdrV02 = new BusinessAppHdrV02();
Party44Choice fr = new Party44Choice();
BranchAndFinancialInstitutionIdentification6 frFiId = new BranchAndFinancialInstitutionIdentification6();
FinancialInstitutionIdentification18 frFinInstnId = new FinancialInstitutionIdentification18();
frFinInstnId.setBICFI(financialInstitutionCreditTransfer.getSenderBic());
frFinInstnId.setBICFI(swiftHeader.getSenderBic());
frFiId.setFinInstnId(frFinInstnId);
fr.setFIId(frFiId);
businessAppHdrV02.setFr(fr);
......@@ -46,28 +48,29 @@ public class SwiftDto2MxPacs009001Creator extends AbstractSwiftDto2MxCreator {
Party44Choice to = new Party44Choice();
BranchAndFinancialInstitutionIdentification6 toFiId = new BranchAndFinancialInstitutionIdentification6();
FinancialInstitutionIdentification18 toFinInstnId = new FinancialInstitutionIdentification18();
toFinInstnId.setBICFI(financialInstitutionCreditTransfer.getSenderBic());
toFinInstnId.setBICFI(swiftHeader.getSenderBic());
toFiId.setFinInstnId(toFinInstnId);
to.setFIId(toFiId);
businessAppHdrV02.setTo(to);
XMLGregorianCalendar creDt = DateUtil.parseXMLGregorianCalendar(financialInstitutionCreditTransfer.getCreateDate());
XMLGregorianCalendar creDt = DateUtil.parseXMLGregorianCalendar(swiftHeader.getCreateDate());
businessAppHdrV02.setCreDt(creDt);
if (MessagePriority.NORM.equals(financialInstitutionCreditTransfer.getMessagePriority())) {
if (MessagePriority.NORM.equals(swiftHeader.getMessagePriority())) {
businessAppHdrV02.setPrty(Priority2Code.NORM.value());
} else if (MessagePriority.HIGH.equals(financialInstitutionCreditTransfer.getMessagePriority())) {
} else if (MessagePriority.HIGH.equals(swiftHeader.getMessagePriority())) {
businessAppHdrV02.setPrty(Priority2Code.HIGH.value());
}
businessAppHdrV02.setMsgDefIdr("pacs.009.001.09");
businessAppHdrV02.setBizMsgIdr(financialInstitutionCreditTransfer.getMessageId());
businessAppHdrV02.setMsgDefIdr(swiftHeader.getMessageDefId());
businessAppHdrV02.setBizMsgIdr(swiftHeader.getMessageId());
businessAppHdrV02.setBizSvc(swiftHeader.getBusinessService());
mxPacs00900109.setAppHdr(businessAppHdrV02);
FinancialInstitutionCreditTransferV09 fiCdtTrf = new FinancialInstitutionCreditTransferV09();
mxPacs00900109.setFICdtTrf(fiCdtTrf);
//set GroupHeader
GroupHeader93 grpHdr = new GroupHeader93();
grpHdr.setMsgId(financialInstitutionCreditTransfer.getMessageId());
grpHdr.setCreDtTm(DateUtil.parseXMLGregorianCalendar(financialInstitutionCreditTransfer.getCreateDate()));
grpHdr.setMsgId(swiftHeader.getMessageId());
grpHdr.setCreDtTm(DateUtil.parseXMLGregorianCalendar(swiftHeader.getCreateDate()));
grpHdr.setNbOfTxs("1");
SettlementInstruction7 sttlmInf = new SettlementInstruction7();
sttlmInf.setSttlmMtd(SettlementMethod1Code.INDA);
......@@ -89,10 +92,11 @@ public class SwiftDto2MxPacs009001Creator extends AbstractSwiftDto2MxCreator {
CreditTransferTransaction44 cdtTrfTxInf = new CreditTransferTransaction44();
fiCdtTrf.addCdtTrfTxInf(cdtTrfTxInf);
//PmtId
TransactionReference txnRef = financialInstitutionCreditTransfer.getTxnRef();
PaymentIdentification13 pmtId = new PaymentIdentification13();
pmtId.setInstrId(financialInstitutionCreditTransfer.getMessageId());
pmtId.setEndToEndId(financialInstitutionCreditTransfer.getEndToEndId());
pmtId.setUETR(financialInstitutionCreditTransfer.getUetr());
pmtId.setInstrId(txnRef.getInstructionId());
pmtId.setEndToEndId(txnRef.getEndToEndId());
pmtId.setUETR(txnRef.getUetr());
cdtTrfTxInf.setPmtId(pmtId);
//SttlmTmIndctn SttlmTmReq
SettlementDateTimeIndication1 sttlmTmIndctn = null;
......
......@@ -185,20 +185,20 @@ public class XmlUtil {
}
public static void main(String[] args) throws IOException, DocumentException {
// File file = new File(System.getProperty("user.dir") + "\\src\\main\\resources\\swiftXml\\MxPacs00900102.xml");
// File file = new File(System.getProperty("user.dir") + "\\src\\main\\resources\\swiftXml\\MxPacs00900109.xml");
/* File file = new File("d:/test/test.xml");
String xmlStr = FileUtils.readFileToString(file);
Document document = DocumentHelper.parseText(xmlStr);
String value = getXmlNodeValue(document, "Document.BkToCstmrStmt.GrpHdr.MsgId");
System.out.println(value);*/
/*File file = new File(System.getProperty("user.dir") + "\\src\\main\\resources\\swiftXml\\MxPacs00800102.xml");
/*File file = new File(System.getProperty("user.dir") + "\\src\\main\\resources\\swiftXml\\MxPacs00800109.xml");
String xmlStr = FileUtils.readFileToString(file);
Document document = DocumentHelper.parseText(xmlStr);
String value = getXmlNodeValue(document, "Document.FIToFICstmrCdtTrf.CdtTrfTxInf.SttlmTmIndctn.DbtDtTm");
System.out.println(value);*/
File file = new File(System.getProperty("user.dir") + "\\src\\main\\resources\\swiftXml\\MxPacs00900102.xml");
File file = new File(System.getProperty("user.dir") + "\\src\\main\\resources\\swiftXml\\MxPacs00900109.xml");
String xmlStr = FileUtils.readFileToString(file);
Document document = DocumentHelper.parseText(xmlStr);
Map<String, String> maps = getParentElementMaps(document);
......
......@@ -3,6 +3,7 @@ package com.brilliance.swift.vo;
import com.brilliance.swift.vo.common.CcyFormatAmount;
import com.brilliance.swift.vo.common.PartyAccount;
import com.brilliance.swift.vo.common.PartyDto;
import com.brilliance.swift.vo.common.TransactionReference;
import java.util.Date;
......@@ -17,7 +18,7 @@ public class BankToCustomerDebitCreditNotification extends SwiftDto{
*/
protected String cdtDbtCode;
protected String endToEndId;
protected TransactionReference txnRef;
protected PartyAccount account;
......@@ -41,12 +42,12 @@ public class BankToCustomerDebitCreditNotification extends SwiftDto{
this.cdtDbtCode = cdtDbtCode;
}
public String getEndToEndId() {
return endToEndId;
public TransactionReference getTxnRef() {
return txnRef;
}
public void setEndToEndId(String endToEndId) {
this.endToEndId = endToEndId;
public void setTxnRef(TransactionReference txnRef) {
this.txnRef = txnRef;
}
public PartyAccount getAccount() {
......
......@@ -11,7 +11,7 @@ import java.util.List;
*/
public class BankToCustomerStatement extends SwiftDto{
protected String endToEndId;
protected TransactionReference txnRef;
protected PartyAccount account;
......@@ -55,12 +55,12 @@ public class BankToCustomerStatement extends SwiftDto{
return this;
}
public String getEndToEndId() {
return endToEndId;
public TransactionReference getTxnRef() {
return txnRef;
}
public void setEndToEndId(String endToEndId) {
this.endToEndId = endToEndId;
public void setTxnRef(TransactionReference txnRef) {
this.txnRef = txnRef;
}
public PartyAccount getAccount() {
......
package com.brilliance.swift.vo;
import com.brilliance.swift.vo.common.MessagePriority;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.apache.commons.lang3.Validate;
......@@ -11,84 +10,15 @@ import java.util.Date;
public class SwiftDto implements Serializable {
private static final long serialVersionUID = 2296248553989810638L;
protected String messageType;
protected String version;
protected SwiftHeader swiftHeader;
protected String senderBic;
protected String receiverBic;
protected Date createDate;
protected MessagePriority messagePriority;
protected String messageId;
protected String uetr;
public String getMessageType() {
return messageType;
}
public void setMessageType(String messageType) {
this.messageType = messageType;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getSenderBic() {
return senderBic;
}
public void setSenderBic(String senderBic) {
this.senderBic = senderBic;
}
public String getReceiverBic() {
return receiverBic;
}
public void setReceiverBic(String receiverBic) {
this.receiverBic = receiverBic;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public MessagePriority getMessagePriority() {
return messagePriority;
}
public void setMessagePriority(MessagePriority messagePriority) {
this.messagePriority = messagePriority;
}
public String getMessageId() {
return messageId;
}
public void setMessageId(String messageId) {
this.messageId = messageId;
}
public String getUetr() {
return uetr;
public SwiftHeader getSwiftHeader() {
return swiftHeader;
}
public void setUetr(String uetr) {
this.uetr = uetr;
public void setSwiftHeader(SwiftHeader swiftHeader) {
this.swiftHeader = swiftHeader;
}
public String toJson() {
......
......@@ -11,7 +11,8 @@ public class SwiftDtoAdapter implements JsonSerializer<SwiftDto>, JsonDeserializ
@Override
public SwiftDto deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
JsonObject jsonObject = json.getAsJsonObject();
JsonPrimitive prim = (JsonPrimitive) jsonObject.get(MESSAGETYPE);
JsonObject jsonObject1 = jsonObject.getAsJsonObject("swiftHeader");
JsonPrimitive prim = (JsonPrimitive) jsonObject1.get(MESSAGETYPE);
if (prim == null) {
throw new JsonParseException("Missing " + MESSAGETYPE + " in JSON structure");
}
......
package com.brilliance.swift.vo;
import com.brilliance.swift.vo.common.MessagePriority;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SwiftHeader {
private String senderBic;
private String receiverBic;
private String messageId;
private String messageDefId;
private String messageType;
private String version;
private String businessService;
private Date createDate;
private MessagePriority messagePriority;
private List<SwiftHeader> relatedSwiftHeaders;
public String getSenderBic() {
return senderBic;
}
public void setSenderBic(String senderBic) {
this.senderBic = senderBic;
}
public String getReceiverBic() {
return receiverBic;
}
public void setReceiverBic(String receiverBic) {
this.receiverBic = receiverBic;
}
public String getMessageId() {
return messageId;
}
public void setMessageId(String messageId) {
this.messageId = messageId;
}
public String getMessageDefId() {
return messageDefId;
}
public void setMessageDefId(String messageDefId) {
this.messageDefId = messageDefId;
}
public String getMessageType() {
/*if (messageDefId != null) {
if (messageDefId.split("\\.").length == 4) {
messageType = messageDefId.substring(0, messageDefId.lastIndexOf("."));
}
}*/
return messageType;
}
public void setMessageType(String messageType) {
this.messageType = messageType;
}
public String getVersion() {
/*if (messageDefId != null) {
if (messageDefId.split("\\.").length == 4) {
version = messageDefId.substring(messageDefId.lastIndexOf(".")+1);
}
}*/
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getBusinessService() {
return businessService;
}
public void setBusinessService(String businessService) {
this.businessService = businessService;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public MessagePriority getMessagePriority() {
return messagePriority;
}
public void setMessagePriority(MessagePriority messagePriority) {
this.messagePriority = messagePriority;
}
public List<SwiftHeader> getRelatedSwiftHeaderList() {
if (relatedSwiftHeaders == null) {
relatedSwiftHeaders = new ArrayList<>();
}
return this.relatedSwiftHeaders;
}
public void addRelatedSwiftHeader(SwiftHeader swiftHeader) {
getRelatedSwiftHeaderList().add(swiftHeader);
}
}
......@@ -12,6 +12,8 @@ import java.util.List;
*/
public class VoCustomerCreditTransfer extends SwiftDto {
protected TransactionReference txnRef;
protected Date debitDate;
protected Date creditDate;
......@@ -54,7 +56,7 @@ public class VoCustomerCreditTransfer extends SwiftDto {
protected ChargeForEnum chargeFor;
protected CcyFormatAmount chargeCcyFormatAmount;
protected List<ChargeInfo> chargeInfos;
protected PartyDto preInstgAgtParty;
......@@ -136,14 +138,6 @@ public class VoCustomerCreditTransfer extends SwiftDto {
this.chargeFor = chargeFor;
}
public CcyFormatAmount getChargeCcyFormatAmount() {
return chargeCcyFormatAmount;
}
public void setChargeCcyFormatAmount(CcyFormatAmount chargeCcyFormatAmount) {
this.chargeCcyFormatAmount = chargeCcyFormatAmount;
}
public List<String> getRegulatoryReportingList() {
if (regulatoryReportings == null) {
regulatoryReportings = new ArrayList<>();
......@@ -156,6 +150,18 @@ public class VoCustomerCreditTransfer extends SwiftDto {
return this;
}
public List<ChargeInfo> getChargeInfoList() {
if (chargeInfos == null) {
chargeInfos = new ArrayList<>();
}
return this.chargeInfos;
}
public VoCustomerCreditTransfer addChargeInfo(ChargeInfo chargeInfo) {
getChargeInfoList().add(chargeInfo);
return this;
}
public PartyDto getDebitParty() {
return debitParty;
}
......@@ -275,4 +281,12 @@ public class VoCustomerCreditTransfer extends SwiftDto {
public void setInstForNxtAgt(InstructionForNextAgent instForNxtAgt) {
this.instForNxtAgt = instForNxtAgt;
}
public TransactionReference getTxnRef() {
return txnRef;
}
public void setTxnRef(TransactionReference txnRef) {
this.txnRef = txnRef;
}
}
......@@ -9,7 +9,7 @@ import java.util.Date;
*/
public class VoFinancialInstitutionCreditTransfer extends SwiftDto{
protected String endToEndId;
protected TransactionReference txnRef;
protected Date debitDate;
......@@ -46,14 +46,6 @@ public class VoFinancialInstitutionCreditTransfer extends SwiftDto{
*/
protected VoCustomerCreditTransfer underCustomerCreditTransfer;
public String getEndToEndId() {
return endToEndId;
}
public void setEndToEndId(String endToEndId) {
this.endToEndId = endToEndId;
}
public Date getDebitDate() {
return debitDate;
}
......@@ -174,6 +166,14 @@ public class VoFinancialInstitutionCreditTransfer extends SwiftDto{
this.instForNxtAgt = instForNxtAgt;
}
public TransactionReference getTxnRef() {
return txnRef;
}
public void setTxnRef(TransactionReference txnRef) {
this.txnRef = txnRef;
}
public VoCustomerCreditTransfer getUnderCustomerCreditTransfer() {
return underCustomerCreditTransfer;
}
......
package com.brilliance.swift.vo.common;
public class ChargeInfo {
private CcyFormatAmount amt;
private PartyDto partyDto;
public CcyFormatAmount getAmt() {
return amt;
}
public void setAmt(CcyFormatAmount amt) {
this.amt = amt;
}
public PartyDto getPartyDto() {
return partyDto;
}
public void setPartyDto(PartyDto partyDto) {
this.partyDto = partyDto;
}
}
package com.brilliance.swift.vo.common;
public class TransactionReference {
private String instructionId;
private String endToEndId;
private String uetr;
public String getInstructionId() {
return instructionId;
}
public void setInstructionId(String instructionId) {
this.instructionId = instructionId;
}
public String getEndToEndId() {
return endToEndId;
}
public void setEndToEndId(String endToEndId) {
this.endToEndId = endToEndId;
}
public String getUetr() {
return uetr;
}
public void setUetr(String uetr) {
this.uetr = uetr;
}
}
{
"txnRef": {
"endToEndId": "S100000189-735",
"uetr": "8a562c67-ca16-48ba-b074-65581be6f001"
},
"account": {
"account": "15612345678012345"
"account": "S15612345678012345"
},
"pgNb": "178",
"elctrncSeqNb": "200",
......@@ -17,37 +21,24 @@
{
"valueDate": "2022-03-30 00:00:00,000",
"bookDate": "2022-03-30 00:00:00,000",
"cdtDbtCode": "CRDT",
"cdtDbtCode": "DBIT",
"amt": {
"ccy": "USD",
"amt": 393.17
},
"bankTransactionCodeStructure": {
"domianCode": "PMNT",
"familyCode": "ICHQ",
"subFamilyCode": "CCHQ"
},
"endToEndId": "S100000189-735",
"acctSvcrRef": "1309170100000390154395",
"addtlTxInf": "PLACI LOVECNAMENSKIH WUHAN",
"addtlNtryInf": "CHINESE BEIJINGCHINESE SHANGHAICHINESE WUHANCHINESE GUANGZHOUCHINESE HANGZHOUCHINESE SHENZHEN"
"addtlNtryInf": "CHINESE BEIJING"
},
{
"valueDate": "2022-03-30 00:00:00,000",
"bookDate": "2022-03-30 00:00:00,000",
"cdtDbtCode": "DBIT",
"reversalIndicator": true,
"amt": {
"ccy": "USD",
"amt": 445
},
"bankTransactionCodeStructure": {
"domianCode": "PMNT",
"familyCode": "ICHQ",
"subFamilyCode": "CCHQ"
},
"endToEndId": "S100000189-735",
"acctSvcrRef": "1309170100000390154395",
"addtlTxInf": "PLACI LOVECNAMENSKIH STORITEV"
}
],
......@@ -81,11 +72,14 @@
}
],
"additionalStatementInformation": "HELLO WORLD",
"messageType": "camt.053.001",
"senderBic": "SHWHQWER123",
"receiverBic": "BJWHS12X",
"createDate": "2022-05-07 10:54:53,581",
"messagePriority": "NORM",
"messageId": "00010013800002001234",
"uetr": "8a562c67-ca16-48ba-b074-65581be6f001"
"swiftHeader": {
"senderBic": "SHWHQWER123",
"receiverBic": "BJWHS12X",
"messageId": "00010013800002001234",
"messageDefId": "camt.053.001.08",
"messageType": "camt.053.001",
"version": "08",
"createDate": "2022-04-28 10:23:46,048",
"messagePriority": "NORM"
}
}
\ No newline at end of file
{
"txnRef": {
"endToEndId": "S100000189-735",
"uetr": "8a562c67-ca16-48ba-b074-65581be6f001"
},
"account": {
"account": "15612345678012345"
"account": "S15612345678012345"
},
"pgNb": "178",
"elctrncSeqNb": "200",
......@@ -22,13 +26,7 @@
"ccy": "USD",
"amt": 393.17
},
"bankTransactionCodeStructure": {
"domianCode": "PMNT",
"familyCode": "ICHQ",
"subFamilyCode": "CCHQ"
},
"endToEndId": "S100000189-735",
"acctSvcrRef": "1309170100000390154395",
"addtlTxInf": "PLACI LOVECNAMENSKIH WUHAN"
},
{
......@@ -39,31 +37,18 @@
"ccy": "USD",
"amt": 445
},
"bankTransactionCodeStructure": {
"domianCode": "PMNT",
"familyCode": "ICHQ",
"subFamilyCode": "CCHQ"
},
"endToEndId": "S100000189-735",
"acctSvcrRef": "1309170100000390154395",
"addtlTxInf": "PLACI LOVECNAMENSKIH STORITEV"
}
],
"closingBalance": {
"code": "ITBD",
"cdtDbtCode": "DBIT",
"date": "2022-03-30 00:00:00,000",
"amt": {
"ccy": "USD",
"amt": 123456.29
}
},
"messageType": "camt.053.001",
"version": "08",
"senderBic": "SHWHQWER123",
"receiverBic": "BJWHS12X",
"createDate": "2022-05-07 11:39:42,601",
"messagePriority": "NORM",
"messageId": "00010013800002001234",
"uetr": "8a562c67-ca16-48ba-b074-65581be6f001"
"swiftHeader": {
"senderBic": "SHWHQWER123",
"receiverBic": "BJWHS12X",
"messageId": "00010013800002001234",
"messageDefId": "camt.053.001.08",
"messageType": "camt.053.001",
"version": "08",
"createDate": "2022-04-28 10:24:00,960",
"messagePriority": "NORM"
}
}
\ No newline at end of file
{
"debitDate": "2022-04-26 22:24:00,000",
"creditDate": "2022-04-27 00:30:00,000",
"clsDate": "2022-04-26 23:21:00,000",
"bussinessCode": "SDVA",
"instructionCodes": [
"SDVA",
"BNKK",
"GHJK/789556"
],
"txnTypeCode": "GCY",
"txnRef": {
"instructionId": "GTBEXO12345",
"endToEndId": "GTBEXO12345",
"uetr": "8a562c67-ca16-48ba-b074-65581be6f001"
},
"debitDate": "2022-03-13 21:24:42,112",
"creditDate": "2022-03-13 23:30:42,112",
"clsDate": "2022-03-13 22:21:42,112",
"serviceLevel": {
"code": "SDVA",
"proprietary": "1231234165"
},
"categoryPurpose": {
"code": "CASH"
},
"purposeChoice": {
"proprietary": "GCY"
},
"settledDate": "2022-03-13 00:00:00,000",
"settledCcyFormatAmount": {
"ccy": "USD",
"amt": 23453.13
"amt": 23453.127
},
"InstructedCcyFormatAmount": {
"ccy": "EUR",
"amt": 1345.12
},
"exchangeRate": 17.4357135422,
"settleAccount": {
"account": "00010013800002001234"
},
"debitParty": {
"partyBic": "GCYXXXXXX12",
"partyName": "JOE PurpDOE",
"addressList": [
"310 Field Road, NY",
"XXXX",
"PSBC",
"BJSH"
],
"partyAcct": {
"account": "123456"
"account": "01111001759234567890"
}
},
"debitAgtParty": {
......@@ -41,11 +59,7 @@
"partyBic": "FOOBARC6"
},
"creditAgtParty": {
"partyBic": "BANKANC7",
"clrSysMmb": {
"code": "ATBLZ",
"id": "8193234"
}
"partyBic": "BANKANC7"
},
"creditParty": {
"partyName": "TEST CORP",
......@@ -56,30 +70,41 @@
"account": "00013500510020179998"
}
},
"remittanceInfos": [
"gechengyang"
],
"chargeFor": "DEBT",
"chargeCcyFormatAmount": {
"ccy": "USD",
"amt": 12.43
"remittanceInfo": {
"unstructured": [
"gechengyang",
"weicong"
]
},
"chargeFor": "DEBT",
"chargeInfos": [
{
"amt": {
"ccy": "USD",
"amt": 12.43
}
}
],
"preInstgAgtParty": {
"partyBic": "FOOBARC7"
},
"instForCrdAgtInfo": {
"info": "789556"
"instForCrdAgt": {
"code": "TELB",
"instrInf": "789556"
},
"regulatoryReportings": [
"/ORDERRES/BE//MEILAAN 1, 9000 GENT",
"//JIANGXIAQU",
"//WENHUADADAO"
],
"messageType": "pacs.008.001",
"senderBic": "BANKANC0",
"receiverBic": "FOOBARC0",
"createDate": "2022-04-26 11:31:16,074",
"messagePriority": "NORM",
"messageId": "TBEXO12345",
"uetr": "8a562c67-ca16-48ba-b074-65581be6f001"
"swiftHeader": {
"senderBic": "BANKANC0XXX",
"receiverBic": "FOOBARC0",
"messageId": "TBEXO12345",
"messageDefId": "pacs.008.001.09",
"messageType": "pacs.008.001",
"version": "09",
"businessService": "swift.cbprplus.02",
"createDate": "2020-09-08 10:10:47,000"
}
}
\ No newline at end of file
{
"endToEndId": "NOTPROVIDED",
"debitDate": "2022-04-25 12:35:00,000",
"creditDate": "2022-04-25 13:35:00,000",
"clsDate": "2022-04-25 14:35:00,000",
"txnRef": {
"uetr": "8a562c67-ca16-48ba-b074-65581be6f001"
},
"debitDate": "2022-04-02 19:35:04,807",
"creditDate": "2022-04-02 20:35:04,807",
"clsDate": "1970-01-01 21:35:04,807",
"settledDate": "2022-04-02 00:00:00,000",
"settledCcyFormatAmount": {
"ccy": "USD",
"amt": 120274.34
},
"debitParty": {
"partyName": "QWER",
"partyBic": "ZASXCDFV",
"partyName": "uiopp",
"addressList": [
"12",
"234",
"123"
"11",
"22",
"33",
"44",
"55"
],
"partyAcct": {
"ibanAcct": "S15612345678012345"
"account": "789465123132165",
"ibanAcct": "S15612345678012345",
"acctSehemeType": {
"code": "BBAN"
}
}
},
"instgAgtParty": {
"partyBic": "DEUTNL2A"
"partyBic": "DEUTNL2A",
"partyName": "NUM123"
},
"instdAgtParty": {
"partyBic": "DEUTDEFF",
"partyName": "NUM123",
"partyAcct": {
"ibanAcct": "S15612345678012345"
"account": "789465123132165",
"ibanAcct": "S15612345678012345",
"acctSehemeType": {
"code": "BBAN"
}
}
},
"intrmyAgtParty": {
"partyBic": "AQWSFRED",
"partyBic": "QWERFDSA",
"addressList": [
"11",
"22",
"33",
"44",
"55"
],
"partyAcct": {
"ibanAcct": "S15612345678012345"
"account": "789465123132165",
"ibanAcct": "S15612345678012345",
"acctSehemeType": {
"code": "BBAN"
}
}
},
"creditAgtParty": {
"partyBic": "AQWSDERF"
"partyBic": "ASDFEDRF",
"partyName": "uiopp",
"addressList": [
"11",
"22",
"33",
"44",
"55"
],
"partyAcct": {
"account": "789465123132165",
"ibanAcct": "S15612345678012345",
"acctSehemeType": {
"code": "BBAN"
}
}
},
"creditParty": {
"partyBic": "ZXCDQWER"
},
"preInstgAgtParty": {
"partyName": "5555555"
"partyBic": "anybic01",
"partyName": "33333333",
"addressList": [
"11",
"22",
"33",
"44"
],
"partyAcct": {
"account": "789465123132165",
"ibanAcct": "S15612345678012345",
"acctSehemeType": {
"code": "BBAN"
}
}
},
"instForCrdAgtInfo": {
"code": "TELB",
"info": "456"
"instForCrdAgt": {
"code": "PHOB",
"instrInf": "456"
},
"instForNxtAgtInfo": {
"instForNxtAgt": {
"code": "TELA",
"info": "ins123"
},
"messageType": "pacs.009.001",
"senderBic": "DEUTDEFF",
"receiverBic": "DEUTNL2A",
"createDate": "2022-04-25 11:21:51,614",
"messagePriority": "NORM",
"messageId": "00010013800002001234",
"uetr": "8a562c67-ca16-48ba-b074-65581be6f001"
}
\ No newline at end of file
"instrInf": "ins123"
},
"swiftHeader": {
"senderBic": "DEUTDEFF",
"receiverBic": "DEUTNL2A",
"messageId": "pacs8bizmsgidr02",
"messageDefId": "pacs.009.001.02",
"messageType": "pacs.009.001",
"version": "09",
"businessService": "swift.cbprplus.02",
"createDate": "2020-09-08 10:10:47,000"
}
}
{
"endToEndId": "end456",
"debitDate": "2022-04-29 12:35:00,000",
"creditDate": "2022-04-29 13:35:00,000",
"clsDate": "2022-04-29 14:35:00,000",
"txnRef": {
"endToEndId": "end456",
"uetr": "8a562c67-ca16-48ba-b074-65581be6f001"
},
"debitDate": "2022-04-02 12:35:04,807",
"creditDate": "2022-04-02 13:35:04,807",
"clsDate": "1970-01-01 14:35:04,807",
"settledDate": "2022-04-02 00:00:00,000",
"settledCcyFormatAmount": {
"ccy": "USD",
"amt": 120274.34
},
"debitParty": {
"partyName": "QWER",
"partyBic": "QWERXSAD",
"partyName": "uiopp",
"addressList": [
"12",
"234",
"123"
"11",
"22",
"33",
"44",
"55"
],
"partyAcct": {
"account": "S15612345678012345"
"account": "789465123132165",
"ibanAcct": "S15612345678012345",
"acctSehemeType": {
"code": "BBAN"
}
}
},
"instgAgtParty": {
"partyBic": "DEUTNL2A"
"partyBic": "DEUTNL2A",
"partyName": "NUM123"
},
"instdAgtParty": {
"partyBic": "DEUTDEFF",
"partyName": "NUM123",
"partyAcct": {
"account": "S15612345678012345"
"account": "789465123132165",
"ibanAcct": "S15612345678012345",
"acctSehemeType": {
"code": "BBAN"
}
}
},
"intrmyAgtParty": {
"partyBic": "AQWSFRED",
"addressList": [
"11",
"22",
"33",
"44",
"55"
],
"partyAcct": {
"account": "S15612345678012345"
"account": "789465123132165",
"ibanAcct": "S15612345678012345",
"acctSehemeType": {
"code": "BBAN"
}
}
},
"creditAgtParty": {
"partyBic": "AQWSDERF"
"partyBic": "AQWSDERF",
"partyName": "uiopp",
"addressList": [
"11",
"22",
"33",
"44",
"55"
]
},
"creditParty": {
"partyBic": "ZXCDQWER"
},
"preInstgAgtParty": {
"partyName": "5555555"
"partyBic": "anybic01",
"partyName": "33333333",
"addressList": [
"11",
"22",
"33",
"44"
]
},
"instForCrdAgt": {
"code": "TELB",
"code": "PHOB",
"instrInf": "456"
},
"instForNxtAgt": {
......@@ -54,56 +93,119 @@
"underCustomerCreditTransfer": {
"InstructedCcyFormatAmount": {
"ccy": "USD",
"amt": 120274.34
"amt": 393.17
},
"debitParty": {
"partyBic": "ANYBIC01",
"partyName": "nm01",
"addressList": [
"ade456"
],
"partyAcct": {
"account": "S15612345678012345"
"account": "789465123132165",
"ibanAcct": "S15612345678012345",
"acctSehemeType": {
"code": "BBAN"
}
}
},
"debitAgtParty": {
"partyBic": "QWERTYUI",
"partyName": "nm333333",
"addressList": [
"adr789"
],
"partyAcct": {
"account": "S123"
"account": "789465123132165",
"ibanAcct": "S123",
"acctSehemeType": {
"code": "BBAN"
}
}
},
"intrmyAgtParty": {
"addressList": [
"11",
"22",
"33",
"44",
"55"
],
"partyAcct": {
"account": "789465123132165",
"ibanAcct": "S123456",
"acctSehemeType": {
"code": "CUID"
"code": "BBAN"
}
},
"clrSysMmb": {
"code": "cd02",
"proprietary": "prtry01",
"id": "mmbid01"
}
},
"creditAgtParty": {
"partyBic": "ASDFRTEW",
"partyName": "uiopp",
"addressList": [
"11",
"22",
"33",
"44",
"55"
],
"partyAcct": {
"account": "S15612345678012345"
"account": "789465123132165",
"ibanAcct": "S15612345678012345",
"acctSehemeType": {
"code": "BBAN"
}
},
"clrSysMmb": {
"code": "cd02",
"proprietary": "prtry01",
"id": "mmbid01"
}
},
"creditParty": {
"partyBic": "anybic01",
"partyName": "33333333",
"addressList": [
"11",
"22",
"33"
"33",
"44"
],
"partyAcct": {
"account": "S15612345678012345"
"account": "789465123132165",
"ibanAcct": "S15612345678012345",
"acctSehemeType": {
"code": "BBAN"
}
}
},
"remittanceInfo": {
"unstructured": [
"1111"
]
},
"instForCrdAgt": {
"code": "PHOB",
"instrInf": "789556"
},
"instForNxtAgt": {
"code": "PHOA",
"instrInf": "823456"
}
},
"messageType": "pacs.009.001",
"senderBic": "DEUTDEFF",
"receiverBic": "DEUTNL2A",
"createDate": "2022-04-29 17:20:56,320",
"messagePriority": "NORM",
"messageId": "00010013800002001234",
"uetr": "8a562c67-ca16-48ba-b074-65581be6f001"
"swiftHeader": {
"senderBic": "DEUTDEFF",
"receiverBic": "DEUTNL2A",
"messageId": "pacs8bizmsgidr02",
"messageDefId": "pacs.009.001.02",
"messageType": "pacs.009.001",
"version": "09",
"businessService": "swift.cbprplus.02",
"createDate": "2020-09-08 10:10:47,000"
}
}
\ No newline at end of file
......@@ -40,7 +40,6 @@
</Othr>
</Id>
</Acct>
<Bal></Bal>
<Bal>
<Tp>
<CdOrPrtry>
......@@ -50,7 +49,7 @@
<Amt Ccy="USD">120274.34</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<Dt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</Dt>
</Bal>
<Bal>
......@@ -62,7 +61,7 @@
<Amt Ccy="USD">123456.29</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<Dt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</Dt>
</Bal>
<Bal>
......@@ -74,7 +73,7 @@
<Amt Ccy="USD">119609.29</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<Dt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</Dt>
</Bal>
<Bal>
......@@ -86,18 +85,17 @@
<Amt Ccy="USD">120274.34</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<Dt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</Dt>
</Bal>
<Ntry></Ntry>
<Ntry>
<Amt Ccy="USD">393.17</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<BookgDt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</BookgDt>
<ValDt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</ValDt>
<AcctSvcrRef>1309170100000390154395</AcctSvcrRef>
<BkTxCd>
......@@ -120,10 +118,10 @@
<Amt Ccy="USD">445</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<BookgDt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</BookgDt>
<ValDt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</ValDt>
<AcctSvcrRef>1309170100000390154395</AcctSvcrRef>
<BkTxCd>
......
......@@ -40,7 +40,6 @@
</Othr>
</Id>
</Acct>
<Bal></Bal>
<Bal>
<Tp>
<CdOrPrtry>
......@@ -50,7 +49,7 @@
<Amt Ccy="USD">120274.34</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<Dt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</Dt>
</Bal>
<Bal>
......@@ -62,18 +61,17 @@
<Amt Ccy="USD">123456.29</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<Dt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</Dt>
</Bal>
<Ntry></Ntry>
<Ntry>
<Amt Ccy="USD">393.17</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<BookgDt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</BookgDt>
<ValDt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</ValDt>
<AcctSvcrRef>1309170100000390154395</AcctSvcrRef>
<BkTxCd>
......@@ -95,10 +93,10 @@
<Amt Ccy="USD">445</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<BookgDt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</BookgDt>
<ValDt>
<Dt>2022-03-30+08:00</Dt>
<Dt>2022-03-30</Dt>
</ValDt>
<AcctSvcrRef>1309170100000390154395</AcctSvcrRef>
<BkTxCd>
......
......@@ -20,7 +20,7 @@
<BizSvc>swift.cbprplus.02</BizSvc>
<CreDt>2020-09-08T10:10:47+08:00</CreDt>
</AppHdr>
<Doc:Document xmlns:Doc="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02">
<Doc:Document xmlns:Doc="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.09">
<Doc:FIToFICstmrCdtTrf>
<Doc:GrpHdr>
<Doc:MsgId>TBEXO12345</Doc:MsgId>
......@@ -97,7 +97,9 @@
<Doc:InstdAmt Ccy="EUR">1345.12</Doc:InstdAmt>
<Doc:XchgRate>17.4357135422</Doc:XchgRate>
<Doc:ChrgBr>DEBT</Doc:ChrgBr>
<Doc:ChrgsInf Ccy="USD">12.43</Doc:ChrgsInf>
<Doc:ChrgsInf>
<Doc:Amt Ccy="USD">12.43</Doc:Amt>
</Doc:ChrgsInf>
<Doc:Dbtr>
<Doc:Nm>JOE PurpDOE</Doc:Nm>
<Doc:PstlAdr>
......
......@@ -20,7 +20,7 @@
<BizSvc>swift.cbprplus.02</BizSvc>
<CreDt>2020-09-08T10:10:47+08:00</CreDt>
</AppHdr>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.009.001.02">
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.009.001.09">
<FinInstnCdtTrf>
<GrpHdr>
<MsgId>00010013800002001234</MsgId>
......
......@@ -20,7 +20,7 @@
<BizSvc>swift.cbprplus.02</BizSvc>
<CreDt>2020-09-08T10:10:47+08:00</CreDt>
</AppHdr>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.009.001.02">
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.009.001.09">
<FinInstnCdtTrf>
<GrpHdr>
<MsgId>00010013800002001234</MsgId>
......
......@@ -22,6 +22,12 @@ public class Test {
public static void main(String[] args) throws Exception {
//test202();
test202Cov();
//test202Cov();
String messageId = "camt.053.001.08";
String[] messageIds = messageId.split("\\.");
if (messageIds.length == 4) {
System.out.println(messageId.substring(messageId.lastIndexOf(".")+1));
System.out.println(messageId.substring(0, messageId.lastIndexOf(".")));
}
}
}
......@@ -8,7 +8,7 @@ import java.io.File;
public class TestMx2MtFor103 {
public static void main(String[] args) throws Exception {
String mt103 = SwiftTransfer.mx2Mt(
new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00800102.xml"),
new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00800109.xml"),
"d:/test/MT103.txt", null);
System.out.println(mt103);
}
......
......@@ -7,7 +7,7 @@ import java.io.File;
public class TestMx2MtFor202 {
public static void main(String[] args) throws Exception {
String mt202 = SwiftTransfer.mx2Mt(
new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900102.xml"),
new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900109.xml"),
"d:/test/MT202.txt", null);
System.out.println(mt202);
}
......
......@@ -7,7 +7,7 @@ import java.io.File;
public class TestMx2MtFor202COV {
public static void main(String[] args) throws Exception {
String mt202Cov = SwiftTransfer.mx2Mt(
new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900102_COV.xml"),
new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900109_COV.xml"),
"d:/test/MT202Cov.txt", null);
System.out.println(mt202Cov);
}
......
package com.brilliance.mx2mtmap.mt103;
import com.brilliance.swift.SwiftTransfer;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class Test {
public static void main(String[] args) throws IOException {
String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00800109.xml"));
Map<String, Object> extraMap = new HashMap<>();
extraMap.put("bnkBic", "BANKANC0XXX");//发报
//extraMap.put("bnkBic", "FOOBARC0");//收报
Map<String, String> maps = SwiftTransfer.mx2MtMap(xmlStr, extraMap);
maps.forEach((k, v) -> System.out.println(k + "=" + v));
}
}
package com.brilliance.mx2mtmap.mt202;
import com.brilliance.swift.SwiftTransfer;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class Test {
private static void test202() throws IOException {
String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00800109.xml"));
Map<String, Object> extraMap = new HashMap<>();
extraMap.put("bnkBic", "BANKANC0XXX");//发报
//extraMap.put("bnkBic", "FOOBARC0");//收报
Map<String, String> maps = SwiftTransfer.mx2MtMap(xmlStr, extraMap);
maps.forEach((k, v) -> System.out.println(k + "=" + v));
}
private static void test202Cov() throws IOException {
String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900109_COV.xml"));
Map<String, Object> extraMap = new HashMap<>();
//extraMap.put("bnkBic", "DEUTDEFF");//发报
extraMap.put("bnkBic", "DEUTNL2A");//收报
Map<String, String> maps = SwiftTransfer.mx2MtMap(xmlStr, extraMap);
maps.forEach((k, v) -> System.out.println(k + "=" + v));
}
public static void main(String[] args) throws IOException {
//test202();
test202Cov();
}
}
package com.brilliance.mx2mtmap.mt950;
import com.brilliance.swift.SwiftTransfer;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class Test {
public static void main(String[] args) throws IOException {
String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05300108_950.xml"));
Map<String, Object> extraMap = new HashMap<>();
//extraMap.put("bnkBic", "SHWHQWER123");//发报
extraMap.put("bnkBic", "BJWHS12X");//收报
Map<String, String> maps = SwiftTransfer.mx2MtMap(xmlStr, extraMap);
maps.forEach((k, v) -> System.out.println(k + "=" + v));
}
}
......@@ -8,7 +8,7 @@ import java.io.File;
public class Test940 {
public static void main(String[] args) {
SwiftDto swiftDto = SwiftTransfer.mx2SwiftDto(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05300108_940.xml"), "D:/MxToSwift/BankToCustomerStatement.json", null);
SwiftDto swiftDto = SwiftTransfer.mx2SwiftDto(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05300108_940.xml"), "D:/test/BankToCustomerStatement.json", null);
System.out.println(swiftDto);
}
}
......@@ -8,7 +8,7 @@ import java.io.File;
public class Test950 {
public static void main(String[] args) {
SwiftDto swiftDto = SwiftTransfer.mx2SwiftDto(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05300108_950.xml"), "D:/MxToSwift/BankToStatement.json", null);
SwiftDto swiftDto = SwiftTransfer.mx2SwiftDto(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05300108_950.xml"), "D:/test/BankToStatement.json", null);
System.out.println(swiftDto);
}
}
......@@ -9,7 +9,7 @@ public class Test {
public static void main(String[] args) {
SwiftDto swiftDto = SwiftTransfer.mx2SwiftDto(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00800102.xml"), "d:/test/CustomerCreditTransfer.json", null);
SwiftDto swiftDto = SwiftTransfer.mx2SwiftDto(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00800109.xml"), "d:/test/CustomerCreditTransfer.json", null);
System.out.println(swiftDto);
}
}
......@@ -8,17 +8,17 @@ import java.io.File;
public class Test {
private static void test202() {
SwiftDto swiftDto = SwiftTransfer.mx2SwiftDto(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900102.xml"), "d:/test/FinancialInstitutionCreditTransfer.json", null);
SwiftDto swiftDto = SwiftTransfer.mx2SwiftDto(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900109.xml"), "d:/test/FinancialInstitutionCreditTransfer.json", null);
System.out.println(swiftDto);
}
private static void test202Cov() {
SwiftDto swiftDto = SwiftTransfer.mx2SwiftDto(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900102_COV.xml"), "d:/test/FinancialInstitutionCreditTransfer.json", null);
SwiftDto swiftDto = SwiftTransfer.mx2SwiftDto(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900109_COV.xml"), "d:/test/FinancialInstitutionCreditTransfer.json", null);
System.out.println(swiftDto);
}
public static void main(String[] args) {
//test202();
test202Cov();
test202();
//test202Cov();
}
}
......@@ -19,7 +19,7 @@ public class Test {
}
public static void main(String[] args) {
//test202();
test202Cov();
test202();
//test202Cov();
}
}
......@@ -8,7 +8,7 @@ public class Test {
public static void main(String[] args) {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftJson\\BankToStatement.json");
String mtStr = SwiftTransfer.swiftDto2Mt(file, "D:/SwiftToMt/MT950.txt", null);
String mtStr = SwiftTransfer.swiftDto2Mt(file, "D:/test/MT950.txt", null);
System.out.println(mtStr);
}
}
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