gocardless_pro 2.27.0 → 2.30.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +20 -1
  3. data/lib/gocardless_pro/api_service.rb +4 -0
  4. data/lib/gocardless_pro/client.rb +11 -1
  5. data/lib/gocardless_pro/error/authentication_error.rb +4 -0
  6. data/lib/gocardless_pro/error/permission_error.rb +4 -0
  7. data/lib/gocardless_pro/error/rate_limit_error.rb +4 -0
  8. data/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb +12 -1
  9. data/lib/gocardless_pro/resources/bank_authorisation.rb +3 -9
  10. data/lib/gocardless_pro/resources/billing_request.rb +31 -7
  11. data/lib/gocardless_pro/resources/billing_request_flow.rb +14 -0
  12. data/lib/gocardless_pro/resources/billing_request_template.rb +68 -0
  13. data/lib/gocardless_pro/resources/block.rb +76 -0
  14. data/lib/gocardless_pro/resources/event.rb +20 -0
  15. data/lib/gocardless_pro/resources/institution.rb +7 -1
  16. data/lib/gocardless_pro/resources/payer_authorisation.rb +9 -0
  17. data/lib/gocardless_pro/resources/redirect_flow.rb +6 -0
  18. data/lib/gocardless_pro/services/bank_authorisations_service.rb +0 -2
  19. data/lib/gocardless_pro/services/billing_request_flows_service.rb +23 -0
  20. data/lib/gocardless_pro/services/billing_request_templates_service.rb +131 -0
  21. data/lib/gocardless_pro/services/billing_requests_service.rb +89 -24
  22. data/lib/gocardless_pro/services/blocks_service.rb +223 -0
  23. data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +1 -5
  24. data/lib/gocardless_pro/services/creditors_service.rb +1 -3
  25. data/lib/gocardless_pro/services/currency_exchange_rates_service.rb +1 -1
  26. data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +1 -5
  27. data/lib/gocardless_pro/services/customers_service.rb +1 -3
  28. data/lib/gocardless_pro/services/events_service.rb +1 -1
  29. data/lib/gocardless_pro/services/instalment_schedules_service.rb +1 -7
  30. data/lib/gocardless_pro/services/institutions_service.rb +2 -2
  31. data/lib/gocardless_pro/services/mandate_import_entries_service.rb +1 -1
  32. data/lib/gocardless_pro/services/mandate_imports_service.rb +0 -6
  33. data/lib/gocardless_pro/services/mandates_service.rb +1 -7
  34. data/lib/gocardless_pro/services/payer_authorisations_service.rb +0 -6
  35. data/lib/gocardless_pro/services/payments_service.rb +1 -7
  36. data/lib/gocardless_pro/services/payout_items_service.rb +1 -1
  37. data/lib/gocardless_pro/services/payouts_service.rb +1 -1
  38. data/lib/gocardless_pro/services/redirect_flows_service.rb +0 -4
  39. data/lib/gocardless_pro/services/refunds_service.rb +1 -3
  40. data/lib/gocardless_pro/services/scenario_simulators_service.rb +28 -6
  41. data/lib/gocardless_pro/services/subscriptions_service.rb +3 -11
  42. data/lib/gocardless_pro/services/tax_rates_service.rb +1 -1
  43. data/lib/gocardless_pro/services/webhooks_service.rb +1 -3
  44. data/lib/gocardless_pro/version.rb +1 -1
  45. data/lib/gocardless_pro.rb +9 -0
  46. data/spec/api_service_spec.rb +12 -1
  47. data/spec/middlewares/raise_gocardless_errors_spec.rb +30 -0
  48. data/spec/resources/bank_authorisation_spec.rb +7 -7
  49. data/spec/resources/billing_request_flow_spec.rb +104 -0
  50. data/spec/resources/billing_request_spec.rb +183 -29
  51. data/spec/resources/billing_request_template_spec.rb +502 -0
  52. data/spec/resources/block_spec.rb +577 -0
  53. data/spec/resources/creditor_bank_account_spec.rb +2 -0
  54. data/spec/resources/customer_bank_account_spec.rb +2 -0
  55. data/spec/resources/customer_notification_spec.rb +2 -0
  56. data/spec/resources/customer_spec.rb +2 -0
  57. data/spec/resources/instalment_schedule_spec.rb +2 -0
  58. data/spec/resources/institution_spec.rb +5 -0
  59. data/spec/resources/mandate_import_spec.rb +4 -0
  60. data/spec/resources/mandate_spec.rb +4 -0
  61. data/spec/resources/payer_authorisation_spec.rb +4 -0
  62. data/spec/resources/payment_spec.rb +4 -0
  63. data/spec/resources/redirect_flow_spec.rb +11 -0
  64. data/spec/resources/scenario_simulator_spec.rb +2 -0
  65. data/spec/resources/subscription_spec.rb +6 -0
  66. data/spec/resources/webhook_spec.rb +2 -0
  67. data/spec/services/bank_authorisations_service_spec.rb +7 -20
  68. data/spec/services/billing_request_flows_service_spec.rb +115 -0
  69. data/spec/services/billing_request_templates_service_spec.rb +789 -0
  70. data/spec/services/billing_requests_service_spec.rb +210 -47
  71. data/spec/services/blocks_service_spec.rb +840 -0
  72. data/spec/services/creditor_bank_accounts_service_spec.rb +2 -13
  73. data/spec/services/creditors_service_spec.rb +0 -13
  74. data/spec/services/customer_bank_accounts_service_spec.rb +2 -13
  75. data/spec/services/customer_notifications_service_spec.rb +2 -0
  76. data/spec/services/customers_service_spec.rb +2 -13
  77. data/spec/services/instalment_schedules_service_spec.rb +2 -26
  78. data/spec/services/institutions_service_spec.rb +9 -0
  79. data/spec/services/mandate_imports_service_spec.rb +4 -13
  80. data/spec/services/mandates_service_spec.rb +4 -13
  81. data/spec/services/payer_authorisations_service_spec.rb +4 -13
  82. data/spec/services/payments_service_spec.rb +4 -13
  83. data/spec/services/redirect_flows_service_spec.rb +11 -13
  84. data/spec/services/refunds_service_spec.rb +0 -13
  85. data/spec/services/scenario_simulators_service_spec.rb +2 -0
  86. data/spec/services/subscriptions_service_spec.rb +6 -13
  87. data/spec/services/webhooks_service_spec.rb +2 -0
  88. metadata +18 -3
