diff options
author | Noah Silvera <noah@super.gd> | 2021-06-16 14:53:16 -0700 |
---|---|---|
committer | Noah Silvera <noah@super.gd> | 2021-06-16 14:53:16 -0700 |
commit | 5ad960c7588e8422dc1b3cc4577ec578bc30d54e (patch) | |
tree | 564947c1c5c8d4122714a0149072e7c99a5e589d /lib | |
parent | ab3c4c6ae7381cd85f755e55c11647094e312161 (diff) |
Specify all spree namespaces in lib as root namespaces
An upcoming commit will add a decorator that creates the
SuperGood::SolidusTaxjar::Spree namespace, which will change which module
all existing Spree instances in the lib folder reference.
We should force them to look for the root Spree namespace so tests
do not break.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/super_good/solidus_taxjar/addresses.rb | 6 | ||||
-rw-r--r-- | lib/super_good/solidus_taxjar/calculator_helper.rb | 2 | ||||
-rw-r--r-- | lib/super_good/solidus_taxjar/tax_calculator.rb | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/super_good/solidus_taxjar/addresses.rb b/lib/super_good/solidus_taxjar/addresses.rb index 7fdf852..409d0d3 100644 --- a/lib/super_good/solidus_taxjar/addresses.rb +++ b/lib/super_good/solidus_taxjar/addresses.rb @@ -20,7 +20,7 @@ module SuperGood return if taxjar_address.nil? - Spree::Address.immutable_merge(spree_address, { + ::Spree::Address.immutable_merge(spree_address, { country: us, # TaxJar only supports the US currently. state: state(taxjar_address.state), zipcode: taxjar_address.zip, @@ -31,7 +31,7 @@ module SuperGood def possibilities(spree_address) taxjar_addresses(spree_address).map { |taxjar_address| - Spree::Address.immutable_merge(spree_address, { + ::Spree::Address.immutable_merge(spree_address, { country: us, # TaxJar only supports the US currently. state: state(taxjar_address.state), zipcode: taxjar_address.zip, @@ -52,7 +52,7 @@ module SuperGood end def us - Spree::Country.find_by iso: "US" + ::Spree::Country.find_by iso: "US" end def state(abbr) diff --git a/lib/super_good/solidus_taxjar/calculator_helper.rb b/lib/super_good/solidus_taxjar/calculator_helper.rb index edf0754..9145658 100644 --- a/lib/super_good/solidus_taxjar/calculator_helper.rb +++ b/lib/super_good/solidus_taxjar/calculator_helper.rb @@ -4,7 +4,7 @@ module SuperGood extend ActiveSupport::Concern def incomplete_address?(address) - return true if address.is_a?(Spree::Tax::TaxLocation) + return true if address.is_a?(::Spree::Tax::TaxLocation) [ address.address1, diff --git a/lib/super_good/solidus_taxjar/tax_calculator.rb b/lib/super_good/solidus_taxjar/tax_calculator.rb index 74e6f9b..1c9a4da 100644 --- a/lib/super_good/solidus_taxjar/tax_calculator.rb +++ b/lib/super_good/solidus_taxjar/tax_calculator.rb @@ -17,7 +17,7 @@ module SuperGood cache do next no_tax unless taxjar_breakdown - Spree::Tax::OrderTax.new( + ::Spree::Tax::OrderTax.new( order_id: order.id, line_item_taxes: line_item_taxes, shipment_taxes: shipment_taxes @@ -41,7 +41,7 @@ module SuperGood # orders aren't going to have a huge number of line items. spree_line_item = order.line_items.find { |li| li.id == spree_line_item_id } - Spree::Tax::ItemTax.new( + ::Spree::Tax::ItemTax.new( item_id: spree_line_item_id, label: line_item_tax_label(taxjar_line_item, spree_line_item), tax_rate: tax_rate, @@ -102,7 +102,7 @@ module SuperGood end def no_tax - Spree::Tax::OrderTax.new( + ::Spree::Tax::OrderTax.new( order_id: order.id, line_item_taxes: [], shipment_taxes: [] @@ -110,7 +110,7 @@ module SuperGood end def tax_rate - Spree::TaxRate.find_by(name: "Sales Tax") + ::Spree::TaxRate.find_by(name: "Sales Tax") end def cache_key |