solidus_mp_dois 1.1.2 → 1.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 +4 -4
- data/app/models/solidus_mp_dois/mp_card.rb +7 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa2e4883daa1f5b553b63c017afea054288c9e26337f52905ecbe9ac6e64dd2c
|
4
|
+
data.tar.gz: 2a861122b230ec96145a402ac9f36381e29cc194cfb2711f4bf85af4d31dc7f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50e749a2d31a0854cb77dd974d43b10f69e11519c1476cbbfe962803a249bf7a07b41e33ef7b544f2ad0e0cec7b73648e00d7505ed201b888d5599196741461a
|
7
|
+
data.tar.gz: 66c6cd3b35367d5e48ee5e063b14039390d17dc2b9302a316dcbe846d9f4d44531e4f76ffeee0ae0a5742368897803feffe0b5f730e9c2afa87ef673010e0ae2
|
@@ -46,6 +46,11 @@ module SolidusMpDois
|
|
46
46
|
gateway.purchase(money, source, options)
|
47
47
|
end
|
48
48
|
|
49
|
+
def cancel!(mp_payment_id)
|
50
|
+
MpApi.configuration.access_token = preferences[:access_token]
|
51
|
+
MpApi::Payment.find_by_id(mp_payment_id).update(status: "cancelled")
|
52
|
+
end
|
53
|
+
|
49
54
|
private
|
50
55
|
|
51
56
|
def init_source order, source_params, customer
|
@@ -135,7 +140,7 @@ module SolidusMpDois
|
|
135
140
|
three_ds_creq: mp_payment.three_ds_info_creq,
|
136
141
|
last_four_digits: mp_payment.last_four_digits
|
137
142
|
)
|
138
|
-
if mp_payment.id.blank? || mp_payment.error || mp_payment.internal_error
|
143
|
+
if mp_payment.id.blank? || mp_payment.error || mp_payment.internal_error || mp_payment.status_detail == "pending_review_manual"
|
139
144
|
handle_payment_error(payment, mp_payment)
|
140
145
|
else
|
141
146
|
payment.order.update(email: payment.source.email)
|
@@ -151,14 +156,9 @@ module SolidusMpDois
|
|
151
156
|
payment.source.update!(status: status, internal_details: mp_payment.status_detail)
|
152
157
|
end
|
153
158
|
|
154
|
-
def cancel!(mp_payment_id)
|
155
|
-
MpApi.configuration.access_token = preferences[:access_token]
|
156
|
-
MpApi::Payment.find_by_id(mp_payment_id).update(status: "cancelled")
|
157
|
-
end
|
158
|
-
|
159
159
|
def handle_payment_error(payment, mp_payment)
|
160
160
|
payment.invalidate
|
161
|
-
error_message = mp_payment.error || "Erro ao criar o pagamento"
|
161
|
+
error_message = mp_payment.error || mp_payment.status_detail || "Erro ao criar o pagamento"
|
162
162
|
response = failure_response(error_message)
|
163
163
|
payment.log_entries.create(parsed_payment_response_details_with_fallback: response)
|
164
164
|
payment.source.update(internal_error: error_message, status: "error", internal_details: mp_payment.status_detail)
|