valken-shipping 2.0.8 → 2.0.9

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: b68ecff826d216873de1e906063c2c349d0a9d3c0e23581a90eb05831c67e5a7
4
- data.tar.gz: 4967817ff6b397f68a9ad7237acd167d9c3ffe8e3e0434dd053864ddc5539ec5
3
+ metadata.gz: dc10c599481dc98cee8685adb0b8b321b27e49461965605af4f5b326fdbe73d5
4
+ data.tar.gz: 8841aaf757d728ca2eb93845fb8e38bf95f9a5e7fbf8c848850997fce824fb4e
5
5
  SHA512:
6
- metadata.gz: 123282661e08331848b3442c0ae389c86efd1ae767df922c70a1b7b93b4a90bb40317948b941dc30a588838d20c60baadfd351d98ce564eec95df35f1ef88997
7
- data.tar.gz: 6c4c59add44238adecee109dc536897fab93a1c73dfb670f313a100713f0721b19c71affd633ae853cd6d45f7a0cc95cdb285b7206e1d4310308bd4748922377
6
+ metadata.gz: 601e1c833f65e3dc73746c42ec82794c132bb15af5bcdf9ec78dd5dae7e3004d102625943202f127fa19b6a35d94626d6c5f95d272396bd1fe28db488b59cb4c
7
+ data.tar.gz: 6796e2e1c7c0a16d6097908c0b1619cd76c055af403d4adbc356033bc5f84b577aeb289792a1f11aa8b4a537f5bed925cbd88ade4fe997be306fb441e326fdd4
@@ -41,6 +41,10 @@ module Workarea
41
41
 
42
42
  return default_options(packaging.packages) if Workarea.config.gateways.ups_carrier.class == ActiveShipping::Workarea
43
43
 
44
+ if is_special_region?
45
+ return [get_shipping_for_special_region]
46
+ end
47
+
44
48
  shipping_options_api = get_final_shipping_options(collect_carrier_data)
45
49
  return [] if @error.present?
46
50
 
@@ -151,6 +155,30 @@ module Workarea
151
155
  )
152
156
  end
153
157
 
158
+ def get_shipping_for_special_region
159
+ puts "weight_convertion",weight_convertion
160
+ weight_price = 0
161
+ case weight_convertion
162
+ when 0..15
163
+ weight_price = 50
164
+ when 15..200
165
+ weight_price = (1 * weight_convertion)
166
+ when 200..2500
167
+ weight_price = 200
168
+ else
169
+ weight_price = ((weight_convertion / 2500).ceil()) * 200
170
+ end
171
+
172
+ ShippingOption.new(
173
+ carrier: "LTL Shipping",
174
+ name: "Valken Standard",
175
+ sub_name: "3 - 5 Business Days",
176
+ service_code: "LTL01",
177
+ price: Money.new(weight_price * 100, "USD"),
178
+ tax_code: "TAX01"
179
+ )
180
+ end
181
+
154
182
  # Returns the total weight.
155
183
  def weight_convertion
156
184
  packaging = Packaging.new(order, shipping)
@@ -253,7 +281,11 @@ module Workarea
253
281
  product_carrier_type = product_details.map{ |item| item[:en][ground_ship_attribute] }.flatten
254
282
  product_carrier_type.include?("true")
255
283
  end
256
-
284
+
285
+ def is_special_region?
286
+ Workarea.config.special_region.include?(@shipping.address.region)
287
+ end
288
+
257
289
  def product_details
258
290
  # product_attributes = @order.items.map(&:product_attributes)
259
291
 
@@ -1,5 +1,5 @@
1
1
  module Valken
2
2
  module Shipping
3
- VERSION = '2.0.8'
3
+ VERSION = '2.0.9'
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.8
4
+ version: 2.0.9
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-22 00:00:00.000000000 Z
11
+ date: 2020-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails