|
14 | 14 | use Magento\Quote\Model\Quote as QuoteEntity; |
15 | 15 | use Magento\Quote\Model\Quote\Validator\MinimumOrderAmount\ValidationMessage as OrderAmountValidationMessage; |
16 | 16 | use Magento\Quote\Model\ValidationRules\QuoteValidationRuleInterface; |
17 | | -use Magento\Framework\Webapi\Rest\Response as RestResponse; |
18 | 17 |
|
19 | 18 | /** |
20 | 19 | * Class to validate the quote |
@@ -44,32 +43,24 @@ class QuoteValidator |
44 | 43 | */ |
45 | 44 | private $quoteValidationRule; |
46 | 45 |
|
47 | | - /** |
48 | | - * @var RestResponse |
49 | | - */ |
50 | | - private $_response; |
51 | | - |
52 | 46 | /** |
53 | 47 | * QuoteValidator constructor. |
54 | 48 | * |
55 | 49 | * @param AllowedCountries|null $allowedCountryReader |
56 | 50 | * @param OrderAmountValidationMessage|null $minimumAmountMessage |
57 | 51 | * @param QuoteValidationRuleInterface|null $quoteValidationRule |
58 | | - * @param RestResponse|null $response |
59 | 52 | */ |
60 | 53 | public function __construct( |
61 | 54 | AllowedCountries $allowedCountryReader = null, |
62 | 55 | OrderAmountValidationMessage $minimumAmountMessage = null, |
63 | | - QuoteValidationRuleInterface $quoteValidationRule = null, |
64 | | - RestResponse $response = null |
| 56 | + QuoteValidationRuleInterface $quoteValidationRule = null |
65 | 57 | ) { |
66 | 58 | $this->allowedCountryReader = $allowedCountryReader ?: ObjectManager::getInstance() |
67 | 59 | ->get(AllowedCountries::class); |
68 | 60 | $this->minimumAmountMessage = $minimumAmountMessage ?: ObjectManager::getInstance() |
69 | 61 | ->get(OrderAmountValidationMessage::class); |
70 | 62 | $this->quoteValidationRule = $quoteValidationRule ?: ObjectManager::getInstance() |
71 | 63 | ->get(QuoteValidationRuleInterface::class); |
72 | | - $this->_response = $response ?: ObjectManager::getInstance()->get(RestResponse::class); |
73 | 64 | } |
74 | 65 |
|
75 | 66 | /** |
@@ -115,7 +106,6 @@ public function validateBeforeSubmit(QuoteEntity $quote) |
115 | 106 | $defaultMessage .= ' %1'; |
116 | 107 | } |
117 | 108 | if ($defaultMessage) { |
118 | | - $this->_response->setHeader('errorRedirectAction', '#shipping'); |
119 | 109 | throw new ValidatorException(__($defaultMessage, implode(' ', $messages))); |
120 | 110 | } |
121 | 111 | } |
|
0 commit comments