Beispiel #1
0
 /**
  * Validate polish NIP without european registration entry or send request to VAT validation service and return validation result
  *
  * @param string $countryCode
  * @param string $vatNumber
  * @param string $requesterCountryCode
  * @param string $requesterVatNumber
  *
  * @return Varien_Object
  */
 public function checkVatNumber($countryCode, $vatNumber, $requesterCountryCode = '', $requesterVatNumber = '')
 {
     if ($countryCode == "PL" && (empty($requesterCountryCode) || $requesterCountryCode == "PL")) {
         return $this->validatePolishNIP($vatNumber);
     } else {
         return parent::checkVatNumber($countryCode, $vatNumber, $requesterCountryCode = '', $requesterVatNumber = '');
     }
 }
Beispiel #2
0
 /**
  * Rewrite - Allow VAT ID to contain country code at the beginning
  *
  * @param string $countryCode
  * @param string $vatNumber
  * @param string $requesterCountryCode
  * @param string $requesterVatNumber
  * @return Varien_Object
  */
 public function checkVatNumber($countryCode, $vatNumber, $requesterCountryCode = '', $requesterVatNumber = '')
 {
     if (substr($vatNumber, 0, 2) == $countryCode) {
         $vatNumber = substr($vatNumber, 2);
     }
     if ($requesterVatNumber && substr($requesterVatNumber, 0, 2) == $requesterCountryCode) {
         $requesterVatNumber = substr($requesterVatNumber, 2);
     }
     return parent::checkVatNumber($countryCode, $vatNumber, $requesterCountryCode, $requesterVatNumber);
 }