/**
  * @param CreateOrderFromCartCommand $command
  * @throws EntityValidatorException
  */
 public function handle(CreateOrderFromCartCommand $command)
 {
     $cart = $this->cartService->findOneById($command->getCartId());
     $user = $this->userService->findOneById($command->getUserId());
     $order = $this->orderService->createOrderFromCart($command->getOrderId(), $user, $cart, $this->cartCalculator, $command->getIp4(), OrderAddressDTOBuilder::createFromDTO($command->getShippingAddressDTO()), OrderAddressDTOBuilder::createFromDTO($command->getBillingAddressDTO()), CreditCardDTOBuilder::createFromDTO($command->getCreditCardDTO()));
     $this->cartService->delete($cart);
 }
Пример #2
0
 /**
  * @param UploadFileDTO $uploadFileDTO
  * @param UuidInterface $userId
  * @param UuidInterface $productId
  * @return void
  */
 public function createAttachmentForUserProduct(UploadFileDTO $uploadFileDTO, UuidInterface $userId, UuidInterface $productId)
 {
     $user = $this->userService->findOneById($userId);
     $product = $this->productService->findOneById($productId);
     $attachment = $this->createAttachment($uploadFileDTO);
     $userProductAttachment = new UserProductAttachment($user, $product, $attachment);
     $this->attachmentRepository->create($userProductAttachment);
 }
Пример #3
0
 public function handle(ListUsersQuery $query)
 {
     $paginationDTO = $query->getRequest()->getPaginationDTO();
     $pagination = new Pagination($paginationDTO->maxResults, $paginationDTO->page);
     $users = $this->userService->getAllUsers($query->getRequest()->getQueryString(), $pagination);
     $query->getResponse()->setPaginationDTOBuilder($this->dtoBuilderFactory->getPaginationDTOBuilder($pagination));
     foreach ($users as $user) {
         $query->getResponse()->addUserDTOBuilder($this->dtoBuilderFactory->getUserDTOBuilder($user));
     }
 }
 public function handle(ChangePasswordCommand $command)
 {
     $this->userService->changePassword($command->getUserId(), $command->getPassword());
 }
 public function handle(GetUserByEmailQuery $query)
 {
     $product = $this->userService->findOneByEmail($query->getRequest()->getEmail());
     $query->getResponse()->setUserDTOBuilder($this->dtoBuilderFactory->getUserDTOBuilder($product));
 }
Пример #6
0
 public function handle(CreateUserCommand $command)
 {
     $user = UserDTOBuilder::createFromDTO($command->getUserId(), $command->getUserDTO());
     $this->userService->create($user);
 }
 public function handle(LoginWithTokenCommand $command)
 {
     $this->userService->loginWithToken($command->getEmail(), $command->getToken(), $command->getRemoteIp4());
 }
Пример #8
0
 public function handle(LoginCommand $command)
 {
     $this->userService->login($command->getEmail(), $command->getPassword(), $command->getRemoteIp4());
 }
 public function handle(ResetPasswordCommand $command)
 {
     $this->userService->requestPasswordResetToken($command->getEmail(), $command->getUserAgent(), $command->getIp4());
 }