gocardless_pro 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -4
  3. data/lib/gocardless_pro.rb +1 -0
  4. data/lib/gocardless_pro/api_service.rb +2 -0
  5. data/lib/gocardless_pro/client.rb +4 -3
  6. data/lib/gocardless_pro/error/invalid_state_error.rb +17 -0
  7. data/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb +50 -0
  8. data/lib/gocardless_pro/request.rb +38 -1
  9. data/lib/gocardless_pro/resources/creditor.rb +2 -2
  10. data/lib/gocardless_pro/resources/creditor_bank_account.rb +11 -11
  11. data/lib/gocardless_pro/resources/customer_bank_account.rb +2 -2
  12. data/lib/gocardless_pro/resources/event.rb +2 -2
  13. data/lib/gocardless_pro/resources/mandate.rb +2 -2
  14. data/lib/gocardless_pro/resources/payment.rb +7 -7
  15. data/lib/gocardless_pro/resources/payout.rb +7 -6
  16. data/lib/gocardless_pro/resources/redirect_flow.rb +2 -2
  17. data/lib/gocardless_pro/resources/refund.rb +2 -2
  18. data/lib/gocardless_pro/resources/subscription.rb +2 -2
  19. data/lib/gocardless_pro/response.rb +2 -54
  20. data/lib/gocardless_pro/services/bank_details_lookups_service.rb +3 -0
  21. data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +31 -2
  22. data/lib/gocardless_pro/services/creditors_service.rb +21 -1
  23. data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +34 -2
  24. data/lib/gocardless_pro/services/customers_service.rb +21 -1
  25. data/lib/gocardless_pro/services/events_service.rb +5 -0
  26. data/lib/gocardless_pro/services/mandate_pdfs_service.rb +3 -0
  27. data/lib/gocardless_pro/services/mandates_service.rb +47 -3
  28. data/lib/gocardless_pro/services/payments_service.rb +47 -3
  29. data/lib/gocardless_pro/services/payouts_service.rb +5 -0
  30. data/lib/gocardless_pro/services/redirect_flows_service.rb +28 -2
  31. data/lib/gocardless_pro/services/refunds_service.rb +21 -1
  32. data/lib/gocardless_pro/services/subscriptions_service.rb +34 -2
  33. data/lib/gocardless_pro/version.rb +1 -1
  34. data/spec/api_service_spec.rb +106 -0
  35. data/spec/middlewares/raise_gocardless_errors_spec.rb +98 -0
  36. data/spec/resources/bank_details_lookup_spec.rb +102 -19
  37. data/spec/resources/creditor_bank_account_spec.rb +416 -40
  38. data/spec/resources/creditor_spec.rb +414 -53
  39. data/spec/resources/customer_bank_account_spec.rb +452 -40
  40. data/spec/resources/customer_spec.rb +457 -45
  41. data/spec/resources/event_spec.rb +171 -72
  42. data/spec/resources/mandate_pdf_spec.rb +100 -17
  43. data/spec/resources/mandate_spec.rb +501 -44
  44. data/spec/resources/payment_spec.rb +531 -48
  45. data/spec/resources/payout_spec.rb +189 -45
  46. data/spec/resources/redirect_flow_spec.rb +277 -43
  47. data/spec/resources/refund_spec.rb +349 -34
  48. data/spec/resources/subscription_spec.rb +531 -53
  49. data/spec/response_spec.rb +12 -79
  50. data/spec/services/bank_details_lookups_service_spec.rb +67 -2
  51. data/spec/services/creditor_bank_accounts_service_spec.rb +309 -31
  52. data/spec/services/creditors_service_spec.rb +343 -33
  53. data/spec/services/customer_bank_accounts_service_spec.rb +335 -32
  54. data/spec/services/customers_service_spec.rb +364 -36
  55. data/spec/services/events_service_spec.rb +185 -24
  56. data/spec/services/mandate_pdfs_service_spec.rb +66 -2
  57. data/spec/services/mandates_service_spec.rb +341 -33
  58. data/spec/services/payments_service_spec.rb +355 -35
  59. data/spec/services/payouts_service_spec.rb +206 -26
  60. data/spec/services/redirect_flows_service_spec.rb +137 -7
  61. data/spec/services/refunds_service_spec.rb +301 -27
  62. data/spec/services/subscriptions_service_spec.rb +377 -38
  63. metadata +6 -3
