24 private $directoryData;
35 $this->directoryData = $directoryData;
62 $errors[] =
__(
'"%fieldName" is required. Enter and try again.', [
'fieldName' =>
'firstname']);
66 $errors[] =
__(
'"%fieldName" is required. Enter and try again.', [
'fieldName' =>
'lastname']);
70 $errors[] =
__(
'"%fieldName" is required. Enter and try again.', [
'fieldName' =>
'street']);
74 $errors[] =
__(
'"%fieldName" is required. Enter and try again.', [
'fieldName' =>
'city']);
88 private function checkOptionalFields(AbstractAddress
$address)
91 if ($this->isTelephoneRequired()
94 $errors[] =
__(
'"%fieldName" is required. Enter and try again.', [
'fieldName' =>
'telephone']);
97 if ($this->isFaxRequired()
100 $errors[] =
__(
'"%fieldName" is required. Enter and try again.', [
'fieldName' =>
'fax']);
103 if ($this->isCompanyRequired()
106 $errors[] =
__(
'"%fieldName" is required. Enter and try again.', [
'fieldName' =>
'company']);
109 $havingOptionalZip = $this->directoryData->getCountriesWithOptionalZip();
110 if (!in_array(
$address->getCountryId(), $havingOptionalZip)
113 $errors[] =
__(
'"%fieldName" is required. Enter and try again.', [
'fieldName' =>
'postcode']);
125 private function isCompanyRequired()
127 return $this->eavConfig->getAttribute(
'customer_address',
'company')->getIsRequired();
136 private function isTelephoneRequired()
138 return $this->eavConfig->getAttribute(
'customer_address',
'telephone')->getIsRequired();
147 private function isFaxRequired()
149 return $this->eavConfig->getAttribute(
'customer_address',
'fax')->getIsRequired();
validate(AbstractAddress $address)
__construct(\Magento\Eav\Model\Config $eavConfig, \Magento\Directory\Helper\Data $directoryData)
static is($value, $classBaseName, array $args=array(), $namespaces=array())