solidus_bling 3.3.6 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spree/admin/solidus_bling/orders_controller.rb +1 -1
- data/app/jobs/solidus_bling/order_job.rb +2 -9
- data/app/jobs/solidus_bling/send_order_job.rb +18 -0
- data/app/models/solidus_bling/order.rb +10 -0
- data/app/subscribers/solidus_bling/subscriber.rb +1 -1
- data/lib/generators/solidus_bling/install/templates/initializer.rb +4 -0
- data/lib/solidus_bling/configuration.rb +1 -5
- data/lib/solidus_bling/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79fe67e27c629bd466518506f8e9e115ad5b2f59c3e719f52d96913df4c269ad
|
4
|
+
data.tar.gz: 8071666721cfbe0ad08a837934c19b7cfbcff6374d7fdc3512d87ba37f2d96b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e016162873a364862bff55d5734050929b8e5364078117031b155727151f7d8c41d5f2cd684ccbfb6f2a1ff8a428044579277ab876314e3da8c8d5990a9cc5a7
|
7
|
+
data.tar.gz: e5ae337ef3dd76787e3ce8207896db660a40a1d83a8acb2cef6450a869e8324ab4aac5b1ea60f63a2eee3f6d387a23ec84e0b8ee731f83aaae286e028f9e261b
|
@@ -9,7 +9,7 @@ module Spree
|
|
9
9
|
flash[:error] = "Pedido já enviado"
|
10
10
|
redirect_to edit_admin_order_customer_path(order)
|
11
11
|
else
|
12
|
-
::SolidusBling::
|
12
|
+
::SolidusBling::SendOrderJob.perform_later(event: { order: order })
|
13
13
|
flash[:success] = "O pedido está sendo enviado"
|
14
14
|
redirect_to edit_admin_order_customer_path(order)
|
15
15
|
end
|
@@ -4,15 +4,8 @@ module SolidusBling
|
|
4
4
|
|
5
5
|
def perform(event:)
|
6
6
|
order = event[:order]
|
7
|
-
|
8
|
-
|
9
|
-
SolidusBling::Order.new(order).send
|
10
|
-
bling_event.status = "success"
|
11
|
-
rescue => e
|
12
|
-
bling_event.status = "error"
|
13
|
-
bling_event.message = e.to_json
|
14
|
-
ensure
|
15
|
-
bling_event.save!
|
7
|
+
unless SolidusBling::Order.needs_approval?(order)
|
8
|
+
SolidusBling::SendOrderJob.perform_later(order)
|
16
9
|
end
|
17
10
|
end
|
18
11
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module SolidusBling
|
2
|
+
class SendOrderJob < ApplicationJob
|
3
|
+
queue_as :default
|
4
|
+
|
5
|
+
def perform(order)
|
6
|
+
bling_event = SolidusBling::Event.new(internal_id: order.id, body: order.to_json)
|
7
|
+
begin
|
8
|
+
SolidusBling::Order.new(order).send
|
9
|
+
bling_event.status = "success"
|
10
|
+
rescue => e
|
11
|
+
bling_event.status = "error"
|
12
|
+
bling_event.message = e.to_json
|
13
|
+
ensure
|
14
|
+
bling_event.save!
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -178,5 +178,15 @@ module SolidusBling
|
|
178
178
|
def build_order_url
|
179
179
|
"Link para o pedido: #{@order.store.url}/pedidos/#{@order.number}"
|
180
180
|
end
|
181
|
+
|
182
|
+
def self.needs_approval?(order)
|
183
|
+
payment_method = order.payments.valid.last.payment_method
|
184
|
+
importation_rules = SolidusBling.config.importation_rules
|
185
|
+
if importation_rules
|
186
|
+
order.total >= importation_rules[:amount] && importation_rules[:payment_methods].include?(payment_method.type)
|
187
|
+
else
|
188
|
+
false
|
189
|
+
end
|
190
|
+
end
|
181
191
|
end
|
182
192
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_bling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todas Essas Coisas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_core
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- app/controllers/spree/admin/solidus_bling/orders_controller.rb
|
112
112
|
- app/jobs/solidus_bling/application_job.rb
|
113
113
|
- app/jobs/solidus_bling/order_job.rb
|
114
|
+
- app/jobs/solidus_bling/send_order_job.rb
|
114
115
|
- app/jobs/solidus_bling/upsert_sellers_job.rb
|
115
116
|
- app/models/solidus_bling/account.rb
|
116
117
|
- app/models/solidus_bling/event.rb
|
@@ -183,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
184
|
- !ruby/object:Gem::Version
|
184
185
|
version: '0'
|
185
186
|
requirements: []
|
186
|
-
rubygems_version: 3.5.
|
187
|
+
rubygems_version: 3.5.11
|
187
188
|
signing_key:
|
188
189
|
specification_version: 4
|
189
190
|
summary: Solidus extension to integrate with the Bling
|