paypal-express 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,50 +1,56 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paypal-express (0.4.1)
4
+ paypal-express (0.4.5)
5
5
  activesupport (>= 2.3)
6
- attr_required (>= 0.0.3)
6
+ attr_required (>= 0.0.5)
7
7
  i18n
8
8
  restclient_with_cert
9
9
 
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- activesupport (3.1.3)
13
+ activesupport (3.2.2)
14
+ i18n (~> 0.6)
14
15
  multi_json (~> 1.0)
15
- attr_required (0.0.3)
16
+ attr_required (0.0.5)
16
17
  bouncy-castle-java (1.5.0146.1)
18
+ configatron (2.9.0)
19
+ yamler (>= 0.1.0)
20
+ cover_me (1.2.0)
21
+ configatron
22
+ hashie
17
23
  diff-lcs (1.1.3)
18
24
  fakeweb (1.3.0)
25
+ hashie (1.2.0)
19
26
  i18n (0.6.0)
20
- jruby-openssl (0.7.4)
21
- bouncy-castle-java
22
- mime-types (1.17.2)
23
- multi_json (1.0.3)
24
- rake (0.9.2)
25
- rcov (0.9.10)
26
- rcov (0.9.10-java)
27
+ jruby-openssl (0.7.6.1)
28
+ bouncy-castle-java (>= 1.5.0146.1)
29
+ mime-types (1.18)
30
+ multi_json (1.1.0)
31
+ rake (0.9.2.2)
27
32
  rest-client (1.6.7)
28
33
  mime-types (>= 1.16)
29
34
  restclient_with_cert (0.0.8)
30
35
  rest-client (>= 1.6)
31
- rspec (2.6.0)
32
- rspec-core (~> 2.6.0)
33
- rspec-expectations (~> 2.6.0)
34
- rspec-mocks (~> 2.6.0)
35
- rspec-core (2.6.4)
36
- rspec-expectations (2.6.0)
37
- diff-lcs (~> 1.1.2)
38
- rspec-mocks (2.6.0)
36
+ rspec (2.9.0)
37
+ rspec-core (~> 2.9.0)
38
+ rspec-expectations (~> 2.9.0)
39
+ rspec-mocks (~> 2.9.0)
40
+ rspec-core (2.9.0)
41
+ rspec-expectations (2.9.0)
42
+ diff-lcs (~> 1.1.3)
43
+ rspec-mocks (2.9.0)
44
+ yamler (0.1.0)
39
45
 
40
46
  PLATFORMS
41
47
  java
42
48
  ruby
43
49
 
44
50
  DEPENDENCIES
51
+ cover_me (>= 1.2.0)
45
52
  fakeweb (>= 1.3.0)
46
53
  jruby-openssl (>= 0.7)
47
54
  paypal-express!
48
55
  rake (>= 0.8)
49
- rcov (>= 0.9)
50
56
  rspec (>= 2)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.5
1
+ 0.4.6
@@ -13,6 +13,13 @@ module Paypal
13
13
  params[:REQCONFIRMSHIPPING] = 0
14
14
  params[:NOSHIPPING] = 1
15
15
  end
16
+ {
17
+ :solution_type => :SOLUTIONTYPE,
18
+ :landing_page => :LANDINGPAGE,
19
+ :email => :EMAIL
20
+ }.each do |option_key, param_key|
21
+ params[param_key] = options[option_key] if options[option_key]
22
+ end
16
23
  Array(payment_requests).each_with_index do |payment_request, index|
17
24
  params.merge! payment_request.to_params(index)
18
25
  end
@@ -25,7 +32,7 @@ module Paypal
25
32
  Response.new response
26
33
  end
27
34
 
28
- def transaction_details( transaction_id )
35
+ def transaction_details(transaction_id)
29
36
  response = self.request :GetTransactionDetails, {:TRANSACTIONID=> transaction_id}
30
37
  Response.new response
31
38
  end
@@ -48,8 +48,8 @@ module Paypal
48
48
  end
49
49
 
50
50
  def items_amount
