@Override
 public int prepare(long l, Serializable serializable) {
   Context ctx = (Context) serializable;
   ISOMsg respMsg = (ISOMsg) ctx.get(Constants.RESPONSE_KEY);
   try {
     respMsg.set(39, "00");
     ctx.put(Constants.RESPONSE_KEY, respMsg);
   } catch (ISOException e) {
     e.printStackTrace();
   }
   return PREPARED;
 }
Exemple #2
0
  public void run() {
    Thread.currentThread().setName(getName());
    while (running()) {

      Object o = sp.in(in, timeout);

      if (o != null) {
        Context ctx = new Context();
        ctx.put(contextName, o);

        if (contextValues != null) {
          for (Element e : contextValues) {
            ctx.put(e.getName(), e.getValue());
          }
        }

        sp.out(out, ctx);
      }
    }
  }
  @Override
  protected int doPrepare(long id, Context ctx) throws Exception {
    BatchTxn batchTxn = (BatchTxn) ctx.get(BATCH_TXN);
    Trace trace = (Trace) ctx.get(BANK_TRACE);
    String batchNumber = ctx.getString(BATCH_NUMBER);
    Date now = new Date();
    String refNo = Long.toHexString(System.currentTimeMillis());
    String authId = "";

    batchTxn.setTrace(trace);
    batchTxn.setBatchNumber(batchNumber);
    batchTxn.setTxnTime(now);
    batchTxn.setReferenceNumber(refNo);
    batchTxn.setAuthorizationId(authId);

    ctx.put(TXN_TIME, now);
    ctx.put(REFERENCE_NUMBER, refNo);
    ctx.put(AUTHORIZATION_ID, authId);

    ctx.put(BATCH_TXN, batchTxn);

    return PREPARED | NO_JOIN;
  }
Exemple #4
0
 public String select(long id, Serializable ser) {
   Context ctx = (Context) ser;
   String name = cfg.get("name");
   String action = ctx.get(name) != null ? YES : NO;
   return cfg.get(action, UNKNOWN);
 }