solidus_inter 1.4.3 → 1.5.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 +4 -4
- data/app/models/solidus_inter/gateway.rb +19 -0
- data/app/models/solidus_inter/inter_pix.rb +5 -11
- data/app/models/solidus_inter/pix_payment_source.rb +9 -0
- data/app/views/spree/api/payments/source_views/_inter_pix.jbuilder +1 -1
- data/lib/solidus_inter/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6880a50bb4064d065f42b193d4eca5f279a69e26a53f5e8e98cc4aa1f2ba1f25
|
4
|
+
data.tar.gz: f6f455ab7c640fb55bcee39bf46e0d93e3c1bb0ca93fe5191ae0e83292900dd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc31d973df48f0b66e5913fcc9b0bb71df492e09db7d90470cb029fb3bf183a2b97d7e45f1a587844ceee8a340ebc6d6a86b4722a6c30bd98d3172714b030b24
|
7
|
+
data.tar.gz: e3fdbe911fc408488f990597aee8d218c4408daa33ec02678595c751b22572722e17baf7ef6da09d0393fa9706faf0f865723d34a01deb42988936cb8ef7d57a
|
@@ -3,11 +3,23 @@ module SolidusInter
|
|
3
3
|
def initialize options
|
4
4
|
end
|
5
5
|
|
6
|
+
def purchase money, source, options = {}
|
7
|
+
inter_payment = source.retrieve_from_api
|
8
|
+
if inter_payment.paid?
|
9
|
+
source.update(status: "approved", e2e_id: inter_payment.end_to_end_id)
|
10
|
+
successful_response("Pagamento realizado", inter_payment.txid)
|
11
|
+
else
|
12
|
+
failure_response(inter_payment.internal_error || "Ocorreu um erro no pagamento.")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
6
16
|
def void(transaction_id, options = {})
|
7
17
|
# Respondendo sempre com successful_response para funcionar o botão de "Cancelar" do pedido. Reembolso deve ser feito por fora.
|
8
18
|
successful_response("Pedido cancelado. Se necessário, realize o reembolso.", transaction_id)
|
9
19
|
end
|
10
20
|
|
21
|
+
private
|
22
|
+
|
11
23
|
def successful_response message, transaction_id
|
12
24
|
ActiveMerchant::Billing::Response.new(
|
13
25
|
true,
|
@@ -16,5 +28,12 @@ module SolidusInter
|
|
16
28
|
authorization: transaction_id
|
17
29
|
)
|
18
30
|
end
|
31
|
+
|
32
|
+
def failure_response message
|
33
|
+
ActiveMerchant::Billing::Response.new(
|
34
|
+
false,
|
35
|
+
message
|
36
|
+
)
|
37
|
+
end
|
19
38
|
end
|
20
39
|
end
|
@@ -53,12 +53,12 @@ module SolidusInter
|
|
53
53
|
client.get_payment(txid)
|
54
54
|
end
|
55
55
|
|
56
|
-
def invalidate_payment(
|
57
|
-
return false unless
|
58
|
-
inter_payment = find_payment(
|
56
|
+
def invalidate_payment(payment_source)
|
57
|
+
return false unless payment_source&.txid
|
58
|
+
inter_payment = find_payment(payment_source.txid)
|
59
59
|
return false if inter_payment.paid?
|
60
60
|
inter_payment.invalidate!
|
61
|
-
|
61
|
+
payment_source.payments[0].log_entries.create!(parsed_payment_response_details_with_fallback: failure_response("Pagamento cancelado"))
|
62
62
|
true
|
63
63
|
end
|
64
64
|
|
@@ -71,13 +71,7 @@ module SolidusInter
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def purchase(money, source, options = {})
|
74
|
-
|
75
|
-
if inter_payment.paid?
|
76
|
-
source.update(status: "approved", e2e_id: inter_payment.end_to_end_id)
|
77
|
-
successful_response("Pagamento realizado", inter_payment.txid)
|
78
|
-
else
|
79
|
-
failure_response(inter_payment.internal_error || "Ocorreu um erro no pagamento.")
|
80
|
-
end
|
74
|
+
gateway.purchase(money, source, options)
|
81
75
|
end
|
82
76
|
|
83
77
|
def should_skip_processing?(source)
|
@@ -27,5 +27,14 @@ module SolidusInter
|
|
27
27
|
def retrieve_from_api
|
28
28
|
payment_method.find_payment(txid)
|
29
29
|
end
|
30
|
+
|
31
|
+
def paid?
|
32
|
+
inter_payment = retrieve_from_api
|
33
|
+
inter_payment.paid?
|
34
|
+
end
|
35
|
+
|
36
|
+
def invalidate
|
37
|
+
payment_method.invalidate_payment(self)
|
38
|
+
end
|
30
39
|
end
|
31
40
|
end
|
@@ -1 +1 @@
|
|
1
|
-
json.call(payment_source, :id, :txid, :status, :amount, :payer_name, :payer_tax_id)
|
1
|
+
json.call(payment_source, :id, :txid, :e2e_id, :status, :amount, :payer_name, :payer_tax_id)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_inter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ulysses
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_core
|
@@ -136,7 +136,7 @@ metadata:
|
|
136
136
|
homepage_uri: https://github.com/ulysses-bull/solidus_inter#readme
|
137
137
|
source_code_uri: https://github.com/ulysses-bull/solidus_inter
|
138
138
|
changelog_uri: https://github.com/ulysses-bull/solidus_inter/blob/main/CHANGELOG.md
|
139
|
-
post_install_message:
|
139
|
+
post_install_message:
|
140
140
|
rdoc_options: []
|
141
141
|
require_paths:
|
142
142
|
- lib
|
@@ -154,8 +154,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: '0'
|
156
156
|
requirements: []
|
157
|
-
rubygems_version: 3.5.
|
158
|
-
signing_key:
|
157
|
+
rubygems_version: 3.5.3
|
158
|
+
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
summary: ''
|
161
161
|
test_files: []
|