mp_api 0.3.8 → 0.3.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70b974d39a2f32b20eaf5ab1d1e71a808aee9727de3b440cbcaca6155b70b8be
4
- data.tar.gz: 652c07eda8d6f6a2d246b86a0a95ccf5b564d28c7f4a02f253d849690f9cbaf3
3
+ metadata.gz: 3b265ed3302d5d615c952dca4e462f08969d811f9fbd391eb4708a9917297d23
4
+ data.tar.gz: b0b94e47834a218a9e5b8d8efe717637c5a29db8543a68a0037ecd47681678cd
5
5
  SHA512:
6
- metadata.gz: 21a90e4578f235b1c22fe19a83b2058b54c8d5d08376be73f67cb82ae7817a7c3fcb8b70cf61135eb8a440932ddc2aea916acb5802fe8d72ec21a10d9120813c
7
- data.tar.gz: 2711a21679e9a2f34c25b88acf1dbf3e446267906ba9bf079d408e8d039c8a0d977674e1f8f4fe39c971cc1770883749c80492aea58feaee9f483204bf4ce5af
6
+ metadata.gz: 7dc5029aeadf0b405c4202088e9eafe523602a19695243ed39536d5a9486f3d2279910531eada0cca3c07a45137020eb36800bdc3973bc581b1b4de22b544468
7
+ data.tar.gz: 24ca7ab51eb9c400d5381481f36357cceecebd3f7aba6bff9a3d705bb3762d609e28d7d3a43f44af6e81cc20d2b83b7199f54e56335828560e61f8ac3e82862b
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MpApi
4
- VERSION = "0.3.8"
4
+ VERSION = "0.3.10"
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.8
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - caio