diff options
Diffstat (limited to 'lib/super_good/solidus_taxjar.rb')
-rw-r--r-- | lib/super_good/solidus_taxjar.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/super_good/solidus_taxjar.rb b/lib/super_good/solidus_taxjar.rb index 00c3ad5..7033501 100644 --- a/lib/super_good/solidus_taxjar.rb +++ b/lib/super_good/solidus_taxjar.rb @@ -11,6 +11,7 @@ require "super_good/solidus_taxjar/discount_calculator" module SuperGood module SolidusTaxJar class << self + attr_accessor :cache_key attr_accessor :discount_calculator attr_accessor :exception_handler attr_accessor :line_item_tax_label_maker @@ -19,6 +20,15 @@ module SuperGood attr_accessor :test_mode end + self.cache_key = ->(order) { + APIParams.order_params(order).transform_values do |value| + case value + when Array, Hash then value.hash + else + value + end + end + } self.discount_calculator = ::SuperGood::SolidusTaxJar::DiscountCalculator self.exception_handler = ->(e) { Rails.logger.error "An error occurred while fetching TaxJar tax rates - #{e}: #{e.message}" |