summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/super_good/solidus_taxjar/api_params.rb7
-rw-r--r--spec/super_good/solidus_taxjar/api_params_spec.rb18
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/super_good/solidus_taxjar/api_params.rb b/lib/super_good/solidus_taxjar/api_params.rb
index b8ef896..3e5bcb4 100644
--- a/lib/super_good/solidus_taxjar/api_params.rb
+++ b/lib/super_good/solidus_taxjar/api_params.rb
@@ -29,6 +29,13 @@ module SuperGood
]
end
+ def tax_rate_address_params(address)
+ {
+ amount: 100,
+ shipping: 0,
+ }.merge(order_address_params(address))
+ end
+
def transaction_params(order)
{}
.merge(customer_params(order))
diff --git a/spec/super_good/solidus_taxjar/api_params_spec.rb b/spec/super_good/solidus_taxjar/api_params_spec.rb
index 3a55655..e0a8766 100644
--- a/spec/super_good/solidus_taxjar/api_params_spec.rb
+++ b/spec/super_good/solidus_taxjar/api_params_spec.rb
@@ -183,6 +183,24 @@ RSpec.describe SuperGood::SolidusTaxJar::APIParams do
end
end
+ describe "#tax_rate_address_params" do
+ subject { described_class.tax_rate_address_params(ship_address) }
+
+ it "returns params for fetching the tax rate for that address" do
+ expect(subject).to eq(
+ {
+ amount: 100,
+ shipping: 0,
+ to_city: "Los Angeles",
+ to_country: "US",
+ to_state: "CA",
+ to_street: "475 N Beverly Dr",
+ to_zip: "90210"
+ }
+ )
+ end
+ end
+
describe "#transaction_params" do
subject { described_class.transaction_params(order) }