mp_api 0.3.8 → 0.3.10
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 +3 -3
- 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: 3b265ed3302d5d615c952dca4e462f08969d811f9fbd391eb4708a9917297d23
|
4
|
+
data.tar.gz: b0b94e47834a218a9e5b8d8efe717637c5a29db8543a68a0037ecd47681678cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dc5029aeadf0b405c4202088e9eafe523602a19695243ed39536d5a9486f3d2279910531eada0cca3c07a45137020eb36800bdc3973bc581b1b4de22b544468
|
7
|
+
data.tar.gz: 24ca7ab51eb9c400d5381481f36357cceecebd3f7aba6bff9a3d705bb3762d609e28d7d3a43f44af6e81cc20d2b83b7199f54e56335828560e61f8ac3e82862b
|
data/lib/mp_api/payment_error.rb
CHANGED
@@ -6,6 +6,7 @@ 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
|
|
@@ -17,12 +18,10 @@ module MpApi
|
|
17
18
|
private
|
18
19
|
|
19
20
|
def rejected_payment_error
|
20
|
-
return nil unless ["rejected"].include?(json_response["status"])
|
21
21
|
message_by_status_detail(json_response["status_detail"])
|
22
22
|
end
|
23
23
|
|
24
24
|
def failed_payment_error
|
25
|
-
return nil unless json_response["error"]
|
26
25
|
message_by_error_message(json_response["cause"]&.first["description"])
|
27
26
|
end
|
28
27
|
|
@@ -39,7 +38,8 @@ module MpApi
|
|
39
38
|
|
40
39
|
def message_by_error_message(error_message)
|
41
40
|
{
|
42
|
-
"Invalid user identification number" => "CPF inválido."
|
41
|
+
"Invalid user identification number" => "CPF inválido.",
|
42
|
+
"payer.email must be a valid email" => "E-mail inválido."
|
43
43
|
# "Payer email forbidden" => "E-mail inválido.", Caso do erro no email test_user_2147198029@testuser.com (Nao sei se da pra causar com email valido)
|
44
44
|
}[error_message]
|
45
45
|
end
|
data/lib/mp_api/version.rb
CHANGED