paypal-express 0.5.2 → 0.5.3
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 +3 -3
- data/README.rdoc +3 -0
- data/VERSION +1 -1
- data/lib/paypal/express/request.rb +5 -6
- data/lib/paypal/payment/request.rb +9 -2
- data/lib/paypal/payment/response/info.rb +3 -2
- data/spec/paypal/express/request_spec.rb +1 -2
- data/spec/paypal/payment/request_spec.rb +11 -3
- data/spec/paypal/payment/response/info_spec.rb +3 -2
- metadata +3 -3
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
paypal-express (0.5.
|
4
|
+
paypal-express (0.5.3)
|
5
5
|
activesupport (>= 2.3)
|
6
6
|
attr_required (>= 0.0.5)
|
7
7
|
i18n
|
@@ -10,7 +10,7 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: http://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (3.2.
|
13
|
+
activesupport (3.2.11)
|
14
14
|
i18n (~> 0.6)
|
15
15
|
multi_json (~> 1.0)
|
16
16
|
attr_required (0.0.5)
|
@@ -40,7 +40,7 @@ GEM
|
|
40
40
|
rspec-core (2.12.2)
|
41
41
|
rspec-expectations (2.12.1)
|
42
42
|
diff-lcs (~> 1.1.3)
|
43
|
-
rspec-mocks (2.12.
|
43
|
+
rspec-mocks (2.12.2)
|
44
44
|
yamler (0.1.0)
|
45
45
|
|
46
46
|
PLATFORMS
|
data/README.rdoc
CHANGED
@@ -4,6 +4,9 @@ Handle PayPal Express Checkout.
|
|
4
4
|
Both Instance Payment and Recurring Payment are supported.
|
5
5
|
Express Checkout for Digital Goods is also supported.
|
6
6
|
|
7
|
+
{<img src="https://secure.travis-ci.org/nov/paypal-express.png" />}[http://travis-ci.org/nov/paypal-express]
|
8
|
+
{<img src="http://www.pledgie.com/campaigns/19045.png?skin_name=chrome" />}[http://pledgie.com/campaigns/19045]
|
9
|
+
|
7
10
|
== Installation
|
8
11
|
|
9
12
|
gem install paypal-express
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
@@ -14,12 +14,11 @@ module Paypal
|
|
14
14
|
params[:NOSHIPPING] = 1
|
15
15
|
end
|
16
16
|
{
|
17
|
-
:solution_type
|
18
|
-
:landing_page
|
19
|
-
:email
|
20
|
-
:brand
|
21
|
-
:locale
|
22
|
-
:invoice_number => :INVNUM
|
17
|
+
:solution_type => :SOLUTIONTYPE,
|
18
|
+
:landing_page => :LANDINGPAGE,
|
19
|
+
:email => :EMAIL,
|
20
|
+
:brand => :BRANDNAME,
|
21
|
+
:locale => :LOCALECODE
|
23
22
|
}.each do |option_key, param_key|
|
24
23
|
params[param_key] = options[option_key] if options[option_key]
|
25
24
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Paypal
|
2
2
|
module Payment
|
3
3
|
class Request < Base
|
4
|
-
attr_optional :action, :currency_code, :description, :notify_url, :billing_type, :billing_agreement_description, :billing_agreement_id, :request_id, :seller_id
|
5
|
-
attr_accessor :amount, :items
|
4
|
+
attr_optional :action, :currency_code, :description, :notify_url, :billing_type, :billing_agreement_description, :billing_agreement_id, :request_id, :seller_id, :invoice_number, :custom
|
5
|
+
attr_accessor :amount, :items, :custom_fields
|
6
6
|
|
7
7
|
def initialize(attributes = {})
|
8
8
|
@amount = if attributes[:amount].is_a?(Common::Amount)
|
@@ -18,6 +18,7 @@ module Paypal
|
|
18
18
|
Array(attributes[:items]).each do |item_attrs|
|
19
19
|
@items << Item.new(item_attrs)
|
20
20
|
end
|
21
|
+
@custom_fields = attributes[:custom_fields] || {}
|
21
22
|
super
|
22
23
|
end
|
23
24
|
|
@@ -29,6 +30,8 @@ module Paypal
|
|
29
30
|
:"PAYMENTREQUEST_#{index}_SHIPPINGAMT" => Util.formatted_amount(self.amount.shipping),
|
30
31
|
:"PAYMENTREQUEST_#{index}_CURRENCYCODE" => self.currency_code,
|
31
32
|
:"PAYMENTREQUEST_#{index}_DESC" => self.description,
|
33
|
+
:"PAYMENTREQUEST_#{index}_INVNUM" => self.invoice_number,
|
34
|
+
:"PAYMENTREQUEST_#{index}_CUSTOM" => self.custom,
|
32
35
|
# NOTE:
|
33
36
|
# notify_url works only when DoExpressCheckoutPayment called.
|
34
37
|
# recurring payment doesn't support dynamic notify_url.
|
@@ -47,6 +50,10 @@ module Paypal
|
|
47
50
|
params.merge! item.to_params(index, item_index)
|
48
51
|
end
|
49
52
|
end
|
53
|
+
self.custom_fields.each do |key, value|
|
54
|
+
field = key.to_s.upcase.gsub("{N}", index.to_s).to_sym
|
55
|
+
params[field] = value
|
56
|
+
end
|
50
57
|
params
|
51
58
|
end
|
52
59
|
|
@@ -18,7 +18,8 @@ module Paypal
|
|
18
18
|
:TRANSACTIONID => :transaction_id,
|
19
19
|
:TRANSACTIONTYPE => :transaction_type,
|
20
20
|
:PAYMENTREQUESTID => :request_id,
|
21
|
-
:SELLERPAYPALACCOUNTID => :seller_id
|
21
|
+
:SELLERPAYPALACCOUNTID => :seller_id,
|
22
|
+
:EXCHANGERATE => :exchange_rate
|
22
23
|
}
|
23
24
|
attr_accessor *@@attribute_mapping.values
|
24
25
|
attr_accessor :amount
|
@@ -41,4 +42,4 @@ module Paypal
|
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
44
|
-
end
|
45
|
+
end
|
@@ -131,8 +131,7 @@ describe Paypal::Express::Request do
|
|
131
131
|
:landing_page => :LANDINGPAGE,
|
132
132
|
:email => :EMAIL,
|
133
133
|
:brand => :BRANDNAME,
|
134
|
-
:locale => :LOCALECODE
|
135
|
-
:invoice_number => :INVNUM
|
134
|
+
:locale => :LOCALECODE
|
136
135
|
}.each do |option_key, param_key|
|
137
136
|
it "should support #{option_key} option" do
|
138
137
|
expect do
|
@@ -9,6 +9,8 @@ describe Paypal::Payment::Request do
|
|
9
9
|
:currency_code => :JPY,
|
10
10
|
:description => 'Instant Payment Request',
|
11
11
|
:notify_url => 'http://merchant.example.com/notify',
|
12
|
+
:invoice_number => 'ABC123',
|
13
|
+
:custom => 'Custom',
|
12
14
|
:items => [{
|
13
15
|
:quantity => 2,
|
14
16
|
:name => 'Item1',
|
@@ -19,7 +21,10 @@ describe Paypal::Payment::Request do
|
|
19
21
|
:name => 'Item2',
|
20
22
|
:description => 'Awesome Item 2!',
|
21
23
|
:amount => 1.1
|
22
|
-
}]
|
24
|
+
}],
|
25
|
+
:custom_fields => {
|
26
|
+
"l_surveychoice{n}" => 'abcd' # The '{n}' will be replaced with the index
|
27
|
+
}
|
23
28
|
)
|
24
29
|
end
|
25
30
|
|
@@ -69,9 +74,11 @@ describe Paypal::Payment::Request do
|
|
69
74
|
:PAYMENTREQUEST_0_TAXAMT => "0.40",
|
70
75
|
:PAYMENTREQUEST_0_SHIPPINGAMT => "1.50",
|
71
76
|
:PAYMENTREQUEST_0_CURRENCYCODE => :JPY,
|
72
|
-
:PAYMENTREQUEST_0_DESC => "Instant Payment Request",
|
77
|
+
:PAYMENTREQUEST_0_DESC => "Instant Payment Request",
|
73
78
|
:PAYMENTREQUEST_0_NOTIFYURL => "http://merchant.example.com/notify",
|
74
79
|
:PAYMENTREQUEST_0_ITEMAMT => "23.80",
|
80
|
+
:PAYMENTREQUEST_0_INVNUM => "ABC123",
|
81
|
+
:PAYMENTREQUEST_0_CUSTOM => "Custom",
|
75
82
|
:L_PAYMENTREQUEST_0_NAME0 => "Item1",
|
76
83
|
:L_PAYMENTREQUEST_0_DESC0 => "Awesome Item 1!",
|
77
84
|
:L_PAYMENTREQUEST_0_AMT0 => "10.25",
|
@@ -79,7 +86,8 @@ describe Paypal::Payment::Request do
|
|
79
86
|
:L_PAYMENTREQUEST_0_NAME1 => "Item2",
|
80
87
|
:L_PAYMENTREQUEST_0_DESC1 => "Awesome Item 2!",
|
81
88
|
:L_PAYMENTREQUEST_0_AMT1 => "1.10",
|
82
|
-
:L_PAYMENTREQUEST_0_QTY1 => 3
|
89
|
+
:L_PAYMENTREQUEST_0_QTY1 => 3,
|
90
|
+
:L_SURVEYCHOICE0 => 'abcd' # Note the 'n' was replaced by the index
|
83
91
|
}
|
84
92
|
end
|
85
93
|
|
@@ -25,7 +25,8 @@ describe Paypal::Payment::Response::Info do
|
|
25
25
|
:RECEIPTID => '12345',
|
26
26
|
:SECUREMERCHANTACCOUNTID => '123456789',
|
27
27
|
:PAYMENTREQUESTID => '12345',
|
28
|
-
:SELLERPAYPALACCOUNTID => 'seller@shop.example.com'
|
28
|
+
:SELLERPAYPALACCOUNTID => 'seller@shop.example.com',
|
29
|
+
:EXCHANGERATE => '0.811965'
|
29
30
|
}
|
30
31
|
end
|
31
32
|
|
@@ -89,4 +90,4 @@ describe Paypal::Payment::Response::Info do
|
|
89
90
|
end
|
90
91
|
end
|
91
92
|
end
|
92
|
-
end
|
93
|
+
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.5.
|
4
|
+
version: 0.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -245,7 +245,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
245
245
|
version: '0'
|
246
246
|
segments:
|
247
247
|
- 0
|
248
|
-
hash:
|
248
|
+
hash: 2957452685464048552
|
249
249
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
250
250
|
none: false
|
251
251
|
requirements:
|