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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c600eab092606f704327cff5ebe60fa86932272b751a4dd1103d6ebb4538c235
4
- data.tar.gz: 07b7972375ab32e0511db182e32b7a249f185af9c60844abc305c5cb4588717d
3
+ metadata.gz: 48502672bd54cbc042ef54a26dc316c50234c833ab5f31031c1579dcfc6ca653
4
+ data.tar.gz: 9560c8e8acfb40c240bcbdc177c3d134bed092b9f4b442a22c29d4ff66856db8
5
5
  SHA512:
6
- metadata.gz: 05c48e6250018130c06654b768a809f88bf2a980b422566bc77edfec5da30668ba3708bd70213b259da6f40a2a4c5aa1ec9d51990df8289f3a4205a2ddefaff2
7
- data.tar.gz: 8e9e04813caa77e89d6cb26dd2d2ae1950b5e03d2a6e889c5be1fff5ea7cd659af0078ae2497f509d6e0f9c4de55d6c4861668a42cd48d75a67249b4abb85d69
6
+ metadata.gz: bae242985b66501ea05511ba97bf6b79f568058c9cf1771582034270f5b0ad6f064dc6be88f681604a19b8b6416152756b1878b736b59263d9f4cc26ead0c928
7
+ data.tar.gz: e164962d26a36bbe9be7dba1301e84fcbdbb0637aef1755693d2d66af7ce513d0b9f5a3ddc9a6e940fde823084a797f33047cad973dcf0047af7814c49f7109c
@@ -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["cause"].first["description"]
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
- return nil unless json_response["error"]
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MpApi
4
- VERSION = "0.3.7"
4
+ VERSION = "0.3.9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mp_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - caio