public void setConfiguration (Configuration cfg) { this.cfg = cfg; txnNameEntry = cfg.get("txnname", TXNNAME.toString()); } }
ContextConstants() { this.name = name(); } ContextConstants(String name) {
ContextConstants k = null; try { k = ContextConstants.valueOf(s); } catch (IllegalArgumentException ignored) { } if (k != null) { break; case TRANSMISSION_TIMESTAMP: putTimestamp(ctx, m, TRANSMISSION_TIMESTAMP.toString(), 7, mandatory, validFields, rc); break; case TRANSACTION_TIMESTAMP: putTimestamp(ctx, m, TRANSACTION_TIMESTAMP.toString(), 12, mandatory, validFields, rc); break; case POS_DATA_CODE:
public PausedTransaction getPausedTransaction() { return (PausedTransaction) get (PAUSED_TRANSACTION.toString()); } public void setTimeout (long timeout) {
public void setPausedTransaction (PausedTransaction p) { put (PAUSED_TRANSACTION.toString(), p); synchronized (this) { if (resumeOnPause) { resume(); } } } public PausedTransaction getPausedTransaction() {
public void setConfiguration (Configuration cfg) { this.cfg = cfg; request = cfg.get ("request", ContextConstants.REQUEST.toString()); ignoreCardValidation = cfg.getBoolean("ignore-card-validation", false); }
private void putOriginalDataElements (Context ctx, ISOMsg m, boolean mandatory, Set<String> validFields, Result rc) { String s = m.getString(56); if (s != null) { validFields.add("56"); if (ORIGINAL_DATA_ELEMENTS_PATTERN.matcher(s).matches()) { ctx.put (ORIGINAL_MTI.toString(), s.substring(0,4)); ctx.put (ORIGINAL_STAN.toString(), s.substring(4,16)); ctx.put (ORIGINAL_TIMESTAMP.toString(), ISODate.parseISODate (s.substring(16,30))); } else { rc.fail(CMF.INVALID_FIELD, Caller.info(), "Invalid %s '%s'", ORIGINAL_DATA_ELEMENTS, s); } } else if (mandatory) { rc.fail(CMF.MISSING_FIELD, Caller.info(), ContextConstants.ORIGINAL_DATA_ELEMENTS.toString()); } } }
@Override public void setConfiguration(Configuration cfg) throws ConfigurationException { source = cfg.get ("source", SOURCE.toString()); request = cfg.get ("request", REQUEST.toString()); response = cfg.get ("response", RESPONSE.toString()); timeout = cfg.getLong ("timeout", timeout); try { headerStrategy = HeaderStrategy.valueOf( cfg.get("header-strategy", "PRESERVE_RESPONSE").toUpperCase() ); } catch (IllegalArgumentException e) { throw new ConfigurationException (e.getMessage()); } } public void setTransactionManager(TransactionManager tm) {
public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; timeout = cfg.getLong ("timeout", DEFAULT_TIMEOUT); waitTimeout = cfg.getLong ("wait-timeout", DEFAULT_WAIT_TIMEOUT); requestName = cfg.get ("request", ContextConstants.REQUEST.toString()); responseName = cfg.get ("response", ContextConstants.RESPONSE.toString()); destination = cfg.get ("destination", ContextConstants.DESTINATION.toString()); continuations = cfg.getBoolean("continuations", true); ignoreUnreachable = cfg.getBoolean("ignore-host-unreachable", false); }
/** * return a LogEvent used to store trace information * about this transaction. * If there's no LogEvent there, it creates one. * @return LogEvent */ synchronized public LogEvent getLogEvent () { LogEvent evt = (LogEvent) get (LOGEVT.toString()); if (evt == null) { evt = new LogEvent (); evt.setNoArmor(true); put (LOGEVT.toString(), evt); } return evt; } /**
private void putAmount (Context ctx, ISOMsg m, boolean mandatory,Set<String> validFields, Result rc) { Object o4 = m.getComponent(4); Object o5 = m.getComponent(5); ISOAmount a4 = null; ISOAmount a5 = null; if (o4 instanceof ISOAmount) { a4 = (ISOAmount) o4; validFields.add("4"); } if (o5 instanceof ISOAmount) { a5 = (ISOAmount) o5; validFields.add("5"); } if (a5 != null) { ctx.put (AMOUNT.toString(), a5); if (a4 != null) { ctx.put (LOCAL_AMOUNT.toString(), a4); } } else if (a4 != null) { ctx.put (AMOUNT.toString(), a4); } if (mandatory && (a4 == null && a5 == null)) rc.fail(CMF.MISSING_FIELD, Caller.info(), ContextConstants.AMOUNT.toString()); }
private void putCaptureDate (Context ctx, ISOMsg m, boolean mandatory, Set<String> validFields, Result rc) { if (m.hasField(17)) { String s = m.getString(17); validFields.add("17"); if (CAPTUREDATE_PATTERN.matcher(s).matches()) ctx.put (CAPTURE_DATE.toString(), ISODate.parseISODate(s + "120000")); else rc.fail(CMF.INVALID_FIELD, Caller.info(), "Invalid %s '%s'", CAPTURE_DATE, s); } else if (mandatory) { rc.fail(CMF.MISSING_FIELD, Caller.info(), CAPTURE_DATE.toString()); } }
public void setConfiguration (Configuration cfg) { this.requestName = cfg.get("request", ContextConstants.REQUEST.toString()); this.destinationName = cfg.get ("destination", ContextConstants.DESTINATION.toString()); this.defaultDestination = cfg.get("default-destination", null); this.validator = cfg.getBoolean("ignore-luhn") ? new IgnoreLuhnCardValidator() : Card.Builder.DEFAULT_CARD_VALIDATOR; this.failOnNoRoute = cfg.getBoolean("fail"); }
@SuppressWarnings("unchecked") public void setConfiguration (Configuration cfg) throws ConfigurationException { timeout = cfg.getLong ("timeout", 15000L); sp = (Space<String,Context>) SpaceFactory.getSpace (cfg.get ("space")); queue = cfg.get ("queue", null); if (queue == null) throw new ConfigurationException ("queue property not specified"); source = cfg.get ("source", ContextConstants.SOURCE.toString()); request = cfg.get ("request", ContextConstants.REQUEST.toString()); timestamp = cfg.get ("timestamp", ContextConstants.TIMESTAMP.toString()); remote = cfg.getBoolean("remote") || cfg.get("space").startsWith("rspace:"); Map<String,String> m = new HashMap<>(); cfg.keySet() .stream() .filter (s -> s.startsWith("ctx.")) .forEach(s -> m.put(s.substring(4), cfg.get(s))); if (m.size() > 0) additionalContextEntries = m; } public boolean process (ISOSource src, ISOMsg m) {
private void putTimestamp (Context ctx, ISOMsg m, String key, int fieldNumber, boolean mandatory, Set<String> validFields, Result rc) { if (m.hasField(fieldNumber)) { String s = m.getString(fieldNumber); validFields.add(Integer.toString(fieldNumber)); if (TIMESTAMP_PATTERN.matcher(s).matches()) ctx.put (key, ISODate.parseISODate(s)); else rc.fail(CMF.INVALID_FIELD, Caller.info(), "Invalid %s '%s'", key, s); } else if (mandatory) { rc.fail(CMF.MISSING_FIELD, Caller.info(), TRANSMISSION_TIMESTAMP.toString()); } }
private void putPCode (Context ctx, ISOMsg m, boolean mandatory, Set<String> validFields, Result rc) { if (m.hasField(3)) { String s = m.getString(3); validFields.add("3"); if (PCODE_PATTERN.matcher(s).matches()) { ctx.put(ContextConstants.PCODE.toString(), m.getString(3)); } else rc.fail(CMF.INVALID_FIELD, Caller.info(), "Invalid PCODE '%s'", s); } else if (mandatory) { rc.fail(CMF.MISSING_FIELD, Caller.info(), "PCODE"); } }
private void putTid (Context ctx, ISOMsg m, boolean mandatory, Set<String> validFields, Result rc) { if (m.hasField(41)) { String s = m.getString(41); validFields.add("41"); if (TID_PATTERN.matcher(s).matches()) { ctx.put(ContextConstants.TID.toString(), m.getString(41)); } else rc.fail(CMF.INVALID_FIELD, Caller.info(), "Invalid TID '%s'", s); } else if (mandatory) { rc.fail(CMF.MISSING_FIELD, Caller.info(), "TID"); } }
private void putPDC (Context ctx, ISOMsg m, boolean mandatory, Set<String> validFields, Result rc) { if (m.hasField(22)) { byte[] b = m.getBytes(22); validFields.add("22"); if (b.length != 16) { rc.fail( CMF.INVALID_FIELD, Caller.info(), "Invalid %s '%s'", ContextConstants.POS_DATA_CODE.toString(), ISOUtil.hexString(b) ); } else { ctx.put(ContextConstants.POS_DATA_CODE.toString(), PosDataCode.valueOf(m.getBytes(22))); } } else if (mandatory) { rc.fail(CMF.MISSING_FIELD, Caller.info(), ContextConstants.POS_DATA_CODE.toString()); } }