effective_orders 5.1.4 → 5.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a084a1145beb50dc672efd5506bb81e497553d73e945195f2f31ea567bbc757
4
- data.tar.gz: 2743bac90f7d5f5ff4b2985b97a7404040f875fc12414e308bd188023307512c
3
+ metadata.gz: 70fd6793f180e1b0106c700cef6aacc0363cf7b2e3c76389e53db1301e6bac4e
4
+ data.tar.gz: 9fca2375abb56fd3052d2c098324f0dd6eb3d675772700f8ee792a12e54b39a6
5
5
  SHA512:
6
- metadata.gz: 2ee2c0d212855b3a7883c9ac4194b2b9b796668cdadd57778e23afdfe774fcd07f503f96b0812242bb2e0aa9f872c6a354fa2dd0d10275fc78b3787d9a09a65b
7
- data.tar.gz: 2d6ae464bd99a12bfd0e3226d8a1bdb20fa04c4e7b015d185f0432c8be5a92644840a3e9a93b9f437102f5dc03ae9dcc6faa7d7589582235b55609bef976cbe9
6
+ metadata.gz: 5c33291651b6c2e6789040feca6573827a2f61f64b1b6553692ebfc4b45382949f0814b5257bfa7fc3d65d461b8a36bf01051565acf06474638a9f9771268d4b
7
+ data.tar.gz: 51155ef9663bc5912b70c7c9be2232a55aa4d7565eeaf19eca83eea7f216b1d809d998259f347a2fc643755215792c323e3b7e8eb4ffd6c5b2f733899f407604
@@ -24,19 +24,21 @@ module Effective
24
24
  @order = order
25
25
  @country_code = country_code
26
26
  @state_code = state_code
27
-
28
- raise 'expected an order, or a country and state code' unless (order || country_code)
29
- raise 'expected an order OR a country and state code. Not both.' if (order && country_code)
30
27
  end
31
28
 
32
29
  def tax_rate
33
30
  country = country_code
34
- country ||= order.billing_address.country_code if order.billing_address.present?
35
- country ||= order.user.billing_address.country_code if order.user.respond_to?(:billing_address) && order.user.billing_address.present?
36
-
37
31
  state = state_code
38
- state ||= order.billing_address.state_code if order.billing_address.present?
39
- state ||= order.user.billing_address.state_code if order.user.respond_to?(:billing_address) && order.user.billing_address.present?
32
+
33
+ if order.present? && order.billing_address.present?
34
+ country ||= order.billing_address.country_code
35
+ state ||= order.billing_address.state_code
36
+ end
37
+
38
+ if order.present? && order.user.respond_to?(:billing_address) && order.user.billing_address.present?
39
+ country ||= order.user.billing_address.country_code
40
+ state ||= order.user.billing_address.state_code
41
+ end
40
42
 
41
43
  rate = RATES[country]
42
44
  return rate if rate.kind_of?(Numeric)
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '5.1.4'.freeze
2
+ VERSION = '5.1.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.4
4
+ version: 5.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-30 00:00:00.000000000 Z
11
+ date: 2021-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails