commentRepository = $commentRepository; $this->criteriaBuilder = $criteriaBuilder; $this->filterBuilder = $filterBuilder; $this->repository = $repository; $this->notifier = $notifier; } /** * Returns shipment label * * @param int $id * @return string */ public function getLabel($id) { return (string)$this->repository->get($id)->getShippingLabel(); } /** * Returns list of comments attached to shipment * @param int $id * @return \Magento\Sales\Api\Data\ShipmentCommentSearchResultInterface */ public function getCommentsList($id) { $this->criteriaBuilder->addFilters( [$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()] ); $searchCriteria = $this->criteriaBuilder->create(); return $this->commentRepository->getList($searchCriteria); } /** * Notify user * * @param int $id * @return bool */ public function notify($id) { $shipment = $this->repository->get($id); return $this->notifier->notify($shipment); } }