solidus_me 3.0.2 → 3.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: 9ee90fa75f6efce0402e68f7992665696df6f0fc0fea34c1098489216bfa462d
4
- data.tar.gz: 130f9dec9c6ca3730f25a07e062d22172368967cf752ebce0c131cfbf418c56c
3
+ metadata.gz: 9db290c638a2d01484e2fa15aab8c66e9aa5aa9d655360b2aa59a290654c9131
4
+ data.tar.gz: c6f27dc5ad820d3b778805e138b566de84733caa75a1ec0f49d0bbcb21580ecd
5
5
  SHA512:
6
- metadata.gz: '08327213cb9db79a153e56150d7d70ad364148e28cfa4d92dc2c14e80199b27f1da0dc5e5dda75a78cbda68c49b1ccc70fb364359080130a51d8be0bbd27babd'
7
- data.tar.gz: c34ecfaa9435d0603d86e156a1d950463e7e187f59229b69bc1b74f4f09f114e882a9c86222b49eb5d37996f3b5cb286474d1e3b0bd864024a4b9dadf2659700
6
+ metadata.gz: 69fbcd15348fe78ff501e5245558da1be4156a298889a4afb347f70350d99cd4d857f5ae3445de1d5d02e4e4bbfd3f945b56cd62bb328776fd344cd98d3f1569
7
+ data.tar.gz: 229e6ce800fb87c1330033303358ac7ae6f5ca41eb934e5da7dbdeb60c6a913d968dcc2047696da70a6b094f47c9870c0b69f6d9f936ac6dd299b4bc0d0d267e
@@ -44,7 +44,7 @@ module SolidusMe
44
44
  melhor_envio_rates = get_rates_from_melhor_envio(package)
45
45
  shipping_rates = melhor_envio_rates.map do |melhor_envio_rate|
46
46
  build_shipping_rate(melhor_envio_rate, package)
47
- end
47
+ end.compact
48
48
 
49
49
  shipping_rates
50
50
  end
@@ -70,14 +70,18 @@ module SolidusMe
70
70
  end
71
71
 
72
72
  def build_shipping_rate(melhor_envio_rate, package)
73
+ return unless melhor_envio_rate.max_delivery_time
73
74
  shipping_method = Spree::ShippingMethod.find_by(code: self.class.generate_code(melhor_envio_rate.id))
75
+ estimate_prose = "Chegará em até #{ActionController::Base.helpers.pluralize(melhor_envio_rate.max_delivery_time, "dia", plural: "dias")} úteis"
74
76
 
75
77
  Spree::ShippingRate.new(
76
78
  shipment: package.shipment,
77
79
  shipping_method: shipping_method,
78
80
  cost: melhor_envio_rate.price,
79
- min_delivery_time: (Time.now + melhor_envio_rate.delivery_range["min"].days),
80
- max_delivery_time: (Time.now + melhor_envio_rate.delivery_range["max"].days)
81
+ min_delivery_time: melhor_envio_rate.min_delivery_time.business_days.from_now,
82
+ max_delivery_time: melhor_envio_rate.max_delivery_time.business_days.from_now,
83
+ estimate_prose: estimate_prose,
84
+ expires_in: Time.now + 2.hours
81
85
  )
82
86
  end
83
87
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusMe
4
- VERSION = "3.0.2"
4
+ VERSION = "3.1.0"
5
5
  end
data/lib/solidus_me.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "me_api"
4
4
  require "solidus_brazilian_adaptations"
5
+ require "business_time"
5
6
  require "solidus_me/configuration"
6
7
  require "solidus_me/version"
7
8
  require "solidus_me/engine"
data/solidus_me.gemspec CHANGED
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "solidus_support", "~> 0.5"
33
33
  spec.add_dependency "me_api"
34
34
  spec.add_dependency "solidus_brazilian_adaptations"
35
+ spec.add_dependency "business_time"
35
36
 
36
37
  spec.add_development_dependency "solidus_dev_support", "~> 2.7"
37
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_me
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamilton Tumenas Borges
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-11 00:00:00.000000000 Z
11
+ date: 2024-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -72,6 +72,20 @@ dependencies:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: business_time
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
75
89
  - !ruby/object:Gem::Dependency
76
90
  name: solidus_dev_support
77
91
  requirement: !ruby/object:Gem::Requirement