adyen_jpiqueras 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.travis.yml +30 -0
  4. data/CHANGELOG.md +128 -0
  5. data/CONTRIBUTING.md +85 -0
  6. data/Gemfile +11 -0
  7. data/LICENSE +21 -0
  8. data/README.md +31 -0
  9. data/Rakefile +54 -0
  10. data/adyen_jpiqueras.gemspec +44 -0
  11. data/config.ru +5 -0
  12. data/lib/adyen.rb +16 -0
  13. data/lib/adyen/api.rb +424 -0
  14. data/lib/adyen/api/cacert.pem +3894 -0
  15. data/lib/adyen/api/payment_service.rb +374 -0
  16. data/lib/adyen/api/recurring_service.rb +188 -0
  17. data/lib/adyen/api/response.rb +61 -0
  18. data/lib/adyen/api/simple_soap_client.rb +134 -0
  19. data/lib/adyen/api/templates/payment_service.rb +159 -0
  20. data/lib/adyen/api/templates/recurring_service.rb +71 -0
  21. data/lib/adyen/api/test_helpers.rb +133 -0
  22. data/lib/adyen/api/xml_querier.rb +137 -0
  23. data/lib/adyen/base.rb +17 -0
  24. data/lib/adyen/configuration.rb +179 -0
  25. data/lib/adyen/form.rb +419 -0
  26. data/lib/adyen/hpp.rb +27 -0
  27. data/lib/adyen/hpp/request.rb +192 -0
  28. data/lib/adyen/hpp/response.rb +52 -0
  29. data/lib/adyen/hpp/signature.rb +34 -0
  30. data/lib/adyen/matchers.rb +92 -0
  31. data/lib/adyen/notification_generator.rb +30 -0
  32. data/lib/adyen/railtie.rb +13 -0
  33. data/lib/adyen/rest.rb +67 -0
  34. data/lib/adyen/rest/authorise_payment.rb +234 -0
  35. data/lib/adyen/rest/authorise_recurring_payment.rb +46 -0
  36. data/lib/adyen/rest/client.rb +127 -0
  37. data/lib/adyen/rest/errors.rb +33 -0
  38. data/lib/adyen/rest/modify_payment.rb +89 -0
  39. data/lib/adyen/rest/payout.rb +89 -0
  40. data/lib/adyen/rest/request.rb +104 -0
  41. data/lib/adyen/rest/response.rb +80 -0
  42. data/lib/adyen/rest/signature.rb +27 -0
  43. data/lib/adyen/signature.rb +76 -0
  44. data/lib/adyen/templates/notification_migration.rb +29 -0
  45. data/lib/adyen/templates/notification_model.rb +69 -0
  46. data/lib/adyen/util.rb +147 -0
  47. data/lib/adyen/version.rb +5 -0
  48. data/spec/api/api_spec.rb +231 -0
  49. data/spec/api/payment_service_spec.rb +505 -0
  50. data/spec/api/recurring_service_spec.rb +236 -0
  51. data/spec/api/response_spec.rb +59 -0
  52. data/spec/api/simple_soap_client_spec.rb +133 -0
  53. data/spec/api/spec_helper.rb +463 -0
  54. data/spec/api/test_helpers_spec.rb +84 -0
  55. data/spec/functional/api_spec.rb +117 -0
  56. data/spec/functional/initializer.rb.ci +3 -0
  57. data/spec/functional/initializer.rb.sample +3 -0
  58. data/spec/spec_helper.rb +8 -0
  59. data/test/form_test.rb +303 -0
  60. data/test/functional/payment_authorisation_api_test.rb +107 -0
  61. data/test/functional/payment_modification_api_test.rb +58 -0
  62. data/test/functional/payout_api_test.rb +93 -0
  63. data/test/helpers/capybara.rb +12 -0
  64. data/test/helpers/configure_adyen.rb +6 -0
  65. data/test/helpers/example_server.rb +136 -0
  66. data/test/helpers/public/adyen.encrypt.js +679 -0
  67. data/test/helpers/public/adyen.encrypt.min.js +14 -0
  68. data/test/helpers/test_cards.rb +20 -0
  69. data/test/helpers/views/authorized.erb +7 -0
  70. data/test/helpers/views/hpp.erb +20 -0
  71. data/test/helpers/views/index.erb +6 -0
  72. data/test/helpers/views/pay.erb +36 -0
  73. data/test/helpers/views/redirect_shopper.erb +18 -0
  74. data/test/hpp/signature_test.rb +37 -0
  75. data/test/hpp_test.rb +250 -0
  76. data/test/integration/hpp_integration_test.rb +52 -0
  77. data/test/integration/payment_using_3d_secure_integration_test.rb +41 -0
  78. data/test/integration/payment_with_client_side_encryption_integration_test.rb +26 -0
  79. data/test/rest/signature_test.rb +36 -0
  80. data/test/rest_list_recurring_details_response_test.rb +22 -0
  81. data/test/rest_request_test.rb +43 -0
  82. data/test/rest_response_test.rb +19 -0
  83. data/test/signature_test.rb +76 -0
  84. data/test/test_helper.rb +45 -0
  85. data/test/util_test.rb +78 -0
  86. data/yard_extensions.rb +16 -0
  87. metadata +308 -0
