gocardless_pro 4.2.0 → 4.4.1
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/README.md +16 -12
- data/lib/gocardless_pro/client.rb +33 -3
- data/lib/gocardless_pro/error.rb +3 -3
- data/lib/gocardless_pro/list_response.rb +2 -2
- data/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb +11 -3
- data/lib/gocardless_pro/paginator.rb +3 -2
- data/lib/gocardless_pro/resources/balance.rb +4 -1
- data/lib/gocardless_pro/resources/bank_account_detail.rb +5 -1
- data/lib/gocardless_pro/resources/bank_account_holder_verification.rb +44 -0
- data/lib/gocardless_pro/resources/bank_authorisation.rb +9 -2
- data/lib/gocardless_pro/resources/bank_details_lookup.rb +3 -1
- data/lib/gocardless_pro/resources/billing_request.rb +24 -10
- data/lib/gocardless_pro/resources/billing_request_flow.rb +18 -2
- data/lib/gocardless_pro/resources/billing_request_template.rb +18 -2
- data/lib/gocardless_pro/resources/billing_request_with_action.rb +6 -5
- data/lib/gocardless_pro/resources/block.rb +12 -8
- data/lib/gocardless_pro/resources/creditor.rb +26 -6
- data/lib/gocardless_pro/resources/creditor_bank_account.rb +17 -7
- data/lib/gocardless_pro/resources/currency_exchange_rate.rb +4 -1
- data/lib/gocardless_pro/resources/customer.rb +22 -5
- data/lib/gocardless_pro/resources/customer_bank_account.rb +24 -10
- data/lib/gocardless_pro/resources/customer_notification.rb +8 -5
- data/lib/gocardless_pro/resources/event.rb +31 -4
- data/lib/gocardless_pro/resources/export.rb +7 -1
- data/lib/gocardless_pro/resources/funds_availability.rb +38 -0
- data/lib/gocardless_pro/resources/instalment_schedule.rb +8 -2
- data/lib/gocardless_pro/resources/institution.rb +11 -4
- data/lib/gocardless_pro/resources/logo.rb +2 -1
- data/lib/gocardless_pro/resources/mandate.rb +21 -6
- data/lib/gocardless_pro/resources/mandate_import.rb +29 -22
- data/lib/gocardless_pro/resources/mandate_import_entry.rb +16 -17
- data/lib/gocardless_pro/resources/mandate_pdf.rb +5 -4
- data/lib/gocardless_pro/resources/negative_balance_limit.rb +4 -2
- data/lib/gocardless_pro/resources/outbound_payment.rb +33 -12
- data/lib/gocardless_pro/resources/outbound_payment_import.rb +81 -0
- data/lib/gocardless_pro/resources/outbound_payment_import_entry.rb +77 -0
- data/lib/gocardless_pro/resources/payer_authorisation.rb +34 -32
- data/lib/gocardless_pro/resources/payment.rb +24 -8
- data/lib/gocardless_pro/resources/payment_account.rb +64 -0
- data/lib/gocardless_pro/resources/payment_account_transaction.rb +79 -0
- data/lib/gocardless_pro/resources/payout.rb +19 -8
- data/lib/gocardless_pro/resources/payout_item.rb +4 -3
- data/lib/gocardless_pro/resources/redirect_flow.rb +44 -25
- data/lib/gocardless_pro/resources/refund.rb +16 -7
- data/lib/gocardless_pro/resources/scheme_identifier.rb +18 -3
- data/lib/gocardless_pro/resources/subscription.rb +37 -16
- data/lib/gocardless_pro/resources/tax_rate.rb +8 -3
- data/lib/gocardless_pro/resources/transferred_mandate.rb +3 -1
- data/lib/gocardless_pro/resources/verification_detail.rb +19 -8
- data/lib/gocardless_pro/resources/webhook.rb +13 -2
- data/lib/gocardless_pro/services/balances_service.rb +11 -3
- data/lib/gocardless_pro/services/bank_account_details_service.rb +14 -3
- data/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb +92 -0
- data/lib/gocardless_pro/services/bank_authorisations_service.rb +9 -3
- data/lib/gocardless_pro/services/bank_details_lookups_service.rb +14 -6
- data/lib/gocardless_pro/services/billing_request_flows_service.rb +8 -2
- data/lib/gocardless_pro/services/billing_request_templates_service.rb +14 -7
- data/lib/gocardless_pro/services/billing_request_with_actions_service.rb +7 -1
- data/lib/gocardless_pro/services/billing_requests_service.rb +38 -33
- data/lib/gocardless_pro/services/blocks_service.rb +17 -10
- data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +14 -7
- data/lib/gocardless_pro/services/creditors_service.rb +13 -6
- data/lib/gocardless_pro/services/currency_exchange_rates_service.rb +10 -3
- data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +25 -15
- data/lib/gocardless_pro/services/customer_notifications_service.rb +8 -3
- data/lib/gocardless_pro/services/customers_service.rb +15 -9
- data/lib/gocardless_pro/services/events_service.rb +16 -4
- data/lib/gocardless_pro/services/exports_service.rb +8 -2
- data/lib/gocardless_pro/services/funds_availabilities_service.rb +56 -0
- data/lib/gocardless_pro/services/instalment_schedules_service.rb +21 -13
- data/lib/gocardless_pro/services/institutions_service.rb +8 -2
- data/lib/gocardless_pro/services/logos_service.rb +9 -3
- data/lib/gocardless_pro/services/mandate_import_entries_service.rb +10 -4
- data/lib/gocardless_pro/services/mandate_imports_service.rb +16 -8
- data/lib/gocardless_pro/services/mandate_pdfs_service.rb +11 -5
- data/lib/gocardless_pro/services/mandates_service.rb +23 -16
- data/lib/gocardless_pro/services/negative_balance_limits_service.rb +10 -3
- data/lib/gocardless_pro/services/outbound_payment_import_entries_service.rb +64 -0
- data/lib/gocardless_pro/services/outbound_payment_imports_service.rb +118 -0
- data/lib/gocardless_pro/services/outbound_payments_service.rb +34 -12
- data/lib/gocardless_pro/services/payer_authorisations_service.rb +18 -15
- data/lib/gocardless_pro/services/payer_themes_service.rb +7 -1
- data/lib/gocardless_pro/services/payment_account_transactions_service.rb +93 -0
- data/lib/gocardless_pro/services/payment_accounts_service.rb +83 -0
- data/lib/gocardless_pro/services/payments_service.rb +29 -21
- data/lib/gocardless_pro/services/payout_items_service.rb +12 -7
- data/lib/gocardless_pro/services/payouts_service.rb +14 -7
- data/lib/gocardless_pro/services/redirect_flows_service.rb +19 -9
- data/lib/gocardless_pro/services/refunds_service.rb +18 -13
- data/lib/gocardless_pro/services/scenario_simulators_service.rb +90 -81
- data/lib/gocardless_pro/services/scheme_identifiers_service.rb +15 -9
- data/lib/gocardless_pro/services/subscriptions_service.rb +57 -47
- data/lib/gocardless_pro/services/tax_rates_service.rb +11 -4
- data/lib/gocardless_pro/services/transferred_mandates_service.rb +8 -2
- data/lib/gocardless_pro/services/verification_details_service.rb +7 -1
- data/lib/gocardless_pro/services/webhooks_service.rb +13 -6
- data/lib/gocardless_pro/version.rb +1 -1
- data/lib/gocardless_pro/webhook.rb +45 -0
- data/lib/gocardless_pro.rb +18 -0
- metadata +38 -16
|
@@ -10,9 +10,8 @@ module GoCardlessPro
|
|
|
10
10
|
module Services
|
|
11
11
|
# Service for making requests to the BillingRequest endpoints
|
|
12
12
|
class BillingRequestsService < BaseService
|
|
13
|
-
#
|
|
14
|
-
# `
|
|
15
|
-
# for ACH and PAD schemes.</p>
|
|
13
|
+
# Important: All properties associated with `subscription_request` and
|
|
14
|
+
# `instalment_schedule_request` are only supported for ACH and PAD schemes.
|
|
16
15
|
# Example URL: /billing_requests
|
|
17
16
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
18
17
|
def create(options = {})
|
|
@@ -33,7 +32,7 @@ module GoCardlessPro
|
|
|
33
32
|
if e.idempotent_creation_conflict?
|
|
34
33
|
case @api_service.on_idempotency_conflict
|
|
35
34
|
when :raise
|
|
36
|
-
raise IdempotencyConflict
|
|
35
|
+
raise IdempotencyConflict.new(e.error)
|
|
37
36
|
when :fetch
|
|
38
37
|
return get(e.conflicting_resource_id)
|
|
39
38
|
end
|
|
@@ -47,7 +46,7 @@ module GoCardlessPro
|
|
|
47
46
|
Resources::BillingRequest.new(unenvelope_body(response.body), response)
|
|
48
47
|
end
|
|
49
48
|
|
|
50
|
-
# If the billing request has a pending
|
|
49
|
+
# If the billing request has a pending collect_customer_details
|
|
51
50
|
# action, this endpoint can be used to collect the details in order to
|
|
52
51
|
# complete it.
|
|
53
52
|
#
|
|
@@ -63,7 +62,7 @@ module GoCardlessPro
|
|
|
63
62
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
64
63
|
def collect_customer_details(identity, options = {})
|
|
65
64
|
path = sub_url('/billing_requests/:identity/actions/collect_customer_details', {
|
|
66
|
-
'identity' => identity
|
|
65
|
+
'identity' => identity,
|
|
67
66
|
})
|
|
68
67
|
|
|
69
68
|
params = options.delete(:params) || {}
|
|
@@ -81,7 +80,7 @@ module GoCardlessPro
|
|
|
81
80
|
if e.idempotent_creation_conflict?
|
|
82
81
|
case @api_service.on_idempotency_conflict
|
|
83
82
|
when :raise
|
|
84
|
-
raise IdempotencyConflict
|
|
83
|
+
raise IdempotencyConflict.new(e.error)
|
|
85
84
|
when :fetch
|
|
86
85
|
return get(e.conflicting_resource_id)
|
|
87
86
|
end
|
|
@@ -96,7 +95,7 @@ module GoCardlessPro
|
|
|
96
95
|
end
|
|
97
96
|
|
|
98
97
|
# If the billing request has a pending
|
|
99
|
-
#
|
|
98
|
+
# collect_bank_account action, this endpoint can be
|
|
100
99
|
# used to collect the details in order to complete it.
|
|
101
100
|
#
|
|
102
101
|
# The endpoint takes the same payload as Customer Bank Accounts, but check
|
|
@@ -107,14 +106,14 @@ module GoCardlessPro
|
|
|
107
106
|
# the payload along with the
|
|
108
107
|
# country_code.
|
|
109
108
|
#
|
|
110
|
-
#
|
|
109
|
+
# ACH scheme For compliance reasons, an extra validation step is done using
|
|
111
110
|
# a third-party provider to make sure the customer's bank account can accept
|
|
112
111
|
# Direct Debit. If a bank account is discovered to be closed or invalid, the
|
|
113
112
|
# customer is requested to adjust the account number/routing number and
|
|
114
113
|
# succeed in this check to continue with the flow.
|
|
115
114
|
#
|
|
116
|
-
#
|
|
117
|
-
#
|
|
115
|
+
# BACS scheme Payer Name Verification
|
|
116
|
+
# (https://hub.gocardless.com/s/article/Introduction-to-Payer-Name-Verification?language=en_GB)
|
|
118
117
|
# is enabled by default for UK based bank accounts, meaning we verify the
|
|
119
118
|
# account holder name and bank account
|
|
120
119
|
# number match the details held by the relevant bank.
|
|
@@ -124,7 +123,7 @@ module GoCardlessPro
|
|
|
124
123
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
125
124
|
def collect_bank_account(identity, options = {})
|
|
126
125
|
path = sub_url('/billing_requests/:identity/actions/collect_bank_account', {
|
|
127
|
-
'identity' => identity
|
|
126
|
+
'identity' => identity,
|
|
128
127
|
})
|
|
129
128
|
|
|
130
129
|
params = options.delete(:params) || {}
|
|
@@ -142,7 +141,7 @@ module GoCardlessPro
|
|
|
142
141
|
if e.idempotent_creation_conflict?
|
|
143
142
|
case @api_service.on_idempotency_conflict
|
|
144
143
|
when :raise
|
|
145
|
-
raise IdempotencyConflict
|
|
144
|
+
raise IdempotencyConflict.new(e.error)
|
|
146
145
|
when :fetch
|
|
147
146
|
return get(e.conflicting_resource_id)
|
|
148
147
|
end
|
|
@@ -165,7 +164,7 @@ module GoCardlessPro
|
|
|
165
164
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
166
165
|
def confirm_payer_details(identity, options = {})
|
|
167
166
|
path = sub_url('/billing_requests/:identity/actions/confirm_payer_details', {
|
|
168
|
-
'identity' => identity
|
|
167
|
+
'identity' => identity,
|
|
169
168
|
})
|
|
170
169
|
|
|
171
170
|
params = options.delete(:params) || {}
|
|
@@ -183,7 +182,7 @@ module GoCardlessPro
|
|
|
183
182
|
if e.idempotent_creation_conflict?
|
|
184
183
|
case @api_service.on_idempotency_conflict
|
|
185
184
|
when :raise
|
|
186
|
-
raise IdempotencyConflict
|
|
185
|
+
raise IdempotencyConflict.new(e.error)
|
|
187
186
|
when :fetch
|
|
188
187
|
return get(e.conflicting_resource_id)
|
|
189
188
|
end
|
|
@@ -205,7 +204,7 @@ module GoCardlessPro
|
|
|
205
204
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
206
205
|
def fulfil(identity, options = {})
|
|
207
206
|
path = sub_url('/billing_requests/:identity/actions/fulfil', {
|
|
208
|
-
'identity' => identity
|
|
207
|
+
'identity' => identity,
|
|
209
208
|
})
|
|
210
209
|
|
|
211
210
|
params = options.delete(:params) || {}
|
|
@@ -223,7 +222,7 @@ module GoCardlessPro
|
|
|
223
222
|
if e.idempotent_creation_conflict?
|
|
224
223
|
case @api_service.on_idempotency_conflict
|
|
225
224
|
when :raise
|
|
226
|
-
raise IdempotencyConflict
|
|
225
|
+
raise IdempotencyConflict.new(e.error)
|
|
227
226
|
when :fetch
|
|
228
227
|
return get(e.conflicting_resource_id)
|
|
229
228
|
end
|
|
@@ -245,7 +244,7 @@ module GoCardlessPro
|
|
|
245
244
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
246
245
|
def cancel(identity, options = {})
|
|
247
246
|
path = sub_url('/billing_requests/:identity/actions/cancel', {
|
|
248
|
-
'identity' => identity
|
|
247
|
+
'identity' => identity,
|
|
249
248
|
})
|
|
250
249
|
|
|
251
250
|
params = options.delete(:params) || {}
|
|
@@ -263,7 +262,7 @@ module GoCardlessPro
|
|
|
263
262
|
if e.idempotent_creation_conflict?
|
|
264
263
|
case @api_service.on_idempotency_conflict
|
|
265
264
|
when :raise
|
|
266
|
-
raise IdempotencyConflict
|
|
265
|
+
raise IdempotencyConflict.new(e.error)
|
|
267
266
|
when :fetch
|
|
268
267
|
return get(e.conflicting_resource_id)
|
|
269
268
|
end
|
|
@@ -277,8 +276,9 @@ module GoCardlessPro
|
|
|
277
276
|
Resources::BillingRequest.new(unenvelope_body(response.body), response)
|
|
278
277
|
end
|
|
279
278
|
|
|
280
|
-
# Returns a
|
|
281
|
-
#
|
|
279
|
+
# Returns a cursor-paginated
|
|
280
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
281
|
+
# list of your billing requests.
|
|
282
282
|
# Example URL: /billing_requests
|
|
283
283
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
284
284
|
def list(options = {})
|
|
@@ -313,7 +313,7 @@ module GoCardlessPro
|
|
|
313
313
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
314
314
|
def get(identity, options = {})
|
|
315
315
|
path = sub_url('/billing_requests/:identity', {
|
|
316
|
-
'identity' => identity
|
|
316
|
+
'identity' => identity,
|
|
317
317
|
})
|
|
318
318
|
|
|
319
319
|
options[:retry_failures] = true
|
|
@@ -329,15 +329,14 @@ module GoCardlessPro
|
|
|
329
329
|
# it.
|
|
330
330
|
# Currently, the customer can only be notified by email.
|
|
331
331
|
#
|
|
332
|
-
# This endpoint is currently supported only for
|
|
333
|
-
# Requests.
|
|
332
|
+
# This endpoint is currently supported only for Pay by Bank Billing Requests.
|
|
334
333
|
# Example URL: /billing_requests/:identity/actions/notify
|
|
335
334
|
#
|
|
336
335
|
# @param identity # Unique identifier, beginning with "BRQ".
|
|
337
336
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
338
337
|
def notify(identity, options = {})
|
|
339
338
|
path = sub_url('/billing_requests/:identity/actions/notify', {
|
|
340
|
-
'identity' => identity
|
|
339
|
+
'identity' => identity,
|
|
341
340
|
})
|
|
342
341
|
|
|
343
342
|
params = options.delete(:params) || {}
|
|
@@ -355,7 +354,7 @@ module GoCardlessPro
|
|
|
355
354
|
if e.idempotent_creation_conflict?
|
|
356
355
|
case @api_service.on_idempotency_conflict
|
|
357
356
|
when :raise
|
|
358
|
-
raise IdempotencyConflict
|
|
357
|
+
raise IdempotencyConflict.new(e.error)
|
|
359
358
|
when :fetch
|
|
360
359
|
return get(e.conflicting_resource_id)
|
|
361
360
|
end
|
|
@@ -377,7 +376,7 @@ module GoCardlessPro
|
|
|
377
376
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
378
377
|
def fallback(identity, options = {})
|
|
379
378
|
path = sub_url('/billing_requests/:identity/actions/fallback', {
|
|
380
|
-
'identity' => identity
|
|
379
|
+
'identity' => identity,
|
|
381
380
|
})
|
|
382
381
|
|
|
383
382
|
params = options.delete(:params) || {}
|
|
@@ -395,7 +394,7 @@ module GoCardlessPro
|
|
|
395
394
|
if e.idempotent_creation_conflict?
|
|
396
395
|
case @api_service.on_idempotency_conflict
|
|
397
396
|
when :raise
|
|
398
|
-
raise IdempotencyConflict
|
|
397
|
+
raise IdempotencyConflict.new(e.error)
|
|
399
398
|
when :fetch
|
|
400
399
|
return get(e.conflicting_resource_id)
|
|
401
400
|
end
|
|
@@ -422,7 +421,7 @@ module GoCardlessPro
|
|
|
422
421
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
423
422
|
def choose_currency(identity, options = {})
|
|
424
423
|
path = sub_url('/billing_requests/:identity/actions/choose_currency', {
|
|
425
|
-
'identity' => identity
|
|
424
|
+
'identity' => identity,
|
|
426
425
|
})
|
|
427
426
|
|
|
428
427
|
params = options.delete(:params) || {}
|
|
@@ -440,7 +439,7 @@ module GoCardlessPro
|
|
|
440
439
|
if e.idempotent_creation_conflict?
|
|
441
440
|
case @api_service.on_idempotency_conflict
|
|
442
441
|
when :raise
|
|
443
|
-
raise IdempotencyConflict
|
|
442
|
+
raise IdempotencyConflict.new(e.error)
|
|
444
443
|
when :fetch
|
|
445
444
|
return get(e.conflicting_resource_id)
|
|
446
445
|
end
|
|
@@ -461,7 +460,7 @@ module GoCardlessPro
|
|
|
461
460
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
462
461
|
def select_institution(identity, options = {})
|
|
463
462
|
path = sub_url('/billing_requests/:identity/actions/select_institution', {
|
|
464
|
-
'identity' => identity
|
|
463
|
+
'identity' => identity,
|
|
465
464
|
})
|
|
466
465
|
|
|
467
466
|
params = options.delete(:params) || {}
|
|
@@ -479,7 +478,7 @@ module GoCardlessPro
|
|
|
479
478
|
if e.idempotent_creation_conflict?
|
|
480
479
|
case @api_service.on_idempotency_conflict
|
|
481
480
|
when :raise
|
|
482
|
-
raise IdempotencyConflict
|
|
481
|
+
raise IdempotencyConflict.new(e.error)
|
|
483
482
|
when :fetch
|
|
484
483
|
return get(e.conflicting_resource_id)
|
|
485
484
|
end
|
|
@@ -499,7 +498,13 @@ module GoCardlessPro
|
|
|
499
498
|
#
|
|
500
499
|
# @param body [Hash]
|
|
501
500
|
def unenvelope_body(body)
|
|
502
|
-
body
|
|
501
|
+
if body.key?(envelope_key)
|
|
502
|
+
body[envelope_key]
|
|
503
|
+
elsif body.key?('data')
|
|
504
|
+
body['data']
|
|
505
|
+
else
|
|
506
|
+
body
|
|
507
|
+
end
|
|
503
508
|
end
|
|
504
509
|
|
|
505
510
|
# return the key which API responses will envelope data under
|
|
@@ -31,7 +31,7 @@ module GoCardlessPro
|
|
|
31
31
|
if e.idempotent_creation_conflict?
|
|
32
32
|
case @api_service.on_idempotency_conflict
|
|
33
33
|
when :raise
|
|
34
|
-
raise IdempotencyConflict
|
|
34
|
+
raise IdempotencyConflict.new(e.error)
|
|
35
35
|
when :fetch
|
|
36
36
|
return get(e.conflicting_resource_id)
|
|
37
37
|
end
|
|
@@ -52,7 +52,7 @@ module GoCardlessPro
|
|
|
52
52
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
53
53
|
def get(identity, options = {})
|
|
54
54
|
path = sub_url('/blocks/:identity', {
|
|
55
|
-
'identity' => identity
|
|
55
|
+
'identity' => identity,
|
|
56
56
|
})
|
|
57
57
|
|
|
58
58
|
options[:retry_failures] = true
|
|
@@ -64,8 +64,9 @@ module GoCardlessPro
|
|
|
64
64
|
Resources::Block.new(unenvelope_body(response.body), response)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
# Returns a
|
|
68
|
-
#
|
|
67
|
+
# Returns a cursor-paginated
|
|
68
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
69
|
+
# list of your blocks.
|
|
69
70
|
# Example URL: /blocks
|
|
70
71
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
71
72
|
def list(options = {})
|
|
@@ -100,7 +101,7 @@ module GoCardlessPro
|
|
|
100
101
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
101
102
|
def disable(identity, options = {})
|
|
102
103
|
path = sub_url('/blocks/:identity/actions/disable', {
|
|
103
|
-
'identity' => identity
|
|
104
|
+
'identity' => identity,
|
|
104
105
|
})
|
|
105
106
|
|
|
106
107
|
params = options.delete(:params) || {}
|
|
@@ -118,7 +119,7 @@ module GoCardlessPro
|
|
|
118
119
|
if e.idempotent_creation_conflict?
|
|
119
120
|
case @api_service.on_idempotency_conflict
|
|
120
121
|
when :raise
|
|
121
|
-
raise IdempotencyConflict
|
|
122
|
+
raise IdempotencyConflict.new(e.error)
|
|
122
123
|
when :fetch
|
|
123
124
|
return get(e.conflicting_resource_id)
|
|
124
125
|
end
|
|
@@ -139,7 +140,7 @@ module GoCardlessPro
|
|
|
139
140
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
140
141
|
def enable(identity, options = {})
|
|
141
142
|
path = sub_url('/blocks/:identity/actions/enable', {
|
|
142
|
-
'identity' => identity
|
|
143
|
+
'identity' => identity,
|
|
143
144
|
})
|
|
144
145
|
|
|
145
146
|
params = options.delete(:params) || {}
|
|
@@ -157,7 +158,7 @@ module GoCardlessPro
|
|
|
157
158
|
if e.idempotent_creation_conflict?
|
|
158
159
|
case @api_service.on_idempotency_conflict
|
|
159
160
|
when :raise
|
|
160
|
-
raise IdempotencyConflict
|
|
161
|
+
raise IdempotencyConflict.new(e.error)
|
|
161
162
|
when :fetch
|
|
162
163
|
return get(e.conflicting_resource_id)
|
|
163
164
|
end
|
|
@@ -195,7 +196,7 @@ module GoCardlessPro
|
|
|
195
196
|
if e.idempotent_creation_conflict?
|
|
196
197
|
case @api_service.on_idempotency_conflict
|
|
197
198
|
when :raise
|
|
198
|
-
raise IdempotencyConflict
|
|
199
|
+
raise IdempotencyConflict.new(e.error)
|
|
199
200
|
when :fetch
|
|
200
201
|
return get(e.conflicting_resource_id)
|
|
201
202
|
end
|
|
@@ -217,7 +218,13 @@ module GoCardlessPro
|
|
|
217
218
|
#
|
|
218
219
|
# @param body [Hash]
|
|
219
220
|
def unenvelope_body(body)
|
|
220
|
-
body
|
|
221
|
+
if body.key?(envelope_key)
|
|
222
|
+
body[envelope_key]
|
|
223
|
+
elsif body.key?('data')
|
|
224
|
+
body['data']
|
|
225
|
+
else
|
|
226
|
+
body
|
|
227
|
+
end
|
|
221
228
|
end
|
|
222
229
|
|
|
223
230
|
# return the key which API responses will envelope data under
|
|
@@ -31,7 +31,7 @@ module GoCardlessPro
|
|
|
31
31
|
if e.idempotent_creation_conflict?
|
|
32
32
|
case @api_service.on_idempotency_conflict
|
|
33
33
|
when :raise
|
|
34
|
-
raise IdempotencyConflict
|
|
34
|
+
raise IdempotencyConflict.new(e.error)
|
|
35
35
|
when :fetch
|
|
36
36
|
return get(e.conflicting_resource_id)
|
|
37
37
|
end
|
|
@@ -45,8 +45,9 @@ module GoCardlessPro
|
|
|
45
45
|
Resources::CreditorBankAccount.new(unenvelope_body(response.body), response)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
# Returns a
|
|
49
|
-
#
|
|
48
|
+
# Returns a cursor-paginated
|
|
49
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
50
|
+
# list of your creditor bank accounts.
|
|
50
51
|
# Example URL: /creditor_bank_accounts
|
|
51
52
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
52
53
|
def list(options = {})
|
|
@@ -81,7 +82,7 @@ module GoCardlessPro
|
|
|
81
82
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
82
83
|
def get(identity, options = {})
|
|
83
84
|
path = sub_url('/creditor_bank_accounts/:identity', {
|
|
84
|
-
'identity' => identity
|
|
85
|
+
'identity' => identity,
|
|
85
86
|
})
|
|
86
87
|
|
|
87
88
|
options[:retry_failures] = true
|
|
@@ -107,7 +108,7 @@ module GoCardlessPro
|
|
|
107
108
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
108
109
|
def disable(identity, options = {})
|
|
109
110
|
path = sub_url('/creditor_bank_accounts/:identity/actions/disable', {
|
|
110
|
-
'identity' => identity
|
|
111
|
+
'identity' => identity,
|
|
111
112
|
})
|
|
112
113
|
|
|
113
114
|
params = options.delete(:params) || {}
|
|
@@ -125,7 +126,7 @@ module GoCardlessPro
|
|
|
125
126
|
if e.idempotent_creation_conflict?
|
|
126
127
|
case @api_service.on_idempotency_conflict
|
|
127
128
|
when :raise
|
|
128
|
-
raise IdempotencyConflict
|
|
129
|
+
raise IdempotencyConflict.new(e.error)
|
|
129
130
|
when :fetch
|
|
130
131
|
return get(e.conflicting_resource_id)
|
|
131
132
|
end
|
|
@@ -145,7 +146,13 @@ module GoCardlessPro
|
|
|
145
146
|
#
|
|
146
147
|
# @param body [Hash]
|
|
147
148
|
def unenvelope_body(body)
|
|
148
|
-
body
|
|
149
|
+
if body.key?(envelope_key)
|
|
150
|
+
body[envelope_key]
|
|
151
|
+
elsif body.key?('data')
|
|
152
|
+
body['data']
|
|
153
|
+
else
|
|
154
|
+
body
|
|
155
|
+
end
|
|
149
156
|
end
|
|
150
157
|
|
|
151
158
|
# return the key which API responses will envelope data under
|
|
@@ -31,7 +31,7 @@ module GoCardlessPro
|
|
|
31
31
|
if e.idempotent_creation_conflict?
|
|
32
32
|
case @api_service.on_idempotency_conflict
|
|
33
33
|
when :raise
|
|
34
|
-
raise IdempotencyConflict
|
|
34
|
+
raise IdempotencyConflict.new(e.error)
|
|
35
35
|
when :fetch
|
|
36
36
|
return get(e.conflicting_resource_id)
|
|
37
37
|
end
|
|
@@ -45,8 +45,9 @@ module GoCardlessPro
|
|
|
45
45
|
Resources::Creditor.new(unenvelope_body(response.body), response)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
# Returns a
|
|
49
|
-
#
|
|
48
|
+
# Returns a cursor-paginated
|
|
49
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
50
|
+
# list of your creditors.
|
|
50
51
|
# Example URL: /creditors
|
|
51
52
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
52
53
|
def list(options = {})
|
|
@@ -81,7 +82,7 @@ module GoCardlessPro
|
|
|
81
82
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
82
83
|
def get(identity, options = {})
|
|
83
84
|
path = sub_url('/creditors/:identity', {
|
|
84
|
-
'identity' => identity
|
|
85
|
+
'identity' => identity,
|
|
85
86
|
})
|
|
86
87
|
|
|
87
88
|
options[:retry_failures] = true
|
|
@@ -101,7 +102,7 @@ module GoCardlessPro
|
|
|
101
102
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
102
103
|
def update(identity, options = {})
|
|
103
104
|
path = sub_url('/creditors/:identity', {
|
|
104
|
-
'identity' => identity
|
|
105
|
+
'identity' => identity,
|
|
105
106
|
})
|
|
106
107
|
|
|
107
108
|
params = options.delete(:params) || {}
|
|
@@ -123,7 +124,13 @@ module GoCardlessPro
|
|
|
123
124
|
#
|
|
124
125
|
# @param body [Hash]
|
|
125
126
|
def unenvelope_body(body)
|
|
126
|
-
body
|
|
127
|
+
if body.key?(envelope_key)
|
|
128
|
+
body[envelope_key]
|
|
129
|
+
elsif body.key?('data')
|
|
130
|
+
body['data']
|
|
131
|
+
else
|
|
132
|
+
body
|
|
133
|
+
end
|
|
127
134
|
end
|
|
128
135
|
|
|
129
136
|
# return the key which API responses will envelope data under
|
|
@@ -10,8 +10,9 @@ module GoCardlessPro
|
|
|
10
10
|
module Services
|
|
11
11
|
# Service for making requests to the CurrencyExchangeRate endpoints
|
|
12
12
|
class CurrencyExchangeRatesService < BaseService
|
|
13
|
-
# Returns a
|
|
14
|
-
#
|
|
13
|
+
# Returns a cursor-paginated
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
15
|
+
# list of all exchange rates.
|
|
15
16
|
# Example URL: /currency_exchange_rates
|
|
16
17
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
17
18
|
def list(options = {})
|
|
@@ -45,7 +46,13 @@ module GoCardlessPro
|
|
|
45
46
|
#
|
|
46
47
|
# @param body [Hash]
|
|
47
48
|
def unenvelope_body(body)
|
|
48
|
-
body
|
|
49
|
+
if body.key?(envelope_key)
|
|
50
|
+
body[envelope_key]
|
|
51
|
+
elsif body.key?('data')
|
|
52
|
+
body['data']
|
|
53
|
+
else
|
|
54
|
+
body
|
|
55
|
+
end
|
|
49
56
|
end
|
|
50
57
|
|
|
51
58
|
# return the key which API responses will envelope data under
|
|
@@ -14,15 +14,18 @@ module GoCardlessPro
|
|
|
14
14
|
#
|
|
15
15
|
# There are three different ways to supply bank account details:
|
|
16
16
|
#
|
|
17
|
-
# -
|
|
18
|
-
#
|
|
19
|
-
# -
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
17
|
+
# -
|
|
18
|
+
# Local details
|
|
19
|
+
# (https://developer.gocardless.com/api-reference/#appendix-local-bank-details)
|
|
20
|
+
# -
|
|
21
|
+
# IBAN
|
|
22
|
+
# -
|
|
23
|
+
# Customer Bank Account Tokens
|
|
24
|
+
# (https://developer.gocardless.com/api-reference/#javascript-flow-create-a-customer-bank-account-token)
|
|
23
25
|
#
|
|
24
26
|
# For more information on the different fields required in each country, see
|
|
25
|
-
#
|
|
27
|
+
# local bank details
|
|
28
|
+
# (https://developer.gocardless.com/api-reference/#appendix-local-bank-details).
|
|
26
29
|
# Example URL: /customer_bank_accounts
|
|
27
30
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
28
31
|
def create(options = {})
|
|
@@ -43,7 +46,7 @@ module GoCardlessPro
|
|
|
43
46
|
if e.idempotent_creation_conflict?
|
|
44
47
|
case @api_service.on_idempotency_conflict
|
|
45
48
|
when :raise
|
|
46
|
-
raise IdempotencyConflict
|
|
49
|
+
raise IdempotencyConflict.new(e.error)
|
|
47
50
|
when :fetch
|
|
48
51
|
return get(e.conflicting_resource_id)
|
|
49
52
|
end
|
|
@@ -57,8 +60,9 @@ module GoCardlessPro
|
|
|
57
60
|
Resources::CustomerBankAccount.new(unenvelope_body(response.body), response)
|
|
58
61
|
end
|
|
59
62
|
|
|
60
|
-
# Returns a
|
|
61
|
-
#
|
|
63
|
+
# Returns a cursor-paginated
|
|
64
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
65
|
+
# list of your bank accounts.
|
|
62
66
|
# Example URL: /customer_bank_accounts
|
|
63
67
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
64
68
|
def list(options = {})
|
|
@@ -93,7 +97,7 @@ module GoCardlessPro
|
|
|
93
97
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
94
98
|
def get(identity, options = {})
|
|
95
99
|
path = sub_url('/customer_bank_accounts/:identity', {
|
|
96
|
-
'identity' => identity
|
|
100
|
+
'identity' => identity,
|
|
97
101
|
})
|
|
98
102
|
|
|
99
103
|
options[:retry_failures] = true
|
|
@@ -113,7 +117,7 @@ module GoCardlessPro
|
|
|
113
117
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
114
118
|
def update(identity, options = {})
|
|
115
119
|
path = sub_url('/customer_bank_accounts/:identity', {
|
|
116
|
-
'identity' => identity
|
|
120
|
+
'identity' => identity,
|
|
117
121
|
})
|
|
118
122
|
|
|
119
123
|
params = options.delete(:params) || {}
|
|
@@ -142,7 +146,7 @@ module GoCardlessPro
|
|
|
142
146
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
143
147
|
def disable(identity, options = {})
|
|
144
148
|
path = sub_url('/customer_bank_accounts/:identity/actions/disable', {
|
|
145
|
-
'identity' => identity
|
|
149
|
+
'identity' => identity,
|
|
146
150
|
})
|
|
147
151
|
|
|
148
152
|
params = options.delete(:params) || {}
|
|
@@ -160,7 +164,7 @@ module GoCardlessPro
|
|
|
160
164
|
if e.idempotent_creation_conflict?
|
|
161
165
|
case @api_service.on_idempotency_conflict
|
|
162
166
|
when :raise
|
|
163
|
-
raise IdempotencyConflict
|
|
167
|
+
raise IdempotencyConflict.new(e.error)
|
|
164
168
|
when :fetch
|
|
165
169
|
return get(e.conflicting_resource_id)
|
|
166
170
|
end
|
|
@@ -180,7 +184,13 @@ module GoCardlessPro
|
|
|
180
184
|
#
|
|
181
185
|
# @param body [Hash]
|
|
182
186
|
def unenvelope_body(body)
|
|
183
|
-
body
|
|
187
|
+
if body.key?(envelope_key)
|
|
188
|
+
body[envelope_key]
|
|
189
|
+
elsif body.key?('data')
|
|
190
|
+
body['data']
|
|
191
|
+
else
|
|
192
|
+
body
|
|
193
|
+
end
|
|
184
194
|
end
|
|
185
195
|
|
|
186
196
|
# return the key which API responses will envelope data under
|
|
@@ -17,14 +17,13 @@ module GoCardlessPro
|
|
|
17
17
|
# passed,
|
|
18
18
|
# this endpoint will return an `already_actioned` error and you should not take
|
|
19
19
|
# further action. This endpoint takes no additional parameters.
|
|
20
|
-
#
|
|
21
20
|
# Example URL: /customer_notifications/:identity/actions/handle
|
|
22
21
|
#
|
|
23
22
|
# @param identity # The id of the notification.
|
|
24
23
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
25
24
|
def handle(identity, options = {})
|
|
26
25
|
path = sub_url('/customer_notifications/:identity/actions/handle', {
|
|
27
|
-
'identity' => identity
|
|
26
|
+
'identity' => identity,
|
|
28
27
|
})
|
|
29
28
|
|
|
30
29
|
params = options.delete(:params) || {}
|
|
@@ -46,7 +45,13 @@ module GoCardlessPro
|
|
|
46
45
|
#
|
|
47
46
|
# @param body [Hash]
|
|
48
47
|
def unenvelope_body(body)
|
|
49
|
-
body
|
|
48
|
+
if body.key?(envelope_key)
|
|
49
|
+
body[envelope_key]
|
|
50
|
+
elsif body.key?('data')
|
|
51
|
+
body['data']
|
|
52
|
+
else
|
|
53
|
+
body
|
|
54
|
+
end
|
|
50
55
|
end
|
|
51
56
|
|
|
52
57
|
# return the key which API responses will envelope data under
|