public function handle(GetTagsByIdsQuery $query)
 {
     $tags = $this->tagService->getTagsByIds($query->getRequest()->getTagIds());
     foreach ($tags as $tag) {
         $query->getResponse()->addTagDTOBuilder($this->dtoBuilderFactory->getTagDTOBuilder($tag));
     }
 }
 /**
  * @return static
  */
 public function withProductAttributes()
 {
     foreach ($this->entity->getProductAttributes() as $productAttribute) {
         $this->entityDTO->productAttributes[] = $this->dtoBuilderFactory->getProductAttributeDTOBuilder($productAttribute)->build();
     }
     return $this;
 }
 public function handle(GetOrdersByUserQuery $query)
 {
     $orders = $this->orderService->getOrdersByUserId($query->getRequest()->getUserId());
     foreach ($orders as $order) {
         $query->getResponse()->addOrderDTOBuilder($this->dtoBuilderFactory->getOrderDTOBuilder($order));
     }
 }
Esempio n. 4
0
 /**
  * @return static
  */
 public function withTags()
 {
     foreach ($this->entity->getTags() as $tag) {
         $this->entityDTO->tags[] = $this->dtoBuilderFactory->getTagDTOBuilder($tag)->build();
     }
     return $this;
 }
 /**
  * @return static
  */
 public function withCartPriceRules()
 {
     foreach ($this->entity->getCartPriceRules() as $cartPriceRule) {
         $this->entityDTO->cartPriceRules[] = $this->dtoBuilderFactory->getCartPriceRuleDTOBuilder($cartPriceRule)->build();
     }
     return $this;
 }
Esempio n. 6
0
 public function handle(GetOrderQuery $query)
 {
     $request = $query->getRequest();
     $response = $query->getResponse();
     $order = $this->orderService->findOneById($request->getOrderId());
     $response->setOrderDTOBuilder($this->dtoBuilderFactory->getOrderDTOBuilder($order));
 }
 /**
  * @return static
  */
 public function withOrderItems()
 {
     foreach ($this->entity->getOrderItems() as $orderItem) {
         $this->entityDTO->orderItems[] = $this->dtoBuilderFactory->getOrderItemDTOBuilder($orderItem)->build();
     }
     return $this;
 }
Esempio n. 8
0
 /**
  * @return static
  */
 public function withLogins()
 {
     foreach ($this->entity->getUserLogins() as $login) {
         $this->entityDTO->userLogins[] = $this->dtoBuilderFactory->getUserLoginDTOBuilder($login)->build();
     }
     return $this;
 }
 public function handle(GetRandomProductsQuery $query)
 {
     $products = $this->productService->getRandomProducts($query->getRequest()->getLimit());
     foreach ($products as $product) {
         $query->getResponse()->addProductDTOBuilder($this->dtoBuilderFactory->getProductDTOBuilder($product));
     }
 }
 public function __construct(ShipmentRate $shipmentRate, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $shipmentRate;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = new ShipmentRateDTO();
     $this->entityDTO->externalId = $this->entity->getExternalId();
     $this->entityDTO->shipmentExternalId = $this->entity->getShipmentExternalId();
     $this->entityDTO->service = $this->entity->getService();
     $this->entityDTO->carrier = $this->entity->getCarrier();
     $this->entityDTO->rate = $this->dtoBuilderFactory->getMoneyDTOBuilder($this->entity->getRate())->build();
     $this->entityDTO->isDeliveryDateGuaranteed = $this->entity->isDeliveryDateGuaranteed();
     $this->entityDTO->deliveryDays = $this->entity->getDeliveryDays();
     $this->entityDTO->estDeliveryDays = $this->entity->getEstDeliveryDays();
     if ($this->entity->getDeliveryMethod()->getId() !== null) {
         $this->entityDTO->deliveryMethod = $this->dtoBuilderFactory->getDeliveryMethodTypeDTOBuilder($this->entity->getDeliveryMethod())->build();
     }
     if ($this->entity->getDeliveryDate() !== null) {
         $this->entityDTO->deliveryDate = $this->entity->getDeliveryDate();
     }
     if ($this->entity->getListRate() !== null) {
         $this->entityDTO->listRate = $this->dtoBuilderFactory->getMoneyDTOBuilder($this->entity->getListRate())->build();
     }
     if ($this->entity->getRetailRate() !== null) {
         $this->entityDTO->retailRate = $this->dtoBuilderFactory->getMoneyDTOBuilder($this->entity->getRetailRate())->build();
     }
 }