@@ -0,0 +1,505 @@
1
+ # encoding: UTF-8
2
+ require 'api/spec_helper'
3
+
4
+ shared_examples_for "payment requests" do
5
+ it "includes the merchant account handle" do
6
+ text('./payment:merchantAccount').should == 'SuperShopper'
7
+ end
8
+
9
+ it "includes the payment reference of the merchant" do
10
+ text('./payment:reference').should == 'order-id'
11
+ end
12
+
13
+ it "includes the given amount of `currency'" do
14
+ xpath('./payment:amount') do |amount|
15
+ amount.text('./common:currency').should == 'EUR'
16
+ amount.text('./common:value').should == '1234'
17
+ end
18
+ end
19
+
20
+ it "includes the shopper’s details" do
21
+ text('./payment:shopperReference').should == 'user-id'
22
+ text('./payment:shopperEmail').should == 's.hopper@example.com'
23
+ text('./payment:shopperIP').should == '61.294.12.12'
24
+ text('./payment:shopperStatement').should == 'invoice number 123456'
25
+ end
26
+
27
+ it "includes the fraud offset" do
28
+ text('./payment:fraudOffset').should == '30'
29
+ end
30
+
31
+ it "does not include the fraud offset if none is given" do
32
+ @payment.params.delete(:fraud_offset)
33
+ xpath('./payment:fraudOffset').should be_empty
34
+ end
35
+
36
+ it "includes the given amount of `installments'" do
37
+ xpath('./payment:installments') do |amount|
38
+ amount.text('./common:value').should == '6'
39
+ end
40
+ end
41
+
42
+ it "does not include the installments amount if none is given" do
43
+ @payment.params.delete(:installments)
44
+ xpath('./payment:installments').should be_empty
45
+ end
46
+
47
+ it "only includes shopper details for given parameters" do
48
+ # TODO pretty lame, but for now it will do
49
+ unless @method == "authorise_one_click_payment_request_body" || @method == "authorise_recurring_payment_request_body"
50
+ @payment.params[:shopper].delete(:reference)
51
+ xpath('./payment:shopperReference').should be_empty
52
+ @payment.params[:shopper].delete(:email)
53
+ xpath('./payment:shopperEmail').should be_empty
54
+ @payment.params[:shopper].delete(:ip)
55
+ xpath('./payment:shopperIP').should be_empty
56
+ @payment.params[:shopper].delete(:statement)
57
+ xpath('./payment:shopperStatement').should be_empty
58
+ end
59
+ end
60
+
61
+ it "does not include any shopper details if none are given" do
62
+ # TODO pretty lame, but for now it will do
63
+ unless @method == "authorise_one_click_payment_request_body" || @method == "authorise_recurring_payment_request_body"
64
+ @payment.params.delete(:shopper)
65
+ xpath('./payment:shopperReference').should be_empty
66
+ xpath('./payment:shopperEmail').should be_empty
67
+ xpath('./payment:shopperIP').should be_empty
68
+ xpath('./payment:statement').should be_empty
69
+ end
70
+ end
71
+ end
72
+
73
+ shared_examples_for "recurring payment requests" do
74
+ it_should_behave_like "payment requests"
75
+
76
+ it "uses the given recurring detail reference" do
77
+ @payment.params[:recurring_detail_reference] = 'RecurringDetailReference1'
78
+ text('./payment:selectedRecurringDetailReference').should == 'RecurringDetailReference1'
79
+ end
80
+ end
81
+
82
+ describe Adyen::API::PaymentService do
83
+ include APISpecHelper
84
+
85
+ before do
86
+ @params = {
87
+ :reference => 'order-id',
88
+ :amount => {
89
+ :currency => 'EUR',
90
+ :value => '1234',
91
+ },
92
+ :shopper => {
93
+ :email => 's.hopper@example.com',
94
+ :reference => 'user-id',
95
+ :ip => '61.294.12.12',
96
+ :statement => 'invoice number 123456',
97
+ },
98
+ :card => {
99
+ :expiry_month => 12,
100
+ :expiry_year => 2012,
101
+ :holder_name => 'Simon わくわく Hopper',
102
+ :number => '4444333322221111',
103
+ :cvc => '737',
104
+ # Maestro UK/Solo only
105
+ #:issue_number => ,
106
+ #:start_month => ,
107
+ #:start_year => ,
108
+ },
109
+ :installments => {
110
+ :value => 6
111
+ },
112
+ :recurring_detail_reference => 'RecurringDetailReference1',
113
+ :fraud_offset => 30
114
+ }
115
+ @payment = @object = Adyen::API::PaymentService.new(@params)
116
+ end
117
+
118
+ describe_request_body_of :authorise_payment do
119
+ it_should_behave_like "payment requests"
120
+
121
+ it_should_validate_request_parameters :merchant_account,
122
+ :reference,
123
+ :amount => [:currency, :value],
124
+ :card => [:holder_name, :number, :expiry_year, :expiry_month]
125
+
126
+ it_should_validate_request_param(:shopper) do
127
+ @payment.params[:recurring] = true
128
+ @payment.params[:shopper] = nil
129
+ end
130
+
131
+ it_should_validate_request_param(:fraud_offset) do
132
+ @payment.params[:fraud_offset] = ''
133
+ end
134
+
135
+ [:reference, :email].each do |attr|
136
+ it_should_validate_request_param(:shopper) do
137
+ @payment.params[:recurring] = true
138
+ @payment.params[:shopper][attr] = ''
139
+ end
140
+ end
141
+
142
+ it "includes the creditcard details" do
143
+ xpath('./payment:card') do |card|
144
+ # there's no reason why Nokogiri should escape these characters, but as long as they're correct
145
+ card.text('./payment:holderName').should == 'Simon わくわく Hopper'
146
+ card.text('./payment:number').should == '4444333322221111'
147
+ card.text('./payment:cvc').should == '737'
148
+ card.text('./payment:expiryMonth').should == '12'
149
+ card.text('./payment:expiryYear').should == '2012'
150
+ end
151
+ end
152
+
153
+ it "formats the creditcard’s expiry month as a two digit number" do
154
+ @payment.params[:card][:expiry_month] = 6
155
+ text('./payment:card/payment:expiryMonth').should == '06'
156
+ end
157
+
158
+ it "includes the necessary recurring and one-click contract info if the `:recurring' param is truthful" do
159
+ xpath('./payment:recurring/payment:contract').should be_empty
160
+ @payment.params[:recurring] = true
161
+ text('./payment:recurring/payment:contract').should == 'RECURRING,ONECLICK'
162
+ end
163
+ end
164
+
165
+ describe_response_from :generate_billet, BILLET_RECEIVED_RESPONSE do
166
+ it_should_return_params_for_each_xml_backend({
167
+ :psp_reference => "8814038837489129",
168
+ :result_code => "Received",
169
+ :billet_url => "https://test.adyen.com/hpp/generationBoleto.shtml?data=AgABAQBdYDe9OqdseA79Rfexm2Lz8fRQ1bWqkLhBCf1fHhQEif7bsRKi0otq%2B1ekMAdMIZUiVXeR3QFrAOA8Zy4tpiNLhkMq6f7W2zFqYhVWrByqxQnbQTYuX2FWI7tsu7Vb0MnyOvFfFdFtaxzImZYCli%2BMrqaAJ5HI9ap3egeqBQIsRI%2Fj0zWsu2EGN16lGbwFOLyxl%2By0Pc5jazTo8rnBA7OVPGDIu7Qt%2F2DYIMcB6PXou5W3aJoTC4SldhNdobVqgWUtES8NsWdOYbLGa6I%2BjSwEFXvxyTXwtw4J2E%2BE7ux1UhBiZRj66lMbcvaYlfnR2xWbA%2BKmdLrVvuXTroEHKQ%2B1C%2FuyGuiOk3SmGq6TMgOyCEt%2BmG%2Bq6z5jDi%2BnYLtlLQU4ccMOujgWMfGkViC%2FXDUlqYjKbn8NHwPwoPcelpf1zCDCe%2Fvu6NBTVQbEXbE0oV0j2MT1tLlMdf08iUsDThuQ3MlJbE8VbTMlttOFqoyXhBjepQ42C1eXfswSz1gsZlHanBCTiw1pB69vkvfWPf5IdUSx1cpEr9LJ9PSz%2FeHxEhq%2B8ZdWzrybXqRbEl2mUjLeyhMNuiE%3D"
170
+ })
171
+
172
+ describe "with a received billet" do
173
+ it "returns that the request was successful" do
174
+ @response.should be_success
175
+ end
176
+ end
177
+ end
178
+
179
+ describe_response_from :generate_billet, BILLET_REFUSED_RESPONSE do
180
+ it_should_return_params_for_each_xml_backend({
181
+ :psp_reference => "8514038928235061",
182
+ :result_code => "Refused",
183
+ :billet_url => ""
184
+ })
185
+
186
+ describe "with a received billet" do
187
+ it "returns that the request was successful" do
188
+ @response.should_not be_success
189
+ end
190
+ end
191
+ end
192
+
193
+ describe_response_from :authorise_payment, AUTHORISE_RESPONSE do
194
+ it_should_return_params_for_each_xml_backend({
195
+ :psp_reference => '9876543210987654',
196
+ :result_code => 'Authorised',
197
+ :auth_code => '1234',
198
+ :additional_data => { "cardSummary" => "1111" },
199
+ :refusal_reason => ''
200
+ })
201
+
202
+ describe "with a authorized response" do
203
+ it "returns that the request was authorised" do
204
+ @response.should be_success
205
+ @response.should be_authorized
206
+ end
207
+ end
208
+
209
+ describe "with a `declined' response" do
210
+ before do
211
+ stub_net_http(AUTHORISATION_DECLINED_RESPONSE)
212
+ @response = @payment.authorise_payment
213
+ end
214
+
215
+ it "returns that the request was not authorised" do
216
+ @response.should_not be_success
217
+ @response.should_not be_authorized
218
+ end
219
+ end
220
+
221
+ describe "with a `refused' response" do
222
+ before do
223
+ stub_net_http(AUTHORISE_REQUEST_REFUSED_RESPONSE)
224
+ @response = @payment.authorise_payment
225
+ end
226
+
227
+ it "returns that the payment was refused" do
228
+ @response.should be_refused
229
+ @response.error.should == [:base, 'Transaction was refused.']
230
+ end
231
+ end
232
+
233
+ describe "with a `invalid' response" do
234
+ before do
235
+ stub_net_http(AUTHORISE_REQUEST_INVALID_RESPONSE % 'validation 101 Invalid card number')
236
+ @response = @payment.authorise_payment
237
+ end
238
+
239
+ it "returns that the request was not authorised" do
240
+ @response.should_not be_success
241
+ @response.should_not be_authorized
242
+ end
243
+
244
+ it "it returns that the request was invalid" do
245
+ @response.should be_invalid_request
246
+ end
247
+
248
+ it "returns the fault message from #refusal_reason" do
249
+ @response.refusal_reason.should == 'validation 101 Invalid card number'
250
+ @response.params[:refusal_reason].should == 'validation 101 Invalid card number'
251
+ end
252
+
253
+ it "returns creditcard validation errors" do
254
+ [
255
+ ["validation 101 Invalid card number", [:number, 'is not a valid creditcard number']],
256
+ ["validation 103 CVC is not the right length", [:cvc, 'is not the right length']],
257
+ ["validation 128 Card Holder Missing", [:holder_name, 'can\'t be blank']],
258
+ ["validation Couldn't parse expiry year", [:expiry_year, 'could not be recognized']],
259
+ ["validation Expiry month should be between 1 and 12 inclusive", [:expiry_month, 'could not be recognized']],
260
+ ].each do |message, error|
261
+ response_with_fault_message(message).error.should == error
262
+ end
263
+ end
264
+
265
+ it "returns any other fault messages on `base'" do
266
+ message = "validation 130 Reference Missing"
267
+ response_with_fault_message(message).error.should == [:base, message]
268
+ end
269
+
270
+ it "prepends the error attribute with the given prefix, except for :base" do
271
+ [
272
+ ["validation 101 Invalid card number", [:card_number, 'is not a valid creditcard number']],
273
+ ["validation 130 Reference Missing", [:base, "validation 130 Reference Missing"]],
274
+ ["validation 152 Invalid number of installments", [:base, "validation 152 Invalid number of installments"]],
275
+ ].each do |message, error|
276
+ response_with_fault_message(message).error(:card).should == error
277
+ end
278
+ end
279
+
280
+ private
281
+
282
+ def response_with_fault_message(message)
283
+ stub_net_http(AUTHORISE_REQUEST_INVALID_RESPONSE % message)
284
+ @response = @payment.authorise_payment
285
+ end
286
+ end
287
+ end
288
+
289
+ describe_request_body_of :authorise_recurring_payment do
290
+ it_should_behave_like "recurring payment requests"
291
+
292
+ it_should_validate_request_parameters :merchant_account,
293
+ :reference,
294
+ :fraud_offset,
295
+ :amount => [:currency, :value],
296
+ :shopper => [:reference, :email]
297
+
298
+ it "includes the contract type, which is `RECURRING'" do
299
+ text('./payment:recurring/payment:contract').should == 'RECURRING'
300
+ end
301
+
302
+ it "uses the latest recurring detail reference, by default" do
303
+ @payment.params[:recurring_detail_reference] = nil
304
+ text('./payment:selectedRecurringDetailReference').should == 'LATEST'
305
+ end
306
+
307
+ it "obviously includes the obligatory self-‘describing’ nonsense parameters" do
308
+ text('./payment:shopperInteraction').should == 'ContAuth'
309
+ end
310
+
311
+ it "does not include any creditcard details" do
312
+ xpath('./payment:card').should be_empty
313
+ end
314
+ end
315
+
316
+ describe_response_from :authorise_recurring_payment, AUTHORISE_RESPONSE do
317
+ it_should_return_params_for_each_xml_backend({
318
+ :psp_reference => '9876543210987654',
319
+ :result_code => 'Authorised',
320
+ :auth_code => '1234',
321
+ :additional_data => { "cardSummary" => "1111" },
322
+ :refusal_reason => ''
323
+ })
324
+ end
325
+
326
+ describe_request_body_of :authorise_one_click_payment do
327
+ it_should_behave_like "recurring payment requests"
328
+
329
+ it_should_validate_request_parameters :merchant_account,
330
+ :reference,
331
+ :recurring_detail_reference,
332
+ :fraud_offset,
333
+ :amount => [:currency, :value],
334
+ :shopper => [:reference, :email],
335
+ :card => [:cvc]
336
+
337
+ it "includes the contract type, which is `ONECLICK'" do
338
+ text('./payment:recurring/payment:contract').should == 'ONECLICK'
339
+ end
340
+
341
+ it "does not include the self-‘describing’ nonsense parameters" do
342
+ xpath('./payment:shopperInteraction').should be_empty
343
+ end
344
+
345
+ it "includes only the creditcard's CVC code" do
346
+ xpath('./payment:card') do |card|
347
+ card.text('./payment:cvc').should == '737'
348
+
349
+ card.xpath('./payment:holderName').should be_empty
350
+ card.xpath('./payment:number').should be_empty
351
+ card.xpath('./payment:expiryMonth').should be_empty
352
+ card.xpath('./payment:expiryYear').should be_empty
353
+ end
354
+ end
355
+ end
356
+
357
+ describe_response_from :authorise_one_click_payment, AUTHORISE_RESPONSE do
358
+ it_should_return_params_for_each_xml_backend({
359
+ :psp_reference => '9876543210987654',
360
+ :result_code => 'Authorised',
361
+ :auth_code => '1234',
362
+ :additional_data => { "cardSummary" => "1111" },
363
+ :refusal_reason => ''
364
+ })
365
+ end
366
+
367
+ describe_modification_request_body_of :capture do
368
+ it_should_validate_request_parameters :merchant_account,
369
+ :psp_reference,
370
+ :amount => [:currency, :value]
371
+
372
+ it "includes the amount to capture" do
373
+ xpath('./payment:modificationAmount') do |amount|
374
+ amount.text('./common:currency').should == 'EUR'
375
+ amount.text('./common:value').should == '1234'
376
+ end
377
+ end
378
+ end
379
+
380
+ describe_response_from :capture, CAPTURE_RESPONSE % '[capture-received]' do
381
+ it_should_return_params_for_each_xml_backend({
382
+ :psp_reference => '8512867956198946',
383
+ :response => '[capture-received]'
384
+ })
385
+
386
+ describe "with a successful response" do
387
+ it "returns that the request was received successfully" do
388
+ @response.should be_success
389
+ end
390
+ end
391
+
392
+ describe "with a failed response" do
393
+ before do
394
+ stub_net_http(CAPTURE_RESPONSE % 'failed')
395
+ @response = @payment.capture
396
+ end
397
+
398
+ it "returns that the request was not received successfully" do
399
+ @response.should_not be_success
400
+ end
401
+ end
402
+ end
403
+
404
+ describe_modification_request_body_of :refund do
405
+ it_should_validate_request_parameters :merchant_account,
406
+ :psp_reference,
407
+ :amount => [:currency, :value]
408
+
409
+ it "includes the amount to refund" do
410
+ xpath('./payment:modificationAmount') do |amount|
411
+ amount.text('./common:currency').should == 'EUR'
412
+ amount.text('./common:value').should == '1234'
413
+ end
414
+ end
415
+ end
416
+
417
+ describe_response_from :refund, REFUND_RESPONSE % '[refund-received]' do
418
+ it_should_return_params_for_each_xml_backend({
419
+ :psp_reference => '8512865475512126',
420
+ :response => '[refund-received]'
421
+ })
422
+
423
+ describe "with a successful response" do
424
+ it "returns that the request was received successfully" do
425
+ @response.should be_success
426
+ end
427
+ end
428
+
429
+ describe "with a failed response" do
430
+ before do
431
+ stub_net_http(REFUND_RESPONSE % 'failed')
432
+ @response = @payment.refund
433
+ end
434
+
435
+ it "returns that the request was not received successfully" do
436
+ @response.should_not be_success
437
+ end
438
+ end
439
+ end
440
+
441
+ describe_modification_request_body_of :cancel_or_refund, 'cancelOrRefund' do
442
+ it_should_validate_request_parameters :merchant_account,
443
+ :psp_reference
444
+ end
445
+
446
+ describe_response_from :cancel_or_refund, CANCEL_OR_REFUND_RESPONSE % '[cancelOrRefund-received]' do
447
+ it_should_return_params_for_each_xml_backend({
448
+ :psp_reference => '8512865521218306',
449
+ :response => '[cancelOrRefund-received]'
450
+ })
451
+
452
+ describe "with a successful response" do
453
+ it "returns that the request was received successfully" do
454
+ @response.should be_success
455
+ end
456
+ end
457
+
458
+ describe "with a failed response" do
459
+ before do
460
+ stub_net_http(CANCEL_OR_REFUND_RESPONSE % 'failed')
461
+ @response = @payment.cancel_or_refund
462
+ end
463
+
464
+ it "returns that the request was not received successfully" do
465
+ @response.should_not be_success
466
+ end
467
+ end
468
+ end
469
+
470
+ describe_modification_request_body_of :cancel do
471
+ it_should_validate_request_parameters :merchant_account,
472
+ :psp_reference
473
+ end
474
+
475
+ describe_response_from :cancel, CANCEL_RESPONSE % '[cancel-received]' do
476
+ it_should_return_params_for_each_xml_backend({
477
+ :psp_reference => '8612865544848013',
478
+ :response => '[cancel-received]'
479
+ })
480
+
481
+ describe "with a successful response" do
482
+ it "returns that the request was received successfully" do
483
+ @response.should be_success
484
+ end
485
+ end
486
+
487
+ describe "with a failed response" do
488
+ before do
489
+ stub_net_http(CANCEL_RESPONSE % 'failed')
490
+ @response = @payment.cancel
491
+ end
492
+
493
+ it "returns that the request was not received successfully" do
494
+ @response.should_not be_success
495
+ end
496
+ end
497
+ end
498
+
499
+ private
500
+
501
+ def node_for_current_method
502
+ node_for_current_object_and_method.xpath('//payment:authorise/payment:paymentRequest')
503
+ end
504
+ end
505
+