@@ -1,89 +1,501 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe GoCardlessPro::Resources::Customer do
4
- describe 'initialising' do
5
- let(:data) do
6
- {
4
+ let(:client) do
5
+ GoCardlessPro::Client.new(
6
+ access_token: 'SECRET_TOKEN'
7
+ )
8
+ end
7
9
 
8
- 'address_line1' => 'address_line1-input',
10
+ let(:response_headers) { { 'Content-Type' => 'application/json' } }
11
+
12
+ describe '#create' do
13
+ subject(:post_create_response) { client.customers.create(params: new_resource) }
14
+ context 'with a valid request' do
15
+ let(:new_resource) do
16
+ {
17
+
18
+ 'address_line1' => 'address_line1-input',
19
+ 'address_line2' => 'address_line2-input',
20
+ 'address_line3' => 'address_line3-input',
21
+ 'city' => 'city-input',
22
+ 'company_name' => 'company_name-input',
23
+ 'country_code' => 'country_code-input',
24
+ 'created_at' => 'created_at-input',
25
+ 'email' => 'email-input',
26
+ 'family_name' => 'family_name-input',
27
+ 'given_name' => 'given_name-input',
28
+ 'id' => 'id-input',
29
+ 'language' => 'language-input',
30
+ 'metadata' => 'metadata-input',
31
+ 'postal_code' => 'postal_code-input',
32
+ 'region' => 'region-input',
33
+ 'swedish_identity_number' => 'swedish_identity_number-input'
34
+ }
35
+ end
9
36
 
10
- 'address_line2' => 'address_line2-input',
37
+ before do
38
+ stub_request(:post, %r{.*api.gocardless.com/customers})
39
+ .with(
40
+ body: {
41
+ 'customers' => {
42
+
43
+ 'address_line1' => 'address_line1-input',
44
+ 'address_line2' => 'address_line2-input',
45
+ 'address_line3' => 'address_line3-input',
46
+ 'city' => 'city-input',
47
+ 'company_name' => 'company_name-input',
48
+ 'country_code' => 'country_code-input',
49
+ 'created_at' => 'created_at-input',
50
+ 'email' => 'email-input',
51
+ 'family_name' => 'family_name-input',
52
+ 'given_name' => 'given_name-input',
53
+ 'id' => 'id-input',
54
+ 'language' => 'language-input',
55
+ 'metadata' => 'metadata-input',
56
+ 'postal_code' => 'postal_code-input',
57
+ 'region' => 'region-input',
58
+ 'swedish_identity_number' => 'swedish_identity_number-input'
59
+ }
60
+ }
61
+ )
62
+ .to_return(
63
+ body: {
64
+ 'customers' =>
65
+
66
+ {
67
+
68
+ 'address_line1' => 'address_line1-input',
69
+ 'address_line2' => 'address_line2-input',
70
+ 'address_line3' => 'address_line3-input',
71
+ 'city' => 'city-input',
72
+ 'company_name' => 'company_name-input',
73
+ 'country_code' => 'country_code-input',
74
+ 'created_at' => 'created_at-input',
75
+ 'email' => 'email-input',
76
+ 'family_name' => 'family_name-input',
77
+ 'given_name' => 'given_name-input',
78
+ 'id' => 'id-input',
79
+ 'language' => 'language-input',
80
+ 'metadata' => 'metadata-input',
81
+ 'postal_code' => 'postal_code-input',
82
+ 'region' => 'region-input',
83
+ 'swedish_identity_number' => 'swedish_identity_number-input'
84
+ }
85
+
86
+ }.to_json,
87
+ headers: response_headers
88
+ )
89
+ end
11
90
 
12
- 'address_line3' => 'address_line3-input',
91
+ it 'creates and returns the resource' do
92
+ expect(post_create_response).to be_a(GoCardlessPro::Resources::Customer)
93
+ end
94
+ end
13
95
 
14
- 'city' => 'city-input',
96
+ context 'with a request that returns a validation error' do
97
+ let(:new_resource) { {} }
98
+
99
+ before do
100
+ stub_request(:post, %r{.*api.gocardless.com/customers}).to_return(
101
+ body: {
102
+ error: {
103
+ type: 'validation_failed',
104
+ code: 422,
105
+ errors: [
106
+ { message: 'test error message', field: 'test_field' }
107
+ ]
108
+ }
109
+ }.to_json,
110
+ headers: response_headers,
111
+ status: 422
112
+ )
113
+ end
15
114
 
16
- 'company_name' => 'company_name-input',
115
+ it 'throws the correct error' do
116
+ expect { post_create_response }.to raise_error(GoCardlessPro::ValidationError)
117
+ end
118
+ end
17
119
 
18
- 'country_code' => 'country_code-input',
120
+ context 'with a request that returns an idempotent creation conflict error' do
121
+ let(:id) { 'ID123' }
122
+
123
+ let(:new_resource) do
124
+ {
125
+
126
+ 'address_line1' => 'address_line1-input',
127
+ 'address_line2' => 'address_line2-input',
128
+ 'address_line3' => 'address_line3-input',
129
+ 'city' => 'city-input',
130
+ 'company_name' => 'company_name-input',
131
+ 'country_code' => 'country_code-input',
132
+ 'created_at' => 'created_at-input',
133
+ 'email' => 'email-input',
134
+ 'family_name' => 'family_name-input',
135
+ 'given_name' => 'given_name-input',
136
+ 'id' => 'id-input',
137
+ 'language' => 'language-input',
138
+ 'metadata' => 'metadata-input',
139
+ 'postal_code' => 'postal_code-input',
140
+ 'region' => 'region-input',
141
+ 'swedish_identity_number' => 'swedish_identity_number-input'
142
+ }
143
+ end
19
144
 
20
- 'created_at' => 'created_at-input',
145
+ let!(:post_stub) do
146
+ stub_request(:post, %r{.*api.gocardless.com/customers}).to_return(
147
+ body: {
148
+ error: {
149
+ type: 'invalid_state',
150
+ code: 409,
151
+ errors: [
152
+ {
153
+ message: 'A resource has already been created with this idempotency key',
154
+ reason: 'idempotent_creation_conflict',
155
+ links: {
156
+ conflicting_resource_id: id
157
+ }
158
+ }
159
+ ]
160
+ }
161
+ }.to_json,
162
+ headers: response_headers,
163
+ status: 409
164
+ )
165
+ end
21
166
 
22
- 'email' => 'email-input',
167
+ let!(:get_stub) do
168
+ stub_url = "/customers/#{id}"
169
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/)
170
+ .to_return(
171
+ body: {
172
+ 'customers' => {
173
+
174
+ 'address_line1' => 'address_line1-input',
175
+ 'address_line2' => 'address_line2-input',
176
+ 'address_line3' => 'address_line3-input',
177
+ 'city' => 'city-input',
178
+ 'company_name' => 'company_name-input',
179
+ 'country_code' => 'country_code-input',
180
+ 'created_at' => 'created_at-input',
181
+ 'email' => 'email-input',
182
+ 'family_name' => 'family_name-input',
183
+ 'given_name' => 'given_name-input',
184
+ 'id' => 'id-input',
185
+ 'language' => 'language-input',
186
+ 'metadata' => 'metadata-input',
187
+ 'postal_code' => 'postal_code-input',
188
+ 'region' => 'region-input',
189
+ 'swedish_identity_number' => 'swedish_identity_number-input'
190
+ }
191
+ }.to_json,
192
+ headers: response_headers
193
+ )
194
+ end
23
195
 
