diff options
Diffstat (limited to 'lib/super_good')
-rw-r--r-- | lib/super_good/solidus_taxjar.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/super_good/solidus_taxjar.rb b/lib/super_good/solidus_taxjar.rb index 8841acd..35d9155 100644 --- a/lib/super_good/solidus_taxjar.rb +++ b/lib/super_good/solidus_taxjar.rb @@ -26,7 +26,10 @@ module SuperGood end self.cache_duration = 3.hours - self.cache_key = ->(order) { APIParams.order_params(order).to_json } + self.cache_key = ->(record) { + record_type = record.class.name.demodulize.underscore + APIParams.send("#{record_type}_params", record).to_json + } self.discount_calculator = ::SuperGood::SolidusTaxJar::DiscountCalculator self.exception_handler = ->(e) { Rails.logger.error "An error occurred while fetching TaxJar tax rates - #{e}: #{e.message}" |