source/Core/InputValidator.php
public function checkVatId($user, $invAddress)
    {
        if ($this->_hasRequiredParametersForVatInCheck($invAddress)) {
            $country = $this->_getCountry($invAddress['oxuser__oxcountryid']);

            if ($country && $country->isInEU()) {
                $vatInValidator = $this->getCompanyVatInValidator($country);

                /** @var \OxidEsales\Eshop\Application\Model\CompanyVatIn $oVatIn */
                $oVatIn = oxNew('oxCompanyVatIn', $invAddress['oxuser__oxustid']);

                if (!$vatInValidator->validate($oVatIn)) {
                    /** @var \OxidEsales\Eshop\Core\Exception\InputException $exception */
                    $exception = oxNew(\OxidEsales\Eshop\Core\Exception\InputException::class);
                    $exception->setMessage(\OxidEsales\Eshop\Core\Registry::getLang()->translateString('VAT_MESSAGE_' . $vatInValidator->getError()));

                    return $this->addValidationError("oxuser__oxustid", $exception);
                }
            }
        } elseif ($invAddress['oxuser__oxustid'] && !$invAddress['oxuser__oxcompany']) {
            /** @var \OxidEsales\Eshop\Core\Exception\InputException $exception */
            $exception = oxNew(\OxidEsales\Eshop\Core\Exception\InputException::class);
            $exception->setMessage(\OxidEsales\Eshop\Core\Registry::getLang()->translateString('VAT_MESSAGE_COMPANY_MISSING'));

            return $this->addValidationError("oxuser__oxcompany", $exception);
        }
    }
public function checkVatId($user, $invAddress)
    {
        if ($this->_hasRequiredParametersForVatInCheck($invAddress)) {
            $country = $this->_getCountry($invAddress['oxuser__oxcountryid']);

            if ($country && $country->isInEU()) {
                $vatInValidator = $this->getCompanyVatInValidator($country);

                /** @var \OxidEsales\Eshop\Application\Model\CompanyVatIn $oVatIn */
                $oVatIn = oxNew('oxCompanyVatIn', $invAddress['oxuser__oxustid']);

                if (!$vatInValidator->validate($oVatIn)) {
                    /** @var \OxidEsales\Eshop\Core\Exception\InputException $exception */
                    $exception = oxNew(\OxidEsales\Eshop\Core\Exception\InputException::class);
                    $exception->setMessage(\OxidEsales\Eshop\Core\Registry::getLang()->translateString('VAT_MESSAGE_' . $vatInValidator->getError()));

                    return $this->addValidationError("oxuser__oxustid", $exception);
                }
            }
        } elseif ($invAddress['oxuser__oxustid'] && !$invAddress['oxuser__oxcompany']) {
            /** @var \OxidEsales\Eshop\Core\Exception\InputException $exception */
            $exception = oxNew(\OxidEsales\Eshop\Core\Exception\InputException::class);
            $exception->setMessage(\OxidEsales\Eshop\Core\Registry::getLang()->translateString('VAT_MESSAGE_COMPANY_MISSING'));

            return $this->addValidationError("oxuser__oxcompany", $exception);
        }
    }
public function checkVatId ( $ user , $ invAddress ) { if ( $ this -> _hasRequiredParametersForVatInCheck ( $ invAddress ) ) { $ country = $ this -> _getCountry ( $ invAddress [ 'oxuser__oxcountryid' ] ) ; if ( $ country && $ country -> isInEU ( ) ) { $ vatInValidator = $ this -> getCompanyVatInValidator ( $ country ) ; /** @var \OxidEsales\Eshop\Application\Model\CompanyVatIn $oVatIn */ $ oVatIn = oxNew ( 'oxCompanyVatIn' , $ invAddress [ 'oxuser__oxustid' ] ) ; if ( ! $ vatInValidator -> validate ( $ oVatIn ) ) { /** @var \OxidEsales\Eshop\Core\Exception\InputException $exception */ $ exception = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ InputException :: class ) ; $ exception -> setMessage ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'VAT_MESSAGE_' . $ vatInValidator -> getError ( ) ) ) ; return $ this -> addValidationError ( "oxuser__oxustid" , $ exception ) ; } } } elseif ( $ invAddress [ 'oxuser__oxustid' ] && ! $ invAddress [ 'oxuser__oxcompany' ] ) { /** @var \OxidEsales\Eshop\Core\Exception\InputException $exception */ $ exception = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ InputException :: class ) ; $ exception -> setMessage ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'VAT_MESSAGE_COMPANY_MISSING' ) ) ; return $ this -> addValidationError ( "oxuser__oxcompany" , $ exception ) ; } }
Checks if user passed VAT id is valid. Exception is thrown
if id is not valid.

@param User  $user       Active user.
@param array $invAddress User input array.

@return null
Checks if user passed VAT id is valid . Exception is thrown if id is not valid .