24
- 'family_name' => 'family_name-input',
196
+ it 'fetches the already-created resource' do
197
+ post_create_response
198
+ expect(post_stub).to have_been_requested
199
+ expect(get_stub).to have_been_requested
200
+ end
201
+ end
202
+ end
25
203
 
26
- 'given_name' => 'given_name-input',
204
+ describe '#list' do
205
+ describe 'with no filters' do
206
+ subject(:get_list_response) { client.customers.list }
207
+
208
+ before do
209
+ stub_request(:get, %r{.*api.gocardless.com/customers}).to_return(
210
+ body: {
211
+ 'customers' => [{
212
+
213
+ 'address_line1' => 'address_line1-input',
214
+ 'address_line2' => 'address_line2-input',
215
+ 'address_line3' => 'address_line3-input',
216
+ 'city' => 'city-input',
217
+ 'company_name' => 'company_name-input',
218
+ 'country_code' => 'country_code-input',
219
+ 'created_at' => 'created_at-input',
220
+ 'email' => 'email-input',
221
+ 'family_name' => 'family_name-input',
222
+ 'given_name' => 'given_name-input',
223
+ 'id' => 'id-input',
224
+ 'language' => 'language-input',
225
+ 'metadata' => 'metadata-input',
226
+ 'postal_code' => 'postal_code-input',
227
+ 'region' => 'region-input',
228
+ 'swedish_identity_number' => 'swedish_identity_number-input'
229
+ }],
230
+ meta: {
231
+ cursors: {
232
+ before: nil,
233
+ after: 'ABC123'
234
+ }
235
+ }
236
+ }.to_json,
237
+ headers: response_headers
238
+ )
239
+ end
27
240
 
