blob: c4803a4dc320c6108413e88224cc882ec1ddc720 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
module SuperGood
module SolidusTaxJar
module CalculatorHelper
extend ActiveSupport::Concern
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
def taxable_address?(address)
SuperGood::SolidusTaxJar.taxable_address_check.call(address)
end
def cache
if !Rails.env.test?
Rails.cache.fetch(
cache_key,
expires_in: SuperGood::SolidusTaxJar.cache_duration
) { yield }
else
yield
end
end
def exception_handler
SuperGood::SolidusTaxJar.exception_handler
end
end
end
end
|