diff options
-rw-r--r-- | lib/super_good/solidus_taxjar/tax_calculator.rb | 2 | ||||
-rw-r--r-- | spec/super_good/solidus_taxjar/tax_calculator_spec.rb | 19 |
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/super_good/solidus_taxjar/tax_calculator.rb b/lib/super_good/solidus_taxjar/tax_calculator.rb index 327e248..25339ac 100644 --- a/lib/super_good/solidus_taxjar/tax_calculator.rb +++ b/lib/super_good/solidus_taxjar/tax_calculator.rb @@ -152,6 +152,8 @@ module SuperGood end def incomplete_address?(tax_address) + return true if tax_address.is_a?(Spree::Tax::TaxLocation) + [ tax_address.address1, tax_address.city, diff --git a/spec/super_good/solidus_taxjar/tax_calculator_spec.rb b/spec/super_good/solidus_taxjar/tax_calculator_spec.rb index 0d390ec..aaa4ce1 100644 --- a/spec/super_good/solidus_taxjar/tax_calculator_spec.rb +++ b/spec/super_good/solidus_taxjar/tax_calculator_spec.rb @@ -74,6 +74,25 @@ RSpec.describe ::SuperGood::SolidusTaxJar::TaxCalculator do end end + context "when the order has an incomplete tax address" do + let(:address) do + ::Spree::Address.new( + first_name: "Ronnie James", + zipcode: nil, + address1: nil, + city: "Beverly Hills", + state_name: "California", + country: ::Spree::Country.new(iso: "US") + ) + end + + it "returns no taxes" do + expect(subject.order_id).to eq order.id + expect(subject.shipment_taxes).to be_empty + expect(subject.line_item_taxes).to be_empty + end + end + context "when the order has no line items" do let(:address) do ::Spree::Address.new( |