'avs_street', 'avszip' => 'avs_zip', 'iavs' => 'avs_international', ]; /** * @var array */ protected $errorsMessages = [ 'avs_street' => 'AVS address does not match.', 'avs_zip' => 'AVS zip does not match.', 'avs_international' => 'International AVS indicator does not match.', ]; /** * Validate data * * @param DataObject|Object $response * @param Transparent $transparentModel * @return bool */ public function validate(DataObject $response, Transparent $transparentModel) { $config = $transparentModel->getConfig(); foreach ($this->avsCheck as $fieldName => $settingName) { if ($config->getValue($settingName) == static::CONFIG_ON && strtolower((string) $response->getData($fieldName)) === static::RESPONSE_NO ) { $response->setRespmsg($this->errorsMessages[$settingName]); return false; } } return true; } }