pagseguro-transparente 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 240aa0272c092fe52489f17548b224d1b4d630fe
4
- data.tar.gz: 259fba6f4c7b508a839cdade72733b8990cf5c12
3
+ metadata.gz: ab229b6f3625d815fcacfabd2141da3a26c5cb40
4
+ data.tar.gz: 8625ca7d6d42ca4b921de0296d9dbe78d76952ed
5
5
  SHA512:
6
- metadata.gz: 6d6441e7b0028ed9f217df0137e820dd922d7acf73ec1042f1a8f5523a4d7b85c2a754c721be60aed0f62cd6b3b866cbfcfaa225e25a7e733ff26aa10cdc1af3
7
- data.tar.gz: ce98c5a032cfa814b14b79b0a4fe902999543a21e5c4e5d823e30f9406a9aa885e909ef887587cffba20d9af4ec447a099faeb6b22028ecb0157f45af160228e
6
+ metadata.gz: 3599ad6440a6c63bd9c9d7ec5d82ca2aec3cca74645d5a6a470a6eab3ac7ffabb46dde4f390c461419e60cc03c29f12d9b97d29fbbadcd34fe285df07f312289
7
+ data.tar.gz: 049105aa8cc58c8a7e09ad48c679b0dbdcef4b0d3cbe1263b37ae04a11a37f0e92cdf11bbb5a6015c6ccb300647caa2bbfabf1d88b7d54731420bf87beb7bff8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pagseguro-transparente (0.0.2)
4
+ pagseguro-transparente (0.0.3)
5
5
  activemodel
6
6
  httparty
7
7
  json
@@ -38,12 +38,12 @@ GEM
38
38
  i18n (0.6.9)
39
39
  json (1.8.1)
40
40
  mime-types (2.2)
41
- mini_portile (0.5.3)
41
+ mini_portile (0.6.0)
42
42
  minitest (5.3.3)
43
43
  multi_json (1.10.0)
44
44
  multi_xml (0.5.5)
45
- nokogiri (1.6.1)
46
- mini_portile (~> 0.5.0)
45
+ nokogiri (1.6.2.1)
46
+ mini_portile (= 0.6.0)
47
47
  rake (10.3.1)
48
48
  rest-client (1.6.7)
49
49
  mime-types (>= 1.16)
@@ -94,9 +94,9 @@ module PagSeguro
94
94
  end
95
95
 
96
96
  def errors
97
- response['errors'] ||= {}
97
+ response['errors'] ||= {'error' => []}
98
98
 
99
- [response['errors']['error']].compact
99
+ [response['errors']['error']].flatten
100
100
  end
101
101
 
102
102
  private
@@ -1,3 +1,3 @@
1
1
  module PagSeguro
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -18,8 +18,8 @@ describe PagSeguro::Notification do
18
18
  context "with default credencials" do
19
19
  subject { notification.transaction }
20
20
  before do
21
- stub_request(:get, "https://ws.pagseguro.uol.com.br/v2/transactions/notifications/766B9C-AD4B044B04DA-77742F5FA653-E1AB24").
22
- with(body: "email=mail&token=token").to_return(status: 200)
21
+ stub_request(:get, "https://ws.pagseguro.uol.com.br/v2/transactions/notifications/766B9C-AD4B044B04DA-77742F5FA653-E1AB24?email=mail&token=token").
22
+ to_return(:status => 200, :body => "", :headers => {})
23
23
  end
24
24
 
25
25
  it { should be_a_kind_of(PagSeguro::Transaction) }
@@ -31,8 +31,8 @@ describe PagSeguro::Notification do
31
31
  let(:notification) { PagSeguro::Notification.new(code, type, 'custom_email', 'custom_token') }
32
32
 
33
33
  before do
34
- stub_request(:get, "https://ws.pagseguro.uol.com.br/v2/transactions/notifications/766B9C-AD4B044B04DA-77742F5FA653-E1AB24").
35
- with(body: "email=custom_email&token=custom_token").to_return(status: 200)
34
+ stub_request(:get, "https://ws.pagseguro.uol.com.br/v2/transactions/notifications/766B9C-AD4B044B04DA-77742F5FA653-E1AB24?email=custom_email&token=custom_token").
35
+ to_return(:status => 200, :body => "", :headers => {})
36
36
  end
37
37
 
38
38
  it { should be_a_kind_of(PagSeguro::Transaction) }
@@ -55,16 +55,34 @@ describe PagSeguro::Transaction do
55
55
  end
56
56
 
57
57
  context "unsuccessfull transaction" do
58
- let(:xml_file) {
59
- "<errors>
60
- <error>
61
- <code>53044</code>
62
- <message>credit card holder name invalid value: Flora</message>
63
- </error>
64
- </errors>"
65
- }
58
+ context "one error only" do
59
+ let(:xml_file) {
60
+ "<errors>
61
+ <error>
62
+ <code>53044</code>
63
+ <message>credit card holder name invalid value: Flora</message>
64
+ </error>
65
+ </errors>"
66
+ }
67
+
68
+ it { should_not be_valid}
69
+ its(:errors) { should eq( [ { "code" => "53044", "message" => "credit card holder name invalid value: Flora"} ]) }
70
+ end
71
+
72
+ context "various errors" do
73
+ let(:xml_file) {
74
+ "<errors>
75
+ <error>
76
+ <code>53017</code><message>sender cpf invalid value: 01391039130</message>
77
+ </error>
78
+ <error>
79
+ <code>53015</code><message>sender name invalid value: Flora</message>
80
+ </error>
81
+ </errors>"
82
+ }
66
83
 
67
- it { should_not be_valid}
68
- its(:errors) { should eq( [ { "code" => "53044", "message" => "credit card holder name invalid value: Flora"} ]) }
84
+ it { should_not be_valid}
85
+ its(:errors) { should eq( [ { "code" => "53017", "message" => "sender cpf invalid value: 01391039130"}, { "code" => "53015", "message" => "sender name invalid value: Flora"} ]) }
86
+ end
69
87
  end
70
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagseguro-transparente
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cirdes Henrique
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-13 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel