solidus_tec_estimator 1.0.5 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/solidus_tec_estimator/providers/local_delivery.rb +8 -5
- data/lib/solidus_tec_estimator/version.rb +1 -1
- data/lib/solidus_tec_estimator.rb +2 -0
- data/solidus_tec_estimator.gemspec +1 -0
- metadata +16 -3
- data/db/migrate/20240806202950_recreate_min_and_max_delivery_time.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5e4dc99244ea1042793e9040e0e9e7e21aba0e95299c20c0723a2795cc2298a
|
4
|
+
data.tar.gz: 39eee3390a6e1536306f79fb3a6a4882b9c4de073a64cf8ba9fc5f3cfa0e892f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2b9ce9dffb0e046b438a060b92133a278e7e32d36ec56dc189b7a1acbbe0602b5cefbb15daf073302dd3d3710909f4bd7817dfd96ec3603a322c5cff19ca8c3
|
7
|
+
data.tar.gz: e51d4827b3e2e57344ea1eaa7941bb582754946355d60c4097f9b53bf4a17a5a9ad387102c69b8de10cd692b99dcd7a52c47783dec6cfde63560ebbdb8cb0bc2
|
@@ -58,23 +58,26 @@ module SolidusTecEstimator
|
|
58
58
|
shipping_method: shipping_method,
|
59
59
|
cost: shipping_method.calculator.compute(package),
|
60
60
|
min_delivery_time: min_delivery_time,
|
61
|
-
max_delivery_time: max_delivery_time
|
61
|
+
max_delivery_time: max_delivery_time,
|
62
|
+
estimate_prose: create_estimate_prose(max_delivery_time),
|
63
|
+
expires_in: Time.now + 2.hours
|
62
64
|
)
|
63
65
|
end
|
64
66
|
|
65
67
|
def cep_de_sjbv?
|
66
68
|
sjbv_ceps = Cep.where(localidade: "São João da Boa Vista").pluck(:codigo_postal).map(&:to_i)
|
69
|
+
return false if sjbv_ceps.empty?
|
67
70
|
zipcode = package.order.ship_address.zipcode.gsub(/\D/, "").to_i
|
68
71
|
zipcode >= sjbv_ceps.min && zipcode <= sjbv_ceps.max
|
69
72
|
end
|
70
73
|
|
71
|
-
def
|
72
|
-
if
|
74
|
+
def create_estimate_prose delivery_time
|
75
|
+
if delivery_time.today?
|
73
76
|
"Chegará em até 2 horas"
|
74
|
-
elsif
|
77
|
+
elsif delivery_time.tomorrow?
|
75
78
|
"Chegará amanhã até às 10h"
|
76
79
|
else
|
77
|
-
"Chegará em #{ActionController::Base.helpers.pluralize((
|
80
|
+
"Chegará em #{ActionController::Base.helpers.pluralize((delivery_time.to_datetime.end_of_day - DateTime.now).to_i, "dia", plural: "dias")}"
|
78
81
|
end
|
79
82
|
end
|
80
83
|
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
|
32
32
|
spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 5']
|
33
33
|
spec.add_dependency 'solidus_support', '~> 0.5'
|
34
|
+
spec.add_dependency "solidus_brazilian_adaptations"
|
34
35
|
|
35
36
|
spec.add_development_dependency 'solidus_dev_support', '~> 2.9'
|
36
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_tec_estimator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ulysses
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_core
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0.5'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: solidus_brazilian_adaptations
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
62
|
name: solidus_dev_support
|
49
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,7 +107,6 @@ files:
|
|
93
107
|
- config/routes.rb
|
94
108
|
- db/migrate/20240806142636_create_solidus_tec_estimator_providers.rb
|
95
109
|
- db/migrate/20240806165855_add_provider_id_to_shipping_method.rb
|
96
|
-
- db/migrate/20240806202950_recreate_min_and_max_delivery_time.rb
|
97
110
|
- lib/generators/solidus_tec_estimator/install/install_generator.rb
|
98
111
|
- lib/generators/solidus_tec_estimator/install/templates/initializer.rb
|
99
112
|
- lib/solidus_tec_estimator.rb
|
@@ -1,9 +0,0 @@
|
|
1
|
-
class RecreateMinAndMaxDeliveryTime < ActiveRecord::Migration[7.1]
|
2
|
-
def change
|
3
|
-
remove_column :spree_shipping_rates, :min_delivery_time, if_exists: true
|
4
|
-
remove_column :spree_shipping_rates, :max_delivery_time, if_exists: true
|
5
|
-
|
6
|
-
add_column :spree_shipping_rates, :min_delivery_time, :datetime
|
7
|
-
add_column :spree_shipping_rates, :max_delivery_time, :datetime
|
8
|
-
end
|
9
|
-
end
|