Skip to content

Commit 842dc16

Browse files
committed
MAGETWO-97456: Cart's customer and address mismatch
1 parent 50c4d10 commit 842dc16

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

app/code/Magento/Quote/Model/QuoteAddressValidator.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,36 +67,28 @@ private function doValidate(AddressInterface $address, $customerId)
6767
try {
6868
$customer = $this->customerRepository->getById($customerId);
6969
} catch (NoSuchEntityException $exception) {
70-
throw new NoSuchEntityException(
71-
__('Invalid customer id %1', $customerId)
72-
);
70+
throw new NoSuchEntityException(__('Invalid customer id %1', $customerId));
7371
}
7472
}
7573

7674
if ($address->getCustomerAddressId()) {
7775
//Existing address cannot belong to a guest
7876
if (!$customerId) {
79-
throw new NoSuchEntityException(
80-
__('Invalid customer address id %1', $address->getCustomerAddressId())
81-
);
77+
throw new NoSuchEntityException(__('Invalid customer address id %1', $address->getCustomerAddressId()));
8278
}
8379
//Validating address ID
8480
try {
8581
$this->addressRepository->getById($address->getCustomerAddressId());
8682
} catch (NoSuchEntityException $e) {
87-
throw new NoSuchEntityException(
88-
__('Invalid address id %1', $address->getId())
89-
);
83+
throw new NoSuchEntityException(__('Invalid address id %1', $address->getId()));
9084
}
9185
//Finding available customer's addresses
9286
$applicableAddressIds = array_map(function ($address) {
9387
/** @var \Magento\Customer\Api\Data\AddressInterface $address */
9488
return $address->getId();
9589
}, $this->customerRepository->getById($customerId)->getAddresses());
9690
if (!in_array($address->getCustomerAddressId(), $applicableAddressIds)) {
97-
throw new NoSuchEntityException(
98-
__('Invalid customer address id %1', $address->getCustomerAddressId())
99-
);
91+
throw new NoSuchEntityException(__('Invalid customer address id %1', $address->getCustomerAddressId()));
10092
}
10193
}
10294
}

0 commit comments

Comments
 (0)