valken-shipping 2.0.9 → 2.1.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
2
  SHA256:
3
- metadata.gz: dc10c599481dc98cee8685adb0b8b321b27e49461965605af4f5b326fdbe73d5
4
- data.tar.gz: 8841aaf757d728ca2eb93845fb8e38bf95f9a5e7fbf8c848850997fce824fb4e
3
+ metadata.gz: 21051b703831eeb8b7db181812b3231971498df95778ce15ba3a8ba27fde910e
4
+ data.tar.gz: 751fcb5af0f175a504a61b4b08fabd6ea1db859b3f5b23d6c914cbeb7febebf1
5
5
  SHA512:
6
- metadata.gz: 601e1c833f65e3dc73746c42ec82794c132bb15af5bcdf9ec78dd5dae7e3004d102625943202f127fa19b6a35d94626d6c5f95d272396bd1fe28db488b59cb4c
7
- data.tar.gz: 6796e2e1c7c0a16d6097908c0b1619cd76c055af403d4adbc356033bc5f84b577aeb289792a1f11aa8b4a537f5bed925cbd88ade4fe997be306fb441e326fdd4
6
+ metadata.gz: 39793ffff0a296b60c70221ed76fdb19c1d8516f853efe6e773e779622f4c09bf6badcdf84dafec9676ed2791aee8f1119bcd5b0393143b109a06722b43a0d99
7
+ data.tar.gz: aa0d815b9d042f655377f468d8679dfa5d6572fe7776a4536fd877e29a717b2aac9cb889569560c782a882955399df48dd6a3ec9e090ce2f14771bfb2842c67d
@@ -12,5 +12,36 @@ module Workarea
12
12
  end
13
13
  end
14
14
 
15
+ # if configuration ON, show the free shipping
16
+ # Need to add the free shipping upfront to all options so that we can use that to get discounts
17
+ # if the dicount is not available we are removing the free shipping option
18
+ def available
19
+ @available ||=
20
+ begin
21
+ all_options
22
+ all_options.unshift(get_free_shipping)
23
+ free_discount = price_adjustments["Valken Economy"]
24
+ if (free_discount.present? && free_discount.any?) || Workarea.config.show_free_shipping
25
+ all_options.first.price_adjustments = free_discount
26
+ else
27
+ all_options.shift()
28
+ end
29
+ all_options.each do |option|
30
+ option.price_adjustments = price_adjustments[option.name] || []
31
+ end
32
+ end
33
+ end
34
+
35
+ def get_free_shipping
36
+ ShippingOption.new(
37
+ carrier: "Free Shipping",
38
+ name: "Valken Economy",
39
+ sub_name: "5 - 9 Business Days",
40
+ service_code: "Free",
41
+ price: Money.new(0.0, "USD"),
42
+ tax_code: "TAX01"
43
+ )
44
+ end
45
+
15
46
  end
16
47
  end
@@ -52,7 +52,6 @@ module Workarea
52
52
 
53
53
  if Workarea.config.gateways.ups_carrier.class != ActiveShipping::Workarea
54
54
  carrier_data.push(get_ltl_shipping)
55
- carrier_data.push(get_free_shipping) if Workarea.config.show_free_shipping
56
55
  else
57
56
  return []
58
57
  end
@@ -1,5 +1,5 @@
1
1
  module Valken
2
2
  module Shipping
3
- VERSION = '2.0.9'
3
+ VERSION = '2.1.0'
4
4
  end
5
5
  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.9
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sushmitha02
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-05 00:00:00.000000000 Z
11
+ date: 2020-10-14 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.6
75
+ rubygems_version: 3.0.8
76
76
  signing_key:
77
77
  specification_version: 4
78
78
  summary: shipping options