@@ -212,19 +212,6 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
212
212
  to raise_error(GoCardlessPro::IdempotencyConflict)
213
213
  end
214
214
  end
215
-
216
- context 'with on_idempotency_conflict: :unknown' do
217
- let(:client) do
218
- GoCardlessPro::Client.new(
219
- access_token: 'SECRET_TOKEN',
220
- on_idempotency_conflict: :unknown
221
- )
222
- end
223
-
224
- it 'raises an ArgumentError' do
225
- expect { post_create_response }.to raise_error(ArgumentError)
226
- end
227
- end
228
215
  end
229
216
  end
230
217
 
@@ -660,6 +647,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
660
647
  # /creditor_bank_accounts/%v/actions/disable
661
648
  stub_url = '/creditor_bank_accounts/:identity/actions/disable'.gsub(':identity', resource_id)
662
649
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
650
+
663
651
  body: {
664
652
  'creditor_bank_accounts' => {
665
653
 
@@ -676,6 +664,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
676
664
  'metadata' => 'metadata-input',
677
665
  },
678
666
  }.to_json,
667
+
679
668
  headers: response_headers
680
669
  )
681
670
  end
@@ -252,19 +252,6 @@ describe GoCardlessPro::Services::CreditorsService do
252
252
  to raise_error(GoCardlessPro::IdempotencyConflict)
253
253
  end
254
254
  end
