gocardless_pro 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/gocardless_pro/resources/bank_details_lookup.rb +3 -0
- data/lib/gocardless_pro/resources/creditor.rb +4 -1
- data/lib/gocardless_pro/resources/creditor_bank_account.rb +12 -9
- data/lib/gocardless_pro/resources/customer_bank_account.rb +4 -1
- data/lib/gocardless_pro/resources/event.rb +4 -1
- data/lib/gocardless_pro/resources/mandate.rb +4 -1
- data/lib/gocardless_pro/resources/mandate_pdf.rb +1 -1
- data/lib/gocardless_pro/resources/payment.rb +8 -5
- data/lib/gocardless_pro/resources/payout.rb +8 -4
- data/lib/gocardless_pro/resources/redirect_flow.rb +8 -1
- data/lib/gocardless_pro/resources/refund.rb +4 -1
- data/lib/gocardless_pro/resources/subscription.rb +4 -1
- data/lib/gocardless_pro/services/payouts_service.rb +1 -1
- data/lib/gocardless_pro/version.rb +1 -1
- data/spec/resources/bank_details_lookup_spec.rb +16 -1
- data/spec/resources/creditor_bank_account_spec.rb +13 -1
- data/spec/resources/creditor_spec.rb +13 -1
- data/spec/resources/customer_bank_account_spec.rb +13 -1
- data/spec/resources/customer_spec.rb +8 -1
- data/spec/resources/event_spec.rb +13 -1
- data/spec/resources/mandate_pdf_spec.rb +8 -1
- data/spec/resources/mandate_spec.rb +13 -1
- data/spec/resources/payment_spec.rb +13 -1
- data/spec/resources/payout_spec.rb +13 -1
- data/spec/resources/redirect_flow_spec.rb +21 -1
- data/spec/resources/refund_spec.rb +13 -1
- data/spec/resources/subscription_spec.rb +13 -1
- data/spec/services/bank_details_lookups_service_spec.rb +8 -4
- data/spec/services/creditor_bank_accounts_service_spec.rb +25 -21
- data/spec/services/creditors_service_spec.rb +24 -19
- data/spec/services/customer_bank_accounts_service_spec.rb +28 -23
- data/spec/services/customers_service_spec.rb +24 -19
- data/spec/services/events_service_spec.rb +17 -13
- data/spec/services/mandate_pdfs_service_spec.rb +5 -4
- data/spec/services/mandates_service_spec.rb +32 -27
- data/spec/services/payments_service_spec.rb +32 -27
- data/spec/services/payouts_service_spec.rb +17 -13
- data/spec/services/redirect_flows_service_spec.rb +19 -15
- data/spec/services/refunds_service_spec.rb +24 -19
- data/spec/services/subscriptions_service_spec.rb +28 -23
- metadata +3 -3
@@ -9,6 +9,7 @@ describe GoCardlessPro::Services::MandatePdfsService do
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
|
13
14
|
|
14
15
|
|
@@ -24,10 +25,10 @@ describe GoCardlessPro::Services::MandatePdfsService do
|
|
24
25
|
end
|
25
26
|
|
26
27
|
before do
|
27
|
-
stub_request(:post,
|
28
|
+
stub_request(:post, %r(.*api.gocardless.com/mandate_pdfs)).
|
28
29
|
with(
|
29
30
|
body: {
|
30
|
-
mandate_pdfs
|
31
|
+
"mandate_pdfs" => {
|
31
32
|
|
32
33
|
"expires_at" => "expires_at-input",
|
33
34
|
"url" => "url-input",
|
@@ -36,7 +37,7 @@ describe GoCardlessPro::Services::MandatePdfsService do
|
|
36
37
|
).
|
37
38
|
to_return(
|
38
39
|
body: {
|
39
|
-
mandate_pdfs
|
40
|
+
"mandate_pdfs" => {
|
40
41
|
|
41
42
|
"expires_at" => "expires_at-input",
|
42
43
|
"url" => "url-input",
|
@@ -55,7 +56,7 @@ describe GoCardlessPro::Services::MandatePdfsService do
|
|
55
56
|
let(:new_resource) { {} }
|
56
57
|
|
57
58
|
before do
|
58
|
-
stub_request(:post,
|
59
|
+
stub_request(:post, %r(.*api.gocardless.com/mandate_pdfs)).to_return(
|
59
60
|
body: {
|
60
61
|
error: {
|
61
62
|
type: 'validation_failed',
|
@@ -9,6 +9,7 @@ describe GoCardlessPro::Services::MandatesService do
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
|
13
14
|
|
14
15
|
|
@@ -30,10 +31,10 @@ describe GoCardlessPro::Services::MandatesService do
|
|
30
31
|
end
|
31
32
|
|
32
33
|
before do
|
33
|
-
stub_request(:post,
|
34
|
+
stub_request(:post, %r(.*api.gocardless.com/mandates)).
|
34
35
|
with(
|
35
36
|
body: {
|
36
|
-
mandates
|
37
|
+
"mandates" => {
|
37
38
|
|
38
39
|
"created_at" => "created_at-input",
|
39
40
|
"id" => "id-input",
|
@@ -48,7 +49,7 @@ describe GoCardlessPro::Services::MandatesService do
|
|
48
49
|
).
|
49
50
|
to_return(
|
50
51
|
body: {
|
51
|
-
mandates
|
52
|
+
"mandates" => {
|
52
53
|
|
53
54
|
"created_at" => "created_at-input",
|
54
55
|
"id" => "id-input",
|
@@ -73,7 +74,7 @@ describe GoCardlessPro::Services::MandatesService do
|
|
73
74
|
let(:new_resource) { {} }
|
74
75
|
|
75
76
|
before do
|
76
|
-
stub_request(:post,
|
77
|
+
stub_request(:post, %r(.*api.gocardless.com/mandates)).to_return(
|
77
78
|
body: {
|
78
79
|
error: {
|
79
80
|
type: 'validation_failed',
|
@@ -103,9 +104,9 @@ describe GoCardlessPro::Services::MandatesService do
|
|
103
104
|
subject(:get_list_response) { client.mandates.list }
|
104
105
|
|
105
106
|
before do
|
106
|
-
stub_request(:get,
|
107
|
+
stub_request(:get, %r(.*api.gocardless.com/mandates)).to_return(
|
107
108
|
body: {
|
108
|
-
mandates
|
109
|
+
"mandates" => [{
|
109
110
|
|
110
111
|
"created_at" => "created_at-input",
|
111
112
|
"id" => "id-input",
|
@@ -174,9 +175,9 @@ describe GoCardlessPro::Services::MandatesService do
|
|
174
175
|
|
175
176
|
describe "#all" do
|
176
177
|
let!(:first_response_stub) do
|
177
|
-
stub_request(:get,
|
178
|
+
stub_request(:get, %r(.*api.gocardless.com/mandates$)).to_return(
|
178
179
|
body: {
|
179
|
-
mandates
|
180
|
+
"mandates" => [{
|
180
181
|
|
181
182
|
"created_at" => "created_at-input",
|
182
183
|
"id" => "id-input",
|
@@ -197,9 +198,9 @@ describe GoCardlessPro::Services::MandatesService do
|
|
197
198
|
end
|
198
199
|
|
199
200
|
let!(:second_response_stub) do
|
200
|
-
stub_request(:get,
|
201
|
+
stub_request(:get, %r(.*api.gocardless.com/mandates\?after=AB345)).to_return(
|
201
202
|
body: {
|
202
|
-
mandates
|
203
|
+
"mandates" => [{
|
203
204
|
|
204
205
|
"created_at" => "created_at-input",
|
205
206
|
"id" => "id-input",
|
@@ -238,11 +239,12 @@ describe GoCardlessPro::Services::MandatesService do
|
|
238
239
|
|
239
240
|
context "passing in a custom header" do
|
240
241
|
let!(:stub) do
|
241
|
-
|
242
|
-
|
243
|
-
.
|
242
|
+
stub_url = "/mandates/:identity".gsub(':identity', id)
|
243
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).
|
244
|
+
with(headers: { 'Foo' => 'Bar' }).
|
245
|
+
to_return(
|
244
246
|
body: {
|
245
|
-
mandates
|
247
|
+
"mandates" => {
|
246
248
|
|
247
249
|
"created_at" => "created_at-input",
|
248
250
|
"id" => "id-input",
|
@@ -272,9 +274,10 @@ describe GoCardlessPro::Services::MandatesService do
|
|
272
274
|
|
273
275
|
context "when there is a mandate to return" do
|
274
276
|
before do
|
275
|
-
|
277
|
+
stub_url = "/mandates/:identity".gsub(':identity', id)
|
278
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
276
279
|
body: {
|
277
|
-
mandates
|
280
|
+
"mandates" => {
|
278
281
|
|
279
282
|
"created_at" => "created_at-input",
|
280
283
|
"id" => "id-input",
|
@@ -297,7 +300,8 @@ describe GoCardlessPro::Services::MandatesService do
|
|
297
300
|
|
298
301
|
context "when nothing is returned" do
|
299
302
|
before do
|
300
|
-
|
303
|
+
stub_url = "/mandates/:identity".gsub(':identity', id)
|
304
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
301
305
|
body: "",
|
302
306
|
headers: { 'Content-Type' => 'application/json' }
|
303
307
|
)
|
@@ -322,9 +326,10 @@ describe GoCardlessPro::Services::MandatesService do
|
|
322
326
|
let(:update_params) { { "hello" => "world" } }
|
323
327
|
|
324
328
|
let!(:stub) do
|
325
|
-
|
329
|
+
stub_url = "/mandates/:identity".gsub(':identity', id)
|
330
|
+
stub_request(:put, %r(.*api.gocardless.com#{stub_url})).to_return(
|
326
331
|
body: {
|
327
|
-
mandates
|
332
|
+
"mandates" => {
|
328
333
|
|
329
334
|
"created_at" => "created_at-input",
|
330
335
|
"id" => "id-input",
|
@@ -361,9 +366,9 @@ describe GoCardlessPro::Services::MandatesService do
|
|
361
366
|
let!(:stub) do
|
362
367
|
# /mandates/%v/actions/cancel
|
363
368
|
stub_url = "/mandates/:identity/actions/cancel".gsub(':identity', resource_id)
|
364
|
-
stub_request(:post,
|
369
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).to_return(
|
365
370
|
body: {
|
366
|
-
mandates
|
371
|
+
"mandates" => {
|
367
372
|
|
368
373
|
"created_at" => "created_at-input",
|
369
374
|
"id" => "id-input",
|
@@ -396,13 +401,13 @@ describe GoCardlessPro::Services::MandatesService do
|
|
396
401
|
let!(:stub) do
|
397
402
|
# /mandates/%v/actions/cancel
|
398
403
|
stub_url = "/mandates/:identity/actions/cancel".gsub(':identity', resource_id)
|
399
|
-
stub_request(:post,
|
404
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).
|
400
405
|
with(
|
401
406
|
body: { foo: 'bar' },
|
402
407
|
headers: { 'Foo' => 'Bar' }
|
403
408
|
).to_return(
|
404
409
|
body: {
|
405
|
-
mandates
|
410
|
+
"mandates" => {
|
406
411
|
|
407
412
|
"created_at" => "created_at-input",
|
408
413
|
"id" => "id-input",
|
@@ -434,9 +439,9 @@ describe GoCardlessPro::Services::MandatesService do
|
|
434
439
|
let!(:stub) do
|
435
440
|
# /mandates/%v/actions/reinstate
|
436
441
|
stub_url = "/mandates/:identity/actions/reinstate".gsub(':identity', resource_id)
|
437
|
-
stub_request(:post,
|
442
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).to_return(
|
438
443
|
body: {
|
439
|
-
mandates
|
444
|
+
"mandates" => {
|
440
445
|
|
441
446
|
"created_at" => "created_at-input",
|
442
447
|
"id" => "id-input",
|
@@ -469,13 +474,13 @@ describe GoCardlessPro::Services::MandatesService do
|
|
469
474
|
let!(:stub) do
|
470
475
|
# /mandates/%v/actions/reinstate
|
471
476
|
stub_url = "/mandates/:identity/actions/reinstate".gsub(':identity', resource_id)
|
472
|
-
stub_request(:post,
|
477
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).
|
473
478
|
with(
|
474
479
|
body: { foo: 'bar' },
|
475
480
|
headers: { 'Foo' => 'Bar' }
|
476
481
|
).to_return(
|
477
482
|
body: {
|
478
|
-
mandates
|
483
|
+
"mandates" => {
|
479
484
|
|
480
485
|
"created_at" => "created_at-input",
|
481
486
|
"id" => "id-input",
|
@@ -9,6 +9,7 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
|
13
14
|
|
14
15
|
|
@@ -33,10 +34,10 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
33
34
|
end
|
34
35
|
|
35
36
|
before do
|
36
|
-
stub_request(:post,
|
37
|
+
stub_request(:post, %r(.*api.gocardless.com/payments)).
|
37
38
|
with(
|
38
39
|
body: {
|
39
|
-
payments
|
40
|
+
"payments" => {
|
40
41
|
|
41
42
|
"amount" => "amount-input",
|
42
43
|
"amount_refunded" => "amount_refunded-input",
|
@@ -54,7 +55,7 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
54
55
|
).
|
55
56
|
to_return(
|
56
57
|
body: {
|
57
|
-
payments
|
58
|
+
"payments" => {
|
58
59
|
|
59
60
|
"amount" => "amount-input",
|
60
61
|
"amount_refunded" => "amount_refunded-input",
|
@@ -82,7 +83,7 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
82
83
|
let(:new_resource) { {} }
|
83
84
|
|
84
85
|
before do
|
85
|
-
stub_request(:post,
|
86
|
+
stub_request(:post, %r(.*api.gocardless.com/payments)).to_return(
|
86
87
|
body: {
|
87
88
|
error: {
|
88
89
|
type: 'validation_failed',
|
@@ -112,9 +113,9 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
112
113
|
subject(:get_list_response) { client.payments.list }
|
113
114
|
|
114
115
|
before do
|
115
|
-
stub_request(:get,
|
116
|
+
stub_request(:get, %r(.*api.gocardless.com/payments)).to_return(
|
116
117
|
body: {
|
117
|
-
payments
|
118
|
+
"payments" => [{
|
118
119
|
|
119
120
|
"amount" => "amount-input",
|
120
121
|
"amount_refunded" => "amount_refunded-input",
|
@@ -198,9 +199,9 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
198
199
|
|
199
200
|
describe "#all" do
|
200
201
|
let!(:first_response_stub) do
|
201
|
-
stub_request(:get,
|
202
|
+
stub_request(:get, %r(.*api.gocardless.com/payments$)).to_return(
|
202
203
|
body: {
|
203
|
-
payments
|
204
|
+
"payments" => [{
|
204
205
|
|
205
206
|
"amount" => "amount-input",
|
206
207
|
"amount_refunded" => "amount_refunded-input",
|
@@ -224,9 +225,9 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
224
225
|
end
|
225
226
|
|
226
227
|
let!(:second_response_stub) do
|
227
|
-
stub_request(:get,
|
228
|
+
stub_request(:get, %r(.*api.gocardless.com/payments\?after=AB345)).to_return(
|
228
229
|
body: {
|
229
|
-
payments
|
230
|
+
"payments" => [{
|
230
231
|
|
231
232
|
"amount" => "amount-input",
|
232
233
|
"amount_refunded" => "amount_refunded-input",
|
@@ -268,11 +269,12 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
268
269
|
|
269
270
|
context "passing in a custom header" do
|
270
271
|
let!(:stub) do
|
271
|
-
|
272
|
-
|
273
|
-
.
|
272
|
+
stub_url = "/payments/:identity".gsub(':identity', id)
|
273
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).
|
274
|
+
with(headers: { 'Foo' => 'Bar' }).
|
275
|
+
to_return(
|
274
276
|
body: {
|
275
|
-
payments
|
277
|
+
"payments" => {
|
276
278
|
|
277
279
|
"amount" => "amount-input",
|
278
280
|
"amount_refunded" => "amount_refunded-input",
|
@@ -305,9 +307,10 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
305
307
|
|
306
308
|
context "when there is a payment to return" do
|
307
309
|
before do
|
308
|
-
|
310
|
+
stub_url = "/payments/:identity".gsub(':identity', id)
|
311
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
309
312
|
body: {
|
310
|
-
payments
|
313
|
+
"payments" => {
|
311
314
|
|
312
315
|
"amount" => "amount-input",
|
313
316
|
"amount_refunded" => "amount_refunded-input",
|
@@ -333,7 +336,8 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
333
336
|
|
334
337
|
context "when nothing is returned" do
|
335
338
|
before do
|
336
|
-
|
339
|
+
stub_url = "/payments/:identity".gsub(':identity', id)
|
340
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
337
341
|
body: "",
|
338
342
|
headers: { 'Content-Type' => 'application/json' }
|
339
343
|
)
|
@@ -358,9 +362,10 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
358
362
|
let(:update_params) { { "hello" => "world" } }
|
359
363
|
|
360
364
|
let!(:stub) do
|
361
|
-
|
365
|
+
stub_url = "/payments/:identity".gsub(':identity', id)
|
366
|
+
stub_request(:put, %r(.*api.gocardless.com#{stub_url})).to_return(
|
362
367
|
body: {
|
363
|
-
payments
|
368
|
+
"payments" => {
|
364
369
|
|
365
370
|
"amount" => "amount-input",
|
366
371
|
"amount_refunded" => "amount_refunded-input",
|
@@ -400,9 +405,9 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
400
405
|
let!(:stub) do
|
401
406
|
# /payments/%v/actions/cancel
|
402
407
|
stub_url = "/payments/:identity/actions/cancel".gsub(':identity', resource_id)
|
403
|
-
stub_request(:post,
|
408
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).to_return(
|
404
409
|
body: {
|
405
|
-
payments
|
410
|
+
"payments" => {
|
406
411
|
|
407
412
|
"amount" => "amount-input",
|
408
413
|
"amount_refunded" => "amount_refunded-input",
|
@@ -438,13 +443,13 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
438
443
|
let!(:stub) do
|
439
444
|
# /payments/%v/actions/cancel
|
440
445
|
stub_url = "/payments/:identity/actions/cancel".gsub(':identity', resource_id)
|
441
|
-
stub_request(:post,
|
446
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).
|
442
447
|
with(
|
443
448
|
body: { foo: 'bar' },
|
444
449
|
headers: { 'Foo' => 'Bar' }
|
445
450
|
).to_return(
|
446
451
|
body: {
|
447
|
-
payments
|
452
|
+
"payments" => {
|
448
453
|
|
449
454
|
"amount" => "amount-input",
|
450
455
|
"amount_refunded" => "amount_refunded-input",
|
@@ -479,9 +484,9 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
479
484
|
let!(:stub) do
|
480
485
|
# /payments/%v/actions/retry
|
481
486
|
stub_url = "/payments/:identity/actions/retry".gsub(':identity', resource_id)
|
482
|
-
stub_request(:post,
|
487
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).to_return(
|
483
488
|
body: {
|
484
|
-
payments
|
489
|
+
"payments" => {
|
485
490
|
|
486
491
|
"amount" => "amount-input",
|
487
492
|
"amount_refunded" => "amount_refunded-input",
|
@@ -517,13 +522,13 @@ describe GoCardlessPro::Services::PaymentsService do
|
|
517
522
|
let!(:stub) do
|
518
523
|
# /payments/%v/actions/retry
|
519
524
|
stub_url = "/payments/:identity/actions/retry".gsub(':identity', resource_id)
|
520
|
-
stub_request(:post,
|
525
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).
|
521
526
|
with(
|
522
527
|
body: { foo: 'bar' },
|
523
528
|
headers: { 'Foo' => 'Bar' }
|
524
529
|
).to_return(
|
525
530
|
body: {
|
526
|
-
payments
|
531
|
+
"payments" => {
|
527
532
|
|
528
533
|
"amount" => "amount-input",
|
529
534
|
"amount_refunded" => "amount_refunded-input",
|
@@ -9,6 +9,7 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
|
13
14
|
|
14
15
|
|
@@ -17,9 +18,9 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
17
18
|
subject(:get_list_response) { client.payouts.list }
|
18
19
|
|
19
20
|
before do
|
20
|
-
stub_request(:get,
|
21
|
+
stub_request(:get, %r(.*api.gocardless.com/payouts)).to_return(
|
21
22
|
body: {
|
22
|
-
payouts
|
23
|
+
"payouts" => [{
|
23
24
|
|
24
25
|
"amount" => "amount-input",
|
25
26
|
"created_at" => "created_at-input",
|
@@ -83,9 +84,9 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
83
84
|
|
84
85
|
describe "#all" do
|
85
86
|
let!(:first_response_stub) do
|
86
|
-
stub_request(:get,
|
87
|
+
stub_request(:get, %r(.*api.gocardless.com/payouts$)).to_return(
|
87
88
|
body: {
|
88
|
-
payouts
|
89
|
+
"payouts" => [{
|
89
90
|
|
90
91
|
"amount" => "amount-input",
|
91
92
|
"created_at" => "created_at-input",
|
@@ -105,9 +106,9 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
105
106
|
end
|
106
107
|
|
107
108
|
let!(:second_response_stub) do
|
108
|
-
stub_request(:get,
|
109
|
+
stub_request(:get, %r(.*api.gocardless.com/payouts\?after=AB345)).to_return(
|
109
110
|
body: {
|
110
|
-
payouts
|
111
|
+
"payouts" => [{
|
111
112
|
|
112
113
|
"amount" => "amount-input",
|
113
114
|
"created_at" => "created_at-input",
|
@@ -145,11 +146,12 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
145
146
|
|
146
147
|
context "passing in a custom header" do
|
147
148
|
let!(:stub) do
|
148
|
-
|
149
|
-
|
150
|
-
.
|
149
|
+
stub_url = "/payouts/:identity".gsub(':identity', id)
|
150
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).
|
151
|
+
with(headers: { 'Foo' => 'Bar' }).
|
152
|
+
to_return(
|
151
153
|
body: {
|
152
|
-
payouts
|
154
|
+
"payouts" => {
|
153
155
|
|
154
156
|
"amount" => "amount-input",
|
155
157
|
"created_at" => "created_at-input",
|
@@ -178,9 +180,10 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
178
180
|
|
179
181
|
context "when there is a payout to return" do
|
180
182
|
before do
|
181
|
-
|
183
|
+
stub_url = "/payouts/:identity".gsub(':identity', id)
|
184
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
182
185
|
body: {
|
183
|
-
payouts
|
186
|
+
"payouts" => {
|
184
187
|
|
185
188
|
"amount" => "amount-input",
|
186
189
|
"created_at" => "created_at-input",
|
@@ -202,7 +205,8 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
202
205
|
|
203
206
|
context "when nothing is returned" do
|
204
207
|
before do
|
205
|
-
|
208
|
+
stub_url = "/payouts/:identity".gsub(':identity', id)
|
209
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
206
210
|
body: "",
|
207
211
|
headers: { 'Content-Type' => 'application/json' }
|
208
212
|
)
|