diff --git a/vendor/magento/module-negotiable-quote-shared-catalog/Plugin/Catalog/Api/ProductRepositoryApplyFilter.php b/vendor/magento/module-negotiable-quote-shared-catalog/Plugin/Catalog/Api/ProductRepositoryApplyFilter.php deleted file mode 100644 index ab63e7065a8f..000000000000 --- a/vendor/magento/module-negotiable-quote-shared-catalog/Plugin/Catalog/Api/ProductRepositoryApplyFilter.php +++ /dev/null @@ -1,156 +0,0 @@ -config = $config; - $this->customerGroupManagement = $customerGroupManagement; - $this->companyContext = $companyContext; - $this->request = $request; - $this->quoteRepository = $quoteRepository; - $this->storeManager = $storeManager; - $this->sharedCatalogProductItemRetriever = $sharedCatalogProductItemRetriever; - } - - /** - * Check if product is available for this customer group. - * - * @param \Magento\Catalog\Api\ProductRepositoryInterface $subject - * @param \Magento\Catalog\Api\Data\ProductInterface $product - * @return \Magento\Catalog\Api\Data\ProductInterface - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function afterGetById( - \Magento\Catalog\Api\ProductRepositoryInterface $subject, - \Magento\Catalog\Api\Data\ProductInterface $product - ) { - $this->applyFilter($product); - return $product; - } - - /** - * Check if product is available for current customer group. - * - * @param \Magento\Catalog\Api\ProductRepositoryInterface $subject - * @param \Magento\Catalog\Api\Data\ProductInterface $product - * @return \Magento\Catalog\Api\Data\ProductInterface - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function afterGet( - \Magento\Catalog\Api\ProductRepositoryInterface $subject, - \Magento\Catalog\Api\Data\ProductInterface $product - ) { - $this->applyFilter($product); - return $product; - } - - /** - * Apply filter to search results. - * - * @param \Magento\Catalog\Api\Data\ProductInterface $product - * @return void - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - private function applyFilter(\Magento\Catalog\Api\Data\ProductInterface $product) - { - $website = $this->storeManager->getWebsite()->getId(); - if (!$this->config->isActive(ScopeInterface::SCOPE_WEBSITE, $website)) { - return; - } - $customerGroupId = $this->getCustomerGroupId(); - if ($customerGroupId === null || $this->customerGroupManagement->isPrimaryCatalogAvailable($customerGroupId)) { - return; - } - $sku = $product->getData(\Magento\Catalog\Api\Data\ProductInterface::SKU); - $items = $this->sharedCatalogProductItemRetriever->retrieve($customerGroupId, $sku); - if (empty($items)) { - throw new \Magento\Framework\Exception\NoSuchEntityException( - __("The product that was requested doesn't exist. Verify the product and try again.") - ); - } - } - - /** - * Get customer group id from Negotiable Quote page. - * - * @return mixed|null - */ - private function getCustomerGroupId() - { - $customerGroupId = $this->companyContext->getCustomerGroupId(); - if ($this->request->getParam('negotiable_quote_update_flag') - && $this->request->getParam('quote_id')) { - /** @var \Magento\Quote\Api\Data\CartInterface $quote */ - $quote = $this->quoteRepository->get($this->request->getParam('quote_id'), ['*']); - $customerGroupId = $quote->getCustomerGroupId(); - } - - return $customerGroupId; - } -} diff --git a/vendor/magento/module-negotiable-quote-shared-catalog/etc/frontend/di.xml b/vendor/magento/module-negotiable-quote-shared-catalog/etc/frontend/di.xml index 587e55dd7cc5..0b1175b0cd94 100644 --- a/vendor/magento/module-negotiable-quote-shared-catalog/etc/frontend/di.xml +++ b/vendor/magento/module-negotiable-quote-shared-catalog/etc/frontend/di.xml @@ -6,7 +6,4 @@ */ --> - - -