28
- 'id' => 'id-input',
241
+ it 'wraps each item in the resource class' do
242
+ expect(get_list_response.records.map(&:class).uniq.first).to eq(GoCardlessPro::Resources::Customer)
29
243
 
30
- 'language' => 'language-input',
244
+ expect(get_list_response.records.first.address_line1).to eq('address_line1-input')
31
245
 
32
- 'metadata' => 'metadata-input',
246
+ expect(get_list_response.records.first.address_line2).to eq('address_line2-input')
33
247
 
34
- 'postal_code' => 'postal_code-input',
248
+ expect(get_list_response.records.first.address_line3).to eq('address_line3-input')
35
249
 
36
- 'region' => 'region-input',
250
+ expect(get_list_response.records.first.city).to eq('city-input')
37
251
 
38
- 'swedish_identity_number' => 'swedish_identity_number-input'
252
+ expect(get_list_response.records.first.company_name).to eq('company_name-input')
39
253
 
40
- }
41
- end
254
+ expect(get_list_response.records.first.country_code).to eq('country_code-input')
42
255
 
43
- it 'can be initialized from an unenveloped response' do
44
- resource = described_class.new(data)
256
+ expect(get_list_response.records.first.created_at).to eq('created_at-input')
45
257
 
46
- expect(resource.address_line1).to eq('address_line1-input')
258
+ expect(get_list_response.records.first.email).to eq('email-input')
47
259
 
48
- expect(resource.address_line2).to eq('address_line2-input')
260
+ expect(get_list_response.records.first.family_name).to eq('family_name-input')
49
261
 
50
- expect(resource.address_line3).to eq('address_line3-input')
262
+ expect(get_list_response.records.first.given_name).to eq('given_name-input')
51
263
 
52
- expect(resource.city).to eq('city-input')
264
+ expect(get_list_response.records.first.id).to eq('id-input')
53
265
 
54
- expect(resource.company_name).to eq('company_name-input')
266
+ expect(get_list_response.records.first.language).to eq('language-input')
55
267
 
56
- expect(resource.country_code).to eq('country_code-input')
268
+ expect(get_list_response.records.first.metadata).to eq('metadata-input')
57
269
 
58
- expect(resource.created_at).to eq('created_at-input')
270
+ expect(get_list_response.records.first.postal_code).to eq('postal_code-input')
59
271
 
60
- expect(resource.email).to eq('email-input')
272
+ expect(get_list_response.records.first.region).to eq('region-input')
61
273
 
62
- expect(resource.family_name).to eq('family_name-input')
274
+ expect(get_list_response.records.first.swedish_identity_number).to eq('swedish_identity_number-input')
275
+ end
63
276
 
64
- expect(resource.given_name).to eq('given_name-input')
277
+ it 'exposes the cursors for before and after' do
278
+ expect(get_list_response.before).to eq(nil)
279
+ expect(get_list_response.after).to eq('ABC123')
280
+ end
65
281
 
66
- expect(resource.id).to eq('id-input')
282
+ specify { expect(get_list_response.api_response.headers).to eql('content-type' => 'application/json') }
283
+ end
284
+ end
67
285
 
