/** * Validates VAT. * * @param oxCompanyVatIn $oVatIn Company VAT identification number object. * * @return bool */ public function validate(\OxidEsales\EshopCommunity\Application\Model\CompanyVatIn $oVatIn) { $oCheckVat = new stdClass(); $oCheckVat->countryCode = $oVatIn->getCountryCode(); $oCheckVat->vatNumber = $oVatIn->getNumbers(); $blResult = $this->_checkOnline($oCheckVat); if (!$blResult) { $this->setError('ID_NOT_VALID'); } return $blResult; }
/** * Validates. * * @param oxCompanyVatIn $vatIn * * @return bool */ public function validate(\OxidEsales\EshopCommunity\Application\Model\CompanyVatIn $vatIn) { $result = false; $country = $this->getCountry(); if (!is_null($country)) { $result = $country->getVATIdentificationNumberPrefix() === $vatIn->getCountryCode(); if (!$result) { $this->setError(self::ERROR_ID_NOT_VALID); } } return $result; }