effective_orders 5.1.4 → 5.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/tax_rate_calculator.rb +10 -8
- data/lib/effective_orders/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70fd6793f180e1b0106c700cef6aacc0363cf7b2e3c76389e53db1301e6bac4e
|
4
|
+
data.tar.gz: 9fca2375abb56fd3052d2c098324f0dd6eb3d675772700f8ee792a12e54b39a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
39
|
-
|
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)
|
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
|
+
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-
|
11
|
+
date: 2021-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|