Example #1
0
 @RequestMapping(value = "/forgetform", method = RequestMethod.POST)
 public ModelAndView forgetForm(
     HttpServletRequest request, @RequestParam("id") String hdnmerchantId) {
   System.out.println("In auth forgetForm method");
   String mailid = request.getParameter("email");
   System.out.println("mailid" + mailid);
   ModelAndView model = new ModelAndView();
   Merchant merchant = new Merchant();
   String randomPwd = generateRandomString();
   String encryptedPwd = encrypt(randomPwd);
   System.out.println("merchantId==>" + encryptedPwd);
   if (encryptedPwd != null) {
     merchant.setAutogeneratedPassword(encryptedPwd);
   } else {
     merchant.setAutogeneratedPassword("");
   }
   String password = merchant.getAutogeneratedPassword();
   System.out.println("password==>" + password);
   String decryptedPwd = decrypt(password);
   merchantService.updateautopassword(hdnmerchantId, decryptedPwd);
   List<Merchant> merchantList = merchantService.getMerchantdetails(hdnmerchantId);
   System.out.println("Modifylist" + merchantList);
   String mername = merchantList.get(0).getMerchantName();
   System.out.println("mername" + mername);
   sendEmailPassword(mailid, request, password, mername);
   String merchantId = merchantList.get(0).getMerchantId();
   System.out.println("mername" + mername);
   model.addObject("mername", mername);
   model.addObject("merchantId", hdnmerchantId);
   model.setViewName("acquirer/mailforget");
   return model;
 }
Example #2
0
  @RequestMapping(value = "/updatedetails", method = RequestMethod.POST)
  public @ResponseBody ModelAndView updateDetails(HttpServletRequest request) {
    System.out.println("In auth updatedetail method");
    ModelAndView model = null;
    try {

      AuditTrial audit = new AuditTrial();
      HttpSession sessionObj = request.getSession();

      String merchantid = request.getParameter("merchantId").trim();
      System.out.println("merchantid" + merchantid);
      String merchantname = request.getParameter("merchantName");
      String merchantemail = request.getParameter("merchantEmailId");
      String merchantdob = request.getParameter("merchantDOB");
      System.out.println("merchantdob" + merchantdob);
      String merchantmobile = request.getParameter("merchantMobile");
      // long mermobile = Long.to(merchantmobile);
      String merchantbusiness = request.getParameter("merchantBusiness");
      String merchantregion = request.getParameter("merchantregion");
      String merchantcountry = request.getParameter("merchantCountry");
      String merchanttel = request.getParameter("merchantTel");
      // long mertel = Long.parseLong(merchanttel);
      String merchantaddress = request.getParameter("merchantAddress");
      System.out.println("merchantaddress" + merchantaddress);
      String merchantmember = request.getParameter("merchantmember");
      String merchanttxnfee = request.getParameter("transactionfee");
      // long mertxn = Long.parseLong(merchanttxnfee);
      String id = request.getParameter("merchant_id");
      long merid = Long.valueOf(id).longValue();
      System.out.println("check" + merid);

      Merchant merchant = new Merchant();
      merchant.setId(merid);
      merchant.setMerchantId(merchantid);
      merchant.setMerchantName(merchantname);
      // merchant.setDOB(merchantdob);
      DateFormat df2 = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");

      Date merchantDOB;
      try {
        merchantDOB = (Date) df2.parse(merchantdob);
        System.out.println("merchantDOB" + merchantDOB);
        merchant.setDOB(merchantDOB);
      } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }

      merchant.setMobile(Long.valueOf(merchantmobile).longValue());

      merchant.setEmailId(merchantemail);
      merchant.setTelephone(Long.valueOf(merchanttel).longValue());
      merchant.setBusiness(merchantbusiness);
      merchant.setRegion(merchantregion);
      merchant.setAddress(merchantaddress);
      merchant.setCountry(merchantcountry);
      merchant.setMembershiptype(merchantmember);
      merchant.setTransactionfee(Long.valueOf(merchanttxnfee).longValue());
      merchantService.updatemodifydetails(merchant);

      // --audit process start--
      DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
      // get current date time with Date()
      Date date = new Date();
      System.out.println("date and time==>" + dateFormat.format(date));

      String adminname = (String) sessionObj.getAttribute("adminname");
      audit.setUsername(adminname);
      audit.setDescription("Update the merchent '" + merchantname + "'");
      audit.setLogdate(dateFormat.format(date));

      int auditid = merchantService.saveAudit(audit);
      // --audit process end--

      model = new ModelAndView("treatement/searchmerchant");
    } catch (Exception e) {
      e.printStackTrace();
    }
    return model;
  }