/**
  * @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);
 }
Ejemplo n.º 2
0
 public function handle(GetCartQuery $query)
 {
     $cart = $this->cartService->findOneById($query->getRequest()->getCartId());
     $query->getResponse()->setCartDTOBuilder($this->dtoBuilderFactory->getCartDTOBuilder($cart));
 }