68
- expect(resource.language).to eq('language-input')
286
+ describe '#all' do
287
+ let!(:first_response_stub) do
288
+ stub_request(:get, %r{.*api.gocardless.com/customers$}).to_return(
289
+ body: {
290
+ 'customers' => [{
291
+
292
+ 'address_line1' => 'address_line1-input',
293
+ 'address_line2' => 'address_line2-input',
294
+ 'address_line3' => 'address_line3-input',
295
+ 'city' => 'city-input',
296
+ 'company_name' => 'company_name-input',
297
+ 'country_code' => 'country_code-input',
298
+ 'created_at' => 'created_at-input',
299
+ 'email' => 'email-input',
300
+ 'family_name' => 'family_name-input',
301
+ 'given_name' => 'given_name-input',
302
+ 'id' => 'id-input',
303
+ 'language' => 'language-input',
304
+ 'metadata' => 'metadata-input',
305
+ 'postal_code' => 'postal_code-input',
306
+ 'region' => 'region-input',
307
+ 'swedish_identity_number' => 'swedish_identity_number-input'
308
+ }],
309
+ meta: {
310
+ cursors: { after: 'AB345' },
311
+ limit: 1
312
+ }
313
+ }.to_json,
314
+ headers: response_headers
315
+ )
316
+ end
69
317
 
70
- expect(resource.metadata).to eq('metadata-input')
318
+ let!(:second_response_stub) do
319
+ stub_request(:get, %r{.*api.gocardless.com/customers\?after=AB345}).to_return(
320
+ body: {
321
+ 'customers' => [{
322
+
323
+ 'address_line1' => 'address_line1-input',
324
+ 'address_line2' => 'address_line2-input',
325
+ 'address_line3' => 'address_line3-input',
326
+ 'city' => 'city-input',
327
+ 'company_name' => 'company_name-input',
328
+ 'country_code' => 'country_code-input',
329
+ 'created_at' => 'created_at-input',
330
+ 'email' => 'email-input',
331
+ 'family_name' => 'family_name-input',
332
+ 'given_name' => 'given_name-input',
333
+ 'id' => 'id-input',
334
+ 'language' => 'language-input',
335
+ 'metadata' => 'metadata-input',
336
+ 'postal_code' => 'postal_code-input',
337
+ 'region' => 'region-input',
338
+ 'swedish_identity_number' => 'swedish_identity_number-input'
339
+ }],
340
+ meta: {
341
+ limit: 2,
342
+ cursors: {}
343
+ }
344
+ }.to_json,
345
+ headers: response_headers
346
+ )
347
+ end
71
348
 
72
- expect(resource.postal_code).to eq('postal_code-input')
349
+ it 'automatically makes the extra requests' do
350
+ expect(client.customers.all.to_a.length).to eq(2)
351
+ expect(first_response_stub).to have_been_requested
352
+ expect(second_response_stub).to have_been_requested
353
+ end
354
+ end
355
+
356
+ describe '#get' do
357
+ let(:id) { 'ID123' }
358
+
359
+ subject(:get_response) { client.customers.get(id) }
360
+
361
+ context 'passing in a custom header' do
362
+ let!(:stub) do
363
+ stub_url = '/customers/:identity'.gsub(':identity', id)
364
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/)
365
+ .with(headers: { 'Foo' => 'Bar' })
366
+ .to_return(
367
+ body: {
368
+ 'customers' => {
369
+
370
+ 'address_line1' => 'address_line1-input',
371
+ 'address_line2' => 'address_line2-input',
372
+ 'address_line3' => 'address_line3-input',
373
+ 'city' => 'city-input',
374
+ 'company_name' => 'company_name-input',
375
+ 'country_code' => 'country_code-input',
376
+ 'created_at' => 'created_at-input',
377
+ 'email' => 'email-input',
378
+ 'family_name' => 'family_name-input',
379
+ 'given_name' => 'given_name-input',
380
+ 'id' => 'id-input',
381
+ 'language' => 'language-input',
382
+ 'metadata' => 'metadata-input',
383
+ 'postal_code' => 'postal_code-input',
384
+ 'region' => 'region-input',
385
+ 'swedish_identity_number' => 'swedish_identity_number-input'
386
+ }
387
+ }.to_json,
388
+ headers: response_headers
389
+ )
390
+ end
73
391
 
74
- expect(resource.region).to eq('region-input')
392
+ subject(:get_response) do
393
+ client.customers.get(id, headers: {
394
+ 'Foo' => 'Bar'
395
+ })
396
+ end
75
397
 
