- Version 3 doesn't support Laravel/Cashier anymore (BC BREAK).
- The namespace has been changed for this fork from
Mpociot\VatCalculator
toSpaze\VatCalculator
(BC BREAK) - Exceptions (
VatCheckUnavailableException
) are always thrown,forwardSoapFaults
option has been removed (BC BREAK) - Some countries have various VAT rates depending on location resulting in
getTaxRateForCountry()
removal, usegetTaxRateForLocation()
instead (BC BREAK) - Rates have been moved to a separate class
VatRates
, you need to pass the class toVatCalculator
constructor (BC BREAK) calculate()
&calculateNet()
methods returnVatPrice
object instead of the calculated price (BR BREAK)- After running
calculate()
&calculateNet()
, theVatCalculator
object keeps its state,getNetPrice()
,getTaxRate()
,getCountryCode()
,setCountryCode()
,getPostalCode()
,setPostalCode()
,isCompany()
,setCompany()
removed (BR BREAK) - Norway, Turkey, Switzerland VAT rates removed, can be manually added back with
VatRates::addRateForCountry()
shouldCollectVat()
will also returntrue
for those manually added non-EU countries, useshouldCollectEuVat()
to returntrue
only for EU member statesgetIPBasedCountry()
&getClientIP()
methods have been removed, use some other package (orCF-IPCountry
HTTP header if you're behind Cloudflare)- Some methods have been properly camelCased: methods like
getClientIP()
->getClientIp()
andshouldCollectVAT
->shouldCollectVat
and a few more VATCheckUnavailableException
has been camelCased toVatCheckUnavailableException
- If a VAT number from an unsupported/non-EU country is provided for validation or for
getVatDetails()
call,UnsupportedCountryException
will be thrown - VIES WSDL is now loaded over HTTPS, if you hit issues you should update your system's list of trusted CAs, or install composer/ca-bundle, use it with PHP streams, create your own
SoapClient
instance withstream_context
option (new SoapClient(self::VAT_SERVICE_URL, ['stream_context' => $context])
) and useVatCalculator::setSoapClient()
to use the custom client - Requires PHP 7.3
Version 2 of the VAT Calculator provides a new method to get a more precise VAT rate result.
It's recommended to use the new getTaxRateForLocation
method instead of getTaxRateForCountry
.
This method expects 3 arguments:
- country code - The country code of the customer
- postal code - The postal code of the customer
- company - Flag to indicate if the customer is a company