Esempio n. 11
0
 /**
  * @return static
  */
 public function withCoupons()
 {
     foreach ($this->entity->getCoupons() as $key => $coupon) {
         $this->entityDTO->coupons[$key] = $this->dtoBuilderFactory->getCouponDTOBuilder($coupon)->build();
     }
     return $this;
 }
Esempio n. 12
0
 /**
  * @return static
  */
 public function withCartItemTextOptionValues()
 {
     foreach ($this->entity->getCartItemTextOptionValues() as $cartItemTextOptionValue) {
         $this->entityDTO->cartItemTextOptionValues[] = $this->dtoBuilderFactory->getCartItemTextOptionValueDTOBuilder($cartItemTextOptionValue)->withTextOption()->build();
     }
     return $this;
 }
 public function withUser()
 {
     $user = $this->entity->getUser();
     if ($user !== null) {
         $this->entityDTO->user = $this->dtoBuilderFactory->getUserDTOBuilder($user)->build();
     }
     return $this;
 }
 /**
  * @return static
  */
 public function withOption()
 {
     $option = $this->entity->getOption();
     if ($option !== null) {
         $this->entityDTO->option = $this->dtoBuilderFactory->getOptionDTOBuilder($option)->build();
     }
     return $this;
 }
Esempio n. 15
0
 /**
  * @return static
  */
 public function withTag()
 {
     $tag = $this->entity->getTag();
     if (!empty($tag)) {
         $this->entityDTO->tag = $this->dtoBuilderFactory->getTagDTOBuilder($tag)->build();
     }
     return $this;
 }
 public function handle(ListTaxRatesQuery $query)
 {
     $request = $query->getRequest();
     $taxRates = $this->taxRateService->findAll();
     foreach ($taxRates as $taxRate) {
         $query->getResponse()->addTaxRateDTOBuilder($this->dtoBuilderFactory->getTaxRateDTOBuilder($taxRate));
     }
 }
 /**
  * @return static
  */
 public function withProduct()
 {
     $product = $this->entity->getProduct();
     if (!empty($product)) {
         $this->entityDTO->product = $this->dtoBuilderFactory->getProductDTOBuilder($product)->build();
     }
     return $this;
 }
 public function __construct(ShipmentItem $shipmentItem, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $shipmentItem;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = new ShipmentItemDTO();
     $this->setId();
     $this->setTime();
     $this->entityDTO->orderItem = $this->dtoBuilderFactory->getOrderItemDTOBuilder($this->entity->getOrderItem())->build();
 }
 public function handle(GetLowestShipmentRatesByDeliveryMethodQuery $query)
 {
     $request = $query->getRequest();
     $response = $query->getResponse();
     $shipmentRates = $this->shipmentGateway->getTrimmedRates($request->getToAddressDTO(), $request->getParcelDTO());
     foreach ($shipmentRates as $shipmentRate) {
         $response->addShipmentRateDTOBuilder($this->dtoBuilderFactory->getShipmentRateDTOBuilder($shipmentRate));
     }
 }
 public function __construct(CartItemOptionValue $cartItemOptionValue, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $cartItemOptionValue;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = new CartItemOptionValueDTO();
     $this->setId();
     $this->setTime();
     $this->entityDTO->optionValue = $this->dtoBuilderFactory->getOptionValueDTOBuilder($this->entity->getOptionValue())->withAllData()->build();
 }
 public function handle(GetProductsByTagQuery $query)
 {
     $paginationDTO = $query->getRequest()->getPaginationDTO();
     $pagination = new Pagination($paginationDTO->maxResults, $paginationDTO->page);
     $products = $this->productService->getProductsByTagId($query->getRequest()->getTagId(), $pagination);
     $query->getResponse()->setPaginationDTOBuilder($this->dtoBuilderFactory->getPaginationDTOBuilder($pagination));
     foreach ($products as $product) {
         $query->getResponse()->addProductDTOBuilder($this->dtoBuilderFactory->getProductDTOBuilder($product));
     }
 }
Esempio n. 22
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));
     }
 }
