gocardless_pro 2.15.1 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,700 @@
1
+ require 'spec_helper'
2
+
3
+ describe GoCardlessPro::Services::InstalmentSchedulesService do
4
+ let(:client) do
5
+ GoCardlessPro::Client.new(
6
+ access_token: 'SECRET_TOKEN'
7
+ )
8
+ end
9
+
10
+ let(:response_headers) { { 'Content-Type' => 'application/json' } }
11
+
12
+ describe '#create' do
13
+ subject(:post_create_response) { client.instalment_schedules.create(params: new_resource) }
14
+ context 'with a valid request' do
15
+ let(:new_resource) do
16
+ {
17
+
18
+ 'created_at' => 'created_at-input',
19
+ 'currency' => 'currency-input',
20
+ 'id' => 'id-input',
21
+ 'links' => 'links-input',
22
+ 'metadata' => 'metadata-input',
23
+ 'name' => 'name-input',
24
+ 'payment_errors' => 'payment_errors-input',
25
+ 'status' => 'status-input',
26
+ 'total_amount' => 'total_amount-input',
27
+ }
28
+ end
29
+
30
+ before do
31
+ stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).
32
+ with(
33
+ body: {
34
+ 'instalment_schedules' => {
35
+
36
+ 'created_at' => 'created_at-input',
37
+ 'currency' => 'currency-input',
38
+ 'id' => 'id-input',
39
+ 'links' => 'links-input',
40
+ 'metadata' => 'metadata-input',
41
+ 'name' => 'name-input',
42
+ 'payment_errors' => 'payment_errors-input',
43
+ 'status' => 'status-input',
44
+ 'total_amount' => 'total_amount-input',
45
+ },
46
+ }
47
+ ).
48
+ to_return(
49
+ body: {
50
+ 'instalment_schedules' =>
51
+
52
+ {
53
+
54
+ 'created_at' => 'created_at-input',
55
+ 'currency' => 'currency-input',
56
+ 'id' => 'id-input',
57
+ 'links' => 'links-input',
58
+ 'metadata' => 'metadata-input',
59
+ 'name' => 'name-input',
60
+ 'payment_errors' => 'payment_errors-input',
61
+ 'status' => 'status-input',
62
+ 'total_amount' => 'total_amount-input',
63
+ },
64
+
65
+ }.to_json,
66
+ headers: response_headers
67
+ )
68
+ end
69
+
70
+ it 'creates and returns the resource' do
71
+ expect(post_create_response).to be_a(GoCardlessPro::Resources::InstalmentSchedule)
72
+ end
73
+
74
+ describe 'retry behaviour' do
75
+ before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
76
+
77
+ it 'retries timeouts' do
78
+ stub = stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).
79
+ to_timeout.then.to_return(status: 200, headers: response_headers)
80
+
81
+ post_create_response
82
+ expect(stub).to have_been_requested.twice
83
+ end
84
+
85
+ it 'retries 5XX errors' do
86
+ stub = stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).
87
+ to_return(status: 502,
88
+ headers: { 'Content-Type' => 'text/html' },
89
+ body: '<html><body>Response from Cloudflare</body></html>').
90
+ then.to_return(status: 200, headers: response_headers)
91
+
92
+ post_create_response
93
+ expect(stub).to have_been_requested.twice
94
+ end
95
+ end
96
+ end
97
+
98
+ context 'with a request that returns a validation error' do
99
+ let(:new_resource) { {} }
100
+
101
+ before do
102
+ stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).to_return(
103
+ body: {
104
+ error: {
105
+ type: 'validation_failed',
106
+ code: 422,
107
+ errors: [
108
+ { message: 'test error message', field: 'test_field' },
109
+ ],
110
+ },
111
+ }.to_json,
112
+ headers: response_headers,
113
+ status: 422
114
+ )
115
+ end
116
+
117
+ it 'throws the correct error' do
118
+ expect { post_create_response }.to raise_error(GoCardlessPro::ValidationError)
119
+ end
120
+ end
121
+
122
+ context 'with a request that returns an idempotent creation conflict error' do
123
+ let(:id) { 'ID123' }
124
+
125
+ let(:new_resource) do
126
+ {
127
+
128
+ 'created_at' => 'created_at-input',
129
+ 'currency' => 'currency-input',
130
+ 'id' => 'id-input',
131
+ 'links' => 'links-input',
132
+ 'metadata' => 'metadata-input',
133
+ 'name' => 'name-input',
134
+ 'payment_errors' => 'payment_errors-input',
135
+ 'status' => 'status-input',
136
+ 'total_amount' => 'total_amount-input',
137
+ }
138
+ end
139
+
140
+ let!(:post_stub) do
141
+ stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).to_return(
142
+ body: {
143
+ error: {
144
+ type: 'invalid_state',
145
+ code: 409,
146
+ errors: [
147
+ {
148
+ message: 'A resource has already been created with this idempotency key',
149
+ reason: 'idempotent_creation_conflict',
150
+ links: {
151
+ conflicting_resource_id: id,
152
+ },
153
+ },
154
+ ],
155
+ },
156
+ }.to_json,
157
+ headers: response_headers,
158
+ status: 409
159
+ )
160
+ end
161
+
162
+ let!(:get_stub) do
163
+ stub_url = "/instalment_schedules/#{id}"
164
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
165
+ to_return(
166
+ body: {
167
+ 'instalment_schedules' => {
168
+
169
+ 'created_at' => 'created_at-input',
170
+ 'currency' => 'currency-input',
171
+ 'id' => 'id-input',
172
+ 'links' => 'links-input',
173
+ 'metadata' => 'metadata-input',
174
+ 'name' => 'name-input',
175
+ 'payment_errors' => 'payment_errors-input',
176
+ 'status' => 'status-input',
177
+ 'total_amount' => 'total_amount-input',
178
+ },
179
+ }.to_json,
180
+ headers: response_headers
181
+ )
182
+ end
183
+
184
+ context 'with default behaviour' do
185
+ it 'fetches the already-created resource' do
186
+ post_create_response
187
+ expect(post_stub).to have_been_requested
188
+ expect(get_stub).to have_been_requested
189
+ end
190
+ end
191
+
192
+ context 'with on_idempotency_conflict: :raise' do
193
+ let(:client) do
194
+ GoCardlessPro::Client.new(
195
+ access_token: 'SECRET_TOKEN',
196
+ on_idempotency_conflict: :raise
197
+ )
198
+ end
199
+
200
+ it 'raises an IdempotencyConflict error' do
201
+ expect { post_create_response }.
202
+ to raise_error(GoCardlessPro::IdempotencyConflict)
203
+ end
204
+ end
205
+
206
+ context 'with on_idempotency_conflict: :unknown' do
207
+ let(:client) do
208
+ GoCardlessPro::Client.new(
209
+ access_token: 'SECRET_TOKEN',
210
+ on_idempotency_conflict: :unknown
211
+ )
212
+ end
213
+
214
+ it 'raises an ArgumentError' do
215
+ expect { post_create_response }.to raise_error(ArgumentError)
216
+ end
217
+ end
218
+ end
219
+ end
220
+
221
+ describe '#list' do
222
+ describe 'with no filters' do
223
+ subject(:get_list_response) { client.instalment_schedules.list }
224
+
225
+ let(:body) do
226
+ {
227
+ 'instalment_schedules' => [{
228
+
229
+ 'created_at' => 'created_at-input',
230
+ 'currency' => 'currency-input',
231
+ 'id' => 'id-input',
232
+ 'links' => 'links-input',
233
+ 'metadata' => 'metadata-input',
234
+ 'name' => 'name-input',
235
+ 'payment_errors' => 'payment_errors-input',
236
+ 'status' => 'status-input',
237
+ 'total_amount' => 'total_amount-input',
238
+ }],
239
+ meta: {
240
+ cursors: {
241
+ before: nil,
242
+ after: 'ABC123',
243
+ },
244
+ },
245
+ }.to_json
246
+ end
247
+
248
+ before do
249
+ stub_request(:get, %r{.*api.gocardless.com/instalment_schedules}).to_return(
250
+ body: body,
251
+ headers: response_headers
252
+ )
253
+ end
254
+
255
+ it 'wraps each item in the resource class' do
256
+ expect(get_list_response.records.map(&:class).uniq.first).to eq(GoCardlessPro::Resources::InstalmentSchedule)
257
+
258
+ expect(get_list_response.records.first.created_at).to eq('created_at-input')
259
+
260
+ expect(get_list_response.records.first.currency).to eq('currency-input')
261
+
262
+ expect(get_list_response.records.first.id).to eq('id-input')
263
+
264
+ expect(get_list_response.records.first.metadata).to eq('metadata-input')
265
+
266
+ expect(get_list_response.records.first.name).to eq('name-input')
267
+
268
+ expect(get_list_response.records.first.payment_errors).to eq('payment_errors-input')
269
+
270
+ expect(get_list_response.records.first.status).to eq('status-input')
271
+
272
+ expect(get_list_response.records.first.total_amount).to eq('total_amount-input')
273
+ end
274
+
275
+ it 'exposes the cursors for before and after' do
276
+ expect(get_list_response.before).to eq(nil)
277
+ expect(get_list_response.after).to eq('ABC123')
278
+ end
279
+
280
+ specify { expect(get_list_response.api_response.headers).to eql('content-type' => 'application/json') }
281
+
282
+ describe 'retry behaviour' do
283
+ before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
284
+
285
+ it 'retries timeouts' do
286
+ stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules}).
287
+ to_timeout.then.to_return(status: 200, headers: response_headers, body: body)
288
+
289
+ get_list_response
290
+ expect(stub).to have_been_requested.twice
291
+ end
292
+
293
+ it 'retries 5XX errors' do
294
+ stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules}).
295
+ to_return(status: 502,
296
+ headers: { 'Content-Type' => 'text/html' },
297
+ body: '<html><body>Response from Cloudflare</body></html>').
298
+ then.to_return(status: 200, headers: response_headers, body: body)
299
+
300
+ get_list_response
301
+ expect(stub).to have_been_requested.twice
302
+ end
303
+ end
304
+ end
305
+ end
306
+
307
+ describe '#all' do
308
+ let!(:first_response_stub) do
309
+ stub_request(:get, %r{.*api.gocardless.com/instalment_schedules$}).to_return(
310
+ body: {
311
+ 'instalment_schedules' => [{
312
+
313
+ 'created_at' => 'created_at-input',
314
+ 'currency' => 'currency-input',
315
+ 'id' => 'id-input',
316
+ 'links' => 'links-input',
317
+ 'metadata' => 'metadata-input',
318
+ 'name' => 'name-input',
319
+ 'payment_errors' => 'payment_errors-input',
320
+ 'status' => 'status-input',
321
+ 'total_amount' => 'total_amount-input',
322
+ }],
323
+ meta: {
324
+ cursors: { after: 'AB345' },
325
+ limit: 1,
326
+ },
327
+ }.to_json,
328
+ headers: response_headers
329
+ )
330
+ end
331
+
332
+ let!(:second_response_stub) do
333
+ stub_request(:get, %r{.*api.gocardless.com/instalment_schedules\?after=AB345}).to_return(
334
+ body: {
335
+ 'instalment_schedules' => [{
336
+
337
+ 'created_at' => 'created_at-input',
338
+ 'currency' => 'currency-input',
339
+ 'id' => 'id-input',
340
+ 'links' => 'links-input',
341
+ 'metadata' => 'metadata-input',
342
+ 'name' => 'name-input',
343
+ 'payment_errors' => 'payment_errors-input',
344
+ 'status' => 'status-input',
345
+ 'total_amount' => 'total_amount-input',
346
+ }],
347
+ meta: {
348
+ limit: 2,
349
+ cursors: {},
350
+ },
351
+ }.to_json,
352
+ headers: response_headers
353
+ )
354
+ end
355
+
356
+ it 'automatically makes the extra requests' do
357
+ expect(client.instalment_schedules.all.to_a.length).to eq(2)
358
+ expect(first_response_stub).to have_been_requested
359
+ expect(second_response_stub).to have_been_requested
360
+ end
361
+
362
+ describe 'retry behaviour' do
363
+ before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
364
+
365
+ it 'retries timeouts' do
366
+ first_response_stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules$}).to_return(
367
+ body: {
368
+ 'instalment_schedules' => [{
369
+
370
+ 'created_at' => 'created_at-input',
371
+ 'currency' => 'currency-input',
372
+ 'id' => 'id-input',
373
+ 'links' => 'links-input',
374
+ 'metadata' => 'metadata-input',
375
+ 'name' => 'name-input',
376
+ 'payment_errors' => 'payment_errors-input',
377
+ 'status' => 'status-input',
378
+ 'total_amount' => 'total_amount-input',
379
+ }],
380
+ meta: {
381
+ cursors: { after: 'AB345' },
382
+ limit: 1,
383
+ },
384
+ }.to_json,
385
+ headers: response_headers
386
+ )
387
+
388
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules\?after=AB345}).
389
+ to_timeout.then.
390
+ to_return(
391
+ body: {
392
+ 'instalment_schedules' => [{
393
+
394
+ 'created_at' => 'created_at-input',
395
+ 'currency' => 'currency-input',
396
+ 'id' => 'id-input',
397
+ 'links' => 'links-input',
398
+ 'metadata' => 'metadata-input',
399
+ 'name' => 'name-input',
400
+ 'payment_errors' => 'payment_errors-input',
401
+ 'status' => 'status-input',
402
+ 'total_amount' => 'total_amount-input',
403
+ }],
404
+ meta: {
405
+ limit: 2,
406
+ cursors: {},
407
+ },
408
+ }.to_json,
409
+ headers: response_headers
410
+ )
411
+
412
+ client.instalment_schedules.all.to_a
413
+
414
+ expect(first_response_stub).to have_been_requested
415
+ expect(second_response_stub).to have_been_requested.twice
416
+ end
417
+
418
+ it 'retries 5XX errors' do
419
+ first_response_stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules$}).to_return(
420
+ body: {
421
+ 'instalment_schedules' => [{
422
+
423
+ 'created_at' => 'created_at-input',
424
+ 'currency' => 'currency-input',
425
+ 'id' => 'id-input',
426
+ 'links' => 'links-input',
427
+ 'metadata' => 'metadata-input',
428
+ 'name' => 'name-input',
429
+ 'payment_errors' => 'payment_errors-input',
430
+ 'status' => 'status-input',
431
+ 'total_amount' => 'total_amount-input',
432
+ }],
433
+ meta: {
434
+ cursors: { after: 'AB345' },
435
+ limit: 1,
436
+ },
437
+ }.to_json,
438
+ headers: response_headers
439
+ )
440
+
441
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules\?after=AB345}).
442
+ to_return(
443
+ status: 502,
444
+ body: '<html><body>Response from Cloudflare</body></html>',
445
+ headers: { 'Content-Type' => 'text/html' }
446
+ ).then.to_return(
447
+ body: {
448
+ 'instalment_schedules' => [{
449
+
450
+ 'created_at' => 'created_at-input',
451
+ 'currency' => 'currency-input',
452
+ 'id' => 'id-input',
453
+ 'links' => 'links-input',
454
+ 'metadata' => 'metadata-input',
455
+ 'name' => 'name-input',
456
+ 'payment_errors' => 'payment_errors-input',
457
+ 'status' => 'status-input',
458
+ 'total_amount' => 'total_amount-input',
459
+ }],
460
+ meta: {
461
+ limit: 2,
462
+ cursors: {},
463
+ },
464
+ }.to_json,
465
+ headers: response_headers
466
+ )
467
+
468
+ client.instalment_schedules.all.to_a
469
+
470
+ expect(first_response_stub).to have_been_requested
471
+ expect(second_response_stub).to have_been_requested.twice
472
+ end
473
+ end
474
+ end
475
+
476
+ describe '#get' do
477
+ let(:id) { 'ID123' }
478
+
479
+ subject(:get_response) { client.instalment_schedules.get(id) }
480
+
481
+ context 'passing in a custom header' do
482
+ let!(:stub) do
483
+ stub_url = '/instalment_schedules/:identity'.gsub(':identity', id)
484
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
485
+ with(headers: { 'Foo' => 'Bar' }).
486
+ to_return(
487
+ body: {
488
+ 'instalment_schedules' => {
489
+
490
+ 'created_at' => 'created_at-input',
491
+ 'currency' => 'currency-input',
492
+ 'id' => 'id-input',
493
+ 'links' => 'links-input',
494
+ 'metadata' => 'metadata-input',
495
+ 'name' => 'name-input',
496
+ 'payment_errors' => 'payment_errors-input',
497
+ 'status' => 'status-input',
498
+ 'total_amount' => 'total_amount-input',
499
+ },
500
+ }.to_json,
501
+ headers: response_headers
502
+ )
503
+ end
504
+
505
+ subject(:get_response) do
506
+ client.instalment_schedules.get(id, headers: {
507
+ 'Foo' => 'Bar',
508
+ })
509
+ end
510
+
511
+ it 'includes the header' do
512
+ get_response
513
+ expect(stub).to have_been_requested
514
+ end
515
+ end
516
+
517
+ context 'when there is a instalment_schedule to return' do
518
+ before do
519
+ stub_url = '/instalment_schedules/:identity'.gsub(':identity', id)
520
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return(
521
+ body: {
522
+ 'instalment_schedules' => {
523
+
524
+ 'created_at' => 'created_at-input',
525
+ 'currency' => 'currency-input',
526
+ 'id' => 'id-input',
527
+ 'links' => 'links-input',
528
+ 'metadata' => 'metadata-input',
529
+ 'name' => 'name-input',
530
+ 'payment_errors' => 'payment_errors-input',
531
+ 'status' => 'status-input',
532
+ 'total_amount' => 'total_amount-input',
533
+ },
534
+ }.to_json,
535
+ headers: response_headers
536
+ )
537
+ end
538
+
539
+ it 'wraps the response in a resource' do
540
+ expect(get_response).to be_a(GoCardlessPro::Resources::InstalmentSchedule)
541
+ end
542
+ end
543
+
544
+ context 'when nothing is returned' do
545
+ before do
546
+ stub_url = '/instalment_schedules/:identity'.gsub(':identity', id)
547
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return(
548
+ body: '',
549
+ headers: response_headers
550
+ )
551
+ end
552
+
553
+ it 'returns nil' do
554
+ expect(get_response).to be_nil
555
+ end
556
+ end
557
+
558
+ context "when an ID is specified which can't be included in a valid URI" do
559
+ let(:id) { '`' }
560
+
561
+ it "doesn't raise an error" do
562
+ expect { get_response }.to_not raise_error(/bad URI/)
563
+ end
564
+ end
565
+
566
+ describe 'retry behaviour' do
567
+ before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
568
+
569
+ it 'retries timeouts' do
570
+ stub_url = '/instalment_schedules/:identity'.gsub(':identity', id)
571
+
572
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
573
+ to_timeout.then.to_return(status: 200, headers: response_headers)
574
+
575
+ get_response
576
+ expect(stub).to have_been_requested.twice
577
+ end
578
+
579
+ it 'retries 5XX errors, other than 500s' do
580
+ stub_url = '/instalment_schedules/:identity'.gsub(':identity', id)
581
+
582
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
583
+ to_return(status: 502,
584
+ headers: { 'Content-Type' => 'text/html' },
585
+ body: '<html><body>Response from Cloudflare</body></html>').
586
+ then.to_return(status: 200, headers: response_headers)
587
+
588
+ get_response
589
+ expect(stub).to have_been_requested.twice
590
+ end
591
+
592
+ it 'retries 500 errors returned by the API' do
593
+ stub_url = '/instalment_schedules/:identity'.gsub(':identity', id)
594
+
595
+ gocardless_error = {
596
+ 'error' => {
597
+ 'message' => 'Internal server error',
598
+ 'documentation_url' => 'https://developer.gocardless.com/#gocardless',
599
+ 'errors' => [{
600
+ 'message' => 'Internal server error',
601
+ 'reason' => 'internal_server_error',
602
+ }],
603
+ 'type' => 'gocardless',
604
+ 'code' => 500,
605
+ 'request_id' => 'dummy_request_id',
606
+ 'id' => 'dummy_exception_id',
607
+ },
608
+ }
609
+
610
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
611
+ to_return(status: 500,
612
+ headers: response_headers,
613
+ body: gocardless_error.to_json).
614
+ then.to_return(status: 200, headers: response_headers)
615
+
616
+ get_response
617
+ expect(stub).to have_been_requested.twice
618
+ end
619
+ end
620
+ end
621
+
622
+ describe '#cancel' do
623
+ subject(:post_response) { client.instalment_schedules.cancel(resource_id) }
624
+
625
+ let(:resource_id) { 'ABC123' }
626
+
627
+ let!(:stub) do
628
+ # /instalment_schedules/%v/actions/cancel
629
+ stub_url = '/instalment_schedules/:identity/actions/cancel'.gsub(':identity', resource_id)
630
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
631
+ body: {
632
+ 'instalment_schedules' => {
633
+
634
+ 'created_at' => 'created_at-input',
635
+ 'currency' => 'currency-input',
636
+ 'id' => 'id-input',
637
+ 'links' => 'links-input',
638
+ 'metadata' => 'metadata-input',
639
+ 'name' => 'name-input',
640
+ 'payment_errors' => 'payment_errors-input',
641
+ 'status' => 'status-input',
642
+ 'total_amount' => 'total_amount-input',
643
+ },
644
+ }.to_json,
645
+ headers: response_headers
646
+ )
647
+ end
648
+
649
+ it 'wraps the response and calls the right endpoint' do
650
+ expect(post_response).to be_a(GoCardlessPro::Resources::InstalmentSchedule)
651
+
652
+ expect(stub).to have_been_requested
653
+ end
654
+
655
+ describe 'retry behaviour' do
656
+ it "doesn't retry errors" do
657
+ stub_url = '/instalment_schedules/:identity/actions/cancel'.gsub(':identity', resource_id)
658
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
659
+ to_timeout
660
+
661
+ expect { post_response }.to raise_error(Faraday::TimeoutError)
662
+ expect(stub).to have_been_requested
663
+ end
664
+ end
665
+
666
+ context 'when the request needs a body and custom header' do
667
+ let(:body) { { foo: 'bar' } }
668
+ let(:headers) { { 'Foo' => 'Bar' } }
669
+ subject(:post_response) { client.instalment_schedules.cancel(resource_id, body, headers) }
670
+
671
+ let(:resource_id) { 'ABC123' }
672
+
673
+ let!(:stub) do
674
+ # /instalment_schedules/%v/actions/cancel
675
+ stub_url = '/instalment_schedules/:identity/actions/cancel'.gsub(':identity', resource_id)
676
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
677
+ with(
678
+ body: { foo: 'bar' },
679
+ headers: { 'Foo' => 'Bar' }
680
+ ).to_return(
681
+ body: {
682
+ 'instalment_schedules' => {
683
+
684
+ 'created_at' => 'created_at-input',
685
+ 'currency' => 'currency-input',
686
+ 'id' => 'id-input',
687
+ 'links' => 'links-input',
688
+ 'metadata' => 'metadata-input',
689
+ 'name' => 'name-input',
690
+ 'payment_errors' => 'payment_errors-input',
691
+ 'status' => 'status-input',
692
+ 'total_amount' => 'total_amount-input',
693
+ },
694
+ }.to_json,
695
+ headers: response_headers
696
+ )
697
+ end
698
+ end
699
+ end
700
+ end