solidus_inter 1.4.4 → 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
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
|
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
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_core
|