}
public void prepare(Context ctx) throws ParticipantException, ValidatorException {
try {
IMessage msg = ctx.getOriginalMessage();
Object tmp = msg.getElement("BankSvcRq.DebitAddRq.CustId.CardLogicalData.CardEmbossNum");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.CustId.CardLogicalData.CardEmbossNum", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.DebitInfo.CompositeCurAmt.CurAmt.Amt");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.DebitInfo.CompositeCurAmt.CurAmt.Amt", tmp.toString());
}
tmp = msg.getElement("SignonRq.ClientDt");
if (tmp != null) {
ctx.put("SignonRq.ClientDt", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.MsgRqHdr.ClientTerminalSeqId");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.MsgRqHdr.ClientTerminalSeqId", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.CustId.CardLogicalData.ExpDt");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.CustId.CardLogicalData.ExpDt", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.MsgRqHdr.PointOfServiceData.IdentCharacterData.IdentReadMethod");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.MsgRqHdr.PointOfServiceData.IdentCharacterData.IdentReadMethod", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.MsgRqHdr.PointOfServiceData.IdentCharacterData.IdentConditions");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.MsgRqHdr.PointOfServiceData.IdentCharacterData.IdentConditions", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.MsgRqHdr.NetworkTrnInfo.BankId");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.MsgRqHdr.NetworkTrnInfo.BankId", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.DebitInfo.CardAcctId.CardMagData.MagData2");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.DebitInfo.CardAcctId.CardMagData.MagData2", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitCanRq.DebitId");
if (tmp != null) {
ctx.put("BankSvcRq.DebitCanRq.DebitId", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.MsgRqHdr.NetworkTrnInfo.TerminalId");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.MsgRqHdr.NetworkTrnInfo.TerminalId", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.DebitInfo.NetworkTrnInfo.OriginatorName");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.DebitInfo.NetworkTrnInfo.OriginatorName", tmp.toString());
}
tmp = msg.getElement("SignonRq.SignonPswd.CustId.PersonalIdent.PersonInfo.GovIssueIdent.IdentSerialNum");
if (tmp != null) {
ctx.put("SignonRq.SignonPswd.CustId.PersonalIdent.PersonInfo.GovIssueIdent.IdentSerialNum", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.DebitInfo.CardAcctId.CardMagData.MagData1");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.DebitInfo.CardAcctId.CardMagData.MagData1", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.DebitInfo.CompositeCurAmt.Memo");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.DebitInfo.CompositeCurAmt.Memo", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.DebitInfo.CompositeCurAmt.CurAmt.CurCode");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.DebitInfo.CompositeCurAmt.CurAmt.CurCode", tmp.toString());
}
tmp = msg.getElement("SignonRq.SignonMagPIN.PINBlock");
if (tmp != null) {
ctx.put("SignonRq.SignonMagPIN.PINBlock", tmp.toString());
}
tmp = msg.getElement("SignonRq.ClientApp.Name");
if (tmp != null) {
ctx.put("SignonRq.ClientApp.Name", tmp.toString());
}
tmp = msg.getElement("SignonRq.ClientApp.Version");
if (tmp != null) {
ctx.put("SignonRq.ClientApp.Version", tmp.toString());
}
tmp = msg.getElement("BankSvcRq.DebitAddRq.MsgRqHdr.PointOfServiceData.POSCapabilities.POSEntryCapability");
if (tmp != null) {
ctx.put("BankSvcRq.DebitAddRq.MsgRqHdr.PointOfServiceData.POSCapabilities.POSEntryCapability", tmp.toString());
}
String id = (String) msg.getElement("BankSvcRq.DebitAddRq.MsgRqHdr.ClientTerminalSeqId");
Matcher matcher = pattern.matcher(id);
if (matcher.matches()) {
ctx.put("ClientTerminalSeqId", matcher.group(1));
IMessage iso = ISOMessageFactory.createPOSRequest(5896572104578400l, 1, 10, Integer.valueOf(matcher.group(1)));
ILink link = LinkFactory.getFactory().getLinkChannel(properties.get("link"));
IMessage res = link.sendReceiveMessage(iso);
ctx.put("RESPONSE", res);
System.out.println("Respuesta: " + res);
} else
throw new ParticipantException("El valor en el campo BankSvcRq.DebitAddRq.MsgRqHdr.ClientTerminalSeqId no es num�rico.");