valken-shipping 2.0.3 → 2.0.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b68ecff826d216873de1e906063c2c349d0a9d3c0e23581a90eb05831c67e5a7
|
4
|
+
data.tar.gz: 4967817ff6b397f68a9ad7237acd167d9c3ffe8e3e0434dd053864ddc5539ec5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 123282661e08331848b3442c0ae389c86efd1ae767df922c70a1b7b93b4a90bb40317948b941dc30a588838d20c60baadfd351d98ce564eec95df35f1ef88997
|
7
|
+
data.tar.gz: 6c4c59add44238adecee109dc536897fab93a1c73dfb670f313a100713f0721b19c71affd633ae853cd6d45f7a0cc95cdb285b7206e1d4310308bd4748922377
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Workarea
|
2
2
|
module AddressesHelper
|
3
3
|
def country_options
|
4
|
-
return [[Country['US'].name, Country['US'].alpha2]] if is_usa_only?
|
5
4
|
Workarea.config.countries.map do |country|
|
6
5
|
[country.name, country.alpha2]
|
7
6
|
end
|
@@ -13,19 +12,29 @@ module Workarea
|
|
13
12
|
.map { |id, region| [region.translations[I18n.locale.to_s] || region.name, id] }
|
14
13
|
.sort_by { |name, id| name || id }
|
15
14
|
|
16
|
-
|
15
|
+
if country.name == "United States of America"
|
16
|
+
region = regions.reject do |state|
|
17
|
+
Workarea.config.shipping_state_exclude.include?(state.last)
|
18
|
+
end
|
19
|
+
memo << [country.name, region]
|
20
|
+
else
|
21
|
+
memo << [country.name, regions]
|
22
|
+
end
|
17
23
|
memo
|
18
24
|
end
|
19
25
|
end
|
20
26
|
|
21
27
|
def is_usa_only?
|
22
|
-
|
28
|
+
|
23
29
|
orders = current_order rescue nil
|
24
30
|
return false if orders.blank? || orders.items.blank?
|
25
31
|
|
26
32
|
usa_only_attribute = Workarea.config.shipping_attributes[:usa_only]
|
27
|
-
|
28
|
-
|
33
|
+
return product_details(orders).map{ |item| item[:en][usa_only_attribute] }.flatten.include?("true")
|
34
|
+
end
|
35
|
+
|
36
|
+
def product_details(orders)
|
37
|
+
@product_details ||= Catalog::Product.in(id: orders.items.to_a.map(&:product_id)).pluck(:details)
|
29
38
|
end
|
30
39
|
|
31
40
|
def formatted_address(address)
|
@@ -38,7 +47,6 @@ module Workarea
|
|
38
47
|
postalcode: address.postal_code,
|
39
48
|
country: address.country.alpha2
|
40
49
|
}
|
41
|
-
|
42
50
|
address_format = address.country.address_format || Country['US'].address_format
|
43
51
|
result = pieces.reduce(address_format) do |memo, (name, value)|
|
44
52
|
memo.gsub(/{{#{name}}}/, html_escape(value.to_s))
|
@@ -81,9 +81,10 @@ module Workarea
|
|
81
81
|
# If the carrier is ups then it will print ups data...or if carrier is fedex then prinnt fedex data...
|
82
82
|
# else if it is not both then choose cheapest price.
|
83
83
|
def collect_carrier_data
|
84
|
-
return get_ups_data
|
85
|
-
|
86
|
-
return
|
84
|
+
return get_ups_data
|
85
|
+
# Temporarily disabling fedex and cheaper
|
86
|
+
# return get_fedex_data if is_fedex
|
87
|
+
# return get_none_data unless is_ups && is_fedex
|
87
88
|
end
|
88
89
|
|
89
90
|
# UPS data.
|
@@ -8,5 +8,10 @@ Workarea::Configuration.define_fields do
|
|
8
8
|
'ground_shipping_only' => 'ground shipping only'
|
9
9
|
},
|
10
10
|
description: 'Mapping of product details keys with shipping logic. Note: This maps only the keys not the values.'
|
11
|
+
|
12
|
+
field 'Shipping State Exclude',
|
13
|
+
type: :array,
|
14
|
+
default: ["AK", "HI", "PR"],
|
15
|
+
description: 'Shipping Excluded States'
|
11
16
|
end
|
12
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valken-shipping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sushmitha02
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
|
-
rubygems_version: 3.0.
|
75
|
+
rubygems_version: 3.0.6
|
76
76
|
signing_key:
|
77
77
|
specification_version: 4
|
78
78
|
summary: shipping options
|