super_good-solidus_taxjar 0.16.0 → 0.17.0

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: 501ae07a0037373ed9f5cca71c67d469e81f10b9ed8be735c6812401fdab9e02
4
- data.tar.gz: 558cc49c0d712c4a14e74b5f9c98308084791fe98088f6737565a53e6303b8dd
3
+ metadata.gz: b11bc18ca6b156d505c9327b733da737feb0712f55daf51d014c43e67a94f17b
4
+ data.tar.gz: 20143b4baa4080ca6eb57375459d9918fbaf8964e11e0169134029b7ffb8559a
5
5
  SHA512:
6
- metadata.gz: c88ced44e52d7dbd7a90f2e6401d1e9cc01a085e1986ad836c7210e20df99e7ea061ba1129291bee9451107481a8d4f32bd833e4bd9997d960be839d72d1166c
7
- data.tar.gz: 9aef0cf33ce2181eda0e7fb41ba704af88e3629ea4ed34a3f8063ddd8b61f67123edcf617099619d7c82c668eb07c85407873b327aad91345679f6b535d232eb
6
+ metadata.gz: b95355ed63090f876d59814c9a4ecfb94681c156a2880775b4c14d897527479b675d9c1a864a3e0f9ca08e6c3e6d0581f6375c445d33c021595d640aabba132c
7
+ data.tar.gz: 79c294c8ed4b6207c1f493fdc22243d288e5da5d2bcfe9d0194f15abf734ee4df31bba0f48996f7695718638af590f8c91ce9d9c4d35ad485421401c8c233e44
data/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## v0.17.0
6
+
7
+ - Added `SuperGood::SolidusTaxJar.custom_order_params` to allow for custom overrides to the parameters sent to TaxJar when calculating order taxes. For example, if you needed to send a custom nexus address you could do:
8
+ ```ruby
9
+ SuperGood::SolidusTaxJar.custom_order_params = ->(order) {
10
+ {
11
+ nexus_addresses: [
12
+ {
13
+ id: 'Main Location',
14
+ country: 'AU',
15
+ zip: 'NSW 2000',
16
+ city: 'Sydney',
17
+ street: '483 George St',
18
+ }
19
+ ]
20
+ }
21
+ }
22
+ ```
23
+ The callback receives the `Spree::Order` that the params are for and the return value can override existing values like the order's ID.
24
+
5
25
  ## v0.16.0
6
26
 
7
27
  - Fix `#incomplete_address?` method to be friendly also to completely blank addresses.
@@ -15,6 +15,7 @@ module SuperGood
15
15
  class << self
16
16
  attr_accessor :cache_duration
17
17
  attr_accessor :cache_key
18
+ attr_accessor :custom_order_params
18
19
  attr_accessor :discount_calculator
19
20
  attr_accessor :exception_handler
20
21
  attr_accessor :line_item_tax_label_maker
@@ -31,6 +32,7 @@ module SuperGood
31
32
  record_type = record.class.name.demodulize.underscore
32
33
  APIParams.send("#{record_type}_params", record).to_json
33
34
  }
35
+ self.custom_order_params = ->(order) { {} }
34
36
  self.discount_calculator = ::SuperGood::SolidusTaxJar::DiscountCalculator
35
37
  self.exception_handler = ->(e) {
36
38
  Rails.logger.error "An error occurred while fetching TaxJar tax rates - #{e}: #{e.message}"
@@ -8,6 +8,7 @@ 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
+ .merge(SuperGood::SolidusTaxJar.custom_order_params.(order))
11
12
  .tap do |params|
12
13
  next unless SuperGood::SolidusTaxJar.logging_enabled
13
14
 
@@ -1,5 +1,5 @@
1
1
  module SuperGood
2
2
  module SolidusTaxJar
3
- VERSION = "0.16.0"
3
+ VERSION = "0.17.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_good-solidus_taxjar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Norman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-03 00:00:00.000000000 Z
11
+ date: 2020-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core