solidus_inter 1.7.0 → 2.0.0

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: 58e3197c7a31acf76c7cbabd7c4d022d90f066bb7f6fca452b32ef561eb47e9e
4
- data.tar.gz: 279a556d8a93c6bf976b32f64730e792fca81100b0ac68063fbe68bbec24da86
3
+ metadata.gz: f26d5961715115c68b93397ab535656b57c57d69005409c9a62a21f67ee735ff
4
+ data.tar.gz: a781c0a4133a46af79b2a92c930f3fd5165bbe582efa61698d93c6449a81e5cc
5
5
  SHA512:
6
- metadata.gz: ae1df800132213db65a529aaab5a9c2a89bcff18006a4419fb94cf1f9a0da0c46c0bb65dd58bd53dd6a71af71ad3e560b4d327ca962b7920eaa97f2488dc2970
7
- data.tar.gz: 890be9c8071c42e1aadafc995aef753d454a34107187e0ebcdf99420082943f8f3363e46694d02cb08c2120fd700c5428e7c76876b6fb4f6a6920fdedecc79f8
6
+ metadata.gz: 68ded17e92681541c0feadd0149edd8daa29594184c404af8c5c043d751101043721ba93816b420d329106b5930cc5b5f5d6a384698226923bf924d54b7304b4
7
+ data.tar.gz: 28a3d4bf964f59cc37a2cadcbac9ca9913823dc4c2944f1aaa31901986db7b58eb8bba321fbefbb0a30615191df81572111c8ec76c97fb04ed1c700ec3465813
@@ -8,8 +8,6 @@ module SolidusInter
8
8
  if inter_payment.paid?
9
9
  source.update(status: "approved", paid_amount: inter_payment.valor_pago, e2e_id: inter_payment.end_to_end_id)
10
10
  successful_response("Pagamento realizado", inter_payment.txid)
11
- else
12
- failure_response(inter_payment.internal_error || "Ocorreu um erro no pagamento.")
13
11
  end
14
12
  end
15
13
 
@@ -97,7 +97,7 @@ module SolidusInter
97
97
  end
98
98
 
99
99
  def find_existing_payment(order)
100
- pix_payments = order.payments.checkout
100
+ pix_payments = order.payments.checkout.where(payment_method: self)
101
101
  raise "More than one valid payment for #{order.number}" if pix_payments.count > 1
102
102
 
103
103
  pix_payments.first
@@ -119,11 +119,7 @@ module SolidusInter
119
119
  expiration: inter_payment.expiracao
120
120
  )
121
121
 
122
- if inter_payment.internal_error
123
- handle_payment_error(payment, inter_payment)
124
- else
125
- update_payment_status(payment, inter_payment)
126
- end
122
+ update_payment_status(payment, inter_payment)
127
123
  end
128
124
 
129
125
  def update_payment_status(payment, inter_payment)
@@ -133,14 +129,6 @@ module SolidusInter
133
129
  payment.source.update(status: status)
134
130
  end
135
131
 
136
- def handle_payment_error(payment, inter_payment)
137
- payment.invalidate
138
- error_message = inter_payment.internal_error || "Erro ao criar o pagamento"
139
- response = failure_response(error_message)
140
- payment.log_entries.create(parsed_payment_response_details_with_fallback: response)
141
- payment.source.update(internal_error: error_message, status: "error")
142
- end
143
-
144
132
  def set_api_client
145
133
  account = SolidusInter::Account.find_by(chave_pix: preferences[:chave_pix])
146
134
  client = ::InterApi::Client.new(
@@ -150,12 +138,12 @@ module SolidusInter
150
138
  conta_corrente: preferences[:conta_corrente],
151
139
  crt: temp_file(preferences[:crt]).path,
152
140
  key: temp_file(preferences[:key]).path,
153
- token: account&.token,
141
+ access_token: account&.token,
154
142
  token_expires_at: account&.expires_at,
155
143
  test_mode: preferences[:test_mode]
156
144
  )
157
145
  SolidusInter::Account.upsert(
158
- {token: client.token, expires_at: client.token_expires_at, chave_pix: client.chave_pix,
146
+ {token: client.access_token, expires_at: client.token_expires_at, chave_pix: client.chave_pix,
159
147
  spree_payment_method_id: id}, unique_by: :chave_pix
160
148
  )
161
149
  client
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusInter
4
- VERSION = "1.7.0"
4
+ VERSION = "2.0.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_inter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ulysses
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: inter_api
@@ -63,7 +62,6 @@ files:
63
62
  homepage: https://github.com/todasessascoisas/solidus_inter
64
63
  licenses: []
65
64
  metadata: {}
66
- post_install_message:
67
65
  rdoc_options: []
68
66
  require_paths:
69
67
  - lib
@@ -81,8 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
79
  - !ruby/object:Gem::Version
82
80
  version: '0'
83
81
  requirements: []
84
- rubygems_version: 3.5.10
85
- signing_key:
82
+ rubygems_version: 3.6.9
86
83
  specification_version: 4
87
84
  summary: ''
88
85
  test_files: []