valken-shipping 3.0.0.pre → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/workarea/shipping.decorator +1 -37
- data/app/services/workarea/packaging.decorator +4 -2
- data/app/views/workarea/admin/shipping_services/_addtional_service_fields.html.haml +1 -1
- data/app/views/workarea/admin/shipping_services/edit.html.haml +3 -2
- data/lib/active_shipping/carriers/valken.rb +5 -2
- data/lib/valken/shipping/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d75de69e6cf65115669bdcd1a2c662ec266b3aed8d7cc769e72e9bac336baa7e
|
4
|
+
data.tar.gz: c43b08dc302d9a98931e5173ff18af67b7403cc53004fd0a6d7bea5cbb1d8d17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de828f51c73f612bf7939e277e1eaa495ca86f9287ba1f17562a0b74b6d88970cb57306ccb8143fd9dc86ff27d6a21d8cfb1660281ee190f3cd3f19ba31d4fed
|
7
|
+
data.tar.gz: c6edd088265f12e9dd6d599dd3c7a4350a12cff1b586c082113ac12695bfd2866e2ee1931a7ec8a3c0461c89324c01ef338d127f76e4c4120fd8e5b6aa366601
|
@@ -47,31 +47,16 @@ module Workarea
|
|
47
47
|
packaging.packages,
|
48
48
|
{
|
49
49
|
ground: is_ground,
|
50
|
-
special_region: is_special_region
|
51
|
-
free_shipping: is_free_ship
|
50
|
+
special_region: is_special_region?
|
52
51
|
}
|
53
52
|
)
|
54
53
|
shipping_options = response.rates.sort_by(&:price).map do |rate|
|
55
54
|
ShippingOption.from_rate_estimate(rate)
|
56
55
|
end
|
57
56
|
|
58
|
-
shipping_options.unshift(get_free_shipping) if is_free_ship
|
59
57
|
shipping_options
|
60
58
|
end
|
61
59
|
|
62
|
-
|
63
|
-
# Free shipping option.
|
64
|
-
def get_free_shipping
|
65
|
-
ShippingOption.new(
|
66
|
-
carrier: "Free Shipping",
|
67
|
-
name: "Valken Economy",
|
68
|
-
sub_name: "5 - 9 Business Days",
|
69
|
-
service_code: "Free",
|
70
|
-
price: Money.new(0.0, Money.default_currency.to_s),
|
71
|
-
tax_code: "TAX01"
|
72
|
-
)
|
73
|
-
end
|
74
|
-
|
75
60
|
def is_ground
|
76
61
|
ground_ship_attribute = Workarea.config.shipping_attributes[:ground_shipping_only]
|
77
62
|
product_carrier_type = product_details.map{ |item| item[:en][ground_ship_attribute] }.flatten
|
@@ -82,27 +67,6 @@ module Workarea
|
|
82
67
|
Workarea.config.special_region.include?(@shipping.address.region)
|
83
68
|
end
|
84
69
|
|
85
|
-
# if any of the product is NO FREE SHIPPING = TRUE then return false
|
86
|
-
# if free shipping config is then return true
|
87
|
-
# if user applies free shipping promo code then return true
|
88
|
-
def is_free_ship
|
89
|
-
free_ship_attribute = Workarea.config.shipping_attributes[:no_free_shipping]
|
90
|
-
product_carrier_type = product_details.map{ |item| item[:en][free_ship_attribute] }.flatten
|
91
|
-
return false if product_carrier_type.include?("true")
|
92
|
-
|
93
|
-
return true if Workarea.config.show_free_shipping
|
94
|
-
|
95
|
-
test_order = order.clone
|
96
|
-
test_shipping = shipping.clone
|
97
|
-
test_shipping.apply_shipping_service(get_free_shipping.to_h)
|
98
|
-
|
99
|
-
price_adjustments = Pricing.find_shipping_discounts(
|
100
|
-
test_order,
|
101
|
-
test_shipping
|
102
|
-
)
|
103
|
-
return price_adjustments.present? && price_adjustments.any?
|
104
|
-
end
|
105
|
-
|
106
70
|
def product_details
|
107
71
|
# product_attributes = @order.items.map(&:product_attributes)
|
108
72
|
|
@@ -14,7 +14,9 @@ module Workarea
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def no_of_packs
|
17
|
-
(total_weight_lb / Workarea.config.max_weight_per_pack).ceil
|
17
|
+
packs_count = (total_weight_lb / Workarea.config.max_weight_per_pack).ceil
|
18
|
+
|
19
|
+
return packs_count == 0 ? 1 : packs_count
|
18
20
|
end
|
19
21
|
|
20
22
|
def find_shipping_sku(sku)
|
@@ -24,7 +26,7 @@ module Workarea
|
|
24
26
|
def find_sku_weight(sku)
|
25
27
|
product_by_sku = Catalog::Product.find_by_sku(sku).variants
|
26
28
|
sku_data = product_by_sku.detect {|variant| variant.sku == sku }
|
27
|
-
sku_weight = is_pounds(sku_data) ? convert_to_oz(sku_data.weight ||
|
29
|
+
sku_weight = is_pounds(sku_data) ? convert_to_oz(sku_data.weight || 1) : (sku_data.weight || 1)
|
28
30
|
sku_weight
|
29
31
|
end
|
30
32
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
.property
|
2
|
-
= label_tag '
|
2
|
+
= label_tag 'service_carrier', "Carrier Name", class: 'property__name'
|
3
3
|
= text_field_tag "service[carrier]", @service.carrier, class: 'text-box'
|
4
4
|
.property
|
5
5
|
= label_tag 'service_description', "Description", class: 'property__name'
|
@@ -61,13 +61,14 @@
|
|
61
61
|
%td= text_field_tag "rates[#{rate.id}][tier_weight_max]", rate.tier_weight_max, class: 'text-box'
|
62
62
|
%td= text_field_tag "rates[#{rate.id}][tier_min]", rate.tier_min, class: 'text-box'
|
63
63
|
%td= text_field_tag "rates[#{rate.id}][tier_max]", rate.tier_max, class: 'text-box'
|
64
|
-
%td= check_box_tag 'rates_to_remove[]', rate.id
|
64
|
+
%td= check_box_tag 'rates_to_remove[]', rate.id, false, id: nil
|
65
|
+
|
65
66
|
%tr{ data: { cloneable_row: '' } }
|
66
67
|
%td= text_field_tag 'new_rates[][price]', '', placeholder: 'New Price Tier', class: 'text-box'
|
67
68
|
%td= text_field_tag 'new_rates[][tier_weight_min]', '', placeholder: 'Min Weight Value', class: 'text-box'
|
68
69
|
%td= text_field_tag 'new_rates[][tier_weight_max]', '', placeholder: 'Max Weight Value', class: 'text-box'
|
69
70
|
%td= text_field_tag 'new_rates[][tier_min]', '', placeholder: 'Min Value', class: 'text-box'
|
70
|
-
%td= text_field_tag 'new_rates[][
|
71
|
+
%td= text_field_tag 'new_rates[][tier_max]', '', placeholder: 'Min Value', class: 'text-box'
|
71
72
|
%td
|
72
73
|
|
73
74
|
.workflow-bar
|
@@ -4,7 +4,9 @@ module ActiveShipping
|
|
4
4
|
class VALKEN < UPS
|
5
5
|
|
6
6
|
def find_rates(origin, destination, packages, options = {})
|
7
|
-
|
7
|
+
if options[:ground] || (::Workarea.config.default_shipping)
|
8
|
+
return get_workarea_services(origin, destination, packages, options)
|
9
|
+
end
|
8
10
|
super
|
9
11
|
end
|
10
12
|
|
@@ -34,7 +36,8 @@ module ActiveShipping
|
|
34
36
|
end
|
35
37
|
|
36
38
|
workarea_rates = get_workarea_services(origin, destination, packages, options).rates
|
37
|
-
|
39
|
+
|
40
|
+
if message.include?("Failure: Maximum number of packages exceeded")
|
38
41
|
RateResponse.new(true, "Only workarea shipping service", {}, rates: workarea_rates, xml: "", request: "")
|
39
42
|
else
|
40
43
|
RateResponse.new(success, message, Hash.from_xml(response).values.first, rates:(filtered_rates + workarea_rates).flatten, xml: response, request: last_request)
|
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: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sushmitha02
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -76,9 +76,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
76
|
version: '0'
|
77
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- - "
|
79
|
+
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubygems_version: 3.0.3
|
84
84
|
signing_key:
|