paypal-sdk-rest 0.7.3 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,12 +34,12 @@ describe "Payments" do
34
34
  "currency" => "USD" },
35
35
  "description" => "This is the payment transaction description." } ] }
36
36
 
37
- it "Validate user-agent" do
38
- PayPal::SDK::REST::API.user_agent.should match "PayPalSDK/rest-sdk-ruby"
37
+ it "Validate user-agent", :unit => true do
38
+ PayPal::SDK::REST::API.user_agent.should match "PayPalSDK/PayPal-Ruby-SDK"
39
39
  end
40
40
 
41
41
  describe "Examples" do
42
- describe "REST" do
42
+ describe "REST", :unit => true do
43
43
  it "Modifiy global configuration" do
44
44
  backup_config = PayPal::SDK::REST.api.config
45
45
  PayPal::SDK::REST.set_config( :client_id => "XYZ" )
@@ -49,7 +49,7 @@ describe "Payments" do
49
49
  end
50
50
  end
51
51
 
52
- describe "Payment" do
52
+ describe "Payment", :integration => true do
53
53
  it "Create" do
54
54
  payment = Payment.new(PaymentAttributes)
55
55
  # Create
@@ -103,7 +103,7 @@ describe "Payments" do
103
103
  payment.error.should be_nil
104
104
  end
105
105
 
106
- describe "Validation" do
106
+ describe "Validation", :integration => true do
107
107
 
108
108
  it "Create with empty values" do
109
109
  payment = Payment.new
@@ -146,7 +146,7 @@ describe "Payments" do
146
146
 
147
147
  end
148
148
 
149
- describe "Future Payment" do
149
+ describe "Future Payment", :disabled => true do
150
150
  access_token = nil
151
151
 
152
152
  it "Exchange Authorization Code for Refresh / Access Tokens" do
@@ -169,7 +169,7 @@ describe "Payments" do
169
169
 
170
170
  end
171
171
 
172
- describe "Sale" do
172
+ describe "Sale", :integration => true do
173
173
  before :each do
174
174
  @payment = Payment.new(PaymentAttributes)
175
175
  @payment.create
@@ -195,7 +195,49 @@ describe "Payments" do
195
195
  end
196
196
  end
197
197
 
198
- describe "Authorize" do
198
+ describe "Order", :integration => true do
199
+ it "Find" do
200
+ order = Order.find("O-2HT09787H36911800")
201
+ expect(order.error).to be_nil
202
+ expect(order).to_not be_nil
203
+ end
204
+
205
+ # The following Order tests must be ignored when run in an automated environment because executing an order
206
+ # will require approval via the executed payment's approval_url.
207
+
208
+ before :each, :disabled => true do
209
+ @payment = Payment.new(PaymentAttributes.merge( "intent" => "order" ))
210
+ payer_id = "" # replace with the actual payer_id
211
+ @payment.create
212
+ @payment.execute( :payer_id => payer_id )
213
+ expect(@payment.error).to be_nil
214
+ end
215
+
216
+ it "Authorize", :disabled => true do
217
+ auth = order.authorize
218
+ expect(auth.state).to eq("Pending")
219
+ end
220
+
221
+ it "Capture", :disabled => true do
222
+ capture = Capture.new({
223
+ "amount" => {
224
+ "currency" => "USD",
225
+ "total" => "1.00"
226
+ },
227
+ "is_final_capture" => true
228
+ })
229
+ order = order.capture(@capture)
230
+ expect(order.state).to eq("completed")
231
+ end
232
+
233
+ it "Void", :disabled => true do
234
+ order = order.void()
235
+ expect(order.state).to eq("voided")
236
+ end
237
+
238
+ end
239
+
240
+ describe "Authorize", :integration => true do
199
241
  before :each do
200
242
  @payment = Payment.new(PaymentAttributes.merge( "intent" => "authorize" ))
201
243
  @payment.create
@@ -223,12 +265,12 @@ describe "Payments" do
223
265
  it "Reauthorization" do
224
266
  authorize = Authorization.find("7GH53639GA425732B");
225
267
  authorize.amount = { :currency => "USD", :total => "1.00" }
226
- authorize.reauthorize()
268
+ authorize.reauthorize
227
269
  authorize.error.should_not be_nil
228
270
  end
229
271
  end
230
272
 
231
- describe "Capture" do
273
+ describe "Capture", :integration => true do
232
274
  before :each do
233
275
  @payment = Payment.new(PaymentAttributes.merge( "intent" => "authorize" ))
234
276
  @payment.create
@@ -250,7 +292,7 @@ describe "Payments" do
250
292
  end
251
293
  end
252
294
 
253
- describe "CreditCard" do
295
+ describe "CreditCard", :integration => true do
254
296
  it "Create" do
255
297
  credit_card = CreditCard.new({
256
298
  "type" => "visa",
@@ -281,7 +323,7 @@ describe "Payments" do
281
323
  expect(credit_card.delete).to be_truthy
282
324
  end
283
325
 
284
- describe "Validation" do
326
+ describe "Validation", :integration => true do
285
327
  it "Create" do
286
328
  credit_card = CreditCard.new({
287
329
  "type" => "visa",
data/spec/spec_helper.rb CHANGED
@@ -20,5 +20,7 @@ http_log = File.open(File.expand_path('../log/http.log', __FILE__), "w")
20
20
  Payment.api.http.set_debug_output(http_log)
21
21
 
22
22
  RSpec.configure do |config|
23
+ config.filter_run_excluding :integration => true
24
+ config.filter_run_excluding :disabled => true
23
25
  # config.include PayPal::SDK::REST::DataTypes
24
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paypal-sdk-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - PayPal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-21 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paypal-sdk-core
@@ -58,6 +58,7 @@ files:
58
58
  - lib/paypal-sdk/rest/request_data_type.rb
59
59
  - lib/paypal-sdk/rest/set_api.rb
60
60
  - lib/paypal-sdk/rest/version.rb
61
+ - spec/README.md
61
62
  - spec/config/cacert.pem
62
63
  - spec/config/cert_key.pem
63
64
  - spec/config/paypal.yml
@@ -90,6 +91,7 @@ signing_key:
90
91
  specification_version: 4
91
92
  summary: The PayPal REST SDK provides Ruby APIs to create, process and manage payment.
92
93
  test_files:
94
+ - spec/README.md
93
95
  - spec/config/cacert.pem
94
96
  - spec/config/cert_key.pem
95
97
  - spec/config/paypal.yml