コード例 #1
0
 /**
  * @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
 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);
     }
 }
コード例 #3
0
 public function handle(SetCartSessionIdCommand $command)
 {
     $this->cartService->setSessionId($command->getCartId(), $command->getSessionId());
 }
コード例 #4
0
 public function handle(UpdateCartItemQuantityCommand $command)
 {
     $this->cartService->updateItemQuantity($command->getCartId(), $command->getQuantity());
 }
コード例 #5
0
 public function handle(DeleteCartItemCommand $command)
 {
     $this->cartService->deleteItem($command->getCartItemId());
 }
コード例 #6
0
 public function handle(AddCouponToCartCommand $command)
 {
     $this->cartService->addCouponByCode($command->getCartId(), $command->getCouponCode());
 }
コード例 #7
0
 public function handle(SetCartTaxRateByZip5AndStateCommand $command)
 {
     $taxRate = $this->taxRateService->findByZip5AndState($command->getZip5(), $command->getState());
     $this->cartService->setTaxRate($command->getCartId(), $taxRate);
 }
コード例 #8
0
 public function handle(GetCartByUserIdQuery $query)
 {
     $cart = $this->cartService->findByUser($query->getRequest()->getUserId());
     $query->getResponse()->setCartDTOBuilder($this->dtoBuilderFactory->getCartDTOBuilder($cart));
 }
コード例 #9
0
 public function handle(CopyCartItemsCommand $command)
 {
     $this->cartService->copyCartItems($command->getFromCartId(), $command->getToCartId());
 }
コード例 #10
0
 public function handle(SetExternalShipmentRateCommand $command)
 {
     $this->cartService->setExternalShipmentRate($command->getCartId(), $command->getShipmentRateExternalId(), $command->getShippingAddressDTO());
 }
コード例 #11
0
 public function handle(SetCartUserCommand $command)
 {
     $this->cartService->setUserById($command->getCartId(), $command->getUserId());
 }
コード例 #12
0
 public function handle(RemoveCartCommand $command)
 {
     $this->cartService->removeCart($command->getCartId());
 }
コード例 #13
0
 public function handle(SetCartFlatRateShipmentRateCommand $command)
 {
     $moneyDTO = $command->getMoneyDTO();
     $shipmentRate = new ShipmentRate(new Money($moneyDTO->amount, $moneyDTO->currency));
     $this->cartService->setShipmentRate($command->getCartId(), $shipmentRate);
 }
コード例 #14
0
 public function handle(CreateCartCommand $command)
 {
     $this->cartService->create($command->getCartId(), $command->getRemoteIp4(), $command->getUserId(), $command->getSessionId());
 }