super_good-solidus_taxjar 0.15.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 045cc30a313283d465e1252ef957dc484d780e4dcf9eae06263dd9dd1e95f5d7
4
- data.tar.gz: fb605130f6c7602f31c4bea0604183df3e77c166bbaad1b7391a7f51ad7e0cff
3
+ metadata.gz: 9e46125a6ce81b8d88a0e82106a383bd5125db6b76772d9159eb72e43aa18983
4
+ data.tar.gz: 877c5c25c76dca340fb1b984e4c3ddef21b9e1fe79031955ae65e43bfc439e25
5
5
  SHA512:
6
- metadata.gz: c25108f00d39800dad1bb3d217b71d929e64ce4bf5713f414fa40878b89fc814f5fdac5abdb7e897aebc5fa937edcf84e4e9d25122c2c82dba36427fa968c605
7
- data.tar.gz: 06a05cb7a0fdbbbb15c3472353219f0f7db544be35c2d3f5c00dae8537d67e869789b141d526b991365d3af90c19e903cedfc85966fecffae19661f13eae2778
6
+ metadata.gz: d455c4608e74d4345fd0d059abe50dc8592bc8130b3776f093160b4735ae9ba6d512a527cf995b4861eb701bbef092aa5d409c030e5183c6a4cc61ffe4dac729
7
+ data.tar.gz: 9a041b4b1a1ed5d6df82b52bac9ecaeb1f55949287a31e3f632e9f706ce45140f6c633c28ca50d7939759fda33ff043fe9afff0945d4ee4985b143b0be19dc68
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## v0.15.1
6
+
7
+ - Add support for request/response logging.
8
+
5
9
  ## v0.15.0
6
10
 
7
11
  - Made sure cache key is a string, instead of a giant nested hash/array structure that probably won't get interpreted by Rails well. Still not happy with the caching behaviour, but it's configurable.
@@ -16,6 +16,7 @@ module SuperGood
16
16
  attr_accessor :discount_calculator
17
17
  attr_accessor :exception_handler
18
18
  attr_accessor :line_item_tax_label_maker
19
+ attr_accessor :logging_enabled
19
20
  attr_accessor :shipping_calculator
20
21
  attr_accessor :shipping_tax_label_maker
21
22
  attr_accessor :taxable_address_check
@@ -30,6 +31,7 @@ module SuperGood
30
31
  Rails.logger.error "An error occurred while fetching TaxJar tax rates - #{e}: #{e.message}"
31
32
  }
32
33
  self.line_item_tax_label_maker = ->(taxjar_line_item, spree_line_item) { "Sales Tax" }
34
+ self.logging_enabled = false
33
35
  self.shipping_calculator = ->(order) { order.shipment_total }
34
36
  self.shipping_tax_label_maker = ->(shipment, shipping_tax) { "Sales Tax" }
35
37
  self.taxable_address_check = ->(address) { true }
@@ -13,7 +13,13 @@ module SuperGood
13
13
  end
14
14
 
15
15
  def tax_for(order)
16
- taxjar_client.tax_for_order APIParams.order_params(order)
16
+ taxjar_client.tax_for_order(APIParams.order_params(order)).tap do |taxes|
17
+ next unless SuperGood::SolidusTaxJar.logging_enabled
18
+
19
+ Rails.logger.info(
20
+ "TaxJar response for #{order.number}: #{taxes.to_h.inspect}"
21
+ )
22
+ end
17
23
  end
18
24
 
19
25
  def tax_rates_for(address)
@@ -8,6 +8,13 @@ module SuperGood
8
8
  .merge(order_address_params(order.tax_address))
9
9
  .merge(line_items_params(order.line_items))
10
10
  .merge(shipping: order.shipment_total)
11
+ .tap do |params|
12
+ next unless SuperGood::SolidusTaxJar.logging_enabled
13
+
14
+ Rails.logger.info(
15
+ "TaxJar params: #{params.inspect}"
16
+ )
17
+ end
11
18
  end
12
19
 
13
20
  def address_params(address)
@@ -1,5 +1,5 @@
1
1
  module SuperGood
2
2
  module SolidusTaxJar
3
- VERSION = "0.15.0"
3
+ VERSION = "0.15.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_good-solidus_taxjar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Norman