OXID eShop CE  4.9.6
 All Classes Files Functions Variables Pages
oxcompanyvatincountrychecker.php
Go to the documentation of this file.
1 <?php
2 
3 
8 {
9 
13  const ERROR_ID_NOT_VALID = 'ID_NOT_VALID';
14 
20  private $_oCountry = null;
21 
27  public function setCountry(oxCountry $oCountry)
28  {
29  $this->_oCountry = $oCountry;
30  }
31 
37  public function getCountry()
38  {
39  return $this->_oCountry;
40  }
41 
49  public function validate(oxCompanyVatIn $oVatIn)
50  {
51  $blResult = false;
52  $oCountry = $this->getCountry();
53  if (!is_null($oCountry)) {
54  $blResult = ($oCountry->getVATIdentificationNumberPrefix() === $oVatIn->getCountryCode());
55  if (!$blResult) {
56  $this->setError(self::ERROR_ID_NOT_VALID);
57  }
58  }
59 
60  return $blResult;
61  }
62 }