$validation =
$this->addressValidationFactory->
create($context);
$validationEvent =
new BuildValidationEvent($validation,
new DataBag(),
$context->
getContext());
$this->eventDispatcher->
dispatch($validationEvent);
if ($billingAddress === null
) { return;
} $violations =
$this->validator->
getViolations($billingAddress->
jsonSerialize(),
$validation);
if ($violations->
count() > 0
) { $cart->
getErrors()->
add(new AddressValidationError(true,
$violations));
} } private function validateShippingAddress( ?CustomerAddressEntity
$shippingAddress,
?CustomerAddressEntity
$billingAddress,
Cart
$cart,
SalesChannelContext
$context ): void
{ $validation =
$this->addressValidationFactory->
create($context);
$validationEvent =
new BuildValidationEvent($validation,
new DataBag(),
$context->
getContext());