255
-
256
- context 'with on_idempotency_conflict: :unknown' do
257
- let(:client) do
258
- GoCardlessPro::Client.new(
259
- access_token: 'SECRET_TOKEN',
260
- on_idempotency_conflict: :unknown
261
- )
262
- end
263
-
264
- it 'raises an ArgumentError' do
265
- expect { post_create_response }.to raise_error(ArgumentError)
266
- end
267
- end
268
255
  end
269
256
  end
270
257
 
@@ -212,19 +212,6 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
212
212
  to raise_error(GoCardlessPro::IdempotencyConflict)
213
213
  end
214
214
  end
215
-
216
- context 'with on_idempotency_conflict: :unknown' do
217
- let(:client) do
218
- GoCardlessPro::Client.new(
219
- access_token: 'SECRET_TOKEN',
220
- on_idempotency_conflict: :unknown
221
- )
222
- end
223
-
224
- it 'raises an ArgumentError' do
225
- expect { post_create_response }.to raise_error(ArgumentError)
226
- end
227
- end
228
215
  end
229
216
  end
230
217
 
@@ -722,6 +709,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
722
709
  # /customer_bank_accounts/%v/actions/disable
723
710
  stub_url = '/customer_bank_accounts/:identity/actions/disable'.gsub(':identity', resource_id)
724
711
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
712
+
725
713
  body: {
726
714
  'customer_bank_accounts' => {
727
715
 
@@ -738,6 +726,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
738
726
  'metadata' => 'metadata-input',
739
727
  },
740
728
  }.to_json,
729
+
741
730
  headers: response_headers
742
731
  )
743
732
  end
@@ -18,6 +18,7 @@ describe GoCardlessPro::Services::CustomerNotificationsService do
18
18
  # /customer_notifications/%v/actions/handle
19
19
  stub_url = '/customer_notifications/:identity/actions/handle'.gsub(':identity', resource_id)
20
20
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
21
+
21
22
  body: {
22
23
  'customer_notifications' => {
23
24
 
@@ -29,6 +30,7 @@ describe GoCardlessPro::Services::CustomerNotificationsService do
29
30
  'type' => 'type-input',
30
31
  },
31
32
  }.to_json,
33
+
32
34
  headers: response_headers
33
35
  )
34
36
  end
@@ -247,19 +247,6 @@ describe GoCardlessPro::Services::CustomersService do
247
247
  to raise_error(GoCardlessPro::IdempotencyConflict)
248
248
  end
249
249
  end
250
-
251
- context 'with on_idempotency_conflict: :unknown' do
252
- let(:client) do
253
- GoCardlessPro::Client.new(
254
- access_token: 'SECRET_TOKEN',
255
- on_idempotency_conflict: :unknown
256
- )
257
- end
258
-
259
- it 'raises an ArgumentError' do
260
- expect { post_create_response }.to raise_error(ArgumentError)
261
- end
262
- end
263
250
  end
264
251
  end
265
252
 
@@ -843,6 +830,7 @@ describe GoCardlessPro::Services::CustomersService do
843
830
  # /customers/%v
844
831
  stub_url = '/customers/:identity'.gsub(':identity', resource_id)
845
832
  stub_request(:delete, /.*api.gocardless.com#{stub_url}/).to_return(
833
+
846
834
  body: {
847
835
  'customers' => {
848
836
 
@@ -866,6 +854,7 @@ describe GoCardlessPro::Services::CustomersService do
866
854
  'swedish_identity_number' => 'swedish_identity_number-input',
867
855
  },
868
856
  }.to_json,
857
+
869
858
  headers: response_headers
870
859
  )
871
860
  end
@@ -202,19 +202,6 @@ describe GoCardlessPro::Services::InstalmentSchedulesService do
202
202
  to raise_error(GoCardlessPro::IdempotencyConflict)
203
203
  end
204
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
205
  end
219
206
  end
220
207
 
@@ -411,19 +398,6 @@ describe GoCardlessPro::Services::InstalmentSchedulesService do
411
398
  to raise_error(GoCardlessPro::IdempotencyConflict)
