예제 #1
0
  @RequestMapping(
      value = {"/pay_success_url"},
      method = RequestMethod.POST)
  public void successURL(
      @RequestParam(value = "OutSum", required = true) String outSum,
      @RequestParam(value = "InvId", required = true) String invId,
      @RequestParam(value = "SignatureValue", required = true) String signatureValue,
      @RequestParam(value = "Culture", required = false) String culture)
      throws Exception {

    double _money = Double.parseDouble(outSum);
    long _id = Long.parseLong(invId);

    String md5String = md5SignatureValue(_money, _id, password2, ":Shp_item=" + shp_item);
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    UserDetails userDetail = (UserDetails) auth.getPrincipal();
    Users u = userService.getRepository().findUsersByLogin(userDetail.getUsername());

    PaymentSystems ps =
        (PaymentSystems) paymentService.getRepository().findPaymentSystemsByUserId(u.getId());
    if (md5String.equals(ps.getKey())) {
      u.setSummaryCash(u.getSummaryCash() + _money);
      userService.getRepository().save(u);
    }
    HttpGet method = new HttpGet(url.concat("?OK").concat(invId));
    HttpClient client = new DefaultHttpClient();
    client.execute(method);
  }
예제 #2
0
  @RequestMapping(value = {"/pay"})
  public Object requestURL(
      @RequestParam(value = "money", required = true) String money,
      @RequestParam(value = "paymentType", required = true) String paymentType)
      throws Exception {

    int inv_id = 0; // номер заказа
    String inv_desc = "Техническая документация по ROBOKASSA"; // описание заказа
    String email = "*****@*****.**"; // Адрес электронной почты покупателя
    String expirationDate = "2015-07-30T12:00"; // Срок действия счёта

    String in_curr = "BANKOCEAN2R";

    double _money = Double.parseDouble("0" + money);
    String md5String = md5SignatureValue(_money, inv_id, password1, ":Shp_item=" + shp_item);

    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    UserDetails userDetail = (UserDetails) auth.getPrincipal();

    Users u = userService.getRepository().findUsersByLogin(userDetail.getUsername());
    PaymentSystems ps = new PaymentSystems();
    ps.setCash(0);
    ps.setExpiration((new Date()).getTime() + 10000000);
    ps.setKey(md5String);
    ps.setTypeofwallet(Long.parseLong(paymentType));
    ps.setUserId(u.getId());
    paymentService.getRepository().save(ps);

    ModelAndView m = new ModelAndView("jsp/askrequest");
    m.addObject("action", url);
    m.addObject("MrchLogin", login);
    m.addObject("OutSum", _money);
    m.addObject("InvId", inv_id);
    m.addObject("Desc", inv_desc);
    m.addObject("SignatureValue", md5String);
    m.addObject("Shp_item", shp_item);
    m.addObject("IncCurrLabel", in_curr);
    m.addObject("Culture", lang);
    m.addObject("Email", email);
    m.addObject("ExpirationDate", expirationDate);
    m.addObject("OutSumCurrency", outSumCurrency);
    return m;
  }