/** * @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); }
public function handle(AddCartItemCommand $command) { $cartItem = $this->cartService->addItem($command->getCartItemId(), $command->getCartId(), $command->getProductId(), $command->getQuantity()); $optionProductIds = $command->getOptionProductIds(); $optionValueIds = $command->getOptionValueIds(); $textOptionValueDTOs = $command->getTextOptionValueDTOs(); if (!empty($optionProductIds)) { $this->cartService->addItemOptionProducts($cartItem->getId(), $optionProductIds); } if (!empty($optionValueIds)) { $this->cartService->addItemOptionValues($cartItem->getId(), $optionValueIds); } if (!empty($textOptionValueDTOs)) { $this->cartService->addItemTextOptionValues($cartItem->getId(), $textOptionValueDTOs); } }
public function handle(SetCartSessionIdCommand $command) { $this->cartService->setSessionId($command->getCartId(), $command->getSessionId()); }
public function handle(UpdateCartItemQuantityCommand $command) { $this->cartService->updateItemQuantity($command->getCartId(), $command->getQuantity()); }
public function handle(DeleteCartItemCommand $command) { $this->cartService->deleteItem($command->getCartItemId()); }
public function handle(AddCouponToCartCommand $command) { $this->cartService->addCouponByCode($command->getCartId(), $command->getCouponCode()); }
public function handle(SetCartTaxRateByZip5AndStateCommand $command) { $taxRate = $this->taxRateService->findByZip5AndState($command->getZip5(), $command->getState()); $this->cartService->setTaxRate($command->getCartId(), $taxRate); }
public function handle(GetCartByUserIdQuery $query) { $cart = $this->cartService->findByUser($query->getRequest()->getUserId()); $query->getResponse()->setCartDTOBuilder($this->dtoBuilderFactory->getCartDTOBuilder($cart)); }
public function handle(CopyCartItemsCommand $command) { $this->cartService->copyCartItems($command->getFromCartId(), $command->getToCartId()); }
public function handle(SetExternalShipmentRateCommand $command) { $this->cartService->setExternalShipmentRate($command->getCartId(), $command->getShipmentRateExternalId(), $command->getShippingAddressDTO()); }
public function handle(SetCartUserCommand $command) { $this->cartService->setUserById($command->getCartId(), $command->getUserId()); }
public function handle(RemoveCartCommand $command) { $this->cartService->removeCart($command->getCartId()); }
public function handle(SetCartFlatRateShipmentRateCommand $command) { $moneyDTO = $command->getMoneyDTO(); $shipmentRate = new ShipmentRate(new Money($moneyDTO->amount, $moneyDTO->currency)); $this->cartService->setShipmentRate($command->getCartId(), $shipmentRate); }
public function handle(CreateCartCommand $command) { $this->cartService->create($command->getCartId(), $command->getRemoteIp4(), $command->getUserId(), $command->getSessionId()); }