gocardless_pro 2.1.0 → 2.2.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/.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
@@ -16,30 +16,30 @@ describe GoCardlessPro::Resources::MandatePdf do
|
|
16
16
|
{
|
17
17
|
|
18
18
|
'expires_at' => 'expires_at-input',
|
19
|
-
'url' => 'url-input'
|
19
|
+
'url' => 'url-input',
|
20
20
|
}
|
21
21
|
end
|
22
22
|
|
23
23
|
before do
|
24
|
-
stub_request(:post, %r{.*api.gocardless.com/mandate_pdfs})
|
25
|
-
|
24
|
+
stub_request(:post, %r{.*api.gocardless.com/mandate_pdfs}).
|
25
|
+
with(
|
26
26
|
body: {
|
27
27
|
'mandate_pdfs' => {
|
28
28
|
|
29
29
|
'expires_at' => 'expires_at-input',
|
30
|
-
'url' => 'url-input'
|
31
|
-
}
|
30
|
+
'url' => 'url-input',
|
31
|
+
},
|
32
32
|
}
|
33
|
-
)
|
34
|
-
|
33
|
+
).
|
34
|
+
to_return(
|
35
35
|
body: {
|
36
36
|
'mandate_pdfs' =>
|
37
37
|
|
38
38
|
{
|
39
39
|
|
40
40
|
'expires_at' => 'expires_at-input',
|
41
|
-
'url' => 'url-input'
|
42
|
-
}
|
41
|
+
'url' => 'url-input',
|
42
|
+
},
|
43
43
|
|
44
44
|
}.to_json,
|
45
45
|
headers: response_headers
|
@@ -61,9 +61,9 @@ describe GoCardlessPro::Resources::MandatePdf do
|
|
61
61
|
type: 'validation_failed',
|
62
62
|
code: 422,
|
63
63
|
errors: [
|
64
|
-
{ message: 'test error message', field: 'test_field' }
|
65
|
-
]
|
66
|
-
}
|
64
|
+
{ message: 'test error message', field: 'test_field' },
|
65
|
+
],
|
66
|
+
},
|
67
67
|
}.to_json,
|
68
68
|
headers: response_headers,
|
69
69
|
status: 422
|
@@ -82,7 +82,7 @@ describe GoCardlessPro::Resources::MandatePdf do
|
|
82
82
|
{
|
83
83
|
|
84
84
|
'expires_at' => 'expires_at-input',
|
85
|
-
'url' => 'url-input'
|
85
|
+
'url' => 'url-input',
|
86
86
|
}
|
87
87
|
end
|
88
88
|
|
@@ -97,11 +97,11 @@ describe GoCardlessPro::Resources::MandatePdf do
|
|
97
97
|
message: 'A resource has already been created with this idempotency key',
|
98
98
|
reason: 'idempotent_creation_conflict',
|
99
99
|
links: {
|
100
|
-
conflicting_resource_id: id
|
101
|
-
}
|
102
|
-
}
|
103
|
-
]
|
104
|
-
}
|
100
|
+
conflicting_resource_id: id,
|
101
|
+
},
|
102
|
+
},
|
103
|
+
],
|
104
|
+
},
|
105
105
|
}.to_json,
|
106
106
|
headers: response_headers,
|
107
107
|
status: 409
|
@@ -23,13 +23,13 @@ describe GoCardlessPro::Resources::Mandate do
|
|
23
23
|
'payments_require_approval' => 'payments_require_approval-input',
|
24
24
|
'reference' => 'reference-input',
|
25
25
|
'scheme' => 'scheme-input',
|
26
|
-
'status' => 'status-input'
|
26
|
+
'status' => 'status-input',
|
27
27
|
}
|
28
28
|
end
|
29
29
|
|
30
30
|
before do
|
31
|
-
stub_request(:post, %r{.*api.gocardless.com/mandates})
|
32
|
-
|
31
|
+
stub_request(:post, %r{.*api.gocardless.com/mandates}).
|
32
|
+
with(
|
33
33
|
body: {
|
34
34
|
'mandates' => {
|
35
35
|
|
@@ -41,11 +41,11 @@ describe GoCardlessPro::Resources::Mandate do
|
|
41
41
|
'payments_require_approval' => 'payments_require_approval-input',
|
42
42
|
'reference' => 'reference-input',
|
43
43
|
'scheme' => 'scheme-input',
|
44
|
-
'status' => 'status-input'
|
45
|
-
}
|
44
|
+
'status' => 'status-input',
|
45
|
+
},
|
46
46
|
}
|
47
|
-
)
|
48
|
-
|
47
|
+
).
|
48
|
+
to_return(
|
49
49
|
body: {
|
50
50
|
'mandates' =>
|
51
51
|
|
@@ -59,8 +59,8 @@ describe GoCardlessPro::Resources::Mandate do
|
|
59
59
|
'payments_require_approval' => 'payments_require_approval-input',
|
60
60
|
'reference' => 'reference-input',
|
61
61
|
'scheme' => 'scheme-input',
|
62
|
-
'status' => 'status-input'
|
63
|
-
}
|
62
|
+
'status' => 'status-input',
|
63
|
+
},
|
64
64
|
|
65
65
|
}.to_json,
|
66
66
|
headers: response_headers
|
@@ -82,9 +82,9 @@ describe GoCardlessPro::Resources::Mandate do
|
|
82
82
|
type: 'validation_failed',
|
83
83
|
code: 422,
|
84
84
|
errors: [
|
85
|
-
{ message: 'test error message', field: 'test_field' }
|
86
|
-
]
|
87
|
-
}
|
85
|
+
{ message: 'test error message', field: 'test_field' },
|
86
|
+
],
|
87
|
+
},
|
88
88
|
}.to_json,
|
89
89
|
headers: response_headers,
|
90
90
|
status: 422
|
@@ -110,7 +110,7 @@ describe GoCardlessPro::Resources::Mandate do
|
|
110
110
|
'payments_require_approval' => 'payments_require_approval-input',
|
111
111
|
'reference' => 'reference-input',
|
112
112
|
'scheme' => 'scheme-input',
|
113
|
-
'status' => 'status-input'
|
113
|
+
'status' => 'status-input',
|
114
114
|
}
|
115
115
|
end
|
116
116
|
|
@@ -125,11 +125,11 @@ describe GoCardlessPro::Resources::Mandate do
|
|
125
125
|
message: 'A resource has already been created with this idempotency key',
|
126
126
|
reason: 'idempotent_creation_conflict',
|
127
127
|
links: {
|
128
|
-
conflicting_resource_id: id
|
129
|
-
}
|
130
|
-
}
|
131
|
-
]
|
132
|
-
}
|
128
|
+
conflicting_resource_id: id,
|
129
|
+
},
|
130
|
+
},
|
131
|
+
],
|
132
|
+
},
|
133
133
|
}.to_json,
|
134
134
|
headers: response_headers,
|
135
135
|
status: 409
|
@@ -138,8 +138,8 @@ describe GoCardlessPro::Resources::Mandate do
|
|
138
138
|
|
139
139
|
let!(:get_stub) do
|
140
140
|
stub_url = "/mandates/#{id}"
|
141
|
-
stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
142
|
-
|
141
|
+
stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
142
|
+
to_return(
|
143
143
|
body: {
|
144
144
|
'mandates' => {
|
145
145
|
|
@@ -151,8 +151,8 @@ describe GoCardlessPro::Resources::Mandate do
|
|
151
151
|
'payments_require_approval' => 'payments_require_approval-input',
|
152
152
|
'reference' => 'reference-input',
|
153
153
|
'scheme' => 'scheme-input',
|
154
|
-
'status' => 'status-input'
|
155
|
-
}
|
154
|
+
'status' => 'status-input',
|
155
|
+
},
|
156
156
|
}.to_json,
|
157
157
|
headers: response_headers
|
158
158
|
)
|
@@ -183,14 +183,14 @@ describe GoCardlessPro::Resources::Mandate do
|
|
183
183
|
'payments_require_approval' => 'payments_require_approval-input',
|
184
184
|
'reference' => 'reference-input',
|
185
185
|
'scheme' => 'scheme-input',
|
186
|
-
'status' => 'status-input'
|
186
|
+
'status' => 'status-input',
|
187
187
|
}],
|
188
188
|
meta: {
|
189
189
|
cursors: {
|
190
190
|
before: nil,
|
191
|
-
after: 'ABC123'
|
192
|
-
}
|
193
|
-
}
|
191
|
+
after: 'ABC123',
|
192
|
+
},
|
193
|
+
},
|
194
194
|
}.to_json,
|
195
195
|
headers: response_headers
|
196
196
|
)
|
@@ -239,12 +239,12 @@ describe GoCardlessPro::Resources::Mandate do
|
|
239
239
|
'payments_require_approval' => 'payments_require_approval-input',
|
240
240
|
'reference' => 'reference-input',
|
241
241
|
'scheme' => 'scheme-input',
|
242
|
-
'status' => 'status-input'
|
242
|
+
'status' => 'status-input',
|
243
243
|
}],
|
244
244
|
meta: {
|
245
245
|
cursors: { after: 'AB345' },
|
246
|
-
limit: 1
|
247
|
-
}
|
246
|
+
limit: 1,
|
247
|
+
},
|
248
248
|
}.to_json,
|
249
249
|
headers: response_headers
|
250
250
|
)
|
@@ -263,12 +263,12 @@ describe GoCardlessPro::Resources::Mandate do
|
|
263
263
|
'payments_require_approval' => 'payments_require_approval-input',
|
264
264
|
'reference' => 'reference-input',
|
265
265
|
'scheme' => 'scheme-input',
|
266
|
-
'status' => 'status-input'
|
266
|
+
'status' => 'status-input',
|
267
267
|
}],
|
268
268
|
meta: {
|
269
269
|
limit: 2,
|
270
|
-
cursors: {}
|
271
|
-
}
|
270
|
+
cursors: {},
|
271
|
+
},
|
272
272
|
}.to_json,
|
273
273
|
headers: response_headers
|
274
274
|
)
|
@@ -289,9 +289,9 @@ describe GoCardlessPro::Resources::Mandate do
|
|
289
289
|
context 'passing in a custom header' do
|
290
290
|
let!(:stub) do
|
291
291
|
stub_url = '/mandates/:identity'.gsub(':identity', id)
|
292
|
-
stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
293
|
-
|
294
|
-
|
292
|
+
stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
293
|
+
with(headers: { 'Foo' => 'Bar' }).
|
294
|
+
to_return(
|
295
295
|
body: {
|
296
296
|
'mandates' => {
|
297
297
|
|
@@ -303,8 +303,8 @@ describe GoCardlessPro::Resources::Mandate do
|
|
303
303
|
'payments_require_approval' => 'payments_require_approval-input',
|
304
304
|
'reference' => 'reference-input',
|
305
305
|
'scheme' => 'scheme-input',
|
306
|
-
'status' => 'status-input'
|
307
|
-
}
|
306
|
+
'status' => 'status-input',
|
307
|
+
},
|
308
308
|
}.to_json,
|
309
309
|
headers: response_headers
|
310
310
|
)
|
@@ -312,7 +312,7 @@ describe GoCardlessPro::Resources::Mandate do
|
|
312
312
|
|
313
313
|
subject(:get_response) do
|
314
314
|
client.mandates.get(id, headers: {
|
315
|
-
'Foo' => 'Bar'
|
315
|
+
'Foo' => 'Bar',
|
316
316
|
})
|
317
317
|
end
|
318
318
|
|
@@ -337,8 +337,8 @@ describe GoCardlessPro::Resources::Mandate do
|
|
337
337
|
'payments_require_approval' => 'payments_require_approval-input',
|
338
338
|
'reference' => 'reference-input',
|
339
339
|
'scheme' => 'scheme-input',
|
340
|
-
'status' => 'status-input'
|
341
|
-
}
|
340
|
+
'status' => 'status-input',
|
341
|
+
},
|
342
342
|
}.to_json,
|
343
343
|
headers: response_headers
|
344
344
|
)
|
@@ -393,8 +393,8 @@ describe GoCardlessPro::Resources::Mandate do
|
|
393
393
|
'payments_require_approval' => 'payments_require_approval-input',
|
394
394
|
'reference' => 'reference-input',
|
395
395
|
'scheme' => 'scheme-input',
|
396
|
-
'status' => 'status-input'
|
397
|
-
}
|
396
|
+
'status' => 'status-input',
|
397
|
+
},
|
398
398
|
}.to_json,
|
399
399
|
headers: response_headers
|
400
400
|
)
|
@@ -427,8 +427,8 @@ describe GoCardlessPro::Resources::Mandate do
|
|
427
427
|
'payments_require_approval' => 'payments_require_approval-input',
|
428
428
|
'reference' => 'reference-input',
|
429
429
|
'scheme' => 'scheme-input',
|
430
|
-
'status' => 'status-input'
|
431
|
-
}
|
430
|
+
'status' => 'status-input',
|
431
|
+
},
|
432
432
|
}.to_json,
|
433
433
|
headers: response_headers
|
434
434
|
)
|
@@ -450,8 +450,8 @@ describe GoCardlessPro::Resources::Mandate do
|
|
450
450
|
let!(:stub) do
|
451
451
|
# /mandates/%v/actions/cancel
|
452
452
|
stub_url = '/mandates/:identity/actions/cancel'.gsub(':identity', resource_id)
|
453
|
-
stub_request(:post, /.*api.gocardless.com#{stub_url}/)
|
454
|
-
|
453
|
+
stub_request(:post, /.*api.gocardless.com#{stub_url}/).
|
454
|
+
with(
|
455
455
|
body: { foo: 'bar' },
|
456
456
|
headers: { 'Foo' => 'Bar' }
|
457
457
|
).to_return(
|
@@ -466,8 +466,8 @@ describe GoCardlessPro::Resources::Mandate do
|
|
466
466
|
'payments_require_approval' => 'payments_require_approval-input',
|
467
467
|
'reference' => 'reference-input',
|
468
468
|
'scheme' => 'scheme-input',
|
469
|
-
'status' => 'status-input'
|
470
|
-
}
|
469
|
+
'status' => 'status-input',
|
470
|
+
},
|
471
471
|
}.to_json,
|
472
472
|
headers: response_headers
|
473
473
|
)
|
@@ -495,8 +495,8 @@ describe GoCardlessPro::Resources::Mandate do
|
|
495
495
|
'payments_require_approval' => 'payments_require_approval-input',
|
496
496
|
'reference' => 'reference-input',
|
497
497
|
'scheme' => 'scheme-input',
|
498
|
-
'status' => 'status-input'
|
499
|
-
}
|
498
|
+
'status' => 'status-input',
|
499
|
+
},
|
500
500
|
}.to_json,
|
501
501
|
headers: response_headers
|
502
502
|
)
|
@@ -518,8 +518,8 @@ describe GoCardlessPro::Resources::Mandate do
|
|
518
518
|
let!(:stub) do
|
519
519
|
# /mandates/%v/actions/reinstate
|
520
520
|
stub_url = '/mandates/:identity/actions/reinstate'.gsub(':identity', resource_id)
|
521
|
-
stub_request(:post, /.*api.gocardless.com#{stub_url}/)
|
522
|
-
|
521
|
+
stub_request(:post, /.*api.gocardless.com#{stub_url}/).
|
522
|
+
with(
|
523
523
|
body: { foo: 'bar' },
|
524
524
|
headers: { 'Foo' => 'Bar' }
|
525
525
|
).to_return(
|
@@ -534,8 +534,8 @@ describe GoCardlessPro::Resources::Mandate do
|
|
534
534
|
'payments_require_approval' => 'payments_require_approval-input',
|
535
535
|
'reference' => 'reference-input',
|
536
536
|
'scheme' => 'scheme-input',
|
537
|
-
'status' => 'status-input'
|
538
|
-
}
|
537
|
+
'status' => 'status-input',
|
538
|
+
},
|
539
539
|
}.to_json,
|
540
540
|
headers: response_headers
|
541
541
|
)
|
@@ -25,13 +25,13 @@ describe GoCardlessPro::Resources::Payment 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::Resources::Payment 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::Resources::Payment 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
|
@@ -88,9 +88,9 @@ describe GoCardlessPro::Resources::Payment do
|
|
88
88
|
type: 'validation_failed',
|
89
89
|
code: 422,
|
90
90
|
errors: [
|
91
|
-
{ message: 'test error message', field: 'test_field' }
|
92
|
-
]
|
93
|
-
}
|
91
|
+
{ message: 'test error message', field: 'test_field' },
|
92
|
+
],
|
93
|
+
},
|
94
94
|
}.to_json,
|
95
95
|
headers: response_headers,
|
96
96
|
status: 422
|
@@ -118,7 +118,7 @@ describe GoCardlessPro::Resources::Payment do
|
|
118
118
|
'links' => 'links-input',
|
119
119
|
'metadata' => 'metadata-input',
|
120
120
|
'reference' => 'reference-input',
|
121
|
-
'status' => 'status-input'
|
121
|
+
'status' => 'status-input',
|
122
122
|
}
|
123
123
|
end
|
124
124
|
|
@@ -133,11 +133,11 @@ describe GoCardlessPro::Resources::Payment do
|
|
133
133
|
message: 'A resource has already been created with this idempotency key',
|
134
134
|
reason: 'idempotent_creation_conflict',
|
135
135
|
links: {
|
136
|
-
conflicting_resource_id: id
|
137
|
-
}
|
138
|
-
}
|
139
|
-
]
|
140
|
-
}
|
136
|
+
conflicting_resource_id: id,
|
137
|
+
},
|
138
|
+
},
|
139
|
+
],
|
140
|
+
},
|
141
141
|
}.to_json,
|
142
142
|
headers: response_headers,
|
143
143
|
status: 409
|
@@ -146,8 +146,8 @@ describe GoCardlessPro::Resources::Payment do
|
|
146
146
|
|
147
147
|
let!(:get_stub) do
|
148
148
|
stub_url = "/payments/#{id}"
|
149
|
-
stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
150
|
-
|
149
|
+
stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
150
|
+
to_return(
|
151
151
|
body: {
|
152
152
|
'payments' => {
|
153
153
|
|
@@ -161,8 +161,8 @@ describe GoCardlessPro::Resources::Payment do
|
|
161
161
|
'links' => 'links-input',
|
162
162
|
'metadata' => 'metadata-input',
|
163
163
|
'reference' => 'reference-input',
|
164
|
-
'status' => 'status-input'
|
165
|
-
}
|
164
|
+
'status' => 'status-input',
|
165
|
+
},
|
166
166
|
}.to_json,
|
167
167
|
headers: response_headers
|
168
168
|
)
|
@@ -195,14 +195,14 @@ describe GoCardlessPro::Resources::Payment do
|
|
195
195
|
'links' => 'links-input',
|
196
196
|
'metadata' => 'metadata-input',
|
197
197
|
'reference' => 'reference-input',
|
198
|
-
'status' => 'status-input'
|
198
|
+
'status' => 'status-input',
|
199
199
|
}],
|
200
200
|
meta: {
|
201
201
|
cursors: {
|
202
202
|
before: nil,
|
203
|
-
after: 'ABC123'
|
204
|
-
}
|
205
|
-
}
|
203
|
+
after: 'ABC123',
|
204
|
+
},
|
205
|
+
},
|
206
206
|
}.to_json,
|
207
207
|
headers: response_headers
|
208
208
|
)
|
@@ -257,12 +257,12 @@ describe GoCardlessPro::Resources::Payment do
|
|
257
257
|
'links' => 'links-input',
|
258
258
|
'metadata' => 'metadata-input',
|
259
259
|
'reference' => 'reference-input',
|
260
|
-
'status' => 'status-input'
|
260
|
+
'status' => 'status-input',
|
261
261
|
}],
|
262
262
|
meta: {
|
263
263
|
cursors: { after: 'AB345' },
|
264
|
-
limit: 1
|
265
|
-
}
|
264
|
+
limit: 1,
|
265
|
+
},
|
266
266
|
}.to_json,
|
267
267
|
headers: response_headers
|
268
268
|
)
|
@@ -283,12 +283,12 @@ describe GoCardlessPro::Resources::Payment do
|
|
283
283
|
'links' => 'links-input',
|
284
284
|
'metadata' => 'metadata-input',
|
285
285
|
'reference' => 'reference-input',
|
286
|
-
'status' => 'status-input'
|
286
|
+
'status' => 'status-input',
|
287
287
|
}],
|
288
288
|
meta: {
|
289
289
|
limit: 2,
|
290
|
-
cursors: {}
|
291
|
-
}
|
290
|
+
cursors: {},
|
291
|
+
},
|
292
292
|
}.to_json,
|
293
293
|
headers: response_headers
|
294
294
|
)
|
@@ -309,9 +309,9 @@ describe GoCardlessPro::Resources::Payment do
|
|
309
309
|
context 'passing in a custom header' do
|
310
310
|
let!(:stub) do
|
311
311
|
stub_url = '/payments/:identity'.gsub(':identity', id)
|
312
|
-
stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
313
|
-
|
314
|
-
|
312
|
+
stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
313
|
+
with(headers: { 'Foo' => 'Bar' }).
|
314
|
+
to_return(
|
315
315
|
body: {
|
316
316
|
'payments' => {
|
317
317
|
|
@@ -325,8 +325,8 @@ describe GoCardlessPro::Resources::Payment do
|
|
325
325
|
'links' => 'links-input',
|
326
326
|
'metadata' => 'metadata-input',
|
327
327
|
'reference' => 'reference-input',
|
328
|
-
'status' => 'status-input'
|
329
|
-
}
|
328
|
+
'status' => 'status-input',
|
329
|
+
},
|
330
330
|
}.to_json,
|
331
331
|
headers: response_headers
|
332
332
|
)
|
@@ -334,7 +334,7 @@ describe GoCardlessPro::Resources::Payment do
|
|
334
334
|
|
335
335
|
subject(:get_response) do
|
336
336
|
client.payments.get(id, headers: {
|
337
|
-
'Foo' => 'Bar'
|
337
|
+
'Foo' => 'Bar',
|
338
338
|
})
|
339
339
|
end
|
340
340
|
|
@@ -361,8 +361,8 @@ describe GoCardlessPro::Resources::Payment do
|
|
361
361
|
'links' => 'links-input',
|
362
362
|
'metadata' => 'metadata-input',
|
363
363
|
'reference' => 'reference-input',
|
364
|
-
'status' => 'status-input'
|
365
|
-
}
|
364
|
+
'status' => 'status-input',
|
365
|
+
},
|
366
366
|
}.to_json,
|
367
367
|
headers: response_headers
|
368
368
|
)
|
@@ -419,8 +419,8 @@ describe GoCardlessPro::Resources::Payment do
|
|
419
419
|
'links' => 'links-input',
|
420
420
|
'metadata' => 'metadata-input',
|
421
421
|
'reference' => 'reference-input',
|
422
|
-
'status' => 'status-input'
|
423
|
-
}
|
422
|
+
'status' => 'status-input',
|
423
|
+
},
|
424
424
|
}.to_json,
|
425
425
|
headers: response_headers
|
426
426
|
)
|
@@ -455,8 +455,8 @@ describe GoCardlessPro::Resources::Payment do
|
|
455
455
|
'links' => 'links-input',
|
456
456
|
'metadata' => 'metadata-input',
|
457
457
|
'reference' => 'reference-input',
|
458
|
-
'status' => 'status-input'
|
459
|
-
}
|
458
|
+
'status' => 'status-input',
|
459
|
+
},
|
460
460
|
}.to_json,
|
461
461
|
headers: response_headers
|
462
462
|
)
|
@@ -478,8 +478,8 @@ describe GoCardlessPro::Resources::Payment do
|
|
478
478
|
let!(:stub) do
|
479
479
|
# /payments/%v/actions/cancel
|
480
480
|
stub_url = '/payments/:identity/actions/cancel'.gsub(':identity', resource_id)
|
481
|
-
stub_request(:post, /.*api.gocardless.com#{stub_url}/)
|
482
|
-
|
481
|
+
stub_request(:post, /.*api.gocardless.com#{stub_url}/).
|
482
|
+
with(
|
483
483
|
body: { foo: 'bar' },
|
484
484
|
headers: { 'Foo' => 'Bar' }
|
485
485
|
).to_return(
|
@@ -496,8 +496,8 @@ describe GoCardlessPro::Resources::Payment 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
|
)
|
@@ -527,8 +527,8 @@ describe GoCardlessPro::Resources::Payment do
|
|
527
527
|
'links' => 'links-input',
|
528
528
|
'metadata' => 'metadata-input',
|
529
529
|
'reference' => 'reference-input',
|
530
|
-
'status' => 'status-input'
|
531
|
-
}
|
530
|
+
'status' => 'status-input',
|
531
|
+
},
|
532
532
|
}.to_json,
|
533
533
|
headers: response_headers
|
534
534
|
)
|
@@ -550,8 +550,8 @@ describe GoCardlessPro::Resources::Payment do
|
|
550
550
|
let!(:stub) do
|
551
551
|
# /payments/%v/actions/retry
|
552
552
|
stub_url = '/payments/:identity/actions/retry'.gsub(':identity', resource_id)
|
553
|
-
stub_request(:post, /.*api.gocardless.com#{stub_url}/)
|
554
|
-
|
553
|
+
stub_request(:post, /.*api.gocardless.com#{stub_url}/).
|
554
|
+
with(
|
555
555
|
body: { foo: 'bar' },
|
556
556
|
headers: { 'Foo' => 'Bar' }
|
557
557
|
).to_return(
|
@@ -568,8 +568,8 @@ describe GoCardlessPro::Resources::Payment do
|
|
568
568
|
'links' => 'links-input',
|
569
569
|
'metadata' => 'metadata-input',
|
570
570
|
'reference' => 'reference-input',
|
571
|
-
'status' => 'status-input'
|
572
|
-
}
|
571
|
+
'status' => 'status-input',
|
572
|
+
},
|
573
573
|
}.to_json,
|
574
574
|
headers: response_headers
|
575
575
|
)
|