Releases: spaze/vat-calculator
Temporary IE VAT rate cut
Time machine
Adds a new parameter (optional) to VatCalculator::calculate()
, VatCalculator::calculateNet()
, VatCalculator::getTaxRateForLocation()
, VatRates::getTaxRateForLocation()
which allows you to specify an optional date to use the VAT rate for when calculating the price.
Sounds complicated but this allows to issue invoices when a country has changed its VAT rate and you want to issue an invoice for the period when the previous rate was still used. For example Germany has lowered VAT rates temporarily beginning July 1st (#3), and this allows you to issue invoices for June in July with the previous, and correct, rates.
Immutable
The VatCalculator
objects are now immutable, they keep their state, the calculate()
and calculateNet()
calls return a VatPrice
object. These methods have been removed because they're no longer needed, use VatPrice
getters instead:
getNetPrice()
getTaxRate()
getCountryCode()
&setCountryCode()
getPostalCode()
&setPostalCode()
isCompany()
&setCompany()
No-way
While Norway is not part of the EU, the country also uses VAT. But if you're in EU selling to NO customers, you don't always want to charge VAT. See upstream's driesvints#43 and driesvints#14 (comment). This release removes Norway VAT and adds a method to add it back manually.
- Norway VAT rate removed, can be manually added back with
VatRates::addRateForCountry()
(BC BREAK) VatCheckUnavailableException
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) - Separate class
VatRates
for rates, you need to pass the class toVatCalculator
constructor (BC BREAK)
Standalone-ize
This is a fork of mpociot/vat-calculator
. Waiting too long for merging some of my PRs (like driesvints#72) and the need to remove Norway from EU VAT countries were the main reasons for forking the lib. Thanks Marcel Pociot for your work on the lib!
Here are the changes:
- Version 3 doesn't support Laravel/Cashier anymore (BC BREAK).
- The namespace has been changed for this fork from to
Spaze\VatCalculator
(BC BREAK) getIPBasedCountry()
&getClientIP()
methods have been removed (BC BREAK)- Some methods have been properly camelCased (
shouldCollectVAT
->shouldCollectVat
) VATCheckUnavailableException
has been camelCased toVatCheckUnavailableException
SoapFault
exceptions can be thrown in standalone mode too (previously only in Laravel mode)- PSR-4 compatible
- Requires PHP 7.3 or newer, adds types