private function validateCustomerAddresses(Cart
$cart, SalesChannelContext
$context): void
{ $customer =
$context->
getCustomer();
if ($customer === null
) { throw CartException::
customerNotLoggedIn();
} $billingAddress =
$customer->
getActiveBillingAddress();
$shippingAddress =
$customer->
getActiveShippingAddress();
$this->
validateBillingAddress($billingAddress,
$cart,
$context);
$this->
validateShippingAddress($shippingAddress,
$billingAddress,
$cart,
$context);
} private function validateBillingAddress( ?CustomerAddressEntity
$billingAddress,
Cart
$cart,
SalesChannelContext
$context ): void
{ $validation =
$this->addressValidationFactory->
create($context);
$validationEvent =
new BuildValidationEvent($validation,
new DataBag(),
$context->
getContext());
$this->eventDispatcher->
dispatch($validationEvent);