diff options
author | andrea longhi <andrea@spaghetticode.it> | 2020-01-13 20:17:08 +0100 |
---|---|---|
committer | andrea longhi <andrea@spaghetticode.it> | 2020-01-14 09:44:59 +0100 |
commit | 044bb66e25a440388431de27c67d437fe6cebfb6 (patch) | |
tree | bd9e909ede1da9afebcf4f66398b42d5e4b3e59b /lib/super_good | |
parent | 134be24f677be142b5ddeb889c45e80a19fd58c8 (diff) |
Add SolidusTaxJar::API#tax_rate_for
When calculating tax rates, the recommended endpoint from TaxJar
support for live calculations is `/v2/taxes`, the same used for
calculating order taxes, as it accounts for all factors like
sourcing or nexus, while the `/v2/rates` endpoint will return
the full combined rate for the queried location.
Diffstat (limited to 'lib/super_good')
-rw-r--r-- | lib/super_good/solidus_taxjar/api.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/super_good/solidus_taxjar/api.rb b/lib/super_good/solidus_taxjar/api.rb index 0d182ce..601a2ae 100644 --- a/lib/super_good/solidus_taxjar/api.rb +++ b/lib/super_good/solidus_taxjar/api.rb @@ -22,6 +22,10 @@ module SuperGood end end + def tax_rate_for(address) + taxjar_client.tax_for_order(APIParams.tax_rate_address_params(address)).rate + end + def tax_rates_for(address) taxjar_client.rates_for_location(*APIParams.address_params(address)) end |