gocardless_pro 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -0
- data/circle.yml +11 -3
- data/demo.rb +3 -3
- data/gocardless_pro.gemspec +6 -6
- data/lib/gocardless_pro.rb +2 -1
- data/lib/gocardless_pro/api_service.rb +3 -2
- data/lib/gocardless_pro/client.rb +6 -6
- data/lib/gocardless_pro/error.rb +4 -4
- data/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb +4 -4
- data/lib/gocardless_pro/request.rb +2 -2
- data/lib/gocardless_pro/resources/bank_details_lookup.rb +1 -0
- data/lib/gocardless_pro/resources/creditor.rb +1 -0
- data/lib/gocardless_pro/resources/creditor_bank_account.rb +1 -0
- data/lib/gocardless_pro/resources/customer.rb +1 -0
- data/lib/gocardless_pro/resources/customer_bank_account.rb +1 -0
- data/lib/gocardless_pro/resources/event.rb +1 -0
- data/lib/gocardless_pro/resources/mandate.rb +1 -0
- data/lib/gocardless_pro/resources/mandate_pdf.rb +1 -0
- data/lib/gocardless_pro/resources/payment.rb +1 -0
- data/lib/gocardless_pro/resources/payout.rb +1 -0
- data/lib/gocardless_pro/resources/redirect_flow.rb +1 -0
- data/lib/gocardless_pro/resources/refund.rb +1 -0
- data/lib/gocardless_pro/resources/subscription.rb +1 -0
- data/lib/gocardless_pro/services/base_service.rb +1 -1
- data/lib/gocardless_pro/version.rb +1 -1
- data/spec/api_service_spec.rb +49 -49
- data/spec/client_spec.rb +1 -1
- data/spec/error_spec.rb +13 -13
- data/spec/middlewares/raise_gocardless_errors_spec.rb +15 -16
- data/spec/resources/bank_details_lookup_spec.rb +18 -18
- data/spec/resources/creditor_bank_account_spec.rb +46 -46
- data/spec/resources/creditor_spec.rb +42 -42
- data/spec/resources/customer_bank_account_spec.rb +48 -48
- data/spec/resources/customer_spec.rb +42 -42
- data/spec/resources/event_spec.rb +18 -18
- data/spec/resources/mandate_pdf_spec.rb +18 -18
- data/spec/resources/mandate_spec.rb +54 -54
- data/spec/resources/payment_spec.rb +54 -54
- data/spec/resources/payout_spec.rb +18 -18
- data/spec/resources/redirect_flow_spec.rb +36 -36
- data/spec/resources/refund_spec.rb +42 -42
- data/spec/resources/subscription_spec.rb +48 -48
- data/spec/response_spec.rb +1 -2
- data/spec/services/bank_details_lookups_service_spec.rb +25 -25
- data/spec/services/creditor_bank_accounts_service_spec.rb +86 -86
- data/spec/services/creditors_service_spec.rb +87 -87
- data/spec/services/customer_bank_accounts_service_spec.rb +95 -95
- data/spec/services/customers_service_spec.rb +87 -87
- data/spec/services/events_service_spec.rb +49 -49
- data/spec/services/mandate_pdfs_service_spec.rb +25 -25
- data/spec/services/mandates_service_spec.rb +103 -103
- data/spec/services/payments_service_spec.rb +103 -103
- data/spec/services/payouts_service_spec.rb +49 -49
- data/spec/services/redirect_flows_service_spec.rb +52 -52
- data/spec/services/refunds_service_spec.rb +87 -87
- data/spec/services/subscriptions_service_spec.rb +95 -95
- metadata +10 -10
@@ -25,13 +25,13 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
25
25
|
'links' => 'links-input',
|
26
26
|
'metadata' => 'metadata-input',
|
27
27
|
'reference' => 'reference-input',
|
28
|
-
'status' => 'status-input'
|
28
|
+
'status' => 'status-input',
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
32
32
|
before do
|
33
|
-
stub_request(:post, %r{.*api.gocardless.com/payments})
|
34
|
-
|
33
|
+
stub_request(:post, %r{.*api.gocardless.com/payments}).
|
34
|
+
with(
|
35
35
|
body: {
|
36
36
|
'payments' => {
|
37
37
|
|
@@ -45,11 +45,11 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
45
45
|
'links' => 'links-input',
|
46
46
|
'metadata' => 'metadata-input',
|
47
47
|
'reference' => 'reference-input',
|
48
|
-
'status' => 'status-input'
|
49
|
-
}
|
48
|
+
'status' => 'status-input',
|
49
|
+
},
|
50
50
|
}
|
51
|
-
)
|
52
|
-
|
51
|
+
).
|
52
|
+
to_return(
|
53
53
|
body: {
|
54
54
|
'payments' =>
|
55
55
|
|
@@ -65,8 +65,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
65
65
|
'links' => 'links-input',
|
66
66
|
'metadata' => 'metadata-input',
|
67
67
|
'reference' => 'reference-input',
|
68
|
-
'status' => 'status-input'
|
69
|
-
}
|
68
|
+
'status' => 'status-input',
|
69
|
+
},
|
70
70
|
|
71
71
|
}.to_json,
|
72
72
|
headers: response_headers
|
@@ -81,19 +81,19 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
81
81
|
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
|
82
82
|
|
83
83
|
it 'retries timeouts' do
|
84
|
-
stub = stub_request(:post, %r{.*api.gocardless.com/payments})
|
85
|
-
|
84
|
+
stub = stub_request(:post, %r{.*api.gocardless.com/payments}).
|
85
|
+
to_timeout.then.to_return(status: 200, headers: response_headers)
|
86
86
|
|
87
87
|
post_create_response
|
88
88
|
expect(stub).to have_been_requested.twice
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'retries 5XX errors' do
|
92
|
-
stub = stub_request(:post, %r{.*api.gocardless.com/payments})
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
92
|
+
stub = stub_request(:post, %r{.*api.gocardless.com/payments}).
|
93
|
+
to_return(status: 502,
|
94
|
+
headers: { 'Content-Type' => 'text/html' },
|
95
|
+
body: '<html><body>Response from Cloudflare</body></html>').
|
96
|
+
then.to_return(status: 200, headers: response_headers)
|
97
97
|
|
98
98
|
post_create_response
|
99
99
|
expect(stub).to have_been_requested.twice
|
@@ -111,9 +111,9 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
111
111
|
type: 'validation_failed',
|
112
112
|
code: 422,
|
113
113
|
errors: [
|
114
|
-
{ message: 'test error message', field: 'test_field' }
|
115
|
-
]
|
116
|
-
}
|
114
|
+
{ message: 'test error message', field: 'test_field' },
|
115
|
+
],
|
116
|
+
},
|
117
117
|
}.to_json,
|
118
118
|
headers: response_headers,
|
119
119
|
status: 422
|
@@ -141,7 +141,7 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
141
141
|
'links' => 'links-input',
|
142
142
|
'metadata' => 'metadata-input',
|
143
143
|
'reference' => 'reference-input',
|
144
|
-
'status' => 'status-input'
|
144
|
+
'status' => 'status-input',
|
145
145
|
}
|
146
146
|
end
|
147
147
|
|
@@ -156,11 +156,11 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
156
156
|
message: 'A resource has already been created with this idempotency key',
|
157
157
|
reason: 'idempotent_creation_conflict',
|
158
158
|
links: {
|
159
|
-
conflicting_resource_id: id
|
160
|
-
}
|
161
|
-
}
|
162
|
-
]
|
163
|
-
}
|
159
|
+
conflicting_resource_id: id,
|
160
|
+
},
|
161
|
+
},
|
162
|
+
],
|
163
|
+
},
|
164
164
|
}.to_json,
|
165
165
|
headers: response_headers,
|
166
166
|
status: 409
|
@@ -169,8 +169,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
169
169
|
|
170
170
|
let!(:get_stub) do
|
171
171
|
stub_url = "/payments/#{id}"
|
172
|
-
stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
173
|
-
|
172
|
+
stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
173
|
+
to_return(
|
174
174
|
body: {
|
175
175
|
'payments' => {
|
176
176
|
|
@@ -184,8 +184,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
184
184
|
'links' => 'links-input',
|
185
185
|
'metadata' => 'metadata-input',
|
186
186
|
'reference' => 'reference-input',
|
187
|
-
'status' => 'status-input'
|
188
|
-
}
|
187
|
+
'status' => 'status-input',
|
188
|
+
},
|
189
189
|
}.to_json,
|
190
190
|
headers: response_headers
|
191
191
|
)
|
@@ -217,14 +217,14 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
217
217
|
'links' => 'links-input',
|
218
218
|
'metadata' => 'metadata-input',
|
219
219
|
'reference' => 'reference-input',
|
220
|
-
'status' => 'status-input'
|
220
|
+
'status' => 'status-input',
|
221
221
|
}],
|
222
222
|
meta: {
|
223
223
|
cursors: {
|
224
224
|
before: nil,
|
225
|
-
after: 'ABC123'
|
226
|
-
}
|
227
|
-
}
|
225
|
+
after: 'ABC123',
|
226
|
+
},
|
227
|
+
},
|
228
228
|
}.to_json
|
229
229
|
end
|
230
230
|
|
@@ -270,19 +270,19 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
270
270
|
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
|
271
271
|
|
272
272
|
it 'retries timeouts' do
|
273
|
-
stub = stub_request(:get, %r{.*api.gocardless.com/payments})
|
274
|
-
|
273
|
+
stub = stub_request(:get, %r{.*api.gocardless.com/payments}).
|
274
|
+
to_timeout.then.to_return(status: 200, headers: response_headers, body: body)
|
275
275
|
|
276
276
|
get_list_response
|
277
277
|
expect(stub).to have_been_requested.twice
|
278
278
|
end
|
279
279
|
|
280
280
|
it 'retries 5XX errors' do
|
281
|
-
stub = stub_request(:get, %r{.*api.gocardless.com/payments})
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
281
|
+
stub = stub_request(:get, %r{.*api.gocardless.com/payments}).
|
282
|
+
to_return(status: 502,
|
283
|
+
headers: { 'Content-Type' => 'text/html' },
|
284
|
+
body: '<html><body>Response from Cloudflare</body></html>').
|
285
|
+
then.to_return(status: 200, headers: response_headers, body: body)
|
286
286
|
|
287
287
|
get_list_response
|
288
288
|
expect(stub).to have_been_requested.twice
|
@@ -307,12 +307,12 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
307
307
|
'links' => 'links-input',
|
308
308
|
'metadata' => 'metadata-input',
|
309
309
|
'reference' => 'reference-input',
|
310
|
-
'status' => 'status-input'
|
310
|
+
'status' => 'status-input',
|
311
311
|
}],
|
312
312
|
meta: {
|
313
313
|
cursors: { after: 'AB345' },
|
314
|
-
limit: 1
|
315
|
-
}
|
314
|
+
limit: 1,
|
315
|
+
},
|
316
316
|
}.to_json,
|
317
317
|
headers: response_headers
|
318
318
|
)
|
@@ -333,12 +333,12 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
333
333
|
'links' => 'links-input',
|
334
334
|
'metadata' => 'metadata-input',
|
335
335
|
'reference' => 'reference-input',
|
336
|
-
'status' => 'status-input'
|
336
|
+
'status' => 'status-input',
|
337
337
|
}],
|
338
338
|
meta: {
|
339
339
|
limit: 2,
|
340
|
-
cursors: {}
|
341
|
-
}
|
340
|
+
cursors: {},
|
341
|
+
},
|
342
342
|
}.to_json,
|
343
343
|
headers: response_headers
|
344
344
|
)
|
@@ -368,19 +368,19 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
368
368
|
'links' => 'links-input',
|
369
369
|
'metadata' => 'metadata-input',
|
370
370
|
'reference' => 'reference-input',
|
371
|
-
'status' => 'status-input'
|
371
|
+
'status' => 'status-input',
|
372
372
|
}],
|
373
373
|
meta: {
|
374
374
|
cursors: { after: 'AB345' },
|
375
|
-
limit: 1
|
376
|
-
}
|
375
|
+
limit: 1,
|
376
|
+
},
|
377
377
|
}.to_json,
|
378
378
|
headers: response_headers
|
379
379
|
)
|
380
380
|
|
381
|
-
second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payments\?after=AB345})
|
382
|
-
|
383
|
-
|
381
|
+
second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payments\?after=AB345}).
|
382
|
+
to_timeout.then.
|
383
|
+
to_return(
|
384
384
|
body: {
|
385
385
|
'payments' => [{
|
386
386
|
|
@@ -394,12 +394,12 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
394
394
|
'links' => 'links-input',
|
395
395
|
'metadata' => 'metadata-input',
|
396
396
|
'reference' => 'reference-input',
|
397
|
-
'status' => 'status-input'
|
397
|
+
'status' => 'status-input',
|
398
398
|
}],
|
399
399
|
meta: {
|
400
400
|
limit: 2,
|
401
|
-
cursors: {}
|
402
|
-
}
|
401
|
+
cursors: {},
|
402
|
+
},
|
403
403
|
}.to_json,
|
404
404
|
headers: response_headers
|
405
405
|
)
|
@@ -425,18 +425,18 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
425
425
|
'links' => 'links-input',
|
426
426
|
'metadata' => 'metadata-input',
|
427
427
|
'reference' => 'reference-input',
|
428
|
-
'status' => 'status-input'
|
428
|
+
'status' => 'status-input',
|
429
429
|
}],
|
430
430
|
meta: {
|
431
431
|
cursors: { after: 'AB345' },
|
432
|
-
limit: 1
|
433
|
-
}
|
432
|
+
limit: 1,
|
433
|
+
},
|
434
434
|
}.to_json,
|
435
435
|
headers: response_headers
|
436
436
|
)
|
437
437
|
|
438
|
-
second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payments\?after=AB345})
|
439
|
-
|
438
|
+
second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payments\?after=AB345}).
|
439
|
+
to_return(
|
440
440
|
status: 502,
|
441
441
|
body: '<html><body>Response from Cloudflare</body></html>',
|
442
442
|
headers: { 'Content-Type' => 'text/html' }
|
@@ -454,12 +454,12 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
454
454
|
'links' => 'links-input',
|
455
455
|
'metadata' => 'metadata-input',
|
456
456
|
'reference' => 'reference-input',
|
457
|
-
'status' => 'status-input'
|
457
|
+
'status' => 'status-input',
|
458
458
|
}],
|
459
459
|
meta: {
|
460
460
|
limit: 2,
|
461
|
-
cursors: {}
|
462
|
-
}
|
461
|
+
cursors: {},
|
462
|
+
},
|
463
463
|
}.to_json,
|
464
464
|
headers: response_headers
|
465
465
|
)
|
@@ -480,9 +480,9 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
480
480
|
context 'passing in a custom header' do
|
481
481
|
let!(:stub) do
|
482
482
|
stub_url = '/payments/:identity'.gsub(':identity', id)
|
483
|
-
stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
484
|
-
|
485
|
-
|
483
|
+
stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
484
|
+
with(headers: { 'Foo' => 'Bar' }).
|
485
|
+
to_return(
|
486
486
|
body: {
|
487
487
|
'payments' => {
|
488
488
|
|
@@ -496,8 +496,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
496
496
|
'links' => 'links-input',
|
497
497
|
'metadata' => 'metadata-input',
|
498
498
|
'reference' => 'reference-input',
|
499
|
-
'status' => 'status-input'
|
500
|
-
}
|
499
|
+
'status' => 'status-input',
|
500
|
+
},
|
501
501
|
}.to_json,
|
502
502
|
headers: response_headers
|
503
503
|
)
|
@@ -505,7 +505,7 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
505
505
|
|
506
506
|
subject(:get_response) do
|
507
507
|
client.payments.get(id, headers: {
|
508
|
-
'Foo' => 'Bar'
|
508
|
+
'Foo' => 'Bar',
|
509
509
|
})
|
510
510
|
end
|
511
511
|
|
@@ -532,8 +532,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
532
532
|
'links' => 'links-input',
|
533
533
|
'metadata' => 'metadata-input',
|
534
534
|
'reference' => 'reference-input',
|
535
|
-
'status' => 'status-input'
|
536
|
-
}
|
535
|
+
'status' => 'status-input',
|
536
|
+
},
|
537
537
|
}.to_json,
|
538
538
|
headers: response_headers
|
539
539
|
)
|
@@ -572,8 +572,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
572
572
|
it 'retries timeouts' do
|
573
573
|
stub_url = '/payments/:identity'.gsub(':identity', id)
|
574
574
|
|
575
|
-
stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
576
|
-
|
575
|
+
stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
576
|
+
to_timeout.then.to_return(status: 200, headers: response_headers)
|
577
577
|
|
578
578
|
get_response
|
579
579
|
expect(stub).to have_been_requested.twice
|
@@ -582,11 +582,11 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
582
582
|
it 'retries 5XX errors' do
|
583
583
|
stub_url = '/payments/:identity'.gsub(':identity', id)
|
584
584
|
|
585
|
-
stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
585
|
+
stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
586
|
+
to_return(status: 502,
|
587
|
+
headers: { 'Content-Type' => 'text/html' },
|
588
|
+
body: '<html><body>Response from Cloudflare</body></html>').
|
589
|
+
then.to_return(status: 200, headers: response_headers)
|
590
590
|
|
591
591
|
get_response
|
592
592
|
expect(stub).to have_been_requested.twice
|
@@ -617,8 +617,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
617
617
|
'links' => 'links-input',
|
618
618
|
'metadata' => 'metadata-input',
|
619
619
|
'reference' => 'reference-input',
|
620
|
-
'status' => 'status-input'
|
621
|
-
}
|
620
|
+
'status' => 'status-input',
|
621
|
+
},
|
622
622
|
}.to_json,
|
623
623
|
headers: response_headers
|
624
624
|
)
|
@@ -634,8 +634,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
634
634
|
|
635
635
|
it 'retries timeouts' do
|
636
636
|
stub_url = '/payments/:identity'.gsub(':identity', id)
|
637
|
-
stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
|
638
|
-
|
637
|
+
stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
|
638
|
+
to_timeout.then.to_return(status: 200, headers: response_headers)
|
639
639
|
|
640
640
|
put_update_response
|
641
641
|
expect(stub).to have_been_requested.twice
|
@@ -643,11 +643,11 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
643
643
|
|
644
644
|
it 'retries 5XX errors' do
|
645
645
|
stub_url = '/payments/:identity'.gsub(':identity', id)
|
646
|
-
stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
646
|
+
stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
|
647
|
+
to_return(status: 502,
|
648
|
+
headers: { 'Content-Type' => 'text/html' },
|
649
|
+
body: '<html><body>Response from Cloudflare</body></html>').
|
650
|
+
then.to_return(status: 200, headers: response_headers)
|
651
651
|
|
652
652
|
put_update_response
|
653
653
|
expect(stub).to have_been_requested.twice
|
@@ -678,8 +678,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
678
678
|
'links' => 'links-input',
|
679
679
|
'metadata' => 'metadata-input',
|
680
680
|
'reference' => 'reference-input',
|
681
|
-
'status' => 'status-input'
|
682
|
-
}
|
681
|
+
'status' => 'status-input',
|
682
|
+
},
|
683
683
|
}.to_json,
|
684
684
|
headers: response_headers
|
685
685
|
)
|
@@ -694,8 +694,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
694
694
|
describe 'retry behaviour' do
|
695
695
|
it "doesn't retry errors" do
|
696
696
|
stub_url = '/payments/:identity/actions/cancel'.gsub(':identity', resource_id)
|
697
|
-
stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
|
698
|
-
|
697
|
+
stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
|
698
|
+
to_timeout
|
699
699
|
|
700
700
|
expect { post_response }.to raise_error(Faraday::TimeoutError)
|
701
701
|
expect(stub).to have_been_requested
|
@@ -712,8 +712,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
712
712
|
let!(:stub) do
|
713
713
|
# /payments/%v/actions/cancel
|
714
714
|
stub_url = '/payments/:identity/actions/cancel'.gsub(':identity', resource_id)
|
715
|
-
stub_request(:post, /.*api.gocardless.com#{stub_url}/)
|
716
|
-
|
715
|
+
stub_request(:post, /.*api.gocardless.com#{stub_url}/).
|
716
|
+
with(
|
717
717
|
body: { foo: 'bar' },
|
718
718
|
headers: { 'Foo' => 'Bar' }
|
719
719
|
).to_return(
|
@@ -730,8 +730,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
730
730
|
'links' => 'links-input',
|
731
731
|
'metadata' => 'metadata-input',
|
732
732
|
'reference' => 'reference-input',
|
733
|
-
'status' => 'status-input'
|
734
|
-
}
|
733
|
+
'status' => 'status-input',
|
734
|
+
},
|
735
735
|
}.to_json,
|
736
736
|
headers: response_headers
|
737
737
|
)
|
@@ -761,8 +761,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
761
761
|
'links' => 'links-input',
|
762
762
|
'metadata' => 'metadata-input',
|
763
763
|
'reference' => 'reference-input',
|
764
|
-
'status' => 'status-input'
|
765
|
-
}
|
764
|
+
'status' => 'status-input',
|
765
|
+
},
|
766
766
|
}.to_json,
|
767
767
|
headers: response_headers
|
768
768
|
)
|
@@ -777,8 +777,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
777
777
|
describe 'retry behaviour' do
|
778
778
|
it "doesn't retry errors" do
|
779
779
|
stub_url = '/payments/:identity/actions/retry'.gsub(':identity', resource_id)
|
780
|
-
stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
|
781
|
-
|
780
|
+
stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
|
781
|
+
to_timeout
|
782
782
|
|
783
783
|
expect { post_response }.to raise_error(Faraday::TimeoutError)
|
784
784
|
expect(stub).to have_been_requested
|
@@ -795,8 +795,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
795
795
|
let!(:stub) do
|
796
796
|
# /payments/%v/actions/retry
|
797
797
|
stub_url = '/payments/:identity/actions/retry'.gsub(':identity', resource_id)
|
798
|
-
stub_request(:post, /.*api.gocardless.com#{stub_url}/)
|
799
|
-
|
798
|
+
stub_request(:post, /.*api.gocardless.com#{stub_url}/).
|
799
|
+
with(
|
800
800
|
body: { foo: 'bar' },
|
801
801
|
headers: { 'Foo' => 'Bar' }
|
802
802
|
).to_return(
|
@@ -813,8 +813,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
813
813
|
'links' => 'links-input',
|
814
814
|
'metadata' => 'metadata-input',
|
815
815
|
'reference' => 'reference-input',
|
816
|
-
'status' => 'status-input'
|
817
|
-
}
|
816
|
+
'status' => 'status-input',
|
817
|
+
},
|
818
818
|
}.to_json,
|
819
819
|
headers: response_headers
|
820
820
|
)
|