pagseguro-transparente 0.0.4 → 0.0.5
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 +4 -4
- data/Gemfile.lock +4 -4
- data/lib/pagseguro/notification.rb +1 -1
- data/lib/pagseguro/payment.rb +1 -5
- data/lib/pagseguro/request.rb +8 -8
- data/lib/pagseguro/session.rb +1 -8
- data/lib/pagseguro/version.rb +1 -1
- data/spec/pagseguro/notification_spec.rb +0 -13
- data/spec/pagseguro/session_spec.rb +0 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc60e1846eeb8d5e1d717456936b2bad5d4d15a7
|
4
|
+
data.tar.gz: 9dbe4daa795770f44fedcfa2146b676a1095f89b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bce6f42009c9611d2265a0ee4d5192aaf8634ae0f7b8317b3387f26668133a96a3bf425feac64d2c636bbbcb6722e28d44886f94527c23c4450154481b84b6b
|
7
|
+
data.tar.gz: f97787a57e8bf52baecc52ca75927cad8dbe406a40c092d3d6956e4cee79bec32f891f5362575641ff08c9d20ce59405026196a9fa234d244fe1e991ae770bc9
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pagseguro-transparente (0.0.
|
4
|
+
pagseguro-transparente (0.0.5)
|
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.
|
41
|
+
mini_portile (0.5.3)
|
42
42
|
minitest (5.3.3)
|
43
43
|
multi_json (1.10.0)
|
44
44
|
multi_xml (0.5.5)
|
45
|
-
nokogiri (1.6.
|
46
|
-
mini_portile (
|
45
|
+
nokogiri (1.6.1)
|
46
|
+
mini_portile (~> 0.5.0)
|
47
47
|
rake (10.3.1)
|
48
48
|
rest-client (1.6.7)
|
49
49
|
mime-types (>= 1.16)
|
data/lib/pagseguro/payment.rb
CHANGED
@@ -7,8 +7,6 @@ module PagSeguro
|
|
7
7
|
validates_presence_of :credit_card, if: :paid_with_card?
|
8
8
|
validates_inclusion_of :payment_method, in: %w(creditCard boleto eft)
|
9
9
|
|
10
|
-
attr_accessor :email, :token
|
11
|
-
|
12
10
|
# Determines for which url PagSeguro will send the order related
|
13
11
|
# notifications codes.
|
14
12
|
# Optional. Any change happens in the transaction status, a new notification
|
@@ -64,12 +62,10 @@ module PagSeguro
|
|
64
62
|
# Calls the PagSeguro web service and register this request for payment.
|
65
63
|
def transaction
|
66
64
|
params = Serializer.new(self).to_params
|
67
|
-
PagSeguro::Transaction.new post('/transactions',
|
65
|
+
PagSeguro::Transaction.new post('/transactions', params)
|
68
66
|
end
|
69
67
|
|
70
68
|
def initialize(options = {})
|
71
|
-
@email = options[:email]
|
72
|
-
@token = options[:token]
|
73
69
|
@currency = "BRL"
|
74
70
|
@payment_mode = 'default'
|
75
71
|
@notification_url = options[:notification_url]
|
data/lib/pagseguro/request.rb
CHANGED
@@ -7,28 +7,28 @@ module PagSeguro
|
|
7
7
|
|
8
8
|
base_uri "https://ws.pagseguro.uol.com.br/v2/"
|
9
9
|
|
10
|
-
def get(path
|
10
|
+
def get(path)
|
11
11
|
options = { query: {
|
12
|
-
email:
|
13
|
-
token:
|
12
|
+
email: PagSeguro.email,
|
13
|
+
token: PagSeguro.token
|
14
14
|
}
|
15
15
|
}
|
16
16
|
self.class.get(path, options)
|
17
17
|
end
|
18
18
|
|
19
|
-
def post(path,
|
20
|
-
options = add_credencials(
|
19
|
+
def post(path, params = {})
|
20
|
+
options = add_credencials(params)
|
21
21
|
|
22
22
|
response = self.class.post(path, options)
|
23
23
|
response.parsed_response
|
24
24
|
end
|
25
25
|
|
26
26
|
private
|
27
|
-
def add_credencials(
|
27
|
+
def add_credencials(params)
|
28
28
|
options = { body:
|
29
29
|
{
|
30
|
-
email:
|
31
|
-
token:
|
30
|
+
email: PagSeguro.email,
|
31
|
+
token: PagSeguro.token
|
32
32
|
}
|
33
33
|
}
|
34
34
|
options[:body].merge!(params)
|
data/lib/pagseguro/session.rb
CHANGED
@@ -1,14 +1,7 @@
|
|
1
1
|
module PagSeguro
|
2
2
|
class Session < Request
|
3
|
-
attr_accessor :token, :email
|
4
|
-
|
5
3
|
def create
|
6
|
-
Response.new post('/sessions'
|
7
|
-
end
|
8
|
-
|
9
|
-
def initialize(email = nil, token = nil)
|
10
|
-
@email = email
|
11
|
-
@token = token
|
4
|
+
Response.new post('/sessions')
|
12
5
|
end
|
13
6
|
end
|
14
7
|
end
|
data/lib/pagseguro/version.rb
CHANGED
@@ -24,18 +24,5 @@ describe PagSeguro::Notification do
|
|
24
24
|
|
25
25
|
it { should be_a_kind_of(PagSeguro::Transaction) }
|
26
26
|
end
|
27
|
-
|
28
|
-
context "with custom credencials" do
|
29
|
-
subject { notification.transaction }
|
30
|
-
|
31
|
-
let(:notification) { PagSeguro::Notification.new(code, type, 'custom_email', 'custom_token') }
|
32
|
-
|
33
|
-
before do
|
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
|
-
end
|
37
|
-
|
38
|
-
it { should be_a_kind_of(PagSeguro::Transaction) }
|
39
|
-
end
|
40
27
|
end
|
41
28
|
end
|
@@ -22,15 +22,5 @@ describe PagSeguro::Session do
|
|
22
22
|
|
23
23
|
it { should be_a_kind_of(PagSeguro::Session::Response) }
|
24
24
|
end
|
25
|
-
|
26
|
-
context 'with custom email and token' do
|
27
|
-
let(:session) { PagSeguro::Session.new('custom_email', 'custom_token') }
|
28
|
-
before do
|
29
|
-
stub_request(:post, "https://ws.pagseguro.uol.com.br/v2/sessions").
|
30
|
-
with(body: "email=custom_email&token=custom_token").to_return(status: 200)
|
31
|
-
end
|
32
|
-
|
33
|
-
it { should be_a_kind_of(PagSeguro::Session::Response) }
|
34
|
-
end
|
35
25
|
end
|
36
26
|
end
|