Пример #1
0
  public void transfer(SimTransaction txn) {
    try {
      SimTransaction simTransaction = new SimTransaction();
      simTransaction.setTxnId(txn.getTxnId());
      simTransaction.setTxnStatus(AppConstants.TXN_STATUS_DELIVERING);

      SimTransactionDao simTransactionDao = new SimTransactionDao();
      if (simTransactionDao.update(simTransaction)) {
        ContextBase ctxRequest = new ContextBase();
        ctxRequest.put(Attributes.ATTR_TXN_TYPE, txn.getTxnType());
        ctxRequest.put(Attributes.ATTR_COM_ID, txn.getSimId());
        ctxRequest.put(Attributes.ATTR_MSISDN, txn.getMsisdn());
        ctxRequest.putLong(Attributes.ATTR_AMOUNT, txn.getAmount());
        ContextBase response = SimConnectionFactory.getInstance().process(ctxRequest);
        log.info("Transfer money:" + response);
      } else log.info("Fail to change txn status of transfer txn :" + txn);
    } catch (Exception e) {
      log.error("Fail to transfer money", e);
    }
  }