solidus_bling 3.1.0 → 3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59e29330f3c5da9ebba7b08113fa4c6b859861c715040e0915274b7d5af0ae32
4
- data.tar.gz: a6adb152b89aa7aa7a2243d5098aba58563b06e8e6c34a938cf021bce7b353f6
3
+ metadata.gz: 35c7eb372c6064dce193bc26212d674fc52d640aa9a5b82e419df0c9687b5dff
4
+ data.tar.gz: 05d5eebd774563a202e33481f5dcf555db44c0af225aaab1a6657b46ddd35e82
5
5
  SHA512:
6
- metadata.gz: d927218a320e560c0aaaae330c8d5e2402cf45d0298f64a7940b32ff7af065a26468787cac1526c02bb2192424b9add5358bc4f5aa9d4d4ca8f88e143596af3d
7
- data.tar.gz: 8a1b799003bd9f5bfe457e8ef2bac6ba09cd2a5c6698be82699cde210a17d3c1e7d0295db4eb7e8ea7f4eac030ca4e66c85ec859fa89a5acac0c60fa0b865703
6
+ metadata.gz: 339dd623af0910e3ddda55891b1879daa3ae7e0a5cc76e7f570afe24e151f23a20a763ab5314bfaacaa22da34f55cddce0f9c9803734bb7e3688ee9047a13de9
7
+ data.tar.gz: 6d82708caccccd65b6cd622f9fe89fcce74828bf495040dad9326f81d19eff00d46c1585cd362315d6eba716dfb84be27e288eb61af7a70bf5f77e865b69f8bb
@@ -15,7 +15,7 @@ module SolidusBling
15
15
  observacoes_internas = internal_observations
16
16
  transporte = shipment
17
17
 
18
- BlingApi::Order.new(
18
+ bling_order = BlingApi::Order.new(
19
19
  id_contato: contato.id,
20
20
  items: items,
21
21
  parcelas: parcelas,
@@ -26,11 +26,15 @@ module SolidusBling
26
26
  id_loja: @account.external_store_id,
27
27
  observacoes: "Número do pedido loja: #{@order.number}",
28
28
  observacoes_internas: observacoes_internas,
29
- valor_desconto: @order.adjustment_total,
29
+ valor_desconto: @order.adjustment_total.abs,
30
30
  id_categoria: @account.incoming_category_id,
31
31
  transporte: transporte,
32
32
  id_vendedor: @account.sellers.first.external_id
33
33
  ).create
34
+
35
+ if bling_order
36
+ @order.update(bling_order_id: bling_order.id)
37
+ end
34
38
  end
35
39
 
36
40
  def costumer
@@ -84,7 +88,7 @@ module SolidusBling
84
88
  "\n" \
85
89
  "Forma de envio: #{@order.shipments.last.selected_shipping_rate.name}" \
86
90
  "\n" +
87
- build_cupons(@order.promotions).to_s +
91
+ build_cupons(@order.adjustments.where(source_type: "Spree::PromotionAction", eligible: true)).to_s +
88
92
  "\n" +
89
93
  build_order_url.to_s
90
94
  end
@@ -149,7 +153,7 @@ module SolidusBling
149
153
  def build_cupons cupons
150
154
  string_cupons = ""
151
155
  if !cupons.empty?
152
- string_cupons = "Cupons utilizados: #{cupons.pluck(:name).join(", ")}"
156
+ string_cupons = "Cupons utilizados: #{cupons.pluck(:label).join(", ")}"
153
157
  end
154
158
  string_cupons
155
159
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusBling
4
- VERSION = "3.1.0"
4
+ VERSION = "3.2"
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.1.0
4
+ version: '3.2'
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: 2023-11-23 00:00:00.000000000 Z
11
+ date: 2023-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core