示例#1
0
 /**
  * Validates VAT.
  *
  * @param oxCompanyVatIn $oVatIn Company VAT identification number object.
  *
  * @return bool
  */
 public function validate(oxCompanyVatIn $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 $oVatIn
  *
  * @return bool
  */
 public function validate(oxCompanyVatIn $oVatIn)
 {
     $blResult = false;
     $oCountry = $this->getCountry();
     if (!is_null($oCountry)) {
         $blResult = $oCountry->getVATIdentificationNumberPrefix() === $oVatIn->getCountryCode();
         if (!$blResult) {
             $this->setError(self::ERROR_ID_NOT_VALID);
         }
     }
     return $blResult;
 }
 /**
  * @dataProvider vatInProviderForNumbers
  */
 public function testGetVatInNumbers($sVatIn, $sExpectCode)
 {
     $oVatIn = new oxCompanyVatIn($sVatIn);
     $this->assertSame($sExpectCode, $oVatIn->getNumbers());
 }