Esempio n. 23
0
 public function handle(ListOptionsQuery $query)
 {
     $paginationDTO = $query->getRequest()->getPaginationDTO();
     $pagination = new Pagination($paginationDTO->maxResults, $paginationDTO->page);
     $options = $this->optionService->getAllOptions($query->getRequest()->getQueryString(), $pagination);
     $query->getResponse()->setPaginationDTOBuilder($this->dtoBuilderFactory->getPaginationDTOBuilder($pagination));
     foreach ($options as $option) {
         $query->getResponse()->addOptionDTOBuilder($this->dtoBuilderFactory->getOptionDTOBuilder($option));
     }
 }
 public function handle(ListProductsQuery $query)
 {
     $paginationDTO = $query->getRequest()->getPaginationDTO();
     $pagination = new Pagination($paginationDTO->maxResults, $paginationDTO->page);
     $tags = $this->tagService->getAllProducts($query->getRequest()->getQueryString(), $pagination);
     $query->getResponse()->setPaginationDTOBuilder($this->dtoBuilderFactory->getPaginationDTOBuilder($pagination));
     foreach ($tags as $tag) {
         $query->getResponse()->addProductDTOBuilder($this->dtoBuilderFactory->getProductDTOBuilder($tag));
     }
 }
Esempio n. 25
0
 /**
  * @return static
  */
 public function withProductQuantityDiscounts()
 {
     $productQuantityDiscounts = $this->entity->getProductQuantityDiscounts();
     if ($productQuantityDiscounts !== null) {
         foreach ($productQuantityDiscounts as $productQuantityDiscount) {
             $this->entityDTO->productQuantityDiscounts[] = $this->dtoBuilderFactory->getProductQuantityDiscountDTOBuilder($productQuantityDiscount)->build();
         }
     }
     return $this;
 }
 public function __construct(Warehouse $warehouse, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $warehouse;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = new WarehouseDTO();
     $this->setId();
     $this->setTime();
     $this->entityDTO->name = $this->entity->getName();
     $this->entityDTO->address = $this->dtoBuilderFactory->getAddressDTOBuilder($this->entity->getAddress())->build();
 }
Esempio n. 27
0
 public function handle(ListOrdersQuery $query)
 {
     $paginationDTO = $query->getRequest()->getPaginationDTO();
     $pagination = new Pagination($paginationDTO->maxResults, $paginationDTO->page);
     // TODO: Add query search
     $queryString = $query->getRequest()->getQueryString();
     $orders = $this->orderService->getLatestOrders($pagination);
     $query->getResponse()->setPaginationDTOBuilder($this->dtoBuilderFactory->getPaginationDTOBuilder($pagination));
     foreach ($orders as $order) {
         $query->getResponse()->addOrderDTOBuilder($this->dtoBuilderFactory->getOrderDTOBuilder($order));
     }
 }
Esempio n. 28
0
 public function handle(ListCouponsQuery $query)
 {
     $request = $query->getRequest();
     $response = $query->getResponse();
     $paginationDTO = $request->getPaginationDTO();
     $pagination = new Pagination($paginationDTO->maxResults, $paginationDTO->page);
     $coupons = $this->couponService->getAllCoupons($request->getQueryString(), $pagination);
     $response->setPaginationDTOBuilder($this->dtoBuilderFactory->getPaginationDTOBuilder($pagination));
     foreach ($coupons as $coupon) {
         $response->addCouponDTOBuilder($this->dtoBuilderFactory->getCouponDTOBuilder($coupon));
     }
 }
 public function __construct(AbstractPromotion $promotion, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $promotion;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = $this->getEntityDTO();
     $this->setId();
     $this->setTime();
     $this->setStartEndDate();
     $this->setRedemption();
     $this->entityDTO->name = $this->entity->getName();
     $this->entityDTO->value = $this->entity->getValue();
     $this->entityDTO->reducesTaxSubtotal = $this->entity->getReducesTaxSubtotal();
     $this->entityDTO->isRedemptionCountValid = $this->entity->isRedemptionCountValid();
     $this->entityDTO->type = $this->dtoBuilderFactory->getPromotionTypeDTOBuilder($this->entity->getType())->build();
 }
Esempio n. 30
0
 public function __construct(Address $address, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $address;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = new AddressDTO();
     $this->entityDTO->attention = $this->entity->getAttention();
     $this->entityDTO->company = $this->entity->getCompany();
     $this->entityDTO->address1 = $this->entity->getaddress1();
     $this->entityDTO->address2 = $this->entity->getaddress2();
     $this->entityDTO->city = $this->entity->getcity();
     $this->entityDTO->state = $this->entity->getstate();
     $this->entityDTO->zip5 = $this->entity->getzip5();
     $this->entityDTO->zip4 = $this->entity->getzip4();
     $this->entityDTO->point = $this->dtoBuilderFactory->getPointDTOBuilder($this->entity->getPoint())->build();
 }