ibericode / vat

PHP library for dealing with European VAT
https://packagist.org/packages/ibericode/vat
MIT License
425 stars 61 forks source link

New feature: fetch rate from an older date #7

Closed bpolaszek closed 7 years ago

bpolaszek commented 7 years ago

Hi,

For reasons, I had to find which was the VAT rate for a country on a specific date. jsonvat.com provides this information, but this is currently squeezed by the vat.php library, which only fetches the currently applicable rate.

This PR changes the way rates are fetched (which may introduce a BC break for advanced users, but nothing really new otherwise), so if merged, this may need a bound to a new minor version.

The case of a "future" VAT rate (a future applicable rate already defined) is also handled (cf tests).

dannyvankooten commented 7 years ago

This looks great @bpolaszek, testing this in a few hours. :smiley:

bpolaszek commented 7 years ago

Just amended my commit: sorting periods by date is no longer responsibility of the client, this is now done by the Rates class.

bpolaszek commented 7 years ago

Thanks @dannyvankooten !

dannyvankooten commented 7 years ago

Great work @bpolaszek, thanks a lot!