Package com.mustafaiev.tair.cts.dto

Examples of com.mustafaiev.tair.cts.dto.PayerDTO


      @RequestParam(value = "firstname") final String firstname,
      @RequestParam(value = "lastname") final String lastname,
      @RequestParam(value = "email") final String email,
      @RequestParam(value = "password") final String password) {

    final PayerDTO payer = new PayerDTO();
    payer.setFirstname(firstname);
    payer.setEmail(email);
    payer.setLastname(lastname);
    payer.setPassword(password);

    this.payerService.savePayer(payer);
    return "redirect:/payers";
  }
View Full Code Here


  @RequestMapping(value = "/payer/{payerId}/edit", method = RequestMethod.GET)
  public ModelAndView editPayer(
      @PathVariable(value = "payerId") final Long payerId)
      throws DataNotRetrievedException {
    final ModelAndView view = new ModelAndView(ViewNames.ADD_PAYER);
    final PayerDTO payerDTO = this.payerService.getPayer(payerId);
    view.addObject(Attributes.PAYER, payerDTO);
    view.addObject(Attributes.IS_EDIT, true);
    return view;
  }
View Full Code Here

  @RequestMapping(value = "/payer/{payerId}", method = RequestMethod.GET)
  public ModelAndView viewPayer(
      @PathVariable(value = "payerId") final Long payerId)
      throws DataNotRetrievedException {
    final ModelAndView view = new ModelAndView(ViewNames.VIEW_PAYER);
    final PayerDTO payerDTO = this.payerService.getPayer(payerId);
    view.addObject(Attributes.PAYER, payerDTO);
    return view;
  }
View Full Code Here

    final HttpSession session = request.getSession();
    final String email = (String) session
        .getAttribute(Attributes.PAYER_EMAIL);
    session.removeAttribute(Attributes.PAYER_EMAIL);
    final PayerDTO dto = this.payerService.retrieveByEmail(email);
    dto.setState(EntityState.STATE_ACTIVE);
    ModelAndView view = new ModelAndView("redirect:/");
    if (binder.hasErrors()) {
      view = new ModelAndView(ViewNames.GROUP_REGISTRATION);
      view.addObject(Attributes.GROUP, groupDTO);
    } else {
      groupDTO.setState(EntityState.STATE_ACTIVE);
      groupDTO.setPayer(dto.getId());
      this.groupService.registerGroup(groupDTO);
      this.payerService.updatePayer(dto);
    }
    return view;
  }
View Full Code Here

      final Authentication authentication,
      UsernamePasswordAuthenticationToken systemAuthentication,
      final String pass) throws AuthenticationFailedException {

    try {
      final PayerDTO payer = this.payerService
          .retrieveActiveByEmail(authentication.getPrincipal()
              .toString());

      final boolean isValidPassword = this.payerService.checkPassword(
          pass, payer.getPassword());
      if (isValidPassword) {
        systemAuthentication = doAuthenticate(authentication, payer);
      } else {
        throw new AuthenticationFailedException(
            "cts.error.auth.password.not.valid");
View Full Code Here

  private PayerService payerService;

  @Override
  public UserDetails loadUserByUsername(final String email)
      throws UsernameNotFoundException {
    PayerDTO payer = null;
    try {
      payer = this.payerService.retrieveActiveByEmail(email);
    } catch (final DataNotRetrievedException e) {
      LOGGER.error(e.getLocalizedMessage(), e);
    }
View Full Code Here

    this.payerService = payerService;
  }

  @Override
  public void validate(final Object obj, final Errors error) {
    final PayerDTO payer = (PayerDTO) obj;
    ValidationUtils.rejectIfEmpty(error, "email",
        "cts.validator.payer.wrong.email");
    ValidationUtils.rejectIfEmpty(error, "firstname",
        "cts.validator.payer.wrong.firstname");
    ValidationUtils.rejectIfEmpty(error, "lastname",
        "cts.validator.payer.wrong.lastname");
    ValidationUtils.rejectIfEmpty(error, "password",
        "cts.validator.payer.wrong.password");
    try {
      if (this.payerService.isPayerExists(payer.getEmail())) {
        error.reject("cts.validator.payer.exists");
      }
    } catch (final DataNotRetrievedException e) {
      LOGGER.error(e.getLocalizedMessage(), e);
    }
View Full Code Here

    final List<Payer> payers = this.payerDao.retrieveActivePayers();

    final List<PayerDTO> payersList = new ArrayList<PayerDTO>();
    if (payers != null) {
      for (final Payer payer : payers) {
        final PayerDTO payerDto = this.mapper
            .map(payer, PayerDTO.class);
        payerDto.setId(payer.getId());
        payersList.add(payerDto);
      }
    }
    return payersList;
  }
View Full Code Here

    final List<Payer> payers = this.payerDao
        .retrieveActivePayersForGroup(goupKey);
    final List<PayerDTO> payersList = new ArrayList<PayerDTO>();
    if (payers != null) {
      for (final Payer payer : payers) {
        final PayerDTO payerDto = this.mapper
            .map(payer, PayerDTO.class);
        payerDto.setId(payer.getId());
        payersList.add(payerDto);
      }
    }
    return payersList;
  }
View Full Code Here

  @Override
  public PayerDTO retrievePayer(final Long payerId)
      throws DataNotRetrievedException {
    final Payer payer = this.payerDao.retrievePayer(payerId);
    final PayerDTO dto = this.mapper.map(payer, PayerDTO.class);
    dto.setId(payer.getId());
    return dto;
  }
View Full Code Here

TOP

Related Classes of com.mustafaiev.tair.cts.dto.PayerDTO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.