|
| 1 | +diff --git a/vendor/magento/module-rma/Helper/Data.php b/vendor/magento/module-rma/Helper/Data.php |
| 2 | +index 889a7b854a23..16dc3025e537 100644 |
| 3 | +--- a/vendor/magento/module-rma/Helper/Data.php |
| 4 | ++++ b/vendor/magento/module-rma/Helper/Data.php |
| 5 | +@@ -50,15 +50,11 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper |
| 6 | + protected $_allowedHashKeys = ['rma_id', 'track_id']; |
| 7 | + |
| 8 | + /** |
| 9 | +- * Country factory |
| 10 | +- * |
| 11 | + * @var \Magento\Directory\Model\CountryFactory |
| 12 | + */ |
| 13 | + protected $_countryFactory; |
| 14 | + |
| 15 | + /** |
| 16 | +- * Region factory |
| 17 | +- * |
| 18 | + * @var \Magento\Directory\Model\RegionFactory |
| 19 | + */ |
| 20 | + protected $_regionFactory; |
| 21 | +@@ -111,8 +107,6 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper |
| 22 | + protected $_carrierFactory; |
| 23 | + |
| 24 | + /** |
| 25 | +- * Filter manager |
| 26 | +- * |
| 27 | + * @var \Magento\Framework\Filter\FilterManager |
| 28 | + */ |
| 29 | + protected $_filterManager; |
| 30 | +diff --git a/vendor/magento/module-rma-graph-ql/Model/Resolver/CustomerOrder/EligibleItems.php b/vendor/magento/module-rma-graph-ql/Model/Resolver/CustomerOrder/EligibleItems.php |
| 31 | +index b090729551df..ef2369c0e345 100644 |
| 32 | +--- a/vendor/magento/module-rma-graph-ql/Model/Resolver/CustomerOrder/EligibleItems.php |
| 33 | ++++ b/vendor/magento/module-rma-graph-ql/Model/Resolver/CustomerOrder/EligibleItems.php |
| 34 | +@@ -1,14 +1,22 @@ |
| 35 | + <?php |
| 36 | + /** |
| 37 | +- * Copyright © Magento, Inc. All rights reserved. |
| 38 | +- * See COPYING.txt for license details. |
| 39 | ++ * Copyright 2025 Adobe |
| 40 | ++ * All Rights Reserved. |
| 41 | ++ * |
| 42 | ++ * NOTICE: All information contained herein is, and remains |
| 43 | ++ * the property of Adobe and its suppliers, if any. The intellectual |
| 44 | ++ * and technical concepts contained herein are proprietary to Adobe |
| 45 | ++ * and its suppliers and are protected by all applicable intellectual |
| 46 | ++ * property laws, including trade secret and copyright laws. |
| 47 | ++ * Dissemination of this information or reproduction of this material |
| 48 | ++ * is strictly forbidden unless prior written permission is obtained |
| 49 | ++ * from Adobe. |
| 50 | + */ |
| 51 | + |
| 52 | + declare(strict_types=1); |
| 53 | + |
| 54 | + namespace Magento\RmaGraphQl\Model\Resolver\CustomerOrder; |
| 55 | + |
| 56 | +-use Magento\Catalog\Api\ProductRepositoryInterface; |
| 57 | + use Magento\Framework\Exception\LocalizedException; |
| 58 | + use Magento\Framework\GraphQl\Config\Element\Field; |
| 59 | + use Magento\Framework\GraphQl\Query\ResolverInterface; |
| 60 | +@@ -24,63 +32,48 @@ |
| 61 | + class EligibleItems implements ResolverInterface |
| 62 | + { |
| 63 | + /** |
| 64 | +- * @var ProductRepositoryInterface |
| 65 | +- */ |
| 66 | +- private $productRepository; |
| 67 | +- |
| 68 | +- /** |
| 69 | +- * @var StoreManagerInterface |
| 70 | +- */ |
| 71 | +- private $storeManager; |
| 72 | +- |
| 73 | +- /** |
| 74 | +- * @var OrderItemProvider |
| 75 | +- */ |
| 76 | +- private $orderItemProvider; |
| 77 | +- |
| 78 | +- /** |
| 79 | +- * @var RmaHelper |
| 80 | +- */ |
| 81 | +- private $helper; |
| 82 | +- |
| 83 | +- /** |
| 84 | +- * @param ProductRepositoryInterface $productRepository |
| 85 | ++ * EligibleItems Constructor |
| 86 | ++ * |
| 87 | + * @param StoreManagerInterface $storeManager |
| 88 | + * @param OrderItemProvider $orderItemProvider |
| 89 | + * @param RmaHelper $helper |
| 90 | + */ |
| 91 | + public function __construct( |
| 92 | +- ProductRepositoryInterface $productRepository, |
| 93 | +- StoreManagerInterface $storeManager, |
| 94 | +- OrderItemProvider $orderItemProvider, |
| 95 | +- RmaHelper $helper |
| 96 | ++ private readonly StoreManagerInterface $storeManager, |
| 97 | ++ private readonly OrderItemProvider $orderItemProvider, |
| 98 | ++ private readonly RmaHelper $helper |
| 99 | + ) { |
| 100 | +- $this->productRepository = $productRepository; |
| 101 | +- $this->storeManager = $storeManager; |
| 102 | +- $this->orderItemProvider = $orderItemProvider; |
| 103 | +- $this->helper = $helper; |
| 104 | + } |
| 105 | + |
| 106 | + /** |
| 107 | + * @inheritdoc |
| 108 | + */ |
| 109 | +- public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) |
| 110 | +- { |
| 111 | +- if (!isset($value['model']) && !($value['model'] instanceof OrderInterface)) { |
| 112 | ++ public function resolve( |
| 113 | ++ Field $field, |
| 114 | ++ $context, |
| 115 | ++ ResolveInfo $info, |
| 116 | ++ ?array $value = null, |
| 117 | ++ ?array $args = null |
| 118 | ++ ): array { |
| 119 | ++ if (!($value['model'] ?? null) instanceof OrderInterface) { |
| 120 | + throw new LocalizedException(__('"model" value should be specified')); |
| 121 | + } |
| 122 | ++ |
| 123 | + /** @var OrderInterface $order */ |
| 124 | + $order = $value['model']; |
| 125 | + |
| 126 | + $itemsList = []; |
| 127 | +- $storeId = $this->storeManager->getStore()->getId(); |
| 128 | +- foreach ($order->getItems() as $item) { |
| 129 | +- $product = $this->productRepository->getById($item->getProductId()); |
| 130 | +- if ($this->helper->canReturnProduct($product, $storeId)) { |
| 131 | +- $this->orderItemProvider->addOrderItemId((int)$item->getId()); |
| 132 | +- $orderItem = $this->orderItemProvider->getOrderItemById((int)$item->getId()); |
| 133 | +- $orderItem['eligible_for_return'] = true; |
| 134 | +- $itemsList[] = $orderItem; |
| 135 | ++ |
| 136 | ++ foreach ($order->getAllVisibleItems() as $item) { |
| 137 | ++ $qtyAvailable = $item->getQtyOrdered() - $item->getQtyReturned(); |
| 138 | ++ |
| 139 | ++ if ($this->helper->canReturnProduct( |
| 140 | ++ $item->getProduct(), |
| 141 | ++ $this->storeManager->getStore()->getId() |
| 142 | ++ ) && $qtyAvailable > 0) { |
| 143 | ++ $itemId = (int)$item->getId(); |
| 144 | ++ $this->orderItemProvider->addOrderItemId($itemId); |
| 145 | ++ $itemsList[] = $this->orderItemProvider->getOrderItemById($itemId); |
| 146 | + } |
| 147 | + } |
| 148 | + |
| 149 | +diff --git a/vendor/magento/module-rma-graph-ql/Model/Resolver/CustomerOrder/Item/IsEligible.php b/vendor/magento/module-rma-graph-ql/Model/Resolver/CustomerOrder/Item/IsEligible.php |
| 150 | +index 6951954dfc9e..3a5cc569a79c 100644 |
| 151 | +--- a/vendor/magento/module-rma-graph-ql/Model/Resolver/CustomerOrder/Item/IsEligible.php |
| 152 | ++++ b/vendor/magento/module-rma-graph-ql/Model/Resolver/CustomerOrder/Item/IsEligible.php |
| 153 | +@@ -1,14 +1,22 @@ |
| 154 | + <?php |
| 155 | + /** |
| 156 | +- * Copyright © Magento, Inc. All rights reserved. |
| 157 | +- * See COPYING.txt for license details. |
| 158 | ++ * Copyright 2025 Adobe |
| 159 | ++ * All Rights Reserved. |
| 160 | ++ * |
| 161 | ++ * NOTICE: All information contained herein is, and remains |
| 162 | ++ * the property of Adobe and its suppliers, if any. The intellectual |
| 163 | ++ * and technical concepts contained herein are proprietary to Adobe |
| 164 | ++ * and its suppliers and are protected by all applicable intellectual |
| 165 | ++ * property laws, including trade secret and copyright laws. |
| 166 | ++ * Dissemination of this information or reproduction of this material |
| 167 | ++ * is strictly forbidden unless prior written permission is obtained |
| 168 | ++ * from Adobe. |
| 169 | + */ |
| 170 | + |
| 171 | + declare(strict_types=1); |
| 172 | + |
| 173 | + namespace Magento\RmaGraphQl\Model\Resolver\CustomerOrder\Item; |
| 174 | + |
| 175 | +-use Magento\Catalog\Api\ProductRepositoryInterface; |
| 176 | + use Magento\Framework\Exception\LocalizedException; |
| 177 | + use Magento\Framework\GraphQl\Config\Element\Field; |
| 178 | + use Magento\Framework\GraphQl\Query\ResolverInterface; |
| 179 | +@@ -16,6 +24,8 @@ |
| 180 | + use Magento\Rma\Helper\Data as RmaHelper; |
| 181 | + use Magento\Sales\Api\Data\OrderItemInterface; |
| 182 | + use Magento\Store\Model\StoreManagerInterface; |
| 183 | ++use Magento\Store\Model\ScopeInterface; |
| 184 | ++use Magento\Framework\App\Config\ScopeConfigInterface; |
| 185 | + |
| 186 | + /** |
| 187 | + * Resolver for eligible_for_return flag |
| 188 | +@@ -23,33 +33,17 @@ |
| 189 | + class IsEligible implements ResolverInterface |
| 190 | + { |
| 191 | + /** |
| 192 | +- * @var ProductRepositoryInterface |
| 193 | +- */ |
| 194 | +- private $productRepository; |
| 195 | +- |
| 196 | +- /** |
| 197 | +- * @var StoreManagerInterface |
| 198 | +- */ |
| 199 | +- private $storeManager; |
| 200 | +- |
| 201 | +- /** |
| 202 | +- * @var RmaHelper |
| 203 | +- */ |
| 204 | +- private $helper; |
| 205 | +- |
| 206 | +- /** |
| 207 | +- * @param ProductRepositoryInterface $productRepository |
| 208 | ++ * IsEligible Constructor |
| 209 | ++ * |
| 210 | + * @param StoreManagerInterface $storeManager |
| 211 | + * @param RmaHelper $helper |
| 212 | ++ * @param ScopeConfigInterface $scopeConfig |
| 213 | + */ |
| 214 | + public function __construct( |
| 215 | +- ProductRepositoryInterface $productRepository, |
| 216 | +- StoreManagerInterface $storeManager, |
| 217 | +- RmaHelper $helper |
| 218 | ++ private readonly StoreManagerInterface $storeManager, |
| 219 | ++ private readonly RmaHelper $helper, |
| 220 | ++ private readonly ScopeConfigInterface $scopeConfig |
| 221 | + ) { |
| 222 | +- $this->productRepository = $productRepository; |
| 223 | +- $this->storeManager = $storeManager; |
| 224 | +- $this->helper = $helper; |
| 225 | + } |
| 226 | + |
| 227 | + /** |
| 228 | +@@ -57,14 +51,24 @@ public function __construct( |
| 229 | + */ |
| 230 | + public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) |
| 231 | + { |
| 232 | +- if (!isset($value['model']) && !($value['model'] instanceof OrderItemInterface)) { |
| 233 | ++ if (!isset($value['model']) || !($value['model'] instanceof OrderItemInterface)) { |
| 234 | + throw new LocalizedException(__('"model" value should be specified')); |
| 235 | + } |
| 236 | ++ |
| 237 | + /** @var OrderItemInterface $order */ |
| 238 | + $orderItem = $value['model']; |
| 239 | + |
| 240 | ++ $product = $orderItem->getProduct(); |
| 241 | + $storeId = $this->storeManager->getStore()->getId(); |
| 242 | +- $product = $this->productRepository->getById($orderItem->getProductId()); |
| 243 | +- return $this->helper->canReturnProduct($product, $storeId); |
| 244 | ++ if (!$product instanceof \Magento\Catalog\Model\Product) { |
| 245 | ++ return $this->scopeConfig->getValue( |
| 246 | ++ \Magento\Rma\Model\Product\Source::XML_PATH_PRODUCTS_ALLOWED, |
| 247 | ++ ScopeInterface::SCOPE_STORE, |
| 248 | ++ $storeId |
| 249 | ++ ); |
| 250 | ++ } |
| 251 | ++ |
| 252 | ++ return $this->helper->canReturnProduct($product, $storeId) && |
| 253 | ++ ($orderItem->getQtyOrdered() - $orderItem->getQtyReturned()) > 0; |
| 254 | + } |
| 255 | + } |
| 256 | + |
0 commit comments