quoteValidator = $quoteValidator; $this->orderAddressValidator = $orderAddressValidator; } /** * Validates quote. * * @param Quote $quote * @return void * @throws ValidatorException * @throws LocalizedException */ public function validateQuote(Quote $quote): void { $this->quoteValidator->validateBeforeSubmit($quote); } /** * Validates order. * * @param Order $order * @return void * @throws ValidatorException * @throws LocalizedException */ public function validateOrder(Order $order): void { foreach ($order->getAddresses() as $address) { $errors = $this->orderAddressValidator->validate($address); if (!empty($errors)) { throw new ValidatorException( __("Failed address validation:\n%1", implode("\n", $errors)) ); } } } }