gocardless_pro 4.3.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 -0
- data/lib/gocardless_pro/client.rb +11 -1
- data/lib/gocardless_pro/list_response.rb +2 -2
- data/lib/gocardless_pro/resources/billing_request.rb +7 -8
- data/lib/gocardless_pro/resources/billing_request_with_action.rb +4 -4
- data/lib/gocardless_pro/resources/block.rb +4 -6
- data/lib/gocardless_pro/resources/creditor.rb +6 -4
- data/lib/gocardless_pro/resources/creditor_bank_account.rb +6 -5
- data/lib/gocardless_pro/resources/customer.rb +4 -3
- data/lib/gocardless_pro/resources/customer_bank_account.rb +13 -8
- data/lib/gocardless_pro/resources/customer_notification.rb +3 -4
- data/lib/gocardless_pro/resources/event.rb +13 -2
- data/lib/gocardless_pro/resources/export.rb +2 -0
- data/lib/gocardless_pro/resources/instalment_schedule.rb +0 -1
- data/lib/gocardless_pro/resources/institution.rb +3 -3
- data/lib/gocardless_pro/resources/logo.rb +2 -1
- data/lib/gocardless_pro/resources/mandate.rb +7 -4
- data/lib/gocardless_pro/resources/mandate_import.rb +25 -21
- data/lib/gocardless_pro/resources/mandate_import_entry.rb +13 -16
- data/lib/gocardless_pro/resources/mandate_pdf.rb +3 -3
- data/lib/gocardless_pro/resources/negative_balance_limit.rb +0 -1
- data/lib/gocardless_pro/resources/outbound_payment.rb +11 -4
- 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 +27 -31
- data/lib/gocardless_pro/resources/payment.rb +9 -6
- data/lib/gocardless_pro/resources/payment_account.rb +2 -1
- data/lib/gocardless_pro/resources/payment_account_transaction.rb +2 -1
- data/lib/gocardless_pro/resources/payout.rb +7 -6
- data/lib/gocardless_pro/resources/payout_item.rb +1 -2
- data/lib/gocardless_pro/resources/redirect_flow.rb +34 -23
- data/lib/gocardless_pro/resources/refund.rb +8 -6
- data/lib/gocardless_pro/resources/scheme_identifier.rb +0 -1
- data/lib/gocardless_pro/resources/subscription.rb +17 -14
- data/lib/gocardless_pro/resources/tax_rate.rb +2 -2
- data/lib/gocardless_pro/resources/verification_detail.rb +10 -6
- data/lib/gocardless_pro/services/balances_service.rb +11 -3
- data/lib/gocardless_pro/services/bank_account_details_service.rb +10 -4
- data/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb +7 -1
- data/lib/gocardless_pro/services/bank_authorisations_service.rb +7 -1
- data/lib/gocardless_pro/services/bank_details_lookups_service.rb +14 -6
- data/lib/gocardless_pro/services/billing_request_flows_service.rb +7 -1
- data/lib/gocardless_pro/services/billing_request_templates_service.rb +10 -3
- data/lib/gocardless_pro/services/billing_request_with_actions_service.rb +7 -1
- data/lib/gocardless_pro/services/billing_requests_service.rb +18 -13
- data/lib/gocardless_pro/services/blocks_service.rb +10 -3
- data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +10 -3
- data/lib/gocardless_pro/services/creditors_service.rb +10 -3
- data/lib/gocardless_pro/services/currency_exchange_rates_service.rb +10 -3
- data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +20 -10
- data/lib/gocardless_pro/services/customer_notifications_service.rb +7 -2
- data/lib/gocardless_pro/services/customers_service.rb +11 -5
- data/lib/gocardless_pro/services/events_service.rb +15 -3
- data/lib/gocardless_pro/services/exports_service.rb +7 -1
- data/lib/gocardless_pro/services/funds_availabilities_service.rb +7 -1
- data/lib/gocardless_pro/services/instalment_schedules_service.rb +15 -7
- data/lib/gocardless_pro/services/institutions_service.rb +7 -1
- 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 +10 -2
- data/lib/gocardless_pro/services/mandate_pdfs_service.rb +11 -5
- data/lib/gocardless_pro/services/mandates_service.rb +16 -9
- 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 +11 -4
- data/lib/gocardless_pro/services/payer_authorisations_service.rb +11 -8
- data/lib/gocardless_pro/services/payer_themes_service.rb +7 -1
- data/lib/gocardless_pro/services/payment_account_transactions_service.rb +34 -7
- data/lib/gocardless_pro/services/payment_accounts_service.rb +10 -3
- data/lib/gocardless_pro/services/payments_service.rb +22 -14
- data/lib/gocardless_pro/services/payout_items_service.rb +12 -7
- data/lib/gocardless_pro/services/payouts_service.rb +12 -5
- data/lib/gocardless_pro/services/redirect_flows_service.rb +15 -5
- data/lib/gocardless_pro/services/refunds_service.rb +15 -10
- data/lib/gocardless_pro/services/scenario_simulators_service.rb +85 -82
- data/lib/gocardless_pro/services/scheme_identifiers_service.rb +13 -7
- data/lib/gocardless_pro/services/subscriptions_service.rb +48 -38
- data/lib/gocardless_pro/services/tax_rates_service.rb +10 -3
- data/lib/gocardless_pro/services/transferred_mandates_service.rb +7 -1
- data/lib/gocardless_pro/services/verification_details_service.rb +7 -1
- data/lib/gocardless_pro/services/webhooks_service.rb +10 -3
- data/lib/gocardless_pro/version.rb +1 -1
- data/lib/gocardless_pro/webhook.rb +45 -0
- data/lib/gocardless_pro.rb +6 -0
- metadata +7 -7
|
@@ -45,8 +45,9 @@ module GoCardlessPro
|
|
|
45
45
|
Resources::Mandate.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 mandates.
|
|
50
51
|
# Example URL: /mandates
|
|
51
52
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
52
53
|
def list(options = {})
|
|
@@ -163,12 +164,12 @@ module GoCardlessPro
|
|
|
163
164
|
Resources::Mandate.new(unenvelope_body(response.body), response)
|
|
164
165
|
end
|
|
165
166
|
|
|
166
|
-
#
|
|
167
|
-
#
|
|
168
|
-
#
|
|
169
|
-
#
|
|
170
|
-
#
|
|
171
|
-
#
|
|
167
|
+
# Reinstates a cancelled or expired mandate to the banks. You will receive a
|
|
168
|
+
# `resubmission_requested` webhook, but after that reinstating the mandate
|
|
169
|
+
# follows the same process as its initial creation, so you will receive a
|
|
170
|
+
# `submitted` webhook, followed by a `reinstated` or `failed` webhook up to two
|
|
171
|
+
# working days later. Any metadata supplied to this endpoint will be stored on
|
|
172
|
+
# the `resubmission_requested` event it causes.
|
|
172
173
|
#
|
|
173
174
|
# This will fail with a `mandate_not_inactive` error if the mandate is already
|
|
174
175
|
# being submitted, or is active.
|
|
@@ -219,7 +220,13 @@ module GoCardlessPro
|
|
|
219
220
|
#
|
|
220
221
|
# @param body [Hash]
|
|
221
222
|
def unenvelope_body(body)
|
|
222
|
-
body
|
|
223
|
+
if body.key?(envelope_key)
|
|
224
|
+
body[envelope_key]
|
|
225
|
+
elsif body.key?('data')
|
|
226
|
+
body['data']
|
|
227
|
+
else
|
|
228
|
+
body
|
|
229
|
+
end
|
|
223
230
|
end
|
|
224
231
|
|
|
225
232
|
# 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 NegativeBalanceLimit endpoints
|
|
12
12
|
class NegativeBalanceLimitsService < BaseService
|
|
13
|
-
# Returns a
|
|
14
|
-
#
|
|
13
|
+
# Returns a cursor-paginated
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
15
|
+
# list of negative balance limits.
|
|
15
16
|
# Example URL: /negative_balance_limits
|
|
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
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require_relative './base_service'
|
|
2
|
+
|
|
3
|
+
# encoding: utf-8
|
|
4
|
+
#
|
|
5
|
+
# This client is automatically generated from a template and JSON schema definition.
|
|
6
|
+
# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
module GoCardlessPro
|
|
10
|
+
module Services
|
|
11
|
+
# Service for making requests to the OutboundPaymentImportEntry endpoints
|
|
12
|
+
class OutboundPaymentImportEntriesService < BaseService
|
|
13
|
+
# Returns a cursor-paginated
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
15
|
+
# list of the entries for a given outbound payment import.
|
|
16
|
+
# Example URL: /outbound_payment_import_entries
|
|
17
|
+
# @param options [Hash] parameters as a hash, under a params key.
|
|
18
|
+
def list(options = {})
|
|
19
|
+
path = '/outbound_payment_import_entries'
|
|
20
|
+
|
|
21
|
+
options[:retry_failures] = true
|
|
22
|
+
|
|
23
|
+
response = make_request(:get, path, options)
|
|
24
|
+
|
|
25
|
+
ListResponse.new(
|
|
26
|
+
response: response,
|
|
27
|
+
unenveloped_body: unenvelope_body(response.body),
|
|
28
|
+
resource_class: Resources::OutboundPaymentImportEntry
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Get a lazily enumerated list of all the items returned. This is similar to the `list` method but will paginate for you automatically.
|
|
33
|
+
#
|
|
34
|
+
# @param options [Hash] parameters as a hash. If the request is a GET, these will be converted to query parameters.
|
|
35
|
+
# Otherwise they will be the body of the request.
|
|
36
|
+
def all(options = {})
|
|
37
|
+
Paginator.new(
|
|
38
|
+
service: self,
|
|
39
|
+
options: options
|
|
40
|
+
).enumerator
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
# Unenvelope the response of the body using the service's `envelope_key`
|
|
46
|
+
#
|
|
47
|
+
# @param body [Hash]
|
|
48
|
+
def unenvelope_body(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
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# return the key which API responses will envelope data under
|
|
59
|
+
def envelope_key
|
|
60
|
+
'outbound_payment_import_entries'
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
require_relative './base_service'
|
|
2
|
+
|
|
3
|
+
# encoding: utf-8
|
|
4
|
+
#
|
|
5
|
+
# This client is automatically generated from a template and JSON schema definition.
|
|
6
|
+
# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
module GoCardlessPro
|
|
10
|
+
module Services
|
|
11
|
+
# Service for making requests to the OutboundPaymentImport endpoints
|
|
12
|
+
class OutboundPaymentImportsService < BaseService
|
|
13
|
+
#
|
|
14
|
+
# Example URL: /outbound_payment_imports
|
|
15
|
+
# @param options [Hash] parameters as a hash, under a params key.
|
|
16
|
+
def create(options = {})
|
|
17
|
+
path = '/outbound_payment_imports'
|
|
18
|
+
|
|
19
|
+
params = options.delete(:params) || {}
|
|
20
|
+
options[:params] = {}
|
|
21
|
+
options[:params][envelope_key] = params
|
|
22
|
+
|
|
23
|
+
options[:retry_failures] = true
|
|
24
|
+
|
|
25
|
+
begin
|
|
26
|
+
response = make_request(:post, path, options)
|
|
27
|
+
|
|
28
|
+
# Response doesn't raise any errors until #body is called
|
|
29
|
+
response.tap(&:body)
|
|
30
|
+
rescue InvalidStateError => e
|
|
31
|
+
if e.idempotent_creation_conflict?
|
|
32
|
+
case @api_service.on_idempotency_conflict
|
|
33
|
+
when :raise
|
|
34
|
+
raise IdempotencyConflict.new(e.error)
|
|
35
|
+
when :fetch
|
|
36
|
+
return get(e.conflicting_resource_id)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
raise e
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
return if response.body.nil?
|
|
44
|
+
|
|
45
|
+
Resources::OutboundPaymentImport.new(unenvelope_body(response.body), response)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Returns a single outbound payment import.
|
|
49
|
+
# Example URL: /outbound_payment_imports/:identity
|
|
50
|
+
#
|
|
51
|
+
# @param identity # Unique identifier, beginning with "IM".
|
|
52
|
+
# @param options [Hash] parameters as a hash, under a params key.
|
|
53
|
+
def get(identity, options = {})
|
|
54
|
+
path = sub_url('/outbound_payment_imports/:identity', {
|
|
55
|
+
'identity' => identity,
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
options[:retry_failures] = true
|
|
59
|
+
|
|
60
|
+
response = make_request(:get, path, options)
|
|
61
|
+
|
|
62
|
+
return if response.body.nil?
|
|
63
|
+
|
|
64
|
+
Resources::OutboundPaymentImport.new(unenvelope_body(response.body), response)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Returns a cursor-paginated
|
|
68
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
69
|
+
# list of your outbound payment imports.
|
|
70
|
+
# Example URL: /outbound_payment_imports
|
|
71
|
+
# @param options [Hash] parameters as a hash, under a params key.
|
|
72
|
+
def list(options = {})
|
|
73
|
+
path = '/outbound_payment_imports'
|
|
74
|
+
|
|
75
|
+
options[:retry_failures] = true
|
|
76
|
+
|
|
77
|
+
response = make_request(:get, path, options)
|
|
78
|
+
|
|
79
|
+
ListResponse.new(
|
|
80
|
+
response: response,
|
|
81
|
+
unenveloped_body: unenvelope_body(response.body),
|
|
82
|
+
resource_class: Resources::OutboundPaymentImport
|
|
83
|
+
)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Get a lazily enumerated list of all the items returned. This is similar to the `list` method but will paginate for you automatically.
|
|
87
|
+
#
|
|
88
|
+
# @param options [Hash] parameters as a hash. If the request is a GET, these will be converted to query parameters.
|
|
89
|
+
# Otherwise they will be the body of the request.
|
|
90
|
+
def all(options = {})
|
|
91
|
+
Paginator.new(
|
|
92
|
+
service: self,
|
|
93
|
+
options: options
|
|
94
|
+
).enumerator
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
private
|
|
98
|
+
|
|
99
|
+
# Unenvelope the response of the body using the service's `envelope_key`
|
|
100
|
+
#
|
|
101
|
+
# @param body [Hash]
|
|
102
|
+
def unenvelope_body(body)
|
|
103
|
+
if body.key?(envelope_key)
|
|
104
|
+
body[envelope_key]
|
|
105
|
+
elsif body.key?('data')
|
|
106
|
+
body['data']
|
|
107
|
+
else
|
|
108
|
+
body
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# return the key which API responses will envelope data under
|
|
113
|
+
def envelope_key
|
|
114
|
+
'outbound_payment_imports'
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
@@ -124,7 +124,7 @@ module GoCardlessPro
|
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
# Approves an outbound payment. Only outbound payments with the
|
|
127
|
-
#
|
|
127
|
+
# "pending_approval" status can be approved.
|
|
128
128
|
# Example URL: /outbound_payments/:identity/actions/approve
|
|
129
129
|
#
|
|
130
130
|
# @param identity # Unique identifier of the outbound payment.
|
|
@@ -182,8 +182,9 @@ module GoCardlessPro
|
|
|
182
182
|
Resources::OutboundPayment.new(unenvelope_body(response.body), response)
|
|
183
183
|
end
|
|
184
184
|
|
|
185
|
-
# Returns a
|
|
186
|
-
#
|
|
185
|
+
# Returns a cursor-paginated
|
|
186
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
187
|
+
# list of outbound payments.
|
|
187
188
|
# Example URL: /outbound_payments
|
|
188
189
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
189
190
|
def list(options = {})
|
|
@@ -255,7 +256,13 @@ module GoCardlessPro
|
|
|
255
256
|
#
|
|
256
257
|
# @param body [Hash]
|
|
257
258
|
def unenvelope_body(body)
|
|
258
|
-
body
|
|
259
|
+
if body.key?(envelope_key)
|
|
260
|
+
body[envelope_key]
|
|
261
|
+
elsif body.key?('data')
|
|
262
|
+
body['data']
|
|
263
|
+
else
|
|
264
|
+
body
|
|
265
|
+
end
|
|
259
266
|
end
|
|
260
267
|
|
|
261
268
|
# return the key which API responses will envelope data under
|
|
@@ -75,10 +75,9 @@ module GoCardlessPro
|
|
|
75
75
|
# the request will be modified. An empty array of incomplete_fields means that
|
|
76
76
|
# the resource is valid. This endpoint has been designed this way so you do not
|
|
77
77
|
# need to save any payer data on your servers or the browser while still being
|
|
78
|
-
# able to implement a progressive solution, such a multi-step form.
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
# </p>
|
|
78
|
+
# able to implement a progressive solution, such a multi-step form. Note that
|
|
79
|
+
# in order to update the `metadata` attribute values it must be sent completely
|
|
80
|
+
# as it overrides the previously existing values.
|
|
82
81
|
# Example URL: /payer_authorisations/:identity
|
|
83
82
|
#
|
|
84
83
|
# @param identity # Unique identifier, beginning with "PA".
|
|
@@ -147,13 +146,11 @@ module GoCardlessPro
|
|
|
147
146
|
# be created.
|
|
148
147
|
# A Payer Authorisation cannot be confirmed if it hasn't been submitted yet.
|
|
149
148
|
#
|
|
150
|
-
# <p class="notice">
|
|
151
149
|
# The main use of the confirm endpoint is to enable integrators to acknowledge
|
|
152
150
|
# the end of the setup process.
|
|
153
|
-
#
|
|
151
|
+
# They might want to make the payers go through some other steps after they go
|
|
154
152
|
# through our flow or make them go through the necessary verification mechanism
|
|
155
153
|
# (upcoming feature).
|
|
156
|
-
# </p>
|
|
157
154
|
# Example URL: /payer_authorisations/:identity/actions/confirm
|
|
158
155
|
#
|
|
159
156
|
# @param identity # Unique identifier, beginning with "PA".
|
|
@@ -198,7 +195,13 @@ module GoCardlessPro
|
|
|
198
195
|
#
|
|
199
196
|
# @param body [Hash]
|
|
200
197
|
def unenvelope_body(body)
|
|
201
|
-
body
|
|
198
|
+
if body.key?(envelope_key)
|
|
199
|
+
body[envelope_key]
|
|
200
|
+
elsif body.key?('data')
|
|
201
|
+
body['data']
|
|
202
|
+
else
|
|
203
|
+
body
|
|
204
|
+
end
|
|
202
205
|
end
|
|
203
206
|
|
|
204
207
|
# return the key which API responses will envelope data under
|
|
@@ -37,7 +37,13 @@ module GoCardlessPro
|
|
|
37
37
|
#
|
|
38
38
|
# @param body [Hash]
|
|
39
39
|
def unenvelope_body(body)
|
|
40
|
-
body
|
|
40
|
+
if body.key?(envelope_key)
|
|
41
|
+
body[envelope_key]
|
|
42
|
+
elsif body.key?('data')
|
|
43
|
+
body['data']
|
|
44
|
+
else
|
|
45
|
+
body
|
|
46
|
+
end
|
|
41
47
|
end
|
|
42
48
|
|
|
43
49
|
# return the key which API responses will envelope data under
|
|
@@ -10,12 +10,33 @@ module GoCardlessPro
|
|
|
10
10
|
module Services
|
|
11
11
|
# Service for making requests to the PaymentAccountTransaction endpoints
|
|
12
12
|
class PaymentAccountTransactionsService < BaseService
|
|
13
|
+
# Retrieves the details of an existing payment account transaction.
|
|
14
|
+
# Example URL: /payment_account_transactions/:identity
|
|
15
|
+
#
|
|
16
|
+
# @param identity # The unique ID of the bank account
|
|
17
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-creditor-bank-accounts)
|
|
18
|
+
# which happens to be the payment account.
|
|
19
|
+
# @param options [Hash] parameters as a hash, under a params key.
|
|
20
|
+
def get(identity, options = {})
|
|
21
|
+
path = sub_url('/payment_account_transactions/:identity', {
|
|
22
|
+
'identity' => identity,
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
options[:retry_failures] = true
|
|
26
|
+
|
|
27
|
+
response = make_request(:get, path, options)
|
|
28
|
+
|
|
29
|
+
return if response.body.nil?
|
|
30
|
+
|
|
31
|
+
Resources::PaymentAccountTransaction.new(unenvelope_body(response.body), response)
|
|
32
|
+
end
|
|
33
|
+
|
|
13
34
|
# List transactions for a given payment account.
|
|
14
35
|
# Example URL: /payment_accounts/:identity/transactions
|
|
15
36
|
#
|
|
16
|
-
# @param identity # The unique ID of the
|
|
17
|
-
#
|
|
18
|
-
# payment account.
|
|
37
|
+
# @param identity # The unique ID of the bank account
|
|
38
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-creditor-bank-accounts)
|
|
39
|
+
# which happens to be the payment account.
|
|
19
40
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
20
41
|
def list(identity, options = {})
|
|
21
42
|
path = sub_url('/payment_accounts/:identity/transactions', {
|
|
@@ -35,9 +56,9 @@ module GoCardlessPro
|
|
|
35
56
|
|
|
36
57
|
# Get a lazily enumerated list of all the items returned. This is similar to the `list` method but will paginate for you automatically.
|
|
37
58
|
#
|
|
38
|
-
# @param identity # The unique ID of the
|
|
39
|
-
#
|
|
40
|
-
# payment account.
|
|
59
|
+
# @param identity # The unique ID of the bank account
|
|
60
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-creditor-bank-accounts)
|
|
61
|
+
# which happens to be the payment account.
|
|
41
62
|
# @param options [Hash] parameters as a hash. If the request is a GET, these will be converted to query parameters.
|
|
42
63
|
# Otherwise they will be the body of the request.
|
|
43
64
|
def all(identity, options = {})
|
|
@@ -54,7 +75,13 @@ module GoCardlessPro
|
|
|
54
75
|
#
|
|
55
76
|
# @param body [Hash]
|
|
56
77
|
def unenvelope_body(body)
|
|
57
|
-
body
|
|
78
|
+
if body.key?(envelope_key)
|
|
79
|
+
body[envelope_key]
|
|
80
|
+
elsif body.key?('data')
|
|
81
|
+
body['data']
|
|
82
|
+
else
|
|
83
|
+
body
|
|
84
|
+
end
|
|
58
85
|
end
|
|
59
86
|
|
|
60
87
|
# return the key which API responses will envelope data under
|
|
@@ -29,8 +29,9 @@ module GoCardlessPro
|
|
|
29
29
|
Resources::PaymentAccount.new(unenvelope_body(response.body), response)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
# Returns a
|
|
33
|
-
#
|
|
32
|
+
# Returns a cursor-paginated
|
|
33
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
34
|
+
# list of your payment accounts.
|
|
34
35
|
# Example URL: /payment_accounts
|
|
35
36
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
36
37
|
def list(options = {})
|
|
@@ -64,7 +65,13 @@ module GoCardlessPro
|
|
|
64
65
|
#
|
|
65
66
|
# @param body [Hash]
|
|
66
67
|
def unenvelope_body(body)
|
|
67
|
-
body
|
|
68
|
+
if body.key?(envelope_key)
|
|
69
|
+
body[envelope_key]
|
|
70
|
+
elsif body.key?('data')
|
|
71
|
+
body['data']
|
|
72
|
+
else
|
|
73
|
+
body
|
|
74
|
+
end
|
|
68
75
|
end
|
|
69
76
|
|
|
70
77
|
# return the key which API responses will envelope data under
|
|
@@ -10,12 +10,13 @@ module GoCardlessPro
|
|
|
10
10
|
module Services
|
|
11
11
|
# Service for making requests to the Payment endpoints
|
|
12
12
|
class PaymentsService < BaseService
|
|
13
|
-
#
|
|
13
|
+
# Creates a new payment object.
|
|
14
14
|
#
|
|
15
|
-
# This fails with a `mandate_is_inactive` error if the linked
|
|
16
|
-
#
|
|
17
|
-
# be created against mandates with status
|
|
18
|
-
# `pending_submission`, `submitted`, and
|
|
15
|
+
# This fails with a `mandate_is_inactive` error if the linked mandate
|
|
16
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-mandates) is
|
|
17
|
+
# cancelled or has failed. Payments can be created against mandates with status
|
|
18
|
+
# of: `pending_customer_approval`, `pending_submission`, `submitted`, and
|
|
19
|
+
# `active`.
|
|
19
20
|
# Example URL: /payments
|
|
20
21
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
21
22
|
def create(options = {})
|
|
@@ -50,8 +51,9 @@ module GoCardlessPro
|
|
|
50
51
|
Resources::Payment.new(unenvelope_body(response.body), response)
|
|
51
52
|
end
|
|
52
53
|
|
|
53
|
-
# Returns a
|
|
54
|
-
#
|
|
54
|
+
# Returns a cursor-paginated
|
|
55
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
56
|
+
# list of your payments.
|
|
55
57
|
# Example URL: /payments
|
|
56
58
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
57
59
|
def list(options = {})
|
|
@@ -165,12 +167,12 @@ module GoCardlessPro
|
|
|
165
167
|
Resources::Payment.new(unenvelope_body(response.body), response)
|
|
166
168
|
end
|
|
167
169
|
|
|
168
|
-
#
|
|
169
|
-
#
|
|
170
|
-
#
|
|
171
|
-
#
|
|
172
|
-
#
|
|
173
|
-
#
|
|
170
|
+
# Retries a failed payment if the underlying mandate is active. You will receive
|
|
171
|
+
# a `resubmission_requested` webhook, but after that retrying the payment
|
|
172
|
+
# follows the same process as its initial creation, so you will receive a
|
|
173
|
+
# `submitted` webhook, followed by a `confirmed` or `failed` event. Any metadata
|
|
174
|
+
# supplied to this endpoint will be stored against the payment submission event
|
|
175
|
+
# it causes.
|
|
174
176
|
#
|
|
175
177
|
# This will return a `retry_failed` error if the payment has not failed.
|
|
176
178
|
#
|
|
@@ -219,7 +221,13 @@ module GoCardlessPro
|
|
|
219
221
|
#
|
|
220
222
|
# @param body [Hash]
|
|
221
223
|
def unenvelope_body(body)
|
|
222
|
-
body
|
|
224
|
+
if body.key?(envelope_key)
|
|
225
|
+
body[envelope_key]
|
|
226
|
+
elsif body.key?('data')
|
|
227
|
+
body['data']
|
|
228
|
+
else
|
|
229
|
+
body
|
|
230
|
+
end
|
|
223
231
|
end
|
|
224
232
|
|
|
225
233
|
# return the key which API responses will envelope data under
|
|
@@ -10,13 +10,12 @@ module GoCardlessPro
|
|
|
10
10
|
module Services
|
|
11
11
|
# Service for making requests to the PayoutItem endpoints
|
|
12
12
|
class PayoutItemsService < BaseService
|
|
13
|
-
# Returns a
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
# <strong>This endpoint only serves requests for payouts created in the last 6
|
|
17
|
-
# months. Requests for older payouts will return an HTTP status <code>410
|
|
18
|
-
# Gone</code>.</strong>
|
|
13
|
+
# Returns a cursor-paginated
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
15
|
+
# list of items in the payout.
|
|
19
16
|
#
|
|
17
|
+
# This endpoint only serves requests for payouts created in the last 6 months.
|
|
18
|
+
# Requests for older payouts will return an HTTP status 410 Gone.
|
|
20
19
|
# Example URL: /payout_items
|
|
21
20
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
22
21
|
def list(options = {})
|
|
@@ -50,7 +49,13 @@ module GoCardlessPro
|
|
|
50
49
|
#
|
|
51
50
|
# @param body [Hash]
|
|
52
51
|
def unenvelope_body(body)
|
|
53
|
-
body
|
|
52
|
+
if body.key?(envelope_key)
|
|
53
|
+
body[envelope_key]
|
|
54
|
+
elsif body.key?('data')
|
|
55
|
+
body['data']
|
|
56
|
+
else
|
|
57
|
+
body
|
|
58
|
+
end
|
|
54
59
|
end
|
|
55
60
|
|
|
56
61
|
# 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 Payout endpoints
|
|
12
12
|
class PayoutsService < BaseService
|
|
13
|
-
# Returns a
|
|
14
|
-
#
|
|
13
|
+
# Returns a cursor-paginated
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
15
|
+
# list of your payouts.
|
|
15
16
|
# Example URL: /payouts
|
|
16
17
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
17
18
|
def list(options = {})
|
|
@@ -40,8 +41,8 @@ module GoCardlessPro
|
|
|
40
41
|
end
|
|
41
42
|
|
|
42
43
|
# Retrieves the details of a single payout. For an example of how to reconcile
|
|
43
|
-
# the transactions in a payout, see
|
|
44
|
-
#
|
|
44
|
+
# the transactions in a payout, see this guide
|
|
45
|
+
# (https://developer.gocardless.com/api-reference/#events-reconciling-payouts-with-events).
|
|
45
46
|
# Example URL: /payouts/:identity
|
|
46
47
|
#
|
|
47
48
|
# @param identity # Unique identifier, beginning with "PO".
|
|
@@ -89,7 +90,13 @@ module GoCardlessPro
|
|
|
89
90
|
#
|
|
90
91
|
# @param body [Hash]
|
|
91
92
|
def unenvelope_body(body)
|
|
92
|
-
body
|
|
93
|
+
if body.key?(envelope_key)
|
|
94
|
+
body[envelope_key]
|
|
95
|
+
elsif body.key?('data')
|
|
96
|
+
body['data']
|
|
97
|
+
else
|
|
98
|
+
body
|
|
99
|
+
end
|
|
93
100
|
end
|
|
94
101
|
|
|
95
102
|
# return the key which API responses will envelope data under
|
|
@@ -65,10 +65,14 @@ module GoCardlessPro
|
|
|
65
65
|
Resources::RedirectFlow.new(unenvelope_body(response.body), response)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
# This creates a
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
# customer
|
|
68
|
+
# This creates a customer
|
|
69
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-customers),
|
|
70
|
+
# customer bank account
|
|
71
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-customer-bank-accounts),
|
|
72
|
+
# and mandate
|
|
73
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-mandates)
|
|
74
|
+
# using the details supplied by your customer and returns the ID of the created
|
|
75
|
+
# mandate.
|
|
72
76
|
#
|
|
73
77
|
# This will return a `redirect_flow_incomplete` error if your customer has not
|
|
74
78
|
# yet been redirected back to your site, and a `redirect_flow_already_completed`
|
|
@@ -119,7 +123,13 @@ module GoCardlessPro
|
|
|
119
123
|
#
|
|
120
124
|
# @param body [Hash]
|
|
121
125
|
def unenvelope_body(body)
|
|
122
|
-
body
|
|
126
|
+
if body.key?(envelope_key)
|
|
127
|
+
body[envelope_key]
|
|
128
|
+
elsif body.key?('data')
|
|
129
|
+
body['data']
|
|
130
|
+
else
|
|
131
|
+
body
|
|
132
|
+
end
|
|
123
133
|
end
|
|
124
134
|
|
|
125
135
|
# return the key which API responses will envelope data under
|
|
@@ -12,18 +12,16 @@ module GoCardlessPro
|
|
|
12
12
|
class RefundsService < BaseService
|
|
13
13
|
# Creates a new refund object.
|
|
14
14
|
#
|
|
15
|
-
# This fails with
|
|
16
|
-
# name="number_of_refunds_exceeded"></a><a
|
|
17
|
-
# name="available_refund_amount_insufficient"></a>
|
|
15
|
+
# This fails with:
|
|
18
16
|
#
|
|
19
|
-
# -
|
|
17
|
+
# -
|
|
18
|
+
# `total_amount_confirmation_invalid` if the confirmation amount doesn't match
|
|
20
19
|
# the total amount refunded for the payment. This safeguard is there to prevent
|
|
21
20
|
# two processes from creating refunds without awareness of each other.
|
|
22
|
-
#
|
|
23
|
-
#
|
|
21
|
+
# -
|
|
22
|
+
# `available_refund_amount_insufficient` if the creditor does not have
|
|
24
23
|
# sufficient balance for refunds available to cover the cost of the requested
|
|
25
24
|
# refund.
|
|
26
|
-
#
|
|
27
25
|
# Example URL: /refunds
|
|
28
26
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
29
27
|
def create(options = {})
|
|
@@ -58,8 +56,9 @@ module GoCardlessPro
|
|
|
58
56
|
Resources::Refund.new(unenvelope_body(response.body), response)
|
|
59
57
|
end
|
|
60
58
|
|
|
61
|
-
# Returns a
|
|
62
|
-
#
|
|
59
|
+
# Returns a cursor-paginated
|
|
60
|
+
# (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
|
|
61
|
+
# list of your refunds.
|
|
63
62
|
# Example URL: /refunds
|
|
64
63
|
# @param options [Hash] parameters as a hash, under a params key.
|
|
65
64
|
def list(options = {})
|
|
@@ -135,7 +134,13 @@ module GoCardlessPro
|
|
|
135
134
|
#
|
|
136
135
|
# @param body [Hash]
|
|
137
136
|
def unenvelope_body(body)
|
|
138
|
-
body
|
|
137
|
+
if body.key?(envelope_key)
|
|
138
|
+
body[envelope_key]
|
|
139
|
+
elsif body.key?('data')
|
|
140
|
+
body['data']
|
|
141
|
+
else
|
|
142
|
+
body
|
|
143
|
+
end
|
|
139
144
|
end
|
|
140
145
|
|
|
141
146
|
# return the key which API responses will envelope data under
|