|
| 1 | +diff --git a/vendor/magento/module-checkout-address-search/Block/Checkout/CustomerAddressProcessor.php b/vendor/magento/module-checkout-address-search/Block/Checkout/CustomerAddressProcessor.php |
| 2 | +index 450a0a55b22d..fd680c75af30 100644 |
| 3 | +--- a/vendor/magento/module-checkout-address-search/Block/Checkout/CustomerAddressProcessor.php |
| 4 | ++++ b/vendor/magento/module-checkout-address-search/Block/Checkout/CustomerAddressProcessor.php |
| 5 | +@@ -1,7 +1,21 @@ |
| 6 | + <?php |
| 7 | +-/** |
| 8 | +- * Copyright © Magento, Inc. All rights reserved. |
| 9 | +- * See COPYING.txt for license details. |
| 10 | ++/************************************************************************ |
| 11 | ++ * |
| 12 | ++ * ADOBE CONFIDENTIAL |
| 13 | ++ * ___________________ |
| 14 | ++ * |
| 15 | ++ * Copyright 2019 Adobe |
| 16 | ++ * All Rights Reserved. |
| 17 | ++ * |
| 18 | ++ * NOTICE: All information contained herein is, and remains |
| 19 | ++ * the property of Adobe and its suppliers, if any. The intellectual |
| 20 | ++ * and technical concepts contained herein are proprietary to Adobe |
| 21 | ++ * and its suppliers and are protected by all applicable intellectual |
| 22 | ++ * property laws, including trade secret and copyright laws. |
| 23 | ++ * Dissemination of this information or reproduction of this material |
| 24 | ++ * is strictly forbidden unless prior written permission is obtained |
| 25 | ++ * from Adobe. |
| 26 | ++ * ************************************************************************ |
| 27 | + */ |
| 28 | + |
| 29 | + declare(strict_types=1); |
| 30 | +@@ -72,7 +86,7 @@ public function getFormattedOptions(\Magento\Quote\Model\Quote $quote): array |
| 31 | + { |
| 32 | + /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */ |
| 33 | + $customer = $this->customerRepository->getById($quote->getCustomerId()); |
| 34 | +- $customerAddressesData = $this->getCustomerAddressData($customer, $quote); |
| 35 | ++ $customerAddressesData = $this->getCustomerAddressesData($customer, $quote); |
| 36 | + |
| 37 | + $addresses = []; |
| 38 | + foreach ($customerAddressesData as $address) { |
| 39 | +@@ -96,7 +110,7 @@ public function getFormattedOptions(\Magento\Quote\Model\Quote $quote): array |
| 40 | + * @return array |
| 41 | + * @throws \Magento\Framework\Exception\LocalizedException |
| 42 | + */ |
| 43 | +- private function getCustomerAddressData( |
| 44 | ++ public function getCustomerAddressesData( |
| 45 | + \Magento\Customer\Api\Data\CustomerInterface $customer, |
| 46 | + \Magento\Quote\Model\Quote $quote |
| 47 | + ): array { |
| 48 | +diff --git a/vendor/magento/module-checkout-address-search/Plugin/Customer/Model/Address/CustomerAddressDataProvider.php b/vendor/magento/module-checkout-address-search/Plugin/Customer/Model/Address/CustomerAddressDataProvider.php |
| 49 | +index eb9c31c32a08..437854f3ba84 100644 |
| 50 | +--- a/vendor/magento/module-checkout-address-search/Plugin/Customer/Model/Address/CustomerAddressDataProvider.php |
| 51 | ++++ b/vendor/magento/module-checkout-address-search/Plugin/Customer/Model/Address/CustomerAddressDataProvider.php |
| 52 | +@@ -1,10 +1,12 @@ |
| 53 | + <?php |
| 54 | +-/** |
| 55 | ++/************************************************************************ |
| 56 | ++ * |
| 57 | ++ * ADOBE CONFIDENTIAL |
| 58 | ++ * ___________________ |
| 59 | ++ * |
| 60 | + * Copyright 2023 Adobe |
| 61 | + * All Rights Reserved. |
| 62 | + * |
| 63 | +- * ADOBE CONFIDENTIAL |
| 64 | +- * |
| 65 | + * NOTICE: All information contained herein is, and remains |
| 66 | + * the property of Adobe and its suppliers, if any. The intellectual |
| 67 | + * and technical concepts contained herein are proprietary to Adobe |
| 68 | +@@ -13,49 +15,63 @@ |
| 69 | + * Dissemination of this information or reproduction of this material |
| 70 | + * is strictly forbidden unless prior written permission is obtained |
| 71 | + * from Adobe. |
| 72 | ++ * ************************************************************************ |
| 73 | + */ |
| 74 | + |
| 75 | + declare(strict_types=1); |
| 76 | + |
| 77 | + namespace Magento\CheckoutAddressSearch\Plugin\Customer\Model\Address; |
| 78 | + |
| 79 | ++use Magento\Checkout\Model\Session as CheckoutSession; |
| 80 | ++use Magento\CheckoutAddressSearch\Block\Checkout\CustomerAddressProcessor; |
| 81 | + use Magento\Customer\Model\Address\CustomerAddressDataProvider as AddressDataProvider; |
| 82 | + use Magento\Customer\Api\Data\CustomerInterface; |
| 83 | + use Magento\CheckoutAddressSearch\Model\Config as CustomerAddressSearchConfig; |
| 84 | ++use Magento\Framework\Exception\LocalizedException; |
| 85 | ++use Magento\Framework\Exception\NoSuchEntityException; |
| 86 | + |
| 87 | ++/** |
| 88 | ++ * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) |
| 89 | ++ */ |
| 90 | + class CustomerAddressDataProvider |
| 91 | + { |
| 92 | +- /** |
| 93 | +- * @var CustomerAddressSearchConfig |
| 94 | +- */ |
| 95 | +- private CustomerAddressSearchConfig $config; |
| 96 | +- |
| 97 | + /** |
| 98 | + * @param CustomerAddressSearchConfig $config |
| 99 | ++ * @param CustomerAddressProcessor $customerAddressProcessor |
| 100 | ++ * @param CheckoutSession $checkoutSession |
| 101 | + */ |
| 102 | +- public function __construct(CustomerAddressSearchConfig $config) |
| 103 | +- { |
| 104 | +- $this->config = $config; |
| 105 | ++ public function __construct( |
| 106 | ++ private readonly CustomerAddressSearchConfig $config, |
| 107 | ++ private readonly CustomerAddressProcessor $customerAddressProcessor, |
| 108 | ++ private readonly CheckoutSession $checkoutSession |
| 109 | ++ ) { |
| 110 | + } |
| 111 | + |
| 112 | + /** |
| 113 | + * If address search is enabled we should limit the number of addresses required |
| 114 | + * |
| 115 | + * @param AddressDataProvider $subject |
| 116 | ++ * @param callable $proceed |
| 117 | + * @param CustomerInterface $customer |
| 118 | + * @param int|null $addressLimit |
| 119 | + * @return array |
| 120 | ++ * @throws LocalizedException |
| 121 | ++ * @throws NoSuchEntityException |
| 122 | + * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
| 123 | + */ |
| 124 | +- public function beforeGetAddressDataByCustomer( |
| 125 | ++ public function aroundGetAddressDataByCustomer( |
| 126 | + AddressDataProvider $subject, |
| 127 | ++ callable $proceed, |
| 128 | + CustomerInterface $customer, |
| 129 | + ?int $addressLimit = null |
| 130 | + ): array { |
| 131 | + if ($this->config->isEnabledAddressSearch()) { |
| 132 | +- $addressLimit = $this->config->getSearchLimit(); |
| 133 | ++ return $this->customerAddressProcessor->getCustomerAddressesData( |
| 134 | ++ $customer, |
| 135 | ++ $this->checkoutSession->getQuote() |
| 136 | ++ ); |
| 137 | + } |
| 138 | + |
| 139 | +- return [$customer, $addressLimit]; |
| 140 | ++ return $proceed($customer, $addressLimit); |
| 141 | + } |
| 142 | + } |
| 143 | +diff --git a/vendor/magento/module-checkout-address-search/etc/frontend/di.xml b/vendor/magento/module-checkout-address-search/etc/frontend/di.xml |
| 144 | +index bb5a52526556..efe803dd5f0d 100644 |
| 145 | +--- a/vendor/magento/module-checkout-address-search/etc/frontend/di.xml |
| 146 | ++++ b/vendor/magento/module-checkout-address-search/etc/frontend/di.xml |
| 147 | +@@ -1,8 +1,22 @@ |
| 148 | + <?xml version="1.0"?> |
| 149 | + <!-- |
| 150 | +-/** |
| 151 | +- * Copyright © Magento, Inc. All rights reserved. |
| 152 | +- * See COPYING.txt for license details. |
| 153 | ++/************************************************************************ |
| 154 | ++ * |
| 155 | ++ * ADOBE CONFIDENTIAL |
| 156 | ++ * ___________________ |
| 157 | ++ * |
| 158 | ++ * Copyright 2014 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 | + --> |
| 172 | + <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> |
| 173 | +@@ -17,4 +31,9 @@ |
| 174 | + <type name="Magento\Customer\Model\Address\CustomerAddressDataProvider"> |
| 175 | + <plugin name="customer_address_provider" type="Magento\CheckoutAddressSearch\Plugin\Customer\Model\Address\CustomerAddressDataProvider" sortOrder="1" disabled="false" /> |
| 176 | + </type> |
| 177 | ++ <type name="Magento\CheckoutAddressSearch\Plugin\Customer\Model\Address\CustomerAddressDataProvider"> |
| 178 | ++ <arguments> |
| 179 | ++ <argument name="checkoutSession" xsi:type="object">Magento\Checkout\Model\Session\Proxy</argument> |
| 180 | ++ </arguments> |
| 181 | ++ </type> |
| 182 | + </config> |
| 183 | + |
0 commit comments