Skip to content

Instantly share code, notes, and snippets.

@esaounkine
Last active December 27, 2015 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esaounkine/7321818 to your computer and use it in GitHub Desktop.
Save esaounkine/7321818 to your computer and use it in GitHub Desktop.
pacs 008 001 auto reply with 004
//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");
//Construct the message reply information
//Here we are returning a message with reason code AC01 and with no charges
//Charges have effect only for reason code FOCR (acceptance of Request for Recall)
Vector<MsgReplyInfo> msgReplyInfo = new Vector<MsgReplyInfo>();
ReasonCode rc = new ReasonCode(ReasonCode.CD, "AC01", null, null);
//The message reply info has the transaction Id of the payment we want to return, the reason code info, a return Id we generate,
//an instruction id and the settlement date of the payment that we return
MsgReplyInfo mri = new MsgReplyInfo("CB2013103008JR113303E03123860000001", rc, MsgReplyInfo.MSGID_BASED, "RETURNID", "", new Date());
msgReplyInfo.add(mri);
paymentReturn = (PaymentReturn) message.autoReply(paymentReturn, msgReplyInfo);
//and here it is
return paymentReturn.getMessageAsXML();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment