This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void testMessage(String messageContent) throws InvalidMessageFormatException { | |
//parse message string to the SwiftMessage object | |
SwiftMessage message = new SwiftMsgProcessor().ParseMsgStringToObject(messageContent); | |
//validate SwiftMessage (parsed from String or built programmatically) | |
SwiftMsgValidator validator = new SwiftMsgValidator(); | |
SwiftValidObj validation = validator.validateMsg(message); | |
//swift mt text | |
String mtMessageText = validation.getMessage(); | |
//obtain list of errors from the validation object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public SwiftMessage buildMT103() { | |
SwiftMessage message = new SwiftMessage(); | |
// Set Tags for block1 | |
message.setArgApplid("F"); | |
message.setArgServid("01"); | |
message.setArgLTaddrBlk1("COPZBEB0AXXX"); | |
// Set Tags for block2 | |
message.setArgInoutind("O"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public SwiftMessage buildMT103() { | |
SwiftMessage message = new SwiftMessage(); | |
// Set Tags for block1 | |
message.setArgApplid("F"); | |
message.setArgServid("01"); | |
message.setArgLTaddrBlk1("COPZBEB0AXXX"); | |
// Set Tags for block2 | |
message.setArgInoutind("O"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Message parseMessage(String msgText) throws Exception { | |
String namespace = msgText.replaceAll("(?s).*?xmlns=\"(.*?)\".*", "$1"); | |
return CoreMessage.parseXML(msgText, namespace); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testCreating205COV() { | |
SwiftMessage message = new SwiftMessage(); | |
// Set Tags for block1 | |
message.setArgApplid("F"); | |
message.setArgServid("01"); | |
message.setArgLTaddrBlk1("AAAABEBBAXXX"); | |
// Set Tags for block2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SwiftMessage message = new SwiftMsgProcessor().ParseMsgStringToObject(messageContent); | |
SwiftMsgValidator validator = new SwiftMsgValidator(DEFAULT_CRLF); | |
SwiftValidObj validation = validator.validateMsg(message); | |
for(ValidationError error : validation.getValidationErrorList()) { | |
System.out.println(error.getTagName() + " => " + error.getDescription()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Initialize a payment return (pacs.004) | |
PaymentReturn paymentReturn = new PaymentReturn(); | |
//message id is commonly auto-generated by each system | |
paymentReturn.set_GrpHdr_MsgId("OURMESSAGEID"); | |
//The settlement date for our return | |
paymentReturn.set_GrpHdr_IntrBkSttlmDt(Calendar.getInstance()); | |
//In most cases this is set to CLRG... | |
paymentReturn.set_GrpHdr_SttlmInf_SttlmMtd("CLRG"); | |
//and Clearing system is set to ST2 | |
paymentReturn.set_GrpHdr_SttlmInf_ClrSys_Prtry("ST2"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Initialize a request for recall message (camt.056) with default values | |
FIToFIPaymentCancellationRequest fiToFIPaymentCancellationRequest = new FIToFIPaymentCancellationRequest( | |
"GENERATEDASSIGNMENTID", // the assignment id | |
"XXXXXBIC", // the assigner bank BIC | |
"YYYYYBIC" // the assignee bank BIC | |
); | |
//Construct the message reply information | |
//Here we are requesting a recall for a message with reason code DUPL (dulicate sending) | |
Vector<MsgReplyInfo> msgReplyInfo = new Vector<MsgReplyInfo>(); | |
ReasonCode rc = new ReasonCode(ReasonCode.CD, "DUPL", null, null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FIToFICustomerCreditTransfer fiToFICustomerCreditTransfer = new FIToFICustomerCreditTransfer(); | |
fiToFICustomerCreditTransfer.parseMessageFromXML(msgText); | |
List<String> validationErrors = fiToFICustomerCreditTransfer.validate(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SwiftMessage parsedMessage = swiftMessageProcessingService.parseSwiftMessage(messageText); | |
SwiftValidObj validatedMessage = swiftMessageProcessingService.validateSwiftMessage(parsedMessage); | |
//validatedMessage will contain the SWIFT message object and text, as well as error message in case the message is not valid |
NewerOlder