diff options
author | Jared Norman <jared@super.gd> | 2020-02-03 21:19:40 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-03 21:19:40 -0800 |
commit | 218f64bdf4d65d6f1bd6ccca160171426159844a (patch) | |
tree | 30f880e756fb55cd23b5a334d748867d946b83e2 /lib | |
parent | 8c4f7f0d034348620e18936fd043c5cd15b8e453 (diff) | |
parent | 2e37b40e08cc4f2dcb31bf0bb3c41fb213669065 (diff) |
Merge pull request #19 from SuperGoodSoft/custom-order-params
Add support for modifying order params
Diffstat (limited to 'lib')
-rw-r--r-- | lib/super_good/solidus_taxjar.rb | 2 | ||||
-rw-r--r-- | lib/super_good/solidus_taxjar/api_params.rb | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/lib/super_good/solidus_taxjar.rb b/lib/super_good/solidus_taxjar.rb index 1b1a4ac..2c47dda 100644 --- a/lib/super_good/solidus_taxjar.rb +++ b/lib/super_good/solidus_taxjar.rb @@ -15,6 +15,7 @@ module SuperGood class << self attr_accessor :cache_duration attr_accessor :cache_key + attr_accessor :custom_order_params attr_accessor :discount_calculator attr_accessor :exception_handler attr_accessor :line_item_tax_label_maker @@ -31,6 +32,7 @@ module SuperGood record_type = record.class.name.demodulize.underscore APIParams.send("#{record_type}_params", record).to_json } + self.custom_order_params = ->(order) { {} } self.discount_calculator = ::SuperGood::SolidusTaxJar::DiscountCalculator self.exception_handler = ->(e) { Rails.logger.error "An error occurred while fetching TaxJar tax rates - #{e}: #{e.message}" diff --git a/lib/super_good/solidus_taxjar/api_params.rb b/lib/super_good/solidus_taxjar/api_params.rb index 3e5bcb4..6458018 100644 --- a/lib/super_good/solidus_taxjar/api_params.rb +++ b/lib/super_good/solidus_taxjar/api_params.rb @@ -8,6 +8,7 @@ module SuperGood .merge(order_address_params(order.tax_address)) .merge(line_items_params(order.line_items)) .merge(shipping: order.shipment_total) + .merge(SuperGood::SolidusTaxJar.custom_order_params.(order)) .tap do |params| next unless SuperGood::SolidusTaxJar.logging_enabled |