pagseguro 0.1.5 → 0.1.6
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.
- data/Gemfile.lock +49 -32
- data/lib/pagseguro.rb +1 -0
- data/lib/pagseguro/order.rb +1 -1
- data/lib/pagseguro/railtie.rb +1 -1
- data/lib/pagseguro/rake.rb +12 -7
- data/lib/pagseguro/version.rb +1 -1
- data/pagseguro.gemspec +1 -0
- data/spec/pagseguro/order_spec.rb +7 -0
- data/spec/spec_helper.rb +0 -1
- metadata +15 -26
data/Gemfile.lock
CHANGED
@@ -1,69 +1,73 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pagseguro (0.1.
|
4
|
+
pagseguro (0.1.6)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
9
|
abstract (1.0.0)
|
10
|
-
actionmailer (3.0.
|
11
|
-
actionpack (= 3.0.
|
12
|
-
mail (~> 2.2.
|
13
|
-
actionpack (3.0.
|
14
|
-
activemodel (= 3.0.
|
15
|
-
activesupport (= 3.0.
|
10
|
+
actionmailer (3.0.5)
|
11
|
+
actionpack (= 3.0.5)
|
12
|
+
mail (~> 2.2.15)
|
13
|
+
actionpack (3.0.5)
|
14
|
+
activemodel (= 3.0.5)
|
15
|
+
activesupport (= 3.0.5)
|
16
16
|
builder (~> 2.1.2)
|
17
17
|
erubis (~> 2.6.6)
|
18
18
|
i18n (~> 0.4)
|
19
19
|
rack (~> 1.2.1)
|
20
20
|
rack-mount (~> 0.6.13)
|
21
|
-
rack-test (~> 0.5.
|
21
|
+
rack-test (~> 0.5.7)
|
22
22
|
tzinfo (~> 0.3.23)
|
23
|
-
activemodel (3.0.
|
24
|
-
activesupport (= 3.0.
|
23
|
+
activemodel (3.0.5)
|
24
|
+
activesupport (= 3.0.5)
|
25
25
|
builder (~> 2.1.2)
|
26
26
|
i18n (~> 0.4)
|
27
|
-
activerecord (3.0.
|
28
|
-
activemodel (= 3.0.
|
29
|
-
activesupport (= 3.0.
|
27
|
+
activerecord (3.0.5)
|
28
|
+
activemodel (= 3.0.5)
|
29
|
+
activesupport (= 3.0.5)
|
30
30
|
arel (~> 2.0.2)
|
31
31
|
tzinfo (~> 0.3.23)
|
32
|
-
activeresource (3.0.
|
33
|
-
activemodel (= 3.0.
|
34
|
-
activesupport (= 3.0.
|
35
|
-
activesupport (3.0.
|
36
|
-
|
32
|
+
activeresource (3.0.5)
|
33
|
+
activemodel (= 3.0.5)
|
34
|
+
activesupport (= 3.0.5)
|
35
|
+
activesupport (3.0.5)
|
36
|
+
archive-tar-minitar (0.5.2)
|
37
|
+
arel (2.0.9)
|
37
38
|
builder (2.1.2)
|
39
|
+
columnize (0.3.2)
|
38
40
|
diff-lcs (1.1.2)
|
39
41
|
erubis (2.6.6)
|
40
42
|
abstract (>= 1.0.0)
|
41
43
|
fakeweb (1.3.0)
|
42
44
|
i18n (0.5.0)
|
43
|
-
|
45
|
+
linecache19 (0.5.11)
|
46
|
+
ruby_core_source (>= 0.1.4)
|
47
|
+
mail (2.2.15)
|
44
48
|
activesupport (>= 2.3.6)
|
45
49
|
i18n (>= 0.4.0)
|
46
50
|
mime-types (~> 1.16)
|
47
51
|
treetop (~> 1.4.8)
|
48
52
|
mime-types (1.16)
|
49
|
-
nokogiri (1.4.
|
53
|
+
nokogiri (1.4.4)
|
50
54
|
polyglot (0.3.1)
|
51
55
|
rack (1.2.1)
|
52
56
|
rack-mount (0.6.13)
|
53
57
|
rack (>= 1.0.0)
|
54
58
|
rack-test (0.5.7)
|
55
59
|
rack (>= 1.0)
|
56
|
-
rails (3.0.
|
57
|
-
actionmailer (= 3.0.
|
58
|
-
actionpack (= 3.0.
|
59
|
-
activerecord (= 3.0.
|
60
|
-
activeresource (= 3.0.
|
61
|
-
activesupport (= 3.0.
|
60
|
+
rails (3.0.5)
|
61
|
+
actionmailer (= 3.0.5)
|
62
|
+
actionpack (= 3.0.5)
|
63
|
+
activerecord (= 3.0.5)
|
64
|
+
activeresource (= 3.0.5)
|
65
|
+
activesupport (= 3.0.5)
|
62
66
|
bundler (~> 1.0)
|
63
|
-
railties (= 3.0.
|
64
|
-
railties (3.0.
|
65
|
-
actionpack (= 3.0.
|
66
|
-
activesupport (= 3.0.
|
67
|
+
railties (= 3.0.5)
|
68
|
+
railties (3.0.5)
|
69
|
+
actionpack (= 3.0.5)
|
70
|
+
activesupport (= 3.0.5)
|
67
71
|
rake (>= 0.8.7)
|
68
72
|
thor (~> 0.14.4)
|
69
73
|
rake (0.8.7)
|
@@ -80,11 +84,23 @@ GEM
|
|
80
84
|
activesupport (~> 3.0)
|
81
85
|
railties (~> 3.0)
|
82
86
|
rspec (~> 2.4.0)
|
83
|
-
|
87
|
+
ruby-debug-base19 (0.11.24)
|
88
|
+
columnize (>= 0.3.1)
|
89
|
+
linecache19 (>= 0.5.11)
|
90
|
+
ruby_core_source (>= 0.1.4)
|
91
|
+
ruby-debug19 (0.11.6)
|
92
|
+
columnize (>= 0.3.1)
|
93
|
+
linecache19 (>= 0.5.11)
|
94
|
+
ruby-debug-base19 (>= 0.11.19)
|
95
|
+
ruby_core_source (0.1.4)
|
96
|
+
archive-tar-minitar (>= 0.5.2)
|
97
|
+
sqlite3 (1.3.3)
|
98
|
+
sqlite3-ruby (1.3.3)
|
99
|
+
sqlite3 (>= 1.3.3)
|
84
100
|
thor (0.14.6)
|
85
101
|
treetop (1.4.9)
|
86
102
|
polyglot (>= 0.3.1)
|
87
|
-
tzinfo (0.3.
|
103
|
+
tzinfo (0.3.24)
|
88
104
|
|
89
105
|
PLATFORMS
|
90
106
|
ruby
|
@@ -95,4 +111,5 @@ DEPENDENCIES
|
|
95
111
|
pagseguro!
|
96
112
|
rails (~> 3.0.3)
|
97
113
|
rspec-rails (~> 2.4.1)
|
114
|
+
ruby-debug19
|
98
115
|
sqlite3-ruby
|
data/lib/pagseguro.rb
CHANGED
data/lib/pagseguro/order.rb
CHANGED
@@ -66,7 +66,7 @@ module PagSeguro
|
|
66
66
|
|
67
67
|
private
|
68
68
|
def convert_unit(number, unit)
|
69
|
-
number = (number * unit).to_i unless number.nil? || number.kind_of?(Integer)
|
69
|
+
number = (BigDecimal("#{number}") * unit).to_i unless number.nil? || number.kind_of?(Integer)
|
70
70
|
number
|
71
71
|
end
|
72
72
|
end
|
data/lib/pagseguro/railtie.rb
CHANGED
@@ -19,7 +19,7 @@ module PagSeguro
|
|
19
19
|
::ActionController::Base.send(:include, PagSeguro::ActionController)
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
config.after_initialize do
|
23
23
|
require "pagseguro/developer_controller" if PagSeguro.developer?
|
24
24
|
end
|
25
25
|
end
|
data/lib/pagseguro/rake.rb
CHANGED
@@ -5,6 +5,11 @@ module PagSeguro
|
|
5
5
|
def run
|
6
6
|
require "digest/md5"
|
7
7
|
|
8
|
+
env = ENV.inject({}) do |buffer, (name, value)|
|
9
|
+
value = value.respond_to?(:force_encoding) ? value.dup.force_encoding("UTF-8") : value
|
10
|
+
buffer.merge(name => value)
|
11
|
+
end
|
12
|
+
|
8
13
|
# Not running in developer mode? Exit!
|
9
14
|
unless PagSeguro.developer?
|
10
15
|
puts "=> [PagSeguro] Can only notify development URLs"
|
@@ -28,17 +33,17 @@ module PagSeguro
|
|
28
33
|
end
|
29
34
|
|
30
35
|
# Get the specified order
|
31
|
-
order = orders[
|
36
|
+
order = orders[env["ID"]]
|
32
37
|
|
33
38
|
# Not again! No order! Exit!
|
34
39
|
unless order
|
35
|
-
puts "=> [PagSeguro] The order #{
|
40
|
+
puts "=> [PagSeguro] The order #{env['ID'].inspect} could not be found. Exiting now!"
|
36
41
|
exit 1
|
37
42
|
end
|
38
43
|
|
39
44
|
# Set the client's info
|
40
|
-
name =
|
41
|
-
email =
|
45
|
+
name = env.fetch("NAME", Faker.name)
|
46
|
+
email = env.fetch("EMAIL", Faker.email)
|
42
47
|
|
43
48
|
order["CliNome"] = name
|
44
49
|
order["CliEmail"] = email
|
@@ -80,16 +85,16 @@ module PagSeguro
|
|
80
85
|
end
|
81
86
|
|
82
87
|
# Retrieve the specified status or default to :completed
|
83
|
-
status = (
|
88
|
+
status = env.fetch("STATUS", :completed).to_sym
|
84
89
|
|
85
90
|
# Retrieve the specified payment method or default to :credit_card
|
86
|
-
payment_method = (
|
91
|
+
payment_method = env.fetch("PAYMENT_METHOD", :credit_card).to_sym
|
87
92
|
|
88
93
|
# Set a random transaction id
|
89
94
|
order["TransacaoID"] = Digest::MD5.hexdigest(Time.now.to_s)
|
90
95
|
|
91
96
|
# Set note
|
92
|
-
order["Anotacao"] =
|
97
|
+
order["Anotacao"] = env["NOTE"].to_s
|
93
98
|
|
94
99
|
# Retrieve index
|
95
100
|
index = proc do |hash, value|
|
data/lib/pagseguro/version.rb
CHANGED
data/pagseguro.gemspec
CHANGED
@@ -64,6 +64,13 @@ describe PagSeguro::Order do
|
|
64
64
|
p[:shipping].should == 367
|
65
65
|
end
|
66
66
|
|
67
|
+
specify "bug fix: should convert 1.15 correctly" do
|
68
|
+
@order << @product.merge(:price => 1.15)
|
69
|
+
|
70
|
+
p = @order.products.first
|
71
|
+
p[:price].should == 115
|
72
|
+
end
|
73
|
+
|
67
74
|
it "should convert big decimal to cents" do
|
68
75
|
@product.merge!(:price => BigDecimal.new("199.00"))
|
69
76
|
@order << @product
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagseguro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 5
|
9
|
-
version: 0.1.5
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.6
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Nando Vieira
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-02-28 00:00:00 -03:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,10 +21,6 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ~>
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 3
|
30
|
-
- 0
|
31
|
-
- 3
|
32
24
|
version: 3.0.3
|
33
25
|
type: :development
|
34
26
|
version_requirements: *id001
|
@@ -40,8 +32,6 @@ dependencies:
|
|
40
32
|
requirements:
|
41
33
|
- - ">="
|
42
34
|
- !ruby/object:Gem::Version
|
43
|
-
segments:
|
44
|
-
- 0
|
45
35
|
version: "0"
|
46
36
|
type: :development
|
47
37
|
version_requirements: *id002
|
@@ -53,10 +43,6 @@ dependencies:
|
|
53
43
|
requirements:
|
54
44
|
- - ~>
|
55
45
|
- !ruby/object:Gem::Version
|
56
|
-
segments:
|
57
|
-
- 2
|
58
|
-
- 4
|
59
|
-
- 1
|
60
46
|
version: 2.4.1
|
61
47
|
type: :development
|
62
48
|
version_requirements: *id003
|
@@ -68,8 +54,6 @@ dependencies:
|
|
68
54
|
requirements:
|
69
55
|
- - ">="
|
70
56
|
- !ruby/object:Gem::Version
|
71
|
-
segments:
|
72
|
-
- 0
|
73
57
|
version: "0"
|
74
58
|
type: :development
|
75
59
|
version_requirements: *id004
|
@@ -81,11 +65,20 @@ dependencies:
|
|
81
65
|
requirements:
|
82
66
|
- - ">="
|
83
67
|
- !ruby/object:Gem::Version
|
84
|
-
segments:
|
85
|
-
- 0
|
86
68
|
version: "0"
|
87
69
|
type: :development
|
88
70
|
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: ruby-debug19
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
80
|
+
type: :development
|
81
|
+
version_requirements: *id006
|
89
82
|
description: The official PagSeguro library
|
90
83
|
email:
|
91
84
|
- fnando.vieira@gmail.com
|
@@ -156,21 +149,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
149
|
requirements:
|
157
150
|
- - ">="
|
158
151
|
- !ruby/object:Gem::Version
|
159
|
-
segments:
|
160
|
-
- 0
|
161
152
|
version: "0"
|
162
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
154
|
none: false
|
164
155
|
requirements:
|
165
156
|
- - ">="
|
166
157
|
- !ruby/object:Gem::Version
|
167
|
-
segments:
|
168
|
-
- 0
|
169
158
|
version: "0"
|
170
159
|
requirements: []
|
171
160
|
|
172
161
|
rubyforge_project:
|
173
|
-
rubygems_version: 1.
|
162
|
+
rubygems_version: 1.5.2
|
174
163
|
signing_key:
|
175
164
|
specification_version: 3
|
176
165
|
summary: The official PagSeguro library
|