paypal-express 0.6.0 → 0.7.0
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/.gitignore +1 -0
- data/VERSION +1 -1
- data/lib/paypal.rb +1 -1
- data/lib/paypal/express/request.rb +11 -1
- data/lib/paypal/nvp/response.rb +15 -3
- data/lib/paypal/payment/response.rb +13 -2
- data/lib/paypal/payment/response/{ship_to.rb → address.rb} +1 -1
- data/lib/paypal/payment/response/payer.rb +1 -1
- data/spec/fake_response/DoVoid/success.txt +1 -0
- data/spec/paypal/express/request_spec.rb +20 -0
- data/spec/paypal/payment/response/{ship_to_spec.rb → address_spec.rb} +4 -4
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7f72f535c8cd6e0b76346fb390c07371a0622c1
|
4
|
+
data.tar.gz: 9028bbaaded2cd53c0f63b4b027ac8a0e228165a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: defabc0e45346b1a6d2e0988caedfbe0312c3f85ac4381c9efbaf0db5a8209d967d3bb4a19c8d36cf17f8cd1ae41aaf97d2c4f6d9bc2315e363884755c1074d7
|
7
|
+
data.tar.gz: 1398ae44f8c36d17778d832f264b12ba4c2d397ac56f11a4d428235bf250b7e8fb28c68d33060ef8751f787894b399752e32bdd28e263a883c478baba301d91c
|
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.0
|
data/lib/paypal.rb
CHANGED
@@ -75,7 +75,7 @@ require 'paypal/payment/response/item'
|
|
75
75
|
require 'paypal/payment/response/payer'
|
76
76
|
require 'paypal/payment/response/reference'
|
77
77
|
require 'paypal/payment/response/refund'
|
78
|
-
require 'paypal/payment/response/
|
78
|
+
require 'paypal/payment/response/address'
|
79
79
|
require 'paypal/payment/recurring'
|
80
80
|
require 'paypal/payment/recurring/activation'
|
81
81
|
require 'paypal/payment/recurring/billing'
|
@@ -69,6 +69,16 @@ module Paypal
|
|
69
69
|
Response.new response
|
70
70
|
end
|
71
71
|
|
72
|
+
def void!(authorization_id, params={})
|
73
|
+
params = {
|
74
|
+
:AUTHORIZATIONID => authorization_id,
|
75
|
+
:NOTE => params[:note]
|
76
|
+
}
|
77
|
+
|
78
|
+
response = self.request :DoVoid, params
|
79
|
+
Response.new response
|
80
|
+
end
|
81
|
+
|
72
82
|
# Recurring Payment Specific
|
73
83
|
|
74
84
|
def subscribe!(token, recurring_profile)
|
@@ -128,7 +138,7 @@ module Paypal
|
|
128
138
|
|
129
139
|
def agreement(reference_id)
|
130
140
|
params = {
|
131
|
-
:REFERENCEID => reference_id
|
141
|
+
:REFERENCEID => reference_id
|
132
142
|
}
|
133
143
|
response = self.request :BillAgreementUpdate, params
|
134
144
|
Response.new response
|
data/lib/paypal/nvp/response.rb
CHANGED
@@ -38,7 +38,7 @@ module Paypal
|
|
38
38
|
}
|
39
39
|
attr_accessor *@@attribute_mapping.values
|
40
40
|
attr_accessor :shipping_options_is_default, :success_page_redirect_requested, :insurance_option_selected
|
41
|
-
attr_accessor :amount, :description, :ship_to, :payer, :recurring, :billing_agreement, :refund
|
41
|
+
attr_accessor :amount, :description, :ship_to, :bill_to, :payer, :recurring, :billing_agreement, :refund
|
42
42
|
attr_accessor :payment_responses, :payment_info, :items
|
43
43
|
|
44
44
|
def initialize(attributes = {})
|
@@ -59,7 +59,7 @@ module Paypal
|
|
59
59
|
:tax => attrs.delete(:TAXAMT),
|
60
60
|
:fee => attrs.delete(:FEEAMT)
|
61
61
|
)
|
62
|
-
@ship_to = Payment::Response::
|
62
|
+
@ship_to = Payment::Response::Address.new(
|
63
63
|
:owner => attrs.delete(:SHIPADDRESSOWNER),
|
64
64
|
:status => attrs.delete(:SHIPADDRESSSTATUS),
|
65
65
|
:name => attrs.delete(:SHIPTONAME),
|
@@ -71,13 +71,25 @@ module Paypal
|
|
71
71
|
:country_code => attrs.delete(:SHIPTOCOUNTRYCODE),
|
72
72
|
:country_name => attrs.delete(:SHIPTOCOUNTRYNAME)
|
73
73
|
)
|
74
|
+
@bill_to = Payment::Response::Address.new(
|
75
|
+
:owner => attrs.delete(:ADDRESSID),
|
76
|
+
:status => attrs.delete(:ADDRESSSTATUS),
|
77
|
+
:name => attrs.delete(:BILLINGNAME),
|
78
|
+
:zip => attrs.delete(:ZIP),
|
79
|
+
:street => attrs.delete(:STREET),
|
80
|
+
:street2 => attrs.delete(:STREET2),
|
81
|
+
:city => attrs.delete(:CITY),
|
82
|
+
:state => attrs.delete(:STATE),
|
83
|
+
:country_code => attrs.delete(:COUNTRY)
|
84
|
+
)
|
74
85
|
if attrs[:PAYERID]
|
75
86
|
@payer = Payment::Response::Payer.new(
|
76
87
|
:identifier => attrs.delete(:PAYERID),
|
77
88
|
:status => attrs.delete(:PAYERSTATUS),
|
78
89
|
:first_name => attrs.delete(:FIRSTNAME),
|
79
90
|
:last_name => attrs.delete(:LASTNAME),
|
80
|
-
:email => attrs.delete(:EMAIL)
|
91
|
+
:email => attrs.delete(:EMAIL),
|
92
|
+
:company => attrs.delete(:BUSINESS)
|
81
93
|
)
|
82
94
|
end
|
83
95
|
if attrs[:PROFILEID]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Paypal
|
2
2
|
module Payment
|
3
3
|
class Response < Base
|
4
|
-
attr_accessor :amount, :ship_to, :description, :note, :items, :notify_url, :insurance_option_offered, :currency_code, :short_message, :long_message, :error_code, :severity_code, :ack, :transaction_id, :billing_agreement_id, :request_id, :seller_id
|
4
|
+
attr_accessor :amount, :ship_to, :bill_to, :description, :note, :items, :notify_url, :insurance_option_offered, :currency_code, :short_message, :long_message, :error_code, :severity_code, :ack, :transaction_id, :billing_agreement_id, :request_id, :seller_id
|
5
5
|
|
6
6
|
def initialize(attributes = {})
|
7
7
|
attrs = attributes.dup
|
@@ -14,7 +14,7 @@ module Paypal
|
|
14
14
|
:shipping => attrs.delete(:SHIPPINGAMT),
|
15
15
|
:tax => attrs.delete(:TAXAMT)
|
16
16
|
)
|
17
|
-
@ship_to = Payment::Response::
|
17
|
+
@ship_to = Payment::Response::Address.new(
|
18
18
|
:name => attrs.delete(:SHIPTONAME),
|
19
19
|
:zip => attrs.delete(:SHIPTOZIP),
|
20
20
|
:street => attrs.delete(:SHIPTOSTREET),
|
@@ -24,6 +24,17 @@ module Paypal
|
|
24
24
|
:country_code => attrs.delete(:SHIPTOCOUNTRYCODE),
|
25
25
|
:country_name => attrs.delete(:SHIPTOCOUNTRYNAME)
|
26
26
|
)
|
27
|
+
@bill_to = Payment::Response::Address.new(
|
28
|
+
:owner => attrs.delete(:ADDRESSID),
|
29
|
+
:status => attrs.delete(:ADDRESSSTATUS),
|
30
|
+
:name => attrs.delete(:BILLINGNAME),
|
31
|
+
:zip => attrs.delete(:ZIP),
|
32
|
+
:street => attrs.delete(:STREET),
|
33
|
+
:street2 => attrs.delete(:STREET2),
|
34
|
+
:city => attrs.delete(:CITY),
|
35
|
+
:state => attrs.delete(:STATE),
|
36
|
+
:country_code => attrs.delete(:COUNTRY)
|
37
|
+
)
|
27
38
|
@description = attrs.delete(:DESC)
|
28
39
|
@note = attrs.delete(:NOTETEXT)
|
29
40
|
@notify_url = attrs.delete(:NOTIFYURL)
|
@@ -0,0 +1 @@
|
|
1
|
+
ACK=Success&AUTHORIZATIONID=1a2b3c4d5e6f&BUILD=13055236&TIMESTAMP=2014-10-03T17%3A34%3A56Z
|
@@ -287,6 +287,26 @@ describe Paypal::Express::Request do
|
|
287
287
|
end
|
288
288
|
end
|
289
289
|
|
290
|
+
describe "#void!" do
|
291
|
+
it 'should return Paypal::Express::Response' do
|
292
|
+
fake_response 'DoVoid/success'
|
293
|
+
response = instance.void! 'authorization_id', note: "note"
|
294
|
+
response.should be_instance_of Paypal::Express::Response
|
295
|
+
end
|
296
|
+
|
297
|
+
it 'should call DoVoid' do
|
298
|
+
expect do
|
299
|
+
instance.void! 'authorization_id', note: "note"
|
300
|
+
end.to request_to nvp_endpoint, :post
|
301
|
+
|
302
|
+
instance._method_.should == :DoVoid
|
303
|
+
instance._sent_params_.should == {
|
304
|
+
:AUTHORIZATIONID => 'authorization_id',
|
305
|
+
:NOTE => "note"
|
306
|
+
}
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
290
310
|
describe '#checkout!' do
|
291
311
|
it 'should return Paypal::Express::Response' do
|
292
312
|
fake_response 'DoExpressCheckoutPayment/success'
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper.rb'
|
2
2
|
|
3
|
-
describe Paypal::Payment::Response::
|
3
|
+
describe Paypal::Payment::Response::Address do
|
4
4
|
let :keys do
|
5
|
-
Paypal::Payment::Response::
|
5
|
+
Paypal::Payment::Response::Address.optional_attributes
|
6
6
|
end
|
7
7
|
|
8
8
|
describe '.new' do
|
9
9
|
it 'should allow nil for attributes' do
|
10
|
-
payer = Paypal::Payment::Response::
|
10
|
+
payer = Paypal::Payment::Response::Address.new
|
11
11
|
keys.each do |key|
|
12
12
|
payer.send(key).should be_nil
|
13
13
|
end
|
@@ -17,7 +17,7 @@ describe Paypal::Payment::Response::ShipTo do
|
|
17
17
|
attributes = keys.inject({}) do |attributes, key|
|
18
18
|
attributes.merge!(key => "xyz")
|
19
19
|
end
|
20
|
-
payer = Paypal::Payment::Response::
|
20
|
+
payer = Paypal::Payment::Response::Address.new attributes
|
21
21
|
keys.each do |key|
|
22
22
|
payer.send(key).should == "xyz"
|
23
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypal-express
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nov matake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -145,12 +145,12 @@ files:
|
|
145
145
|
- lib/paypal/payment/request.rb
|
146
146
|
- lib/paypal/payment/request/item.rb
|
147
147
|
- lib/paypal/payment/response.rb
|
148
|
+
- lib/paypal/payment/response/address.rb
|
148
149
|
- lib/paypal/payment/response/info.rb
|
149
150
|
- lib/paypal/payment/response/item.rb
|
150
151
|
- lib/paypal/payment/response/payer.rb
|
151
152
|
- lib/paypal/payment/response/reference.rb
|
152
153
|
- lib/paypal/payment/response/refund.rb
|
153
|
-
- lib/paypal/payment/response/ship_to.rb
|
154
154
|
- lib/paypal/util.rb
|
155
155
|
- paypal-express.gemspec
|
156
156
|
- spec/fake_response/BillAgreementUpdate/fetch.txt
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- spec/fake_response/DoExpressCheckoutPayment/success_with_many_items.txt
|
167
167
|
- spec/fake_response/DoReferenceTransaction/failure.txt
|
168
168
|
- spec/fake_response/DoReferenceTransaction/success.txt
|
169
|
+
- spec/fake_response/DoVoid/success.txt
|
169
170
|
- spec/fake_response/GetExpressCheckoutDetails/failure.txt
|
170
171
|
- spec/fake_response/GetExpressCheckoutDetails/success.txt
|
171
172
|
- spec/fake_response/GetExpressCheckoutDetails/with_billing_accepted_status.txt
|
@@ -193,10 +194,10 @@ files:
|
|
193
194
|
- spec/paypal/payment/recurring_spec.rb
|
194
195
|
- spec/paypal/payment/request/item_spec.rb
|
195
196
|
- spec/paypal/payment/request_spec.rb
|
197
|
+
- spec/paypal/payment/response/address_spec.rb
|
196
198
|
- spec/paypal/payment/response/info_spec.rb
|
197
199
|
- spec/paypal/payment/response/item_spec.rb
|
198
200
|
- spec/paypal/payment/response/payer_spec.rb
|
199
|
-
- spec/paypal/payment/response/ship_to_spec.rb
|
200
201
|
- spec/paypal/payment/response_spec.rb
|
201
202
|
- spec/paypal/util_spec.rb
|
202
203
|
- spec/spec_helper.rb
|
@@ -239,6 +240,7 @@ test_files:
|
|
239
240
|
- spec/fake_response/DoExpressCheckoutPayment/success_with_many_items.txt
|
240
241
|
- spec/fake_response/DoReferenceTransaction/failure.txt
|
241
242
|
- spec/fake_response/DoReferenceTransaction/success.txt
|
243
|
+
- spec/fake_response/DoVoid/success.txt
|
242
244
|
- spec/fake_response/GetExpressCheckoutDetails/failure.txt
|
243
245
|
- spec/fake_response/GetExpressCheckoutDetails/success.txt
|
244
246
|
- spec/fake_response/GetExpressCheckoutDetails/with_billing_accepted_status.txt
|
@@ -266,10 +268,10 @@ test_files:
|
|
266
268
|
- spec/paypal/payment/recurring_spec.rb
|
267
269
|
- spec/paypal/payment/request/item_spec.rb
|
268
270
|
- spec/paypal/payment/request_spec.rb
|
271
|
+
- spec/paypal/payment/response/address_spec.rb
|
269
272
|
- spec/paypal/payment/response/info_spec.rb
|
270
273
|
- spec/paypal/payment/response/item_spec.rb
|
271
274
|
- spec/paypal/payment/response/payer_spec.rb
|
272
|
-
- spec/paypal/payment/response/ship_to_spec.rb
|
273
275
|
- spec/paypal/payment/response_spec.rb
|
274
276
|
- spec/paypal/util_spec.rb
|
275
277
|
- spec/spec_helper.rb
|