Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #21692 #21752 - logic in constructor of address validator and Locale Resolver check #21693

19 changes: 10 additions & 9 deletions app/code/Magento/Sales/Model/Order/Address/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ public function __construct(
$this->countryFactory = $countryFactory;
$this->eavConfig = $eavConfig ?: ObjectManager::getInstance()
->get(EavConfig::class);
}

/**
*
* @param \Magento\Sales\Model\Order\Address $address
* @return array
*/
public function validate(Address $address)
{
$warnings = [];

if ($this->isTelephoneRequired()) {
$this->required['telephone'] = 'Phone Number';
Expand All @@ -73,16 +83,7 @@ public function __construct(
if ($this->isFaxRequired()) {
$this->required['fax'] = 'Fax';
}
}

/**
*
* @param \Magento\Sales\Model\Order\Address $address
* @return array
*/
public function validate(Address $address)
{
$warnings = [];
foreach ($this->required as $code => $label) {
if (!$address->hasData($code)) {
$warnings[] = sprintf('"%s" is required. Enter and try again.', $label);
Expand Down