super_good-solidus_taxjar 0.12.0 → 0.14.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
- SHA256:
3
- metadata.gz: 383b1f52471f45dc1f4d51c3bcf7c3b6063313202997858a59bc3107444939ee
4
- data.tar.gz: 348d9b9942e4def84a74ba612124f337438d0d1260408593058eca9867f821c3
2
+ SHA1:
3
+ metadata.gz: 076edfb752053738642c74b55f3eb144366a84a1
4
+ data.tar.gz: df6a3685e1768ebeb40b81c49937a0d4a77b2c78
5
5
  SHA512:
6
- metadata.gz: a0afc95de0aa4073290d7c6c8a5a8c7bb21988c96811eecc4a9be55f0b66339d632861123d814927d1adfa09126cb54d4014d39bde08fe0b16b5a90cebe05057
7
- data.tar.gz: f9ae6f8fb17e5f806aafd5e88adc6b31024814d7182823190a20b4ed46c6e43d0a5e4d36b80d83af7898199e72ee8b99bddf53d7420737b0f524ada22585e6a6
6
+ metadata.gz: 7bfa9842b3f6f60857f13951e689ed7b07476f777d3bdbd2ca9668df7f19765b023e41bb0fb796e917d805028fc0d42f51c3a9946d7ea8d1ac66b1212ee673d8
7
+ data.tar.gz: dc7f6169b651982fb217d48ec800acdd0f926542c71f74dbcc07e064526dbe1fa9568f159e146484057b60930118f10831645a5018036fb1be1a3fed2a0da778
data/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## v0.14.0
6
+
7
+ - Added `SuperGood::SolidusTaxJar.taxable_order_check` option which can be set to a proc that receives the order and will prevent actual tax calculation from occurring if it returns false. If your app has introduced a method like `Spree::Order#complimentary?`, you could avoid trying to compute taxes on complimentary orders by doing the following in an initializer:
8
+ ```ruby
9
+ SuperGood::SolidusTaxJar.taxable_order_check = ->(order) { order.complimentary? }
10
+ ```
11
+
12
+ ## v0.13.0
13
+
14
+ - Report order.user_id as customer_id when calculating taxes and creating transactions. This enables the use of per customer exemptions.
15
+
5
16
  ## v0.12.0
6
17
 
7
18
  - Report no tax collected on order and line items when order total zeroed out.
@@ -4,6 +4,7 @@ module SuperGood
4
4
  class << self
5
5
  def order_params(order)
6
6
  {}
7
+ .merge(customer_params(order))
7
8
  .merge(order_address_params(order.tax_address))
8
9
  .merge(line_items_params(order.line_items))
9
10
  .merge(shipping: order.shipment_total)
@@ -23,6 +24,7 @@ module SuperGood
23
24
 
24
25
  def transaction_params(order)
25
26
  {}
27
+ .merge(customer_params(order))
26
28
  .merge(order_address_params(order.tax_address))
27
29
  .merge(transaction_line_items_params(order.line_items))
28
30
  .merge(
@@ -51,6 +53,12 @@ module SuperGood
51
53
 
52
54
  private
53
55
 
56
+ def customer_params(order)
57
+ return {} unless order.user_id
58
+
59
+ { customer_id: order.user_id.to_s }
60
+ end
61
+
54
62
  def order_address_params(address)
55
63
  {
56
64
  to_country: address.country.iso,
@@ -13,6 +13,7 @@ module SuperGood
13
13
  def calculate
14
14
  return no_tax if SuperGood::SolidusTaxJar.test_mode
15
15
  return no_tax if incomplete_address?(order.tax_address) || order.line_items.none?
16
+ return no_tax unless taxable_order? order
16
17
  return no_tax unless taxable_address? order.tax_address
17
18
 
18
19
  cache do
@@ -133,6 +134,10 @@ module SuperGood
133
134
  SuperGood::SolidusTaxJar.exception_handler
134
135
  end
135
136
 
137
+ def taxable_order?(order)
138
+ SuperGood::SolidusTaxJar.taxable_order_check.(order)
139
+ end
140
+
136
141
  def taxable_address?(address)
137
142
  SuperGood::SolidusTaxJar.taxable_address_check.(address)
138
143
  end
@@ -1,5 +1,5 @@
1
1
  module SuperGood
2
2
  module SolidusTaxJar
3
- VERSION = "0.12.0"
3
+ VERSION = "0.14.0"
4
4
  end
5
5
  end
@@ -19,6 +19,7 @@ module SuperGood
19
19
  attr_accessor :shipping_calculator
20
20
  attr_accessor :shipping_tax_label_maker
21
21
  attr_accessor :taxable_address_check
22
+ attr_accessor :taxable_order_check
22
23
  attr_accessor :test_mode
23
24
  end
24
25
 
@@ -32,6 +33,7 @@ module SuperGood
32
33
  self.shipping_calculator = ->(order) { order.shipment_total }
33
34
  self.shipping_tax_label_maker = ->(shipment, shipping_tax) { "Sales Tax" }
34
35
  self.taxable_address_check = ->(address) { true }
36
+ self.taxable_order_check = ->(order) { true }
35
37
  self.test_mode = false
36
38
  end
37
39
  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.12.0
4
+ version: 0.14.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: 2019-04-24 00:00:00.000000000 Z
11
+ date: 2019-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -194,7 +194,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
196
  requirements: []
197
- rubygems_version: 3.0.3
197
+ rubyforge_project:
198
+ rubygems_version: 2.6.14.3
198
199
  signing_key:
199
200
  specification_version: 4
200
201
  summary: Support for using TaxJar to handle tax calculations in Solidus