412
399
  end
413
400
  end
414
-
415
- context 'with on_idempotency_conflict: :unknown' do
416
- let(:client) do
417
- GoCardlessPro::Client.new(
418
- access_token: 'SECRET_TOKEN',
419
- on_idempotency_conflict: :unknown
420
- )
421
- end
422
-
423
- it 'raises an ArgumentError' do
424
- expect { post_create_response }.to raise_error(ArgumentError)
425
- end
426
- end
427
401
  end
428
402
  end
429
403
 
@@ -897,6 +871,7 @@ describe GoCardlessPro::Services::InstalmentSchedulesService do
897
871
  # /instalment_schedules/%v/actions/cancel
898
872
  stub_url = '/instalment_schedules/:identity/actions/cancel'.gsub(':identity', resource_id)
899
873
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
874
+
900
875
  body: {
901
876
  'instalment_schedules' => {
902
877
 
@@ -911,6 +886,7 @@ describe GoCardlessPro::Services::InstalmentSchedulesService do
911
886
  'total_amount' => 'total_amount-input',
912
887
  },
913
888
  }.to_json,
889
+
914
890
  headers: response_headers
915
891
  )
916
892
  end
@@ -17,6 +17,7 @@ describe GoCardlessPro::Services::InstitutionsService do
17
17
  {
18
18
  'institutions' => [{
19
19
 
20
+ 'country_code' => 'country_code-input',
20
21
  'icon_url' => 'icon_url-input',
21
22
  'id' => 'id-input',
22
23
  'logo_url' => 'logo_url-input',
@@ -41,6 +42,8 @@ describe GoCardlessPro::Services::InstitutionsService do
41
42
  it 'wraps each item in the resource class' do
42
43
  expect(get_list_response.records.map(&:class).uniq.first).to eq(GoCardlessPro::Resources::Institution)
43
44
 
45
+ expect(get_list_response.records.first.country_code).to eq('country_code-input')
46
+
44
47
  expect(get_list_response.records.first.icon_url).to eq('icon_url-input')
45
48
 
46
49
  expect(get_list_response.records.first.id).to eq('id-input')
@@ -88,6 +91,7 @@ describe GoCardlessPro::Services::InstitutionsService do
88
91
  body: {
89
92
  'institutions' => [{
90
93
 
94
+ 'country_code' => 'country_code-input',
91
95
  'icon_url' => 'icon_url-input',
92
96
  'id' => 'id-input',
93
97
  'logo_url' => 'logo_url-input',
@@ -107,6 +111,7 @@ describe GoCardlessPro::Services::InstitutionsService do
107
111
  body: {
108
112
  'institutions' => [{
109
113
 
114
+ 'country_code' => 'country_code-input',
110
115
  'icon_url' => 'icon_url-input',
111
116
  'id' => 'id-input',
112
117
  'logo_url' => 'logo_url-input',
@@ -135,6 +140,7 @@ describe GoCardlessPro::Services::InstitutionsService do
135
140
  body: {
136
141
  'institutions' => [{
137
142
 
143
+ 'country_code' => 'country_code-input',
138
144
  'icon_url' => 'icon_url-input',
139
145
  'id' => 'id-input',
140
146
  'logo_url' => 'logo_url-input',
@@ -154,6 +160,7 @@ describe GoCardlessPro::Services::InstitutionsService do
154
160
  body: {
155
161
  'institutions' => [{
156
162
 
163
+ 'country_code' => 'country_code-input',
157
164
  'icon_url' => 'icon_url-input',
158
165
  'id' => 'id-input',
159
166
  'logo_url' => 'logo_url-input',
@@ -178,6 +185,7 @@ describe GoCardlessPro::Services::InstitutionsService do
178
185
  body: {
179
186
  'institutions' => [{
180
187
 
188
+ 'country_code' => 'country_code-input',
181
189
  'icon_url' => 'icon_url-input',
182
190
  'id' => 'id-input',
183
191
  'logo_url' => 'logo_url-input',
@@ -200,6 +208,7 @@ describe GoCardlessPro::Services::InstitutionsService do
200
208
  body: {
201
209
  'institutions' => [{
202
210
 
211
+ 'country_code' => 'country_code-input',
203
212
  'icon_url' => 'icon_url-input',
204
213
  'id' => 'id-input',
205
214
  'logo_url' => 'logo_url-input',
@@ -177,19 +177,6 @@ describe GoCardlessPro::Services::MandateImportsService do
177
177
  to raise_error(GoCardlessPro::IdempotencyConflict)
178
178
  end
179
179
  end
180
-
181
- context 'with on_idempotency_conflict: :unknown' do
182
- let(:client) do
183
- GoCardlessPro::Client.new(
184
- access_token: 'SECRET_TOKEN',
185
- on_idempotency_conflict: :unknown
186
- )
187
- end
188
-
189
- it 'raises an ArgumentError' do
190
- expect { post_create_response }.to raise_error(ArgumentError)
191
- end
192
- end
193
180
  end
194
181
  end
195
182
 
@@ -338,6 +325,7 @@ describe GoCardlessPro::Services::MandateImportsService do
338
325
  # /mandate_imports/%v/actions/submit
339
326
  stub_url = '/mandate_imports/:identity/actions/submit'.gsub(':identity', resource_id)
340
327
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
328
+
341
329
  body: {
342
330
  'mandate_imports' => {
343
331
 
@@ -347,6 +335,7 @@ describe GoCardlessPro::Services::MandateImportsService do
347
335
  'status' => 'status-input',
348
336
  },
349
337
  }.to_json,
338
+
350
339
  headers: response_headers
351
340
  )
352
341
  end
@@ -407,6 +396,7 @@ describe GoCardlessPro::Services::MandateImportsService do
407
396
  # /mandate_imports/%v/actions/cancel
408
397
  stub_url = '/mandate_imports/:identity/actions/cancel'.gsub(':identity', resource_id)
409
398
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
399
+
410
400
  body: {
411
401
  'mandate_imports' => {
412
402
 
@@ -416,6 +406,7 @@ describe GoCardlessPro::Services::MandateImportsService do
416
406
  'status' => 'status-input',
417
407
  },
418
408
  }.to_json,
409
+
419
410
  headers: response_headers
420
411
  )
421
412
  end
@@ -202,19 +202,6 @@ describe GoCardlessPro::Services::MandatesService do
202
202
  to raise_error(GoCardlessPro::IdempotencyConflict)
203
203
  end
204
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
205
  end
219
206
  end
220
207
 
@@ -688,6 +675,7 @@ describe GoCardlessPro::Services::MandatesService do
688
675
  # /mandates/%v/actions/cancel
689
676
  stub_url = '/mandates/:identity/actions/cancel'.gsub(':identity', resource_id)
690
677
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
678
+
691
679
  body: {
692
680
  'mandates' => {
693
681
 
@@ -702,6 +690,7 @@ describe GoCardlessPro::Services::MandatesService do
702
690
  'status' => 'status-input',
703
691
  },
704
692
  }.to_json,
693
+
705
694
  headers: response_headers
706
695
  )
707
696
  end
@@ -767,6 +756,7 @@ describe GoCardlessPro::Services::MandatesService do
767
756
  # /mandates/%v/actions/reinstate
768
757
  stub_url = '/mandates/:identity/actions/reinstate'.gsub(':identity', resource_id)
769
758
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
759
+
770
760
  body: {
771
761
  'mandates' => {
772
762
 
@@ -781,6 +771,7 @@ describe GoCardlessPro::Services::MandatesService do
781
771
  'status' => 'status-input',
782
772
  },
783
773
  }.to_json,
774
+
784
775
  headers: response_headers
785
776
  )
786
777
  end
@@ -341,19 +341,6 @@ describe GoCardlessPro::Services::PayerAuthorisationsService do
341
341
  to raise_error(GoCardlessPro::IdempotencyConflict)
342
342
  end
343
343
  end
344
-
345
- context 'with on_idempotency_conflict: :unknown' do
346
- let(:client) do
347
- GoCardlessPro::Client.new(
348
- access_token: 'SECRET_TOKEN',
349
- on_idempotency_conflict: :unknown
350
- )
351
- end
352
-
353
- it 'raises an ArgumentError' do
354
- expect { post_create_response }.to raise_error(ArgumentError)
355
- end
356
- end
357
344
  end
358
345
  end
359
346
 
@@ -425,6 +412,7 @@ describe GoCardlessPro::Services::PayerAuthorisationsService do
425
412
  # /payer_authorisations/%v/actions/submit
426
413
  stub_url = '/payer_authorisations/:identity/actions/submit'.gsub(':identity', resource_id)
427
414
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
415
+
428
416
  body: {
429
417
  'payer_authorisations' => {
430
418
 
@@ -438,6 +426,7 @@ describe GoCardlessPro::Services::PayerAuthorisationsService do
438
426
  'status' => 'status-input',
439
427
  },
440
428
  }.to_json,
429
+
441
430
  headers: response_headers
442
431
  )
443
432
  end
@@ -502,6 +491,7 @@ describe GoCardlessPro::Services::PayerAuthorisationsService do
502
491
  # /payer_authorisations/%v/actions/confirm
503
492
  stub_url = '/payer_authorisations/:identity/actions/confirm'.gsub(':identity', resource_id)
504
493
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
494
+
505
495
  body: {
506
496
  'payer_authorisations' => {
507
497
 
@@ -515,6 +505,7 @@ describe GoCardlessPro::Services::PayerAuthorisationsService do
515
505
  'status' => 'status-input',
516
506
  },
517
507
  }.to_json,
508
+
518
509
  headers: response_headers
519
510
  )
520
511
  end
@@ -222,19 +222,6 @@ describe GoCardlessPro::Services::PaymentsService do
222
222
  to raise_error(GoCardlessPro::IdempotencyConflict)
223
223
  end
224
224
  end
225
-
226
- context 'with on_idempotency_conflict: :unknown' do
227
- let(:client) do
228
- GoCardlessPro::Client.new(
229
- access_token: 'SECRET_TOKEN',
230
- on_idempotency_conflict: :unknown
231
- )
232
- end
233
-
234
- it 'raises an ArgumentError' do
235
- expect { post_create_response }.to raise_error(ArgumentError)
236
- end
237
- end
238
225
  end
239
226
  end
240
227
 
@@ -756,6 +743,7 @@ describe GoCardlessPro::Services::PaymentsService do
756
743
  # /payments/%v/actions/cancel
757
744
  stub_url = '/payments/:identity/actions/cancel'.gsub(':identity', resource_id)
758
745
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
746
+
759
747
  body: {
760
748
  'payments' => {
761
749
 
@@ -774,6 +762,7 @@ describe GoCardlessPro::Services::PaymentsService do
774
762
  'status' => 'status-input',
775
763
  },
776
764
  }.to_json,
765
+
777
766
  headers: response_headers
778
767
  )
779
768
  end
@@ -843,6 +832,7 @@ describe GoCardlessPro::Services::PaymentsService do
843
832
  # /payments/%v/actions/retry
844
833
  stub_url = '/payments/:identity/actions/retry'.gsub(':identity', resource_id)
845
834
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
835
+
846
836
  body: {
847
837
  'payments' => {
848
838
 
@@ -861,6 +851,7 @@ describe GoCardlessPro::Services::PaymentsService do
861
851
  'status' => 'status-input',
862
852
  },
863
853
  }.to_json,
854
+
864
855
  headers: response_headers
865
856
  )
866
857
  end
@@ -20,6 +20,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
20
20
  'description' => 'description-input',
21
21
  'id' => 'id-input',
22
22
  'links' => 'links-input',
23
+ 'mandate_reference' => 'mandate_reference-input',
23
24
  'metadata' => 'metadata-input',
24
25
  'redirect_url' => 'redirect_url-input',
25
26
  'scheme' => 'scheme-input',
@@ -39,6 +40,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
39
40
  'description' => 'description-input',
40
41
  'id' => 'id-input',
41
42
  'links' => 'links-input',
43
+ 'mandate_reference' => 'mandate_reference-input',
42
44
  'metadata' => 'metadata-input',
43
45
  'redirect_url' => 'redirect_url-input',
44
46
  'scheme' => 'scheme-input',
@@ -58,6 +60,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
58
60
  'description' => 'description-input',
59
61
  'id' => 'id-input',
60
62
  'links' => 'links-input',
63
+ 'mandate_reference' => 'mandate_reference-input',
61
64
  'metadata' => 'metadata-input',
62
65
  'redirect_url' => 'redirect_url-input',
63
66
  'scheme' => 'scheme-input',
@@ -133,6 +136,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
133
136
  'description' => 'description-input',
134
137
  'id' => 'id-input',
135
138
  'links' => 'links-input',
139
+ 'mandate_reference' => 'mandate_reference-input',
136
140
  'metadata' => 'metadata-input',
137
141
  'redirect_url' => 'redirect_url-input',
138
142
  'scheme' => 'scheme-input',
@@ -175,6 +179,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
175
179
  'description' => 'description-input',
176
180
  'id' => 'id-input',
177
181
  'links' => 'links-input',
182
+ 'mandate_reference' => 'mandate_reference-input',
178
183
  'metadata' => 'metadata-input',
179
184
  'redirect_url' => 'redirect_url-input',
180
185
  'scheme' => 'scheme-input',
@@ -207,19 +212,6 @@ describe GoCardlessPro::Services::RedirectFlowsService do
207
212
  to raise_error(GoCardlessPro::IdempotencyConflict)
208
213
  end
209
214
  end
210
-
211
- context 'with on_idempotency_conflict: :unknown' do
212
- let(:client) do
213
- GoCardlessPro::Client.new(
214
- access_token: 'SECRET_TOKEN',
215
- on_idempotency_conflict: :unknown
216
- )
217
- end
218
-
219
- it 'raises an ArgumentError' do
220
- expect { post_create_response }.to raise_error(ArgumentError)
221
- end
222
- end
223
215
  end
224
216
  end
225
217
 
@@ -242,6 +234,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
242
234
  'description' => 'description-input',
243
235
  'id' => 'id-input',
244
236
  'links' => 'links-input',
237
+ 'mandate_reference' => 'mandate_reference-input',
245
238
  'metadata' => 'metadata-input',
246
239
  'redirect_url' => 'redirect_url-input',
247
240
  'scheme' => 'scheme-input',
@@ -277,6 +270,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
277
270
  'description' => 'description-input',
278
271
  'id' => 'id-input',
279
272
  'links' => 'links-input',
273
+ 'mandate_reference' => 'mandate_reference-input',
280
274
  'metadata' => 'metadata-input',
281
275
  'redirect_url' => 'redirect_url-input',
282
276
  'scheme' => 'scheme-input',
@@ -380,6 +374,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
380
374
  # /redirect_flows/%v/actions/complete
381
375
  stub_url = '/redirect_flows/:identity/actions/complete'.gsub(':identity', resource_id)
382
376
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
377
+
383
378
  body: {
384
379
  'redirect_flows' => {
385
380
 
@@ -388,6 +383,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
388
383
  'description' => 'description-input',
389
384
  'id' => 'id-input',
390
385
  'links' => 'links-input',
386
+ 'mandate_reference' => 'mandate_reference-input',
391
387
  'metadata' => 'metadata-input',
392
388
  'redirect_url' => 'redirect_url-input',
393
389
  'scheme' => 'scheme-input',
@@ -395,6 +391,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
395
391
  'success_redirect_url' => 'success_redirect_url-input',
396
392
  },
397
393
  }.to_json,
394
+
398
395
  headers: response_headers
399
396
  )
400
397
  end
@@ -439,6 +436,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
439
436
  'description' => 'description-input',
440
437
  'id' => 'id-input',
441
438
  'links' => 'links-input',
439
+ 'mandate_reference' => 'mandate_reference-input',
442
440
  'metadata' => 'metadata-input',
443
441
  'redirect_url' => 'redirect_url-input',
444
442
  'scheme' => 'scheme-input',
@@ -202,19 +202,6 @@ describe GoCardlessPro::Services::RefundsService do
202
202
  to raise_error(GoCardlessPro::IdempotencyConflict)
203
203
  end
204
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
205
  end
219
206
  end
220
207
 
@@ -18,12 +18,14 @@ describe GoCardlessPro::Services::ScenarioSimulatorsService do
18
18
  # /scenario_simulators/%v/actions/run
19
19
  stub_url = '/scenario_simulators/:identity/actions/run'.gsub(':identity', resource_id)
20
20
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
21
+
21
22
  body: {
22
23
  'scenario_simulators' => {
23
24
 
24
25
  'id' => 'id-input',
25
26
  },
26
27
  }.to_json,
28
+
27
29
  headers: response_headers
28
30
  )
29
31
  end
@@ -257,19 +257,6 @@ describe GoCardlessPro::Services::SubscriptionsService do
257
257
  to raise_error(GoCardlessPro::IdempotencyConflict)
258
258
  end
259
259
  end
260
-
261
- context 'with on_idempotency_conflict: :unknown' do
262
- let(:client) do
263
- GoCardlessPro::Client.new(
264
- access_token: 'SECRET_TOKEN',
265
- on_idempotency_conflict: :unknown
266
- )
267
- end
268
-
269
- it 'raises an ArgumentError' do
270
- expect { post_create_response }.to raise_error(ArgumentError)
271
- end
272
- end
273
260
  end
274
261
  end
275
262
 
@@ -875,6 +862,7 @@ describe GoCardlessPro::Services::SubscriptionsService do
875
862
  # /subscriptions/%v/actions/pause
876
863
  stub_url = '/subscriptions/:identity/actions/pause'.gsub(':identity', resource_id)
877
864
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
865
+
878
866
  body: {
879
867
  'subscriptions' => {
880
868
 
@@ -900,6 +888,7 @@ describe GoCardlessPro::Services::SubscriptionsService do
900
888
  'upcoming_payments' => 'upcoming_payments-input',
901
889
  },
902
890
  }.to_json,
891
+
903
892
  headers: response_headers
904
893
  )
905
894
  end
@@ -976,6 +965,7 @@ describe GoCardlessPro::Services::SubscriptionsService do
976
965
  # /subscriptions/%v/actions/resume
977
966
  stub_url = '/subscriptions/:identity/actions/resume'.gsub(':identity', resource_id)
978
967
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
968
+
979
969
  body: {
980
970
  'subscriptions' => {
981
971
 
@@ -1001,6 +991,7 @@ describe GoCardlessPro::Services::SubscriptionsService do
1001
991
  'upcoming_payments' => 'upcoming_payments-input',
1002
992
  },
1003
993
  }.to_json,
994
+
1004
995
  headers: response_headers
1005
996
  )
1006
997
  end
@@ -1077,6 +1068,7 @@ describe GoCardlessPro::Services::SubscriptionsService do
1077
1068
  # /subscriptions/%v/actions/cancel
1078
1069
  stub_url = '/subscriptions/:identity/actions/cancel'.gsub(':identity', resource_id)
1079
1070
  stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
1071
+
1080
1072
  body: {
1081
1073
  'subscriptions' => {
1082
1074
 
@@ -1102,6 +1094,7 @@ describe GoCardlessPro::Services::SubscriptionsService do
1102
1094
  'upcoming_payments' => 'upcoming_payments-input',
1103
1095
  },
1104
1096
  }.to_json,
1097
+
1105
1098
  headers: response_headers
1106
1099
  )
1107
1100
  end