@RequestMapping(value = "/{projectId}", method = RequestMethod.GET)
  public String showPaymentForm(@PathVariable Long projectId, Map<String, Object> model) {
    if (!projectDao.isProjectExistById(projectId)) {
      logger.error("Project with id " + projectId + " dosen't exist!");
      model.put("projectId", projectId);
      model.put("projectTestId", -1);
      return "404Page";
    }

    Project project = projectDao.getProjectByProjectId(projectId);
    model.put("project", project);
    model.put("quote", quoteDao.getRandomQuote());

    List<Reward> rewards = projectDao.getRewardsByProjectId(projectId);
    model.put("rewards", rewards);
    model.put("paymentForm", new Payment());
    return "paymentPage";
  }
  @RequestMapping(value = "/project/{projectId}", method = RequestMethod.GET)
  public String showProject(@PathVariable Long projectId, Map<String, Object> model) {
    if (!projectDao.isProjectExistById(projectId)) {
      logger.error("Project with id " + projectId + " dosen't exist!");
      model.put("projectId", projectId);
      model.put("projectTestId", -1);
      return "404Page";
    }

    Project project = projectDao.getProjectByProjectId(projectId);
    project.setAvailableAmount(projectDao.getPaymentSum(projectId));
    model.put("category", project.getCategory());
    model.put("project", project);
    model.put("quote", quoteDao.getRandomQuote());

    List<Question> questions = questionDao.getQuestions(projectId);
    model.put("questions", questions);
    model.put("questionForm", new Question());
    return "projectPage";
  }
  @RequestMapping(value = "/addPayment", method = RequestMethod.POST)
  public String addPayment(
      @Valid @ModelAttribute("paymentForm") Payment payment,
      BindingResult result,
      Map<String, Object> model) {
    Long projectId = payment.getProject().getId();
    if (result.hasErrors()) {
      logger.error("Result " + result + " has errors!");

      model.put("project", payment.getProject());
      List<Reward> rewards = projectDao.getRewardsByProjectId(projectId);
      model.put("rewards", rewards);
      model.put("quote", quoteDao.getRandomQuote());
      return "paymentPage";
    }

    paymentDao.writePaymentInProject(payment);

    return "redirect:/project/" + projectId;
  }