From 044bb66e25a440388431de27c67d437fe6cebfb6 Mon Sep 17 00:00:00 2001 From: andrea longhi Date: Mon, 13 Jan 2020 20:17:08 +0100 Subject: 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. --- lib/super_good/solidus_taxjar/api.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/super_good') 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 -- cgit v1.2.3