diff --git a/vendor/magento/module-instant-purchase/Model/InstantPurchaseOptionLoadingFactory.php b/vendor/magento/module-instant-purchase/Model/InstantPurchaseOptionLoadingFactory.php index b203cfdad2221..272254be98f9b 100644 --- a/vendor/magento/module-instant-purchase/Model/InstantPurchaseOptionLoadingFactory.php +++ b/vendor/magento/module-instant-purchase/Model/InstantPurchaseOptionLoadingFactory.php @@ -10,2 +10,3 @@ use Magento\Customer\Model\AddressFactory; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Quote\Api\Data\ShippingMethodInterfaceFactory; @@ -85,6 +86,11 @@ public function create( $paymentToken = $this->paymentTokenManagement->getByPublicHash($paymentTokenPublicHash, $customerId); $shippingAddress = $this->getAddress($shippingAddressId); $billingAddress = $this->getAddress($billingAddressId); + if ((int)$shippingAddress->getCustomerId() !== $customerId || + (int)$billingAddress->getCustomerId() !== $customerId) { + throw new NoSuchEntityException(__('Address not found.')); + } + $shippingMethod = $this->shippingMethodFactory->create() ->setCarrierCode($carrierCode) ->setMethodCode($shippingMethodCode);