mp_api 0.3.6 → 0.3.7
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 +12 -3
- data/lib/mp_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c600eab092606f704327cff5ebe60fa86932272b751a4dd1103d6ebb4538c235
|
4
|
+
data.tar.gz: 07b7972375ab32e0511db182e32b7a249f185af9c60844abc305c5cb4588717d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c48e6250018130c06654b768a809f88bf2a980b422566bc77edfec5da30668ba3708bd70213b259da6f40a2a4c5aa1ec9d51990df8289f3a4205a2ddefaff2
|
7
|
+
data.tar.gz: 8e9e04813caa77e89d6cb26dd2d2ae1950b5e03d2a6e889c5be1fff5ea7cd659af0078ae2497f509d6e0f9c4de55d6c4861668a42cd48d75a67249b4abb85d69
|
data/lib/mp_api/payment_error.rb
CHANGED
@@ -6,11 +6,11 @@ module MpApi
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def error
|
9
|
-
rejected_payment_error
|
9
|
+
rejected_payment_error || failed_payment_error || "Pagamento recusado."
|
10
10
|
end
|
11
11
|
|
12
12
|
def internal_error
|
13
|
-
|
13
|
+
json_response["cause"].first["description"]
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
@@ -23,6 +23,7 @@ module MpApi
|
|
23
23
|
def failed_payment_error
|
24
24
|
return nil unless json_response["error"]
|
25
25
|
json_response["cause"].first["description"]
|
26
|
+
message_by_error_message(json_response["cause"].first["description"])
|
26
27
|
end
|
27
28
|
|
28
29
|
def message_by_status_detail(status_detail)
|
@@ -33,7 +34,15 @@ module MpApi
|
|
33
34
|
"cc_rejected_insufficient_amount" => "Pagamento recusado. Limite insuficiente.",
|
34
35
|
"cc_rejected_call_for_authorize" => "Pagamento recusado.",
|
35
36
|
"cc_rejected_other_reason" => "Pagamento recusado."
|
36
|
-
}[status_detail]
|
37
|
+
}[status_detail]
|
37
38
|
end
|
39
|
+
|
40
|
+
def message_by_error_message(error_message)
|
41
|
+
{
|
42
|
+
"Invalid user identification number" => "CPF inválido."
|
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
|
+
}[error_message]
|
45
|
+
end
|
46
|
+
|
38
47
|
end
|
39
48
|
end
|
data/lib/mp_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mp_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- caio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ac
|