76
- expect(resource.swedish_identity_number).to eq('swedish_identity_number-input')
398
+ it 'includes the header' do
399
+ get_response
400
+ expect(stub).to have_been_requested
401
+ end
77
402
  end
78
403
 
79
- it 'can handle new attributes without erroring' do
80
- data['foo'] = 'bar'
81
- expect { described_class.new(data) }.to_not raise_error
404
+ context 'when there is a customer to return' do
405
+ before do
406
+ stub_url = '/customers/:identity'.gsub(':identity', id)
407
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return(
408
+ body: {
409
+ 'customers' => {
410
+
411
+ 'address_line1' => 'address_line1-input',
412
+ 'address_line2' => 'address_line2-input',
413
+ 'address_line3' => 'address_line3-input',
414
+ 'city' => 'city-input',
415
+ 'company_name' => 'company_name-input',
416
+ 'country_code' => 'country_code-input',
417
+ 'created_at' => 'created_at-input',
418
+ 'email' => 'email-input',
419
+ 'family_name' => 'family_name-input',
420
+ 'given_name' => 'given_name-input',
421
+ 'id' => 'id-input',
422
+ 'language' => 'language-input',
423
+ 'metadata' => 'metadata-input',
424
+ 'postal_code' => 'postal_code-input',
425
+ 'region' => 'region-input',
426
+ 'swedish_identity_number' => 'swedish_identity_number-input'
427
+ }
428
+ }.to_json,
429
+ headers: response_headers
430
+ )
431
+ end
432
+
433
+ it 'wraps the response in a resource' do
434
+ expect(get_response).to be_a(GoCardlessPro::Resources::Customer)
435
+ end
82
436
  end
83
437
 
84
- describe '#to_h' do
85
- it 'returns a hash representing the resource' do
86
- expect(described_class.new(data).to_h).to eq(data)
438
+ context 'when nothing is returned' do
439
+ before do
440
+ stub_url = '/customers/:identity'.gsub(':identity', id)
441
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return(
442
+ body: '',
443
+ headers: response_headers
444
+ )
445
+ end
446
+
447
+ it 'returns nil' do
448
+ expect(get_response).to be_nil
449
+ end
450
+ end
451
+
452
+ context "when an ID is specified which can't be included in a valid URI" do
453
+ let(:id) { '`' }
454
+
455
+ it "doesn't raise an error" do
456
+ expect { get_response }.to_not raise_error(/bad URI/)
457
+ end
458
+ end
459
+ end
460
+
461
+ describe '#update' do
462
+ subject(:put_update_response) { client.customers.update(id, params: update_params) }
463
+ let(:id) { 'ABC123' }
464
+
465
+ context 'with a valid request' do
466
+ let(:update_params) { { 'hello' => 'world' } }
467
+
468
+ let!(:stub) do
469
+ stub_url = '/customers/:identity'.gsub(':identity', id)
470
+ stub_request(:put, /.*api.gocardless.com#{stub_url}/).to_return(
471
+ body: {
472
+ 'customers' => {
473
+
474
+ 'address_line1' => 'address_line1-input',
475
+ 'address_line2' => 'address_line2-input',
476
+ 'address_line3' => 'address_line3-input',
477
+ 'city' => 'city-input',
478
+ 'company_name' => 'company_name-input',
479
+ 'country_code' => 'country_code-input',
480
+ 'created_at' => 'created_at-input',
481
+ 'email' => 'email-input',
482
+ 'family_name' => 'family_name-input',
483
+ 'given_name' => 'given_name-input',
484
+ 'id' => 'id-input',
485
+ 'language' => 'language-input',
486
+ 'metadata' => 'metadata-input',
487
+ 'postal_code' => 'postal_code-input',
488
+ 'region' => 'region-input',
489
+ 'swedish_identity_number' => 'swedish_identity_number-input'
490
+ }
491
+ }.to_json,
492
+ headers: response_headers
493
+ )
494
+ end
495
+
496
+ it 'updates and returns the resource' do
497
+ expect(put_update_response).to be_a(GoCardlessPro::Resources::Customer)
498
+ expect(stub).to have_been_requested
87
499
  end
88
500
  end
89
501
  end