solidus_bling 3.4.4 → 3.4.6
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/accounts_controller.rb +4 -2
- data/app/models/solidus_bling/order.rb +2 -1
- data/app/models/solidus_bling/seller.rb +5 -1
- data/app/views/spree/admin/solidus_bling/accounts/_form.html.erb +22 -19
- data/db/migrate/20240830124253_add_incoming_category_id_on_payment_method.rb +5 -0
- data/db/migrate/20240830124611_remove_incoming_category_id_from_account.rb +5 -0
- data/lib/solidus_bling/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96ae26320b68f766dc44bb621d62ea6588edca4942dd652e27f9db773b3746a7
|
4
|
+
data.tar.gz: 3cc77c798db3a3e13fae2af0825d3ab9f1c11b9cec025873d7858a47bbb8ad75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e84e85d97a04a3515d3dda9d97e46f8fe947bf15590d315f4fef2a4972d3804c903244e074e041e270d635015db561a1c72a62514ad7de8d25ca5ffeef3bce2e
|
7
|
+
data.tar.gz: 4cf11ba85c9efe1315a498ef9bde72528ee84de38c4768ee416d2bc222adf9897ebb50def3d382e5cd21728441cbaa41f361af7d8c25df31a7ae362b69053d50
|
@@ -38,9 +38,11 @@ module Spree
|
|
38
38
|
def edit
|
39
39
|
@payment_methods = ::Spree::PaymentMethod.all.pluck(:name, :id)
|
40
40
|
@shipping_methods = ::Spree::ShippingMethod.all.pluck(:name, :id)
|
41
|
+
@sellers = @bling_account.sellers.actives.order(:name).pluck(:name, :id)
|
41
42
|
end
|
42
43
|
|
43
44
|
def update
|
45
|
+
@bling_account.sellers.find_by_id(params[:account]["default_seller"]).update(default: true)
|
44
46
|
@bling_account.update account_params
|
45
47
|
redirect_to edit_admin_solidus_bling_account_path(@bling_account.id)
|
46
48
|
end
|
@@ -74,8 +76,8 @@ module Spree
|
|
74
76
|
|
75
77
|
def account_params
|
76
78
|
params.require(:account).permit(
|
77
|
-
:client_id, :client_secret, :refresh_token, :redirect_url, :state, :access_token, :api_key, :external_store_id,
|
78
|
-
payment_methods_attributes: [:id, :spree_payment_method_id, :external_id],
|
79
|
+
:client_id, :client_secret, :refresh_token, :redirect_url, :state, :access_token, :api_key, :external_store_id,
|
80
|
+
payment_methods_attributes: [:id, :spree_payment_method_id, :external_id, :incoming_category_id],
|
79
81
|
shipping_methods_attributes: [:id, :spree_shipping_method_id, :alias, :company],
|
80
82
|
sellers_attributes: [:id, :name, :external_id]
|
81
83
|
)
|
@@ -15,6 +15,7 @@ module SolidusBling
|
|
15
15
|
observacoes_internas = internal_observations
|
16
16
|
transporte = shipment
|
17
17
|
id_vendedor = seller_external_id
|
18
|
+
id_categoria_receita = @account.payment_methods.find_by(spree_payment_method_id: @order.payments.last.payment_method_id).incoming_category_id
|
18
19
|
|
19
20
|
bling_order = BlingApi::Order.new(
|
20
21
|
id_contato: contato.id,
|
@@ -30,7 +31,7 @@ module SolidusBling
|
|
30
31
|
observacoes: "Número do pedido loja: #{@order.number}",
|
31
32
|
observacoes_internas: observacoes_internas,
|
32
33
|
valor_desconto: @order.adjustment_total.abs,
|
33
|
-
id_categoria:
|
34
|
+
id_categoria: id_categoria_receita,
|
34
35
|
transporte: transporte,
|
35
36
|
id_vendedor: id_vendedor
|
36
37
|
).create
|
@@ -2,8 +2,8 @@ module SolidusBling
|
|
2
2
|
class Seller < ApplicationRecord
|
3
3
|
validates :name, presence: true
|
4
4
|
validates :external_id, presence: true
|
5
|
-
|
6
5
|
belongs_to :account
|
6
|
+
after_save :falsify_all_others
|
7
7
|
|
8
8
|
def self.upsert_sellers account
|
9
9
|
account.check_token
|
@@ -30,5 +30,9 @@ module SolidusBling
|
|
30
30
|
sellers_inactive = where(external_id: ids_sellers_inactive)
|
31
31
|
sellers_inactive.update_all(active: false)
|
32
32
|
end
|
33
|
+
|
34
|
+
def falsify_all_others
|
35
|
+
self.class.where("id != ?", id).update(default: false) if default
|
36
|
+
end
|
33
37
|
end
|
34
38
|
end
|
@@ -25,13 +25,6 @@
|
|
25
25
|
<%= form.text_field :external_store_id, required: true, class: 'fullwidth' %>
|
26
26
|
<%= form.error_message_on :external_store_id %>
|
27
27
|
<% end %>
|
28
|
-
|
29
|
-
<%= form.field_container :incoming_category_id do %>
|
30
|
-
<%= form.label :incoming_category_id, "ID Categoria Receita", class: 'required' %>
|
31
|
-
<%= form.text_field :incoming_category_id, required: true, class: 'fullwidth' %>
|
32
|
-
<%= form.error_message_on :incoming_category_id %>
|
33
|
-
<% end %>
|
34
|
-
|
35
28
|
</div>
|
36
29
|
|
37
30
|
<div class="col-12 col-md-6">
|
@@ -76,18 +69,24 @@
|
|
76
69
|
</legend>
|
77
70
|
<%= form.fields_for :payment_methods do |payment_form| %>
|
78
71
|
<div class="row">
|
79
|
-
<div class="col-12 col-md-
|
72
|
+
<div class="col-12 col-md-4">
|
80
73
|
<div class="field">
|
81
74
|
<%= payment_form.label :spree_payment_method_id, "Método de Pagamento", class: 'required' %>
|
82
75
|
<%= payment_form.select :spree_payment_method_id, @payment_methods, {}, { class: "custom-select fullwidth" } %>
|
83
76
|
</div>
|
84
77
|
</div>
|
85
|
-
<div class="col-12 col-md-
|
78
|
+
<div class="col-12 col-md-4">
|
86
79
|
<div class="field">
|
87
80
|
<%= payment_form.label :external_id, "ID Forma de Pagamento", class: 'required' %>
|
88
81
|
<%= payment_form.text_field :external_id, required: true, class:"fullwidth" %>
|
89
82
|
</div>
|
90
83
|
</div>
|
84
|
+
<div class="col-12 col-md-4">
|
85
|
+
<div class="field">
|
86
|
+
<%= payment_form.label :incoming_category_id, "ID Categoria Receita", class: 'required' %>
|
87
|
+
<%= payment_form.text_field :incoming_category_id, required: true, class:"fullwidth" %>
|
88
|
+
</div>
|
89
|
+
</div>
|
91
90
|
</div>
|
92
91
|
<% end %>
|
93
92
|
</fieldset>
|
@@ -120,16 +119,20 @@
|
|
120
119
|
<% end %>
|
121
120
|
</fieldset>
|
122
121
|
|
123
|
-
|
124
|
-
<
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
<
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
122
|
+
<% if @sellers %>
|
123
|
+
<fieldset class="no-border-top text-center">
|
124
|
+
<legend>
|
125
|
+
Vendedor padrão
|
126
|
+
</legend>
|
127
|
+
<div class="col-12 col-md-6 mx-auto">
|
128
|
+
<div class="field">
|
129
|
+
<%= form.select "default_seller", @sellers, {selected: ::SolidusBling::Seller.default&.id, include_blank: true }, { class: "custom-select fullwidth" } %>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
</fieldset>
|
134
|
+
<% end %>
|
135
|
+
|
133
136
|
|
134
137
|
|
135
138
|
<div class="form-buttons filter-actions actions" data-hook="buttons">
|
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.
|
4
|
+
version: 3.4.6
|
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-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_core
|
@@ -151,6 +151,8 @@ files:
|
|
151
151
|
- db/migrate/20240318171147_add_solidus_bling_seller_id_to_orders.rb
|
152
152
|
- db/migrate/20240318180555_add_deafult_column_to_sellers.rb
|
153
153
|
- db/migrate/20240424112257_add_active_column_to_sellers.rb
|
154
|
+
- db/migrate/20240830124253_add_incoming_category_id_on_payment_method.rb
|
155
|
+
- db/migrate/20240830124611_remove_incoming_category_id_from_account.rb
|
154
156
|
- lib/generators/solidus_bling/install/install_generator.rb
|
155
157
|
- lib/generators/solidus_bling/install/templates/initializer.rb
|
156
158
|
- lib/solidus_bling.rb
|