51
- self.items.inject(0.0) do |total, item|
52
- total += item.quantity * item.amount.to_f
51
+ self.items.sum do |item|
52
+ item.quantity * BigDecimal.new(item.amount.to_s)
53
53
  end
54
54
  end
55
55
  end
@@ -126,6 +126,21 @@ describe Paypal::Express::Request do
126
126
  }
127
127
  end
128
128
 
129
+ {
130
+ :solution_type => :SOLUTIONTYPE,
131
+ :landing_page => :LANDINGPAGE,
132
+ :email => :EMAIL
133
+ }.each do |option_key, param_key|
134
+ it "should support #{option_key} option" do
135
+ expect do
136
+ instance.setup instant_payment_request, return_url, cancel_url, option_key => 'some value'
137
+ end.should request_to nvp_endpoint, :post
138
+ instance._method_.should == :SetExpressCheckout
139
+ instance._sent_params_.should include param_key
140
+ instance._sent_params_[param_key].should == 'some value'
141
+ end
142
+ end
143
+
129
144
  context 'when instance payment request given' do
130
145
  it 'should call SetExpressCheckout' do
131
146
  expect do
@@ -105,4 +105,24 @@ describe Paypal::Payment::Request do
105
105
  }
106
106
  end
107
107
  end
108
+
109
+ describe '#items_amount' do
110
+ context 'when BigDecimal'
111
+ let(:instance) do
112
+ Paypal::Payment::Request.new(
113
+ :items => [{
114
+ :quantity => 3,
115
+ :name => 'Item1',
116
+ :description => 'Awesome Item 1!',
117
+ :amount => 130.45
118
+ }]
119
+ )
120
+ end
121
+
122
+ # NOTE:
123
+ # 391.35 * 3 => 391.34999999999997 (in ruby 1.9)
124
+ it 'should calculate total amount correctly' do
125
+ instance.items_amount.should == 391.35
126
+ end
127
+ end
108
128
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paypal-express
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-24 00:00:00.000000000Z
12
+ date: 2012-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70190063841760 !ruby/object:Gem::Requirement
16
+ requirement: &70107968069980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70190063841760
24
+ version_requirements: *70107968069980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: i18n
27
- requirement: &70190063841120 !ruby/object:Gem::Requirement
27
+ requirement: &70107968069300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70190063841120
35
+ version_requirements: *70107968069300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: restclient_with_cert
38
- requirement: &70190063840100 !ruby/object:Gem::Requirement
38
+ requirement: &70107968105540 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70190063840100
46
+ version_requirements: *70107968105540
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: attr_required
49
- requirement: &70190063829120 !ruby/object:Gem::Requirement
49
+ requirement: &70107968104480 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.0.5
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70190063829120
57
+ version_requirements: *70107968104480
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &70190063827760 !ruby/object:Gem::Requirement
60
+ requirement: &70107968103600 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0.8'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70190063827760
68
+ version_requirements: *70107968103600
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cover_me
71
- requirement: &70190063826720 !ruby/object:Gem::Requirement
71
+ requirement: &70107968102740 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.2.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70190063826720
79
+ version_requirements: *70107968102740
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &70190063826000 !ruby/object:Gem::Requirement
82
+ requirement: &70107968102040 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '2'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70190063826000
90
+ version_requirements: *70107968102040
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: fakeweb
93
- requirement: &70190063823880 !ruby/object:Gem::Requirement
93
+ requirement: &70107968101340 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: 1.3.0
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70190063823880
101
+ version_requirements: *70107968101340
102
102
  description: PayPal Express Checkout API Client for Instance, Recurring and Digital
103
103
  Goods Payment.
104
104
  email: nov@matake.jp
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  version: 1.3.6
212
212
  requirements: []
213
213
  rubyforge_project:
214
- rubygems_version: 1.8.12
214
+ rubygems_version: 1.8.17
215
215
  signing_key:
216
216
  specification_version: 3
217
217
  summary: PayPal Express Checkout API Client for Instance, Recurring and Digital Goods