From fc370fa9d6a6f33cf71508f3462e9978a68da53d Mon Sep 17 00:00:00 2001 From: Juan Carlos Ruiz Date: Wed, 13 Mar 2019 12:41:45 -0600 Subject: Add guard clause for TaxLocation addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From Solidus Documentation: An order's tax_address can – through duck typing – be a Spree::TaxLocation instead of the shipping address. This adds a guard clause that validates if the tax_address is a TaxLocation, in this case we know that the address is incomplete. --- lib/super_good/solidus_taxjar/tax_calculator.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/super_good/solidus_taxjar') 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, -- cgit v1.2.3