@RequestMapping(value = "/rechargedetail", method = RequestMethod.POST)
  public String rechargeDetail(
      @ModelAttribute("telecomrecharge") TransactionTransportBean transactionTransport,
      /* @RequestParam Long uuid, */ ModelMap model,
      HttpServletRequest req) {
    HttpSession session = req.getSession();
    String pathToFollow = null;
    Long suuid = (Long) session.getAttribute("suuid");
    if (suuid != null) {
      session.setAttribute("suuid", null);
      session.setAttribute("rechargeType", transactionTransport.getRechargeType());
      session.setAttribute("circle", transactionTransport.getCircleName());
      session.setAttribute("mobileNo", transactionTransport.getMobileNo());
      session.setAttribute(
          "amount", CyberTelUtil.removeDecimalFromNumber(transactionTransport.getAmount()));
      session.setAttribute("operator", transactionTransport.getOperator());

      transactionTransport.setRetailerId((String) req.getSession().getAttribute("userid"));
      transactionTransport.setTransactionName("MOBILE_RECHARGE");
      transactionTransport.setFranchiseeMobileNum((String) session.getAttribute("userName"));
      try {
        rechargeTransactionService.doRechargeService(transactionTransport);
      } catch (Exception e) {
        e.printStackTrace();
        transactionTransport.setMessage("System Error");
        // transactionTransport.setErrorCode(3);
      }

      if (transactionTransport.getErrorCode() > 0
          || transactionTransport.getThirdpartytransid() == null) {
        String errorMsg = "Error in Transaction</br>";
        if (transactionTransport.getMessage() != null) {
          errorMsg += transactionTransport.getMessage();
        }
        model.addAttribute("Error", errorMsg);
        model.addAttribute("telecomrecharge", transactionTransport);
        pathToFollow = "telecomRechargeFran";
      } else {
        session.setAttribute("transId", transactionTransport.getTransid());
        // SimpleDateFormat sdf = new
        // SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
        session.setAttribute("datetime", transactionTransport.getThirdPartyTransDateTime());
        // model.addAttribute("datetime",
        // sdf.format(transactionTransport.getCreatedAt()));

        String userId = (String) session.getAttribute("userid");
        FranchiseeInfo franchiseeInfo = franchiseeInfoService.getFranchiseeInfo(userId);
        session.setAttribute("franchiseeInfo", franchiseeInfo);

        pathToFollow = "redirect:rechargedetailfran";
      }
    } else {
    }
    return pathToFollow;
  }
  private String getDataFromThirdParty(TransactionTransportBean transactionTransport)
      throws Exception {

    String finalInput = null;

    StringBuilder sessionVal = new StringBuilder(transactionTransport.getRetailerId());
    int length = transactionTransport.getRetailerId().length();
    if (length < 10) {
      for (int i = 0; i < 8 - transactionTransport.getRetailerId().length(); i++) {
        sessionVal.append("0");
      }
    }

    String operatorCode = transactionTransport.getOperatorCode();
    String connectURL[] = new String[2];
    if (operatorCode != null) {
      StringTokenizer stringTokenizer = new StringTokenizer(operatorCode, ";");
      int index = 0;
      while (stringTokenizer.hasMoreTokens()) {
        connectURL[index] = stringTokenizer.nextToken();
        index++;
      }
    }
    if (connectURL.length > 1) {
      sessionVal.append(transactionTransport.getTransid().substring(13));
      finalInput = inputMessageCreation(transactionTransport, sessionVal, true);
      String outputMessage = getDataFromURL(connectURL[0], finalInput);
      // System.out.println("outputMessage getDataFromThirdParty "
      // + outputMessage);
      int errorIndex = outputMessage.indexOf("ERROR=");
      int resultIndex = outputMessage.indexOf("RESULT=");
      // System.out.println("resultIndex>" + resultIndex);
      String errorVal = "1";
      String resultVal = "1";
      if (errorIndex != -1 && resultIndex != -1) {
        errorVal = outputMessage.substring(errorIndex + 6, errorIndex + 8);
        resultVal = outputMessage.substring(resultIndex + 7, resultIndex + 9);
        // System.out.println("resulVal:> " + resultVal);
      }

      if ((resultVal != null && "0".equals(resultVal.trim()))
          && (errorVal != null && "0".equals(errorVal.trim()))) {
        transactionTransport.setConnectURL(connectURL[1]);

        finalInput = inputMessageCreation(transactionTransport, sessionVal, false);
        outputMessage = getDataFromURL(transactionTransport.getConnectURL(), finalInput);
        // System.out.println("outputMessage:::" + outputMessage);
        String[] line = outputMessage.split("\n");
        String addInfo = "";
        for (String info : line) {
          if (info.contains("ADDINFO=")) {
            addInfo = info.substring(8);
            break;
          }
        }
        transactionTransport.setMessage(addInfo);

      } else {
        transactionTransport.setErrorCode(2);
        transactionTransport.setErrorcode(errorVal);
        transactionTransport.setMessage("Error " + errorVal);
        transactionTransport.setErrorMessage("Error " + errorVal);
        // System.out.println("errore code"
        // + transactionTransport.getErrorcode() + "message"
        // + transactionTransport.getMessage());
        return "PROBLEM:" + errorVal;
      }
      return outputMessage;
    }
    return "PROBLEM:Operator Setup Error";
  }