mp_api 0.3.7 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mp_api/payment_error.rb +4 -5
- data/lib/mp_api/version.rb +1 -1
- 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: 48502672bd54cbc042ef54a26dc316c50234c833ab5f31031c1579dcfc6ca653
|
4
|
+
data.tar.gz: 9560c8e8acfb40c240bcbdc177c3d134bed092b9f4b442a22c29d4ff66856db8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bae242985b66501ea05511ba97bf6b79f568058c9cf1771582034270f5b0ad6f064dc6be88f681604a19b8b6416152756b1878b736b59263d9f4cc26ead0c928
|
7
|
+
data.tar.gz: e164962d26a36bbe9be7dba1301e84fcbdbb0637aef1755693d2d66af7ce513d0b9f5a3ddc9a6e940fde823084a797f33047cad973dcf0047af7814c49f7109c
|
data/lib/mp_api/payment_error.rb
CHANGED
@@ -6,24 +6,23 @@ module MpApi
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def error
|
9
|
+
return nil unless json_response["error"] || ["rejected"].include?(json_response["status"])
|
9
10
|
rejected_payment_error || failed_payment_error || "Pagamento recusado."
|
10
11
|
end
|
11
12
|
|
12
13
|
def internal_error
|
13
|
-
json_response["
|
14
|
+
return nil unless json_response["error"]
|
15
|
+
json_response["cause"]&.first["description"]
|
14
16
|
end
|
15
17
|
|
16
18
|
private
|
17
19
|
|
18
20
|
def rejected_payment_error
|
19
|
-
return nil unless ["rejected"].include?(json_response["status"])
|
20
21
|
message_by_status_detail(json_response["status_detail"])
|
21
22
|
end
|
22
23
|
|
23
24
|
def failed_payment_error
|
24
|
-
|
25
|
-
json_response["cause"].first["description"]
|
26
|
-
message_by_error_message(json_response["cause"].first["description"])
|
25
|
+
message_by_error_message(json_response["cause"]&.first["description"])
|
27
26
|
end
|
28
27
|
|
29
28
|
def message_by_status_detail(status_detail)
|
data/lib/mp_api/version.rb
CHANGED