@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 inputMessageCreation(
      TransactionTransportBean transactionTransport,
      StringBuilder sessionVal,
      boolean isCommentRequired)
      throws Exception, UnsupportedEncodingException {
    String finalInput;
    // System.out.println("sessionVal=" + sessionVal);
    StringBuilder inputMessageTemp = new StringBuilder();
    String data = transactionTransport.getAgentId();
    ArrayList<String> list = new ArrayList<String>();
    if (data != null) {
      StringTokenizer stringTokenizer = new StringTokenizer(data, ":");
      while (stringTokenizer.hasMoreTokens()) {
        list.add(stringTokenizer.nextToken());
      }
    }

    inputMessageTemp.append("SD=").append(list.get(0)).append("\n");
    inputMessageTemp.append("AP=").append(list.get(1)).append("\n");
    inputMessageTemp.append("OP=").append(list.get(2)).append("\n");
    inputMessageTemp.append("SESSION=").append(sessionVal).append("\n");
    if (transactionTransport.getTransactionName().equals("ELECTRICITY")) {
      if (transactionTransport.getOperator().equals("Reliance Energy Limited - MUMBAI")) {
        inputMessageTemp
            .append("NUMBER=")
            .append(transactionTransport.getConnectionid())
            .append("\n");
        inputMessageTemp
            .append("ACCOUNT=")
            .append(transactionTransport.getCycleNumber())
            .append("\n");
      } else {
        inputMessageTemp
            .append("NUMBER=")
            .append(transactionTransport.getConnectionid())
            .append("\n");
        inputMessageTemp.append("ACCOUNT=").append("\n");
      }
      inputMessageTemp
          .append("AMOUNT=")
          .append(twoDecimalPlaceNumber(transactionTransport.getAmount()))
          .append("\n");

    } else if (transactionTransport.getTransactionName().equals("LANDLINE")) {
      if (transactionTransport.getOperator().equals("MTNL All India")) {
        inputMessageTemp
            .append("NUMBER=")
            .append(transactionTransport.getConnectionid())
            .append("\n");
        inputMessageTemp.append("ACCOUNT=").append(transactionTransport.getCanumber()).append("\n");

      } else {
        inputMessageTemp
            .append("NUMBER=")
            .append(transactionTransport.getConnectionid())
            .append("\n");
        inputMessageTemp.append("ACCOUNT=").append("\n");
      }
      inputMessageTemp
          .append("AMOUNT=")
          .append(twoDecimalPlaceNumber(transactionTransport.getAmount()))
          .append("\n");

    } else if (transactionTransport.getTransactionName().equals("INSURANCE_BILL")) {
      inputMessageTemp
          .append("NUMBER=")
          .append(transactionTransport.getConnectionid())
          .append("\n");
      inputMessageTemp.append("ACCOUNT=").append(transactionTransport.getDob()).append("\n");
      inputMessageTemp
          .append("AMOUNT=")
          .append(twoDecimalPlaceNumber(transactionTransport.getAmount()))
          .append("\n");
    } else if (transactionTransport.getTransactionName().equals("MOBILE_RECHARGE")) {
      inputMessageTemp.append("NUMBER=").append(transactionTransport.getMobileNo()).append("\n");
      inputMessageTemp.append("ACCOUNT=").append("\n");
      inputMessageTemp
          .append("AMOUNT=")
          .append(transactionTransport.getAmount())
          .append("\n"); // transactionTransport.getAmount()

    } else if (transactionTransport.getTransactionName().equals("ICASH_RECHARGE")) {

      iCashRechargeUrl(inputMessageTemp, transactionTransport);
      isCommentRequired = false;

    } else if (transactionTransport.getTransactionName().equals("ICASH_CARD_RECHARGE")) {
      inputMessageTemp.append("NUMBER=").append(transactionTransport.getMobileNo()).append("\n");
      inputMessageTemp
          .append("CARDNO=")
          .append(transactionTransport.getiCashRecharge().getDocumentDetail())
          .append("\n");
      inputMessageTemp
          .append("AMOUNT=")
          .append(CyberTelUtil.twoDecimalPlaceNumber(transactionTransport.getAmount()))
          .append("\n");
      inputMessageTemp
          .append("AMOUNT_ALL=")
          .append(
              CyberTelUtil.twoDecimalPlaceNumber(
                  transactionTransport.getiCashRecharge().getAmountAll()))
          .append("\n");
      inputMessageTemp
          .append("COMMENT=")
          .append(transactionTransport.getiCashRecharge().getComment())
          .append("\n");
      isCommentRequired = false;

    } else if (transactionTransport.getTransactionName().equals("OTP_NUMBER")) {
      moneyTransferOTPNumber(inputMessageTemp, transactionTransport);
    } else if (transactionTransport
        .getTransactionName()
        .equals("MONEY_TRANSFER_USER_REGISTRATION")) {
      moneyTransferUserRegistration(inputMessageTemp, transactionTransport);
    } else if (transactionTransport.getTransactionName().equals("ADD_BANK_DETAIL")) {
      moneyTransferAddBankDetail(inputMessageTemp, transactionTransport);
    } else if (transactionTransport.getTransactionName().equals("GET_BANK_DETAIL")) {
      moneyTransferGetBankDetail(inputMessageTemp, transactionTransport);
    } else if (transactionTransport.getTransactionName().equals("REMITTANCE")) {
      moneyTransferRemittance(inputMessageTemp, transactionTransport);
    } else {
      inputMessageTemp
          .append("NUMBER=")
          .append(transactionTransport.getConnectionid())
          .append("\n");
      inputMessageTemp.append("ACCOUNT=").append("\n");
      if (transactionTransport.getTransactionName().equals("DTH_RECHARGE")
          || transactionTransport.getTransactionName().equals("DATACARD_RECHARGE")) {
        inputMessageTemp
            .append("AMOUNT=")
            .append(transactionTransport.getAmount())
            .append("\n"); // transactionTransport.getAmount()
      } else {
        inputMessageTemp
            .append("AMOUNT=")
            .append(twoDecimalPlaceNumber(transactionTransport.getAmount()))
            .append("\n");
      }
    }

    if (isCommentRequired) {

      inputMessageTemp
          .append("COMMENT=")
          .append("Retailer " + transactionTransport.getFranchiseeMobileNum())
          .append("\n");
    }

    // System.out.println("Before sign in finalInput "
    // + inputMessageTemp.toString());

    finalInput = CyberPlateIntegrationUtil.signMessage(inputMessageTemp.toString());
    // System.out.println("After Signing finalInput=" + finalInput);
    finalInput = URLEncoder.encode(finalInput, "UTF-8");
    // System.out.println("After Encoding finalInput=" + finalInput);

    finalInput = "inputmessage=" + finalInput;
    return finalInput;
  }