solidus_inter 3.1.1 → 3.2.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: 737e834e20ce74075aeda1880bb594784747b70fcbea3d4f321336090fd203f1
|
4
|
+
data.tar.gz: 171834eeffdf8f87daa2c099bb3f762867a07e83888407f366c423caa33f4bda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d20b24744b083c2203c8c29ad4bae102ab8fd86d2e753cfe2672018cc70a7eb3f97192f6fc793f35a04c57a900de6868d3b30bc49f7e60f7f74e218c55814554
|
7
|
+
data.tar.gz: f90c181d39d26600bb088f493f50144d35647fc3badf1d127bdd57df7025e6857e2cce73911ad183dcd662cff698b1813f15dc23558b4b4b8836802285ee1285
|
@@ -12,7 +12,7 @@ module SolidusInter
|
|
12
12
|
def credit(money, transaction_id, options = {})
|
13
13
|
payment = Spree::Payment.find_by(response_code: transaction_id)
|
14
14
|
payment_source = payment.source
|
15
|
-
refund = payment_source.refund!
|
15
|
+
refund = payment_source.refund!(amount: converted_money(money))
|
16
16
|
if refund.status == "DEVOLVIDO"
|
17
17
|
response = successful_response("Pagamento reembolsado (#{refund.status})", transaction_id)
|
18
18
|
payment.log_entries.create(parsed_payment_response_details_with_fallback: response)
|
@@ -26,6 +26,10 @@ module SolidusInter
|
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
+
def converted_money(money)
|
30
|
+
money / 100.0
|
31
|
+
end
|
32
|
+
|
29
33
|
def successful_response(message, transaction_id)
|
30
34
|
ActiveMerchant::Billing::Response.new(
|
31
35
|
true,
|
@@ -96,8 +96,9 @@ module SolidusInter
|
|
96
96
|
payment.checkout?
|
97
97
|
end
|
98
98
|
|
99
|
-
def refund_payment(payment)
|
100
|
-
|
99
|
+
def refund_payment(payment, amount = nil)
|
100
|
+
amount = payment.source.paid_amount if amount.nil?
|
101
|
+
inter_client.refund_payment(end_to_end_id: payment.source.e2e_id, amount: amount)
|
101
102
|
end
|
102
103
|
|
103
104
|
private
|
@@ -20,8 +20,17 @@ module SolidusInter
|
|
20
20
|
payment_method.invalidate_payment(payments.sole)
|
21
21
|
end
|
22
22
|
|
23
|
-
def refund!
|
24
|
-
payment_method.refund_payment(payments.sole)
|
23
|
+
def refund!(amount: nil)
|
24
|
+
payment_method.refund_payment(payments.sole, amount)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Definir para sempre false pois atualmente não implementados o void do Solidus
|
28
|
+
def can_void?(payment)
|
29
|
+
false
|
30
|
+
end
|
31
|
+
|
32
|
+
def can_credit?(payment)
|
33
|
+
payment.completed? && payment.credit_allowed > 0
|
25
34
|
end
|
26
35
|
end
|
27
36
|
end
|