Commit be410ce5 by chengzhuoshen

1.增加SwiftHeader,类似于ISO20022 AppHdr

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