Module: SuperGood::SolidusTaxJar::CalculatorHelper
- Extended by:
- ActiveSupport::Concern
- Included in:
- TaxCalculator, TaxRateCalculator
- Defined in:
- lib/super_good/solidus_taxjar/calculator_helper.rb
Instance Method Summary collapse
- #cache ⇒ Object
- #exception_handler ⇒ Object
- #incomplete_address?(address) ⇒ Boolean
- #taxable_address?(address) ⇒ Boolean
Instance Method Details
#cache ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/super_good/solidus_taxjar/calculator_helper.rb', line 28 def cache if !Rails.env.test? Rails.cache.fetch( cache_key, expires_in: SuperGood::SolidusTaxJar.cache_duration ) { yield } else yield end end |
#exception_handler ⇒ Object
39 40 41 |
# File 'lib/super_good/solidus_taxjar/calculator_helper.rb', line 39 def exception_handler SuperGood::SolidusTaxJar.exception_handler end |
#incomplete_address?(address) ⇒ Boolean
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/super_good/solidus_taxjar/calculator_helper.rb', line 12 def incomplete_address?(address) return true if address.is_a?(Spree::Tax::TaxLocation) [ address.address1, address.city, address.state&.abbr || address.state_name, address.zipcode, address.country&.iso ].any?(&:blank?) end |
#taxable_address?(address) ⇒ Boolean
24 25 26 |
# File 'lib/super_good/solidus_taxjar/calculator_helper.rb', line 24 def taxable_address?(address) SuperGood::SolidusTaxJar.taxable_address_check.(address) end |