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
@@ -26,14 +26,14 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
26
26
|
'links' => 'links-input',
|
27
27
|
'payout_type' => 'payout_type-input',
|
28
28
|
'reference' => 'reference-input',
|
29
|
-
'status' => 'status-input'
|
29
|
+
'status' => 'status-input',
|
30
30
|
}],
|
31
31
|
meta: {
|
32
32
|
cursors: {
|
33
33
|
before: nil,
|
34
|
-
after: 'ABC123'
|
35
|
-
}
|
36
|
-
}
|
34
|
+
after: 'ABC123',
|
35
|
+
},
|
36
|
+
},
|
37
37
|
}.to_json
|
38
38
|
end
|
39
39
|
|
@@ -77,19 +77,19 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
77
77
|
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
|
78
78
|
|
79
79
|
it 'retries timeouts' do
|
80
|
-
stub = stub_request(:get, %r{.*api.gocardless.com/payouts})
|
81
|
-
|
80
|
+
stub = stub_request(:get, %r{.*api.gocardless.com/payouts}).
|
81
|
+
to_timeout.then.to_return(status: 200, headers: response_headers, body: body)
|
82
82
|
|
83
83
|
get_list_response
|
84
84
|
expect(stub).to have_been_requested.twice
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'retries 5XX errors' do
|
88
|
-
stub = stub_request(:get, %r{.*api.gocardless.com/payouts})
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
stub = stub_request(:get, %r{.*api.gocardless.com/payouts}).
|
89
|
+
to_return(status: 502,
|
90
|
+
headers: { 'Content-Type' => 'text/html' },
|
91
|
+
body: '<html><body>Response from Cloudflare</body></html>').
|
92
|
+
then.to_return(status: 200, headers: response_headers, body: body)
|
93
93
|
|
94
94
|
get_list_response
|
95
95
|
expect(stub).to have_been_requested.twice
|
@@ -113,12 +113,12 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
113
113
|
'links' => 'links-input',
|
114
114
|
'payout_type' => 'payout_type-input',
|
115
115
|
'reference' => 'reference-input',
|
116
|
-
'status' => 'status-input'
|
116
|
+
'status' => 'status-input',
|
117
117
|
}],
|
118
118
|
meta: {
|
119
119
|
cursors: { after: 'AB345' },
|
120
|
-
limit: 1
|
121
|
-
}
|
120
|
+
limit: 1,
|
121
|
+
},
|
122
122
|
}.to_json,
|
123
123
|
headers: response_headers
|
124
124
|
)
|
@@ -138,12 +138,12 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
138
138
|
'links' => 'links-input',
|
139
139
|
'payout_type' => 'payout_type-input',
|
140
140
|
'reference' => 'reference-input',
|
141
|
-
'status' => 'status-input'
|
141
|
+
'status' => 'status-input',
|
142
142
|
}],
|
143
143
|
meta: {
|
144
144
|
limit: 2,
|
145
|
-
cursors: {}
|
146
|
-
}
|
145
|
+
cursors: {},
|
146
|
+
},
|
147
147
|
}.to_json,
|
148
148
|
headers: response_headers
|
149
149
|
)
|
@@ -172,19 +172,19 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
172
172
|
'links' => 'links-input',
|
173
173
|
'payout_type' => 'payout_type-input',
|
174
174
|
'reference' => 'reference-input',
|
175
|
-
'status' => 'status-input'
|
175
|
+
'status' => 'status-input',
|
176
176
|
}],
|
177
177
|
meta: {
|
178
178
|
cursors: { after: 'AB345' },
|
179
|
-
limit: 1
|
180
|
-
}
|
179
|
+
limit: 1,
|
180
|
+
},
|
181
181
|
}.to_json,
|
182
182
|
headers: response_headers
|
183
183
|
)
|
184
184
|
|
185
|
-
second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payouts\?after=AB345})
|
186
|
-
|
187
|
-
|
185
|
+
second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payouts\?after=AB345}).
|
186
|
+
to_timeout.then.
|
187
|
+
to_return(
|
188
188
|
body: {
|
189
189
|
'payouts' => [{
|
190
190
|
|
@@ -197,12 +197,12 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
197
197
|
'links' => 'links-input',
|
198
198
|
'payout_type' => 'payout_type-input',
|
199
199
|
'reference' => 'reference-input',
|
200
|
-
'status' => 'status-input'
|
200
|
+
'status' => 'status-input',
|
201
201
|
}],
|
202
202
|
meta: {
|
203
203
|
limit: 2,
|
204
|
-
cursors: {}
|
205
|
-
}
|
204
|
+
cursors: {},
|
205
|
+
},
|
206
206
|
}.to_json,
|
207
207
|
headers: response_headers
|
208
208
|
)
|
@@ -227,18 +227,18 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
227
227
|
'links' => 'links-input',
|
228
228
|
'payout_type' => 'payout_type-input',
|
229
229
|
'reference' => 'reference-input',
|
230
|
-
'status' => 'status-input'
|
230
|
+
'status' => 'status-input',
|
231
231
|
}],
|
232
232
|
meta: {
|
233
233
|
cursors: { after: 'AB345' },
|
234
|
-
limit: 1
|
235
|
-
}
|
234
|
+
limit: 1,
|
235
|
+
},
|
236
236
|
}.to_json,
|
237
237
|
headers: response_headers
|
238
238
|
)
|
239
239
|
|
240
|
-
second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payouts\?after=AB345})
|
241
|
-
|
240
|
+
second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payouts\?after=AB345}).
|
241
|
+
to_return(
|
242
242
|
status: 502,
|
243
243
|
body: '<html><body>Response from Cloudflare</body></html>',
|
244
244
|
headers: { 'Content-Type' => 'text/html' }
|
@@ -255,12 +255,12 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
255
255
|
'links' => 'links-input',
|
256
256
|
'payout_type' => 'payout_type-input',
|
257
257
|
'reference' => 'reference-input',
|
258
|
-
'status' => 'status-input'
|
258
|
+
'status' => 'status-input',
|
259
259
|
}],
|
260
260
|
meta: {
|
261
261
|
limit: 2,
|
262
|
-
cursors: {}
|
263
|
-
}
|
262
|
+
cursors: {},
|
263
|
+
},
|
264
264
|
}.to_json,
|
265
265
|
headers: response_headers
|
266
266
|
)
|
@@ -281,9 +281,9 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
281
281
|
context 'passing in a custom header' do
|
282
282
|
let!(:stub) do
|
283
283
|
stub_url = '/payouts/:identity'.gsub(':identity', id)
|
284
|
-
stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
285
|
-
|
286
|
-
|
284
|
+
stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
285
|
+
with(headers: { 'Foo' => 'Bar' }).
|
286
|
+
to_return(
|
287
287
|
body: {
|
288
288
|
'payouts' => {
|
289
289
|
|
@@ -296,8 +296,8 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
296
296
|
'links' => 'links-input',
|
297
297
|
'payout_type' => 'payout_type-input',
|
298
298
|
'reference' => 'reference-input',
|
299
|
-
'status' => 'status-input'
|
300
|
-
}
|
299
|
+
'status' => 'status-input',
|
300
|
+
},
|
301
301
|
}.to_json,
|
302
302
|
headers: response_headers
|
303
303
|
)
|
@@ -305,7 +305,7 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
305
305
|
|
306
306
|
subject(:get_response) do
|
307
307
|
client.payouts.get(id, headers: {
|
308
|
-
'Foo' => 'Bar'
|
308
|
+
'Foo' => 'Bar',
|
309
309
|
})
|
310
310
|
end
|
311
311
|
|
@@ -331,8 +331,8 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
331
331
|
'links' => 'links-input',
|
332
332
|
'payout_type' => 'payout_type-input',
|
333
333
|
'reference' => 'reference-input',
|
334
|
-
'status' => 'status-input'
|
335
|
-
}
|
334
|
+
'status' => 'status-input',
|
335
|
+
},
|
336
336
|
}.to_json,
|
337
337
|
headers: response_headers
|
338
338
|
)
|
@@ -371,8 +371,8 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
371
371
|
it 'retries timeouts' do
|
372
372
|
stub_url = '/payouts/:identity'.gsub(':identity', id)
|
373
373
|
|
374
|
-
stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
375
|
-
|
374
|
+
stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
375
|
+
to_timeout.then.to_return(status: 200, headers: response_headers)
|
376
376
|
|
377
377
|
get_response
|
378
378
|
expect(stub).to have_been_requested.twice
|
@@ -381,11 +381,11 @@ describe GoCardlessPro::Services::PayoutsService do
|
|
381
381
|
it 'retries 5XX errors' do
|
382
382
|
stub_url = '/payouts/:identity'.gsub(':identity', id)
|
383
383
|
|
384
|
-
stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
384
|
+
stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
385
|
+
to_return(status: 502,
|
386
|
+
headers: { 'Content-Type' => 'text/html' },
|
387
|
+
body: '<html><body>Response from Cloudflare</body></html>').
|
388
|
+
then.to_return(status: 200, headers: response_headers)
|
389
389
|
|
390
390
|
get_response
|
391
391
|
expect(stub).to have_been_requested.twice
|
@@ -22,13 +22,13 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
22
22
|
'redirect_url' => 'redirect_url-input',
|
23
23
|
'scheme' => 'scheme-input',
|
24
24
|
'session_token' => 'session_token-input',
|
25
|
-
'success_redirect_url' => 'success_redirect_url-input'
|
25
|
+
'success_redirect_url' => 'success_redirect_url-input',
|
26
26
|
}
|
27
27
|
end
|
28
28
|
|
29
29
|
before do
|
30
|
-
stub_request(:post, %r{.*api.gocardless.com/redirect_flows})
|
31
|
-
|
30
|
+
stub_request(:post, %r{.*api.gocardless.com/redirect_flows}).
|
31
|
+
with(
|
32
32
|
body: {
|
33
33
|
'redirect_flows' => {
|
34
34
|
|
@@ -39,11 +39,11 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
39
39
|
'redirect_url' => 'redirect_url-input',
|
40
40
|
'scheme' => 'scheme-input',
|
41
41
|
'session_token' => 'session_token-input',
|
42
|
-
'success_redirect_url' => 'success_redirect_url-input'
|
43
|
-
}
|
42
|
+
'success_redirect_url' => 'success_redirect_url-input',
|
43
|
+
},
|
44
44
|
}
|
45
|
-
)
|
46
|
-
|
45
|
+
).
|
46
|
+
to_return(
|
47
47
|
body: {
|
48
48
|
'redirect_flows' =>
|
49
49
|
|
@@ -56,8 +56,8 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
56
56
|
'redirect_url' => 'redirect_url-input',
|
57
57
|
'scheme' => 'scheme-input',
|
58
58
|
'session_token' => 'session_token-input',
|
59
|
-
'success_redirect_url' => 'success_redirect_url-input'
|
60
|
-
}
|
59
|
+
'success_redirect_url' => 'success_redirect_url-input',
|
60
|
+
},
|
61
61
|
|
62
62
|
}.to_json,
|
63
63
|
headers: response_headers
|
@@ -72,19 +72,19 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
72
72
|
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
|
73
73
|
|
74
74
|
it 'retries timeouts' do
|
75
|
-
stub = stub_request(:post, %r{.*api.gocardless.com/redirect_flows})
|
76
|
-
|
75
|
+
stub = stub_request(:post, %r{.*api.gocardless.com/redirect_flows}).
|
76
|
+
to_timeout.then.to_return(status: 200, headers: response_headers)
|
77
77
|
|
78
78
|
post_create_response
|
79
79
|
expect(stub).to have_been_requested.twice
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'retries 5XX errors' do
|
83
|
-
stub = stub_request(:post, %r{.*api.gocardless.com/redirect_flows})
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
stub = stub_request(:post, %r{.*api.gocardless.com/redirect_flows}).
|
84
|
+
to_return(status: 502,
|
85
|
+
headers: { 'Content-Type' => 'text/html' },
|
86
|
+
body: '<html><body>Response from Cloudflare</body></html>').
|
87
|
+
then.to_return(status: 200, headers: response_headers)
|
88
88
|
|
89
89
|
post_create_response
|
90
90
|
expect(stub).to have_been_requested.twice
|
@@ -102,9 +102,9 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
102
102
|
type: 'validation_failed',
|
103
103
|
code: 422,
|
104
104
|
errors: [
|
105
|
-
{ message: 'test error message', field: 'test_field' }
|
106
|
-
]
|
107
|
-
}
|
105
|
+
{ message: 'test error message', field: 'test_field' },
|
106
|
+
],
|
107
|
+
},
|
108
108
|
}.to_json,
|
109
109
|
headers: response_headers,
|
110
110
|
status: 422
|
@@ -129,7 +129,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
129
129
|
'redirect_url' => 'redirect_url-input',
|
130
130
|
'scheme' => 'scheme-input',
|
131
131
|
'session_token' => 'session_token-input',
|
132
|
-
'success_redirect_url' => 'success_redirect_url-input'
|
132
|
+
'success_redirect_url' => 'success_redirect_url-input',
|
133
133
|
}
|
134
134
|
end
|
135
135
|
|
@@ -144,11 +144,11 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
144
144
|
message: 'A resource has already been created with this idempotency key',
|
145
145
|
reason: 'idempotent_creation_conflict',
|
146
146
|
links: {
|
147
|
-
conflicting_resource_id: id
|
148
|
-
}
|
149
|
-
}
|
150
|
-
]
|
151
|
-
}
|
147
|
+
conflicting_resource_id: id,
|
148
|
+
},
|
149
|
+
},
|
150
|
+
],
|
151
|
+
},
|
152
152
|
}.to_json,
|
153
153
|
headers: response_headers,
|
154
154
|
status: 409
|
@@ -157,8 +157,8 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
157
157
|
|
158
158
|
let!(:get_stub) do
|
159
159
|
stub_url = "/redirect_flows/#{id}"
|
160
|
-
stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
161
|
-
|
160
|
+
stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
161
|
+
to_return(
|
162
162
|
body: {
|
163
163
|
'redirect_flows' => {
|
164
164
|
|
@@ -169,8 +169,8 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
169
169
|
'redirect_url' => 'redirect_url-input',
|
170
170
|
'scheme' => 'scheme-input',
|
171
171
|
'session_token' => 'session_token-input',
|
172
|
-
'success_redirect_url' => 'success_redirect_url-input'
|
173
|
-
}
|
172
|
+
'success_redirect_url' => 'success_redirect_url-input',
|
173
|
+
},
|
174
174
|
}.to_json,
|
175
175
|
headers: response_headers
|
176
176
|
)
|
@@ -192,9 +192,9 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
192
192
|
context 'passing in a custom header' do
|
193
193
|
let!(:stub) do
|
194
194
|
stub_url = '/redirect_flows/:identity'.gsub(':identity', id)
|
195
|
-
stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
196
|
-
|
197
|
-
|
195
|
+
stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
196
|
+
with(headers: { 'Foo' => 'Bar' }).
|
197
|
+
to_return(
|
198
198
|
body: {
|
199
199
|
'redirect_flows' => {
|
200
200
|
|
@@ -205,8 +205,8 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
205
205
|
'redirect_url' => 'redirect_url-input',
|
206
206
|
'scheme' => 'scheme-input',
|
207
207
|
'session_token' => 'session_token-input',
|
208
|
-
'success_redirect_url' => 'success_redirect_url-input'
|
209
|
-
}
|
208
|
+
'success_redirect_url' => 'success_redirect_url-input',
|
209
|
+
},
|
210
210
|
}.to_json,
|
211
211
|
headers: response_headers
|
212
212
|
)
|
@@ -214,7 +214,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
214
214
|
|
215
215
|
subject(:get_response) do
|
216
216
|
client.redirect_flows.get(id, headers: {
|
217
|
-
'Foo' => 'Bar'
|
217
|
+
'Foo' => 'Bar',
|
218
218
|
})
|
219
219
|
end
|
220
220
|
|
@@ -238,8 +238,8 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
238
238
|
'redirect_url' => 'redirect_url-input',
|
239
239
|
'scheme' => 'scheme-input',
|
240
240
|
'session_token' => 'session_token-input',
|
241
|
-
'success_redirect_url' => 'success_redirect_url-input'
|
242
|
-
}
|
241
|
+
'success_redirect_url' => 'success_redirect_url-input',
|
242
|
+
},
|
243
243
|
}.to_json,
|
244
244
|
headers: response_headers
|
245
245
|
)
|
@@ -278,8 +278,8 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
278
278
|
it 'retries timeouts' do
|
279
279
|
stub_url = '/redirect_flows/:identity'.gsub(':identity', id)
|
280
280
|
|
281
|
-
stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
282
|
-
|
281
|
+
stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
282
|
+
to_timeout.then.to_return(status: 200, headers: response_headers)
|
283
283
|
|
284
284
|
get_response
|
285
285
|
expect(stub).to have_been_requested.twice
|
@@ -288,11 +288,11 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
288
288
|
it 'retries 5XX errors' do
|
289
289
|
stub_url = '/redirect_flows/:identity'.gsub(':identity', id)
|
290
290
|
|
291
|
-
stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
291
|
+
stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
|
292
|
+
to_return(status: 502,
|
293
|
+
headers: { 'Content-Type' => 'text/html' },
|
294
|
+
body: '<html><body>Response from Cloudflare</body></html>').
|
295
|
+
then.to_return(status: 200, headers: response_headers)
|
296
296
|
|
297
297
|
get_response
|
298
298
|
expect(stub).to have_been_requested.twice
|
@@ -319,8 +319,8 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
319
319
|
'redirect_url' => 'redirect_url-input',
|
320
320
|
'scheme' => 'scheme-input',
|
321
321
|
'session_token' => 'session_token-input',
|
322
|
-
'success_redirect_url' => 'success_redirect_url-input'
|
323
|
-
}
|
322
|
+
'success_redirect_url' => 'success_redirect_url-input',
|
323
|
+
},
|
324
324
|
}.to_json,
|
325
325
|
headers: response_headers
|
326
326
|
)
|
@@ -335,8 +335,8 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
335
335
|
describe 'retry behaviour' do
|
336
336
|
it "doesn't retry errors" do
|
337
337
|
stub_url = '/redirect_flows/:identity/actions/complete'.gsub(':identity', resource_id)
|
338
|
-
stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
|
339
|
-
|
338
|
+
stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
|
339
|
+
to_timeout
|
340
340
|
|
341
341
|
expect { post_response }.to raise_error(Faraday::TimeoutError)
|
342
342
|
expect(stub).to have_been_requested
|
@@ -353,8 +353,8 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
353
353
|
let!(:stub) do
|
354
354
|
# /redirect_flows/%v/actions/complete
|
355
355
|
stub_url = '/redirect_flows/:identity/actions/complete'.gsub(':identity', resource_id)
|
356
|
-
stub_request(:post, /.*api.gocardless.com#{stub_url}/)
|
357
|
-
|
356
|
+
stub_request(:post, /.*api.gocardless.com#{stub_url}/).
|
357
|
+
with(
|
358
358
|
body: { foo: 'bar' },
|
359
359
|
headers: { 'Foo' => 'Bar' }
|
360
360
|
).to_return(
|
@@ -368,8 +368,8 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
368
368
|
'redirect_url' => 'redirect_url-input',
|
369
369
|
'scheme' => 'scheme-input',
|
370
370
|
'session_token' => 'session_token-input',
|
371
|
-
'success_redirect_url' => 'success_redirect_url-input'
|
372
|
-
}
|
371
|
+
'success_redirect_url' => 'success_redirect_url-input',
|
372
|
+
},
|
373
373
|
}.to_json,
|
374
374
|
headers: response_headers
|
375
375
|
)
|