solidus_bling 3.4.3 → 3.4.5

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: 474c1d7250f5abafe50d9c1b70978e78a16ee1d4954b85ca631be3829364a4c5
4
- data.tar.gz: 3b2ed9546da3d3f3cd8a4e558ea4f5ef8ec09488e748f94fa3a95c602b1f8765
3
+ metadata.gz: 86fb55a042d40aa34d5eaf3c1dc697d189a8ab9d5bdf551410871eb002b816bd
4
+ data.tar.gz: b95270aa77365172bdab967704f0ad64ee4e3b26cef5daed44a007c80fd5892e
5
5
  SHA512:
6
- metadata.gz: 8c0e2b194f2b37c398c8e8afc7edfd62b7ef85553ba6a0b398351c95c28e06268813b3da0c20476469ce71da3f1e372fb99a89757158f053872a916d3e9b4de7
7
- data.tar.gz: 99c3756b1fdc64462729d68c12dc29329eb9e127fe95c1dcbaa7a30d861cfb55f0ce5a06b82b7a8e395be157130d16df25457f37310147f085942d2c9afd837f
6
+ metadata.gz: 64986dd4c0f9177c8ae667c8414d6b28e4aad0c0e821f614241c29ae426ebb8325993c0c3e4943dd8b7b7a1e2ce64bffc82a069de49c0faec72aca5cf141d536
7
+ data.tar.gz: f76a22b611035be87d7a326bb67441807df7b4ef115be32454a4b93691abc14b2716f0d929ab35a02a095400fe62a0bbad4b7c857bf00944d4f44aa402fab858
@@ -74,8 +74,8 @@ module Spree
74
74
 
75
75
  def account_params
76
76
  params.require(:account).permit(
77
- :client_id, :client_secret, :refresh_token, :redirect_url, :state, :access_token, :api_key, :external_store_id, :incoming_category_id,
78
- payment_methods_attributes: [:id, :spree_payment_method_id, :external_id],
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, :incoming_category_id],
79
79
  shipping_methods_attributes: [:id, :spree_shipping_method_id, :alias, :company],
80
80
  sellers_attributes: [:id, :name, :external_id]
81
81
  )
@@ -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: @account.incoming_category_id,
34
+ id_categoria: id_categoria_receita,
34
35
  transporte: transporte,
35
36
  id_vendedor: id_vendedor
36
37
  ).create
@@ -183,7 +184,7 @@ module SolidusBling
183
184
  payment_method = order.payments.valid.last&.payment_method
184
185
  importation_rules = SolidusBling.config.importation_rules
185
186
  if importation_rules
186
- order.total >= importation_rules[:amount] && importation_rules[:payment_methods].include?(payment_method.type)
187
+ order.total >= importation_rules[:amount] && importation_rules[:payment_methods].include?(payment_method&.type)
187
188
  else
188
189
  false
189
190
  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-6">
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-6">
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>
@@ -0,0 +1,5 @@
1
+ class AddIncomingCategoryIdOnPaymentMethod < ActiveRecord::Migration[7.1]
2
+ def change
3
+ add_column :solidus_bling_payment_methods, :incoming_category_id, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class RemoveIncomingCategoryIdFromAccount < ActiveRecord::Migration[7.1]
2
+ def change
3
+ remove_column :solidus_bling_accounts, :incoming_category_id, :string
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusBling
4
- VERSION = "3.4.3"
4
+ VERSION = "3.4.5"
5
5
  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.3
4
+ version: 3.4.5
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-07-23 00:00:00.000000000 Z
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