summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJared Norman <jared@super.gd>2019-01-23 17:27:54 -0800
committerJared Norman <jared@super.gd>2019-01-23 17:27:54 -0800
commit8c1df35a32722bf654a7428bed4a868b90dfce4e (patch)
treefb5ab8ed891e28600a75d26e59b67d66aa747c14 /lib
parent751ce67631ea6df5ce2aa3baa5874b4c93b6a7c5 (diff)
Add support for fetching tax rates by location
Diffstat (limited to 'lib')
-rw-r--r--lib/super_good/solidus_taxjar/api.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/super_good/solidus_taxjar/api.rb b/lib/super_good/solidus_taxjar/api.rb
index 1065ae5..ffefd5f 100644
--- a/lib/super_good/solidus_taxjar/api.rb
+++ b/lib/super_good/solidus_taxjar/api.rb
@@ -16,6 +16,16 @@ module SuperGood
taxjar_client.tax_for_order order_params(order)
end
+ def tax_rates_for(address)
+ taxjar_client.rates_for_location(
+ address.zipcode,
+ street: address.address1,
+ city: address.city,
+ state: address&.state&.abbr || address.state_name,
+ country: address.country.iso
+ )
+ end
+
private
attr_reader :taxjar_client