|
43 | 43 | use Magento\Sales\Api\Data\OrderInterfaceFactory as OrderFactory;
|
44 | 44 | use Magento\Sales\Api\OrderManagementInterface as OrderManagement;
|
45 | 45 | use Magento\Store\Model\StoreManagerInterface;
|
46 |
| -use Magento\Customer\Model\AddressRegistry; |
47 | 46 |
|
48 | 47 | /**
|
49 | 48 | * Class for managing quote
|
@@ -184,11 +183,6 @@ class QuoteManagement implements CartManagementInterface, ResetAfterRequestInter
|
184 | 183 | */
|
185 | 184 | private $cartMutex;
|
186 | 185 |
|
187 |
| - /** |
188 |
| - * @var AddressRegistry |
189 |
| - */ |
190 |
| - private $addressRegistry; |
191 |
| - |
192 | 186 | /**
|
193 | 187 | * @param EventManager $eventManager
|
194 | 188 | * @param SubmitQuoteValidator $submitQuoteValidator
|
@@ -216,7 +210,6 @@ class QuoteManagement implements CartManagementInterface, ResetAfterRequestInter
|
216 | 210 | * @param RemoteAddress|null $remoteAddress
|
217 | 211 | * @param LockManagerInterface $lockManager
|
218 | 212 | * @param CartMutexInterface|null $cartMutex
|
219 |
| - * @param AddressRegistry|null $addressRegistry |
220 | 213 | * @SuppressWarnings(PHPMD.ExcessiveParameterList)
|
221 | 214 | * @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
222 | 215 | */
|
@@ -246,8 +239,7 @@ public function __construct(
|
246 | 239 | RequestInterface $request = null,
|
247 | 240 | RemoteAddress $remoteAddress = null,
|
248 | 241 | LockManagerInterface $lockManager = null,
|
249 |
| - ?CartMutexInterface $cartMutex = null, |
250 |
| - ?AddressRegistry $addressRegistry = null |
| 242 | + ?CartMutexInterface $cartMutex = null |
251 | 243 | ) {
|
252 | 244 | $this->eventManager = $eventManager;
|
253 | 245 | $this->submitQuoteValidator = $submitQuoteValidator;
|
@@ -279,8 +271,6 @@ public function __construct(
|
279 | 271 | ->get(RemoteAddress::class);
|
280 | 272 | $this->cartMutex = $cartMutex
|
281 | 273 | ?? ObjectManager::getInstance()->get(CartMutexInterface::class);
|
282 |
| - $this->addressRegistry = $addressRegistry |
283 |
| - ?? ObjectManager::getInstance()->get(AddressRegistry::class); |
284 | 274 | }
|
285 | 275 |
|
286 | 276 | /**
|
@@ -706,9 +696,7 @@ protected function _prepareCustomerQuote($quote)
|
706 | 696 | }
|
707 | 697 | //save here new customer address
|
708 | 698 | $shippingAddress->setCustomerId($quote->getCustomerId());
|
709 |
| - if ($this->validateAddress((int) $shippingAddress->getId()) === true) { |
710 |
| - $this->addressRepository->save($shippingAddress); |
711 |
| - } |
| 699 | + $this->addressRepository->save($shippingAddress); |
712 | 700 | $quote->addCustomerAddress($shippingAddress);
|
713 | 701 | $shipping->setCustomerAddressData($shippingAddress);
|
714 | 702 | $this->addressesToSync[] = $shippingAddress->getId();
|
@@ -740,9 +728,7 @@ protected function _prepareCustomerQuote($quote)
|
740 | 728 | $billingAddress->setIsDefaultBilling(true);
|
741 | 729 | }
|
742 | 730 | $billingAddress->setCustomerId($quote->getCustomerId());
|
743 |
| - if ($this->validateAddress((int) $billingAddress->getId()) === true) { |
744 |
| - $this->addressRepository->save($billingAddress); |
745 |
| - } |
| 731 | + $this->addressRepository->save($billingAddress); |
746 | 732 | $quote->addCustomerAddress($billingAddress);
|
747 | 733 | $billing->setCustomerAddressData($billingAddress);
|
748 | 734 | $this->addressesToSync[] = $billingAddress->getId();
|
@@ -805,17 +791,4 @@ public function _resetState(): void
|
805 | 791 | {
|
806 | 792 | $this->addressesToSync = [];
|
807 | 793 | }
|
808 |
| - |
809 |
| - /** |
810 |
| - * Validate address |
811 |
| - * |
812 |
| - * @param int|null $addressId |
813 |
| - * @return array|bool |
814 |
| - * @throws NoSuchEntityException |
815 |
| - */ |
816 |
| - private function validateAddress(?int $addressId): bool|array |
817 |
| - { |
818 |
| - $addressModel = $this->addressRegistry->retrieve($addressId); |
819 |
| - return $addressModel->validate(); |
820 |
| - } |
821 | 794 | }
|
0 commit comments