We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, about my last PR I have added some useful code. Again, not pretty:
EuropaTIN class:
protected const TIN_EU_COUNTRY_LIST = ['AT','BE','BG','CY','CZ','DE','DK','EE','EL','ES','FI','FR','HR','HU','IE','IT','LU','LV','LT','MT','NL','PL','PT','RO','SE','SI','SK']; private const COUNTRY_NOT_VALID = 'Country not valid in Europa TIN Service: %s'; public function getResource($sTinNumber, string $sCountryCode): stdClass { if (!in_array(strtoupper($sCountryCode), self::TIN_EU_COUNTRY_LIST)) { throw new Exception( sprintf(self::COUNTRY_NOT_VALID, strtoupper($sCountryCode)) ); } try { $aDetails = [ 'countryCode' => strtoupper($sCountryCode), 'tinNumber' => $sTinNumber ]; return $this->oClient->checkTin($aDetails); } catch (SoapFault $oExcept) { throw new Exception( sprintf(self::IMPOSSIBLE_RETRIEVE_DATA_MESSAGE, $oExcept->faultstring) ); } }
And EuropaVAT class (it also has Northern Ireland):
protected const VAT_EU_COUNTRY_LIST = ['AT','BE','BG','CY','CZ','DE','DK','EE','EL','ES','FI','FR','HR','HU','IE','IT','LU','LV','LT','MT','NL','PL','PT','RO','SE','SI','SK','XI']; private const COUNTRY_NOT_VALID = 'Country not valid in Europa VAT Service: %s'; public function getResource($sVatNumber, string $sCountryCode): stdClass { if (!in_array(strtoupper($sCountryCode), self::VAT_EU_COUNTRY_LIST)) { throw new Exception( sprintf(self::COUNTRY_NOT_VALID, strtoupper($sCountryCode)) ); } try { $aDetails = [ 'countryCode' => strtoupper($sCountryCode), 'vatNumber' => $sVatNumber ]; return $this->oClient->checkVat($aDetails); } catch (SoapFault $oExcept) { throw new Exception( sprintf(self::IMPOSSIBLE_RETRIEVE_DATA_MESSAGE, $oExcept->faultstring) ); } }
May you can implement this any other way or as you think is better.
Thanks a lot
The text was updated successfully, but these errors were encountered:
Added to PR #14
Sorry, something went wrong.
No branches or pull requests
Hi, about my last PR I have added some useful code. Again, not pretty:
EuropaTIN class:
And EuropaVAT class (it also has Northern Ireland):
May you can implement this any other way or as you think is better.
Thanks a lot
The text was updated successfully, but these errors were encountered: