gocardless_pro 2.29.0 → 2.30.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gocardless_pro/client.rb +1 -1
- data/lib/gocardless_pro/resources/billing_request.rb +2 -0
- data/lib/gocardless_pro/resources/billing_request_flow.rb +4 -0
- data/lib/gocardless_pro/resources/block.rb +19 -9
- data/lib/gocardless_pro/resources/institution.rb +5 -1
- data/lib/gocardless_pro/resources/payer_authorisation.rb +4 -4
- data/lib/gocardless_pro/resources/redirect_flow.rb +4 -0
- data/lib/gocardless_pro/services/billing_request_flows_service.rb +1 -1
- data/lib/gocardless_pro/services/billing_requests_service.rb +40 -2
- data/lib/gocardless_pro/services/institutions_service.rb +1 -1
- data/lib/gocardless_pro/version.rb +1 -1
- data/spec/resources/billing_request_flow_spec.rb +14 -0
- data/spec/resources/billing_request_spec.rb +108 -0
- data/spec/resources/block_spec.rb +18 -1
- data/spec/resources/creditor_bank_account_spec.rb +2 -0
- data/spec/resources/customer_bank_account_spec.rb +2 -0
- data/spec/resources/customer_notification_spec.rb +2 -0
- data/spec/resources/customer_spec.rb +2 -0
- data/spec/resources/instalment_schedule_spec.rb +2 -0
- data/spec/resources/mandate_import_spec.rb +4 -0
- data/spec/resources/mandate_spec.rb +4 -0
- data/spec/resources/payer_authorisation_spec.rb +4 -0
- data/spec/resources/payment_spec.rb +4 -0
- data/spec/resources/redirect_flow_spec.rb +2 -0
- data/spec/resources/scenario_simulator_spec.rb +2 -0
- data/spec/resources/subscription_spec.rb +6 -0
- data/spec/resources/webhook_spec.rb +2 -0
- data/spec/services/billing_request_flows_service_spec.rb +14 -0
- data/spec/services/billing_requests_service_spec.rb +123 -0
- data/spec/services/blocks_service_spec.rb +18 -1
- data/spec/services/creditor_bank_accounts_service_spec.rb +2 -0
- data/spec/services/customer_bank_accounts_service_spec.rb +2 -0
- data/spec/services/customer_notifications_service_spec.rb +2 -0
- data/spec/services/customers_service_spec.rb +2 -0
- data/spec/services/instalment_schedules_service_spec.rb +2 -0
- data/spec/services/mandate_imports_service_spec.rb +4 -0
- data/spec/services/mandates_service_spec.rb +4 -0
- data/spec/services/payer_authorisations_service_spec.rb +4 -0
- data/spec/services/payments_service_spec.rb +4 -0
- data/spec/services/redirect_flows_service_spec.rb +2 -0
- data/spec/services/scenario_simulators_service_spec.rb +2 -0
- data/spec/services/subscriptions_service_spec.rb +6 -0
- data/spec/services/webhooks_service_spec.rb +2 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1591576f071daabb20a04e9e91a7e802be0efed1b3e71910e33c35335589cdf4
|
4
|
+
data.tar.gz: 763c87329cc80eba691ae417c58b3344abbc7ffc48fe554be85fedcc24c1e80d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b8552085fb1ec811f6398ed9f52990853a48c4836e8f6092273366dcd0a9e1f27e4399cc8489322a726e94153dd221e1a4cd20b68f72a0c371d4b62984ac0bb
|
7
|
+
data.tar.gz: ec4ab730899aad19e7a670b5da2378e651db3bb1e88734e9794967ef33ac764e973b70e7c2a61613065a8284a1cf8afbf6879e8c7eaa13cda53a3176527be200
|
@@ -198,7 +198,7 @@ module GoCardlessPro
|
|
198
198
|
'User-Agent' => user_agent.to_s,
|
199
199
|
'Content-Type' => 'application/json',
|
200
200
|
'GoCardless-Client-Library' => 'gocardless-pro-ruby',
|
201
|
-
'GoCardless-Client-Version' => '2.
|
201
|
+
'GoCardless-Client-Version' => '2.30.0',
|
202
202
|
},
|
203
203
|
}
|
204
204
|
end
|
@@ -24,6 +24,7 @@ module GoCardlessPro
|
|
24
24
|
class BillingRequest
|
25
25
|
attr_reader :actions
|
26
26
|
attr_reader :created_at
|
27
|
+
attr_reader :fallback_enabled
|
27
28
|
attr_reader :id
|
28
29
|
attr_reader :mandate_request
|
29
30
|
attr_reader :metadata
|
@@ -38,6 +39,7 @@ module GoCardlessPro
|
|
38
39
|
|
39
40
|
@actions = object['actions']
|
40
41
|
@created_at = object['created_at']
|
42
|
+
@fallback_enabled = object['fallback_enabled']
|
41
43
|
@id = object['id']
|
42
44
|
@links = object['links']
|
43
45
|
@mandate_request = object['mandate_request']
|
@@ -19,12 +19,14 @@ module GoCardlessPro
|
|
19
19
|
attr_reader :authorisation_url
|
20
20
|
attr_reader :auto_fulfil
|
21
21
|
attr_reader :created_at
|
22
|
+
attr_reader :exit_uri
|
22
23
|
attr_reader :expires_at
|
23
24
|
attr_reader :id
|
24
25
|
attr_reader :lock_bank_account
|
25
26
|
attr_reader :lock_customer_details
|
26
27
|
attr_reader :redirect_uri
|
27
28
|
attr_reader :session_token
|
29
|
+
attr_reader :show_redirect_buttons
|
28
30
|
|
29
31
|
# Initialize a billing_request_flow resource instance
|
30
32
|
# @param object [Hash] an object returned from the API
|
@@ -34,6 +36,7 @@ module GoCardlessPro
|
|
34
36
|
@authorisation_url = object['authorisation_url']
|
35
37
|
@auto_fulfil = object['auto_fulfil']
|
36
38
|
@created_at = object['created_at']
|
39
|
+
@exit_uri = object['exit_uri']
|
37
40
|
@expires_at = object['expires_at']
|
38
41
|
@id = object['id']
|
39
42
|
@links = object['links']
|
@@ -41,6 +44,7 @@ module GoCardlessPro
|
|
41
44
|
@lock_customer_details = object['lock_customer_details']
|
42
45
|
@redirect_uri = object['redirect_uri']
|
43
46
|
@session_token = object['session_token']
|
47
|
+
@show_redirect_buttons = object['show_redirect_buttons']
|
44
48
|
@response = response
|
45
49
|
end
|
46
50
|
|
@@ -12,17 +12,27 @@ module GoCardlessPro
|
|
12
12
|
module Resources
|
13
13
|
# Represents an instance of a block resource returned from the API
|
14
14
|
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
15
|
+
# Blocks are created to prevent certain customer details from being used
|
16
|
+
# when creating
|
17
|
+
# mandates.
|
18
|
+
#
|
19
|
+
# The details used to create blocks can be exact matches, like a bank
|
20
|
+
# account or an email,
|
21
|
+
# or a more generic match such as an email domain. New block types may be
|
22
|
+
# added over time.
|
23
|
+
#
|
24
|
+
# A block object is in essence a simple rule that is used to match against
|
25
|
+
# details in a
|
26
|
+
# newly created mandate. If there is a successful match then the mandate is
|
27
|
+
# transitioned
|
28
|
+
# to a "blocked" state.
|
29
|
+
#
|
30
|
+
# Payments and subscriptions cannot be created against a mandate in blocked
|
31
|
+
# state.
|
32
|
+
#
|
33
|
+
# A mandate can never be transitioned out of the blocked state.
|
22
34
|
#
|
23
35
|
# <p class="notice">
|
24
|
-
# Client libraries have not yet been updated for this API but will be
|
25
|
-
# released soon.
|
26
36
|
# This API is currently only available for approved integrators - please
|
27
37
|
# <a href="mailto:help@gocardless.com">get in touch</a> if you would like to
|
28
38
|
# use this API.
|
@@ -13,7 +13,11 @@ module GoCardlessPro
|
|
13
13
|
# Represents an instance of a institution resource returned from the API
|
14
14
|
|
15
15
|
# Institutions that are supported when creating [Bank
|
16
|
-
# Authorisations](#billing-requests-bank-authorisations)
|
16
|
+
# Authorisations](#billing-requests-bank-authorisations) for a particular
|
17
|
+
# country or purpose.
|
18
|
+
#
|
19
|
+
# Not all institutions support both Payment Initiation (PIS) and Account
|
20
|
+
# Information (AIS) services.
|
17
21
|
class Institution
|
18
22
|
attr_reader :country_code
|
19
23
|
attr_reader :icon_url
|
@@ -13,12 +13,12 @@ module GoCardlessPro
|
|
13
13
|
# Represents an instance of a payer_authorisation resource returned from the API
|
14
14
|
|
15
15
|
# <p class="restricted-notice">
|
16
|
-
# Payer Authorisations
|
16
|
+
# Don't use Payer Authorisations for new integrations.
|
17
|
+
# It is deprecated in favour of
|
17
18
|
# <a
|
18
19
|
# href="https://developer.gocardless.com/getting-started/billing-requests/overview/">
|
19
|
-
# Billing Requests</a>.
|
20
|
-
#
|
21
|
-
# future integrations.
|
20
|
+
# Billing Requests</a>. Use Billing Requests to build any future
|
21
|
+
# integrations.
|
22
22
|
# </p>
|
23
23
|
#
|
24
24
|
# Payer Authorisation resource acts as a wrapper for creating customer, bank
|
@@ -34,7 +34,7 @@ module GoCardlessPro
|
|
34
34
|
# integrations that manipulate the flow.
|
35
35
|
# Example URL: /billing_request_flows/:identity/actions/initialise
|
36
36
|
#
|
37
|
-
# @param identity # Unique identifier, beginning with "
|
37
|
+
# @param identity # Unique identifier, beginning with "BRF".
|
38
38
|
# @param options [Hash] parameters as a hash, under a params key.
|
39
39
|
def initialise(identity, options = {})
|
40
40
|
path = sub_url('/billing_request_flows/:identity/actions/initialise', 'identity' => identity)
|
@@ -11,7 +11,7 @@ module GoCardlessPro
|
|
11
11
|
# Service for making requests to the BillingRequest endpoints
|
12
12
|
class BillingRequestsService < BaseService
|
13
13
|
# Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
|
14
|
-
#
|
14
|
+
# billing requests.
|
15
15
|
# Example URL: /billing_requests
|
16
16
|
# @param options [Hash] parameters as a hash, under a params key.
|
17
17
|
def list(options = {})
|
@@ -218,7 +218,7 @@ module GoCardlessPro
|
|
218
218
|
Resources::BillingRequest.new(unenvelope_body(response.body), response)
|
219
219
|
end
|
220
220
|
|
221
|
-
# This is needed when you have
|
221
|
+
# This is needed when you have a mandate request. As a scheme compliance rule we
|
222
222
|
# are required to
|
223
223
|
# allow the payer to crosscheck the details entered by them and confirm it.
|
224
224
|
# Example URL: /billing_requests/:identity/actions/confirm_payer_details
|
@@ -334,6 +334,44 @@ module GoCardlessPro
|
|
334
334
|
Resources::BillingRequest.new(unenvelope_body(response.body), response)
|
335
335
|
end
|
336
336
|
|
337
|
+
# Triggers a fallback from the open-banking flow to direct debit. Note, the
|
338
|
+
# billing request must have fallback enabled.
|
339
|
+
# Example URL: /billing_requests/:identity/actions/fallback
|
340
|
+
#
|
341
|
+
# @param identity # Unique identifier, beginning with "BRQ".
|
342
|
+
# @param options [Hash] parameters as a hash, under a params key.
|
343
|
+
def fallback(identity, options = {})
|
344
|
+
path = sub_url('/billing_requests/:identity/actions/fallback', 'identity' => identity)
|
345
|
+
|
346
|
+
params = options.delete(:params) || {}
|
347
|
+
options[:params] = {}
|
348
|
+
options[:params]['data'] = params
|
349
|
+
|
350
|
+
options[:retry_failures] = false
|
351
|
+
|
352
|
+
begin
|
353
|
+
response = make_request(:post, path, options)
|
354
|
+
|
355
|
+
# Response doesn't raise any errors until #body is called
|
356
|
+
response.tap(&:body)
|
357
|
+
rescue InvalidStateError => e
|
358
|
+
if e.idempotent_creation_conflict?
|
359
|
+
case @api_service.on_idempotency_conflict
|
360
|
+
when :raise
|
361
|
+
raise IdempotencyConflict, e.error
|
362
|
+
when :fetch
|
363
|
+
return get(e.conflicting_resource_id)
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
raise e
|
368
|
+
end
|
369
|
+
|
370
|
+
return if response.body.nil?
|
371
|
+
|
372
|
+
Resources::BillingRequest.new(unenvelope_body(response.body), response)
|
373
|
+
end
|
374
|
+
|
337
375
|
private
|
338
376
|
|
339
377
|
# Unenvelope the response of the body using the service's `envelope_key`
|
@@ -10,7 +10,7 @@ module GoCardlessPro
|
|
10
10
|
module Services
|
11
11
|
# Service for making requests to the Institution endpoints
|
12
12
|
class InstitutionsService < BaseService
|
13
|
-
# Returns a list of
|
13
|
+
# Returns a list of supported institutions.
|
14
14
|
# Example URL: /institutions
|
15
15
|
# @param options [Hash] parameters as a hash, under a params key.
|
16
16
|
def list(options = {})
|
@@ -18,6 +18,7 @@ describe GoCardlessPro::Resources::BillingRequestFlow do
|
|
18
18
|
'authorisation_url' => 'authorisation_url-input',
|
19
19
|
'auto_fulfil' => 'auto_fulfil-input',
|
20
20
|
'created_at' => 'created_at-input',
|
21
|
+
'exit_uri' => 'exit_uri-input',
|
21
22
|
'expires_at' => 'expires_at-input',
|
22
23
|
'id' => 'id-input',
|
23
24
|
'links' => 'links-input',
|
@@ -25,6 +26,7 @@ describe GoCardlessPro::Resources::BillingRequestFlow do
|
|
25
26
|
'lock_customer_details' => 'lock_customer_details-input',
|
26
27
|
'redirect_uri' => 'redirect_uri-input',
|
27
28
|
'session_token' => 'session_token-input',
|
29
|
+
'show_redirect_buttons' => 'show_redirect_buttons-input',
|
28
30
|
}
|
29
31
|
end
|
30
32
|
|
@@ -37,6 +39,7 @@ describe GoCardlessPro::Resources::BillingRequestFlow do
|
|
37
39
|
'authorisation_url' => 'authorisation_url-input',
|
38
40
|
'auto_fulfil' => 'auto_fulfil-input',
|
39
41
|
'created_at' => 'created_at-input',
|
42
|
+
'exit_uri' => 'exit_uri-input',
|
40
43
|
'expires_at' => 'expires_at-input',
|
41
44
|
'id' => 'id-input',
|
42
45
|
'links' => 'links-input',
|
@@ -44,6 +47,7 @@ describe GoCardlessPro::Resources::BillingRequestFlow do
|
|
44
47
|
'lock_customer_details' => 'lock_customer_details-input',
|
45
48
|
'redirect_uri' => 'redirect_uri-input',
|
46
49
|
'session_token' => 'session_token-input',
|
50
|
+
'show_redirect_buttons' => 'show_redirect_buttons-input',
|
47
51
|
},
|
48
52
|
}
|
49
53
|
).
|
@@ -56,6 +60,7 @@ describe GoCardlessPro::Resources::BillingRequestFlow do
|
|
56
60
|
'authorisation_url' => 'authorisation_url-input',
|
57
61
|
'auto_fulfil' => 'auto_fulfil-input',
|
58
62
|
'created_at' => 'created_at-input',
|
63
|
+
'exit_uri' => 'exit_uri-input',
|
59
64
|
'expires_at' => 'expires_at-input',
|
60
65
|
'id' => 'id-input',
|
61
66
|
'links' => 'links-input',
|
@@ -63,6 +68,7 @@ describe GoCardlessPro::Resources::BillingRequestFlow do
|
|
63
68
|
'lock_customer_details' => 'lock_customer_details-input',
|
64
69
|
'redirect_uri' => 'redirect_uri-input',
|
65
70
|
'session_token' => 'session_token-input',
|
71
|
+
'show_redirect_buttons' => 'show_redirect_buttons-input',
|
66
72
|
},
|
67
73
|
|
68
74
|
}.to_json,
|
@@ -108,6 +114,7 @@ describe GoCardlessPro::Resources::BillingRequestFlow do
|
|
108
114
|
'authorisation_url' => 'authorisation_url-input',
|
109
115
|
'auto_fulfil' => 'auto_fulfil-input',
|
110
116
|
'created_at' => 'created_at-input',
|
117
|
+
'exit_uri' => 'exit_uri-input',
|
111
118
|
'expires_at' => 'expires_at-input',
|
112
119
|
'id' => 'id-input',
|
113
120
|
'links' => 'links-input',
|
@@ -115,6 +122,7 @@ describe GoCardlessPro::Resources::BillingRequestFlow do
|
|
115
122
|
'lock_customer_details' => 'lock_customer_details-input',
|
116
123
|
'redirect_uri' => 'redirect_uri-input',
|
117
124
|
'session_token' => 'session_token-input',
|
125
|
+
'show_redirect_buttons' => 'show_redirect_buttons-input',
|
118
126
|
}
|
119
127
|
end
|
120
128
|
|
@@ -156,12 +164,14 @@ describe GoCardlessPro::Resources::BillingRequestFlow do
|
|
156
164
|
# /billing_request_flows/%v/actions/initialise
|
157
165
|
stub_url = '/billing_request_flows/:identity/actions/initialise'.gsub(':identity', resource_id)
|
158
166
|
stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
|
167
|
+
|
159
168
|
body: {
|
160
169
|
'billing_request_flows' => {
|
161
170
|
|
162
171
|
'authorisation_url' => 'authorisation_url-input',
|
163
172
|
'auto_fulfil' => 'auto_fulfil-input',
|
164
173
|
'created_at' => 'created_at-input',
|
174
|
+
'exit_uri' => 'exit_uri-input',
|
165
175
|
'expires_at' => 'expires_at-input',
|
166
176
|
'id' => 'id-input',
|
167
177
|
'links' => 'links-input',
|
@@ -169,8 +179,10 @@ describe GoCardlessPro::Resources::BillingRequestFlow do
|
|
169
179
|
'lock_customer_details' => 'lock_customer_details-input',
|
170
180
|
'redirect_uri' => 'redirect_uri-input',
|
171
181
|
'session_token' => 'session_token-input',
|
182
|
+
'show_redirect_buttons' => 'show_redirect_buttons-input',
|
172
183
|
},
|
173
184
|
}.to_json,
|
185
|
+
|
174
186
|
headers: response_headers
|
175
187
|
)
|
176
188
|
end
|
@@ -202,6 +214,7 @@ describe GoCardlessPro::Resources::BillingRequestFlow do
|
|
202
214
|
'authorisation_url' => 'authorisation_url-input',
|
203
215
|
'auto_fulfil' => 'auto_fulfil-input',
|
204
216
|
'created_at' => 'created_at-input',
|
217
|
+
'exit_uri' => 'exit_uri-input',
|
205
218
|
'expires_at' => 'expires_at-input',
|
206
219
|
'id' => 'id-input',
|
207
220
|
'links' => 'links-input',
|
@@ -209,6 +222,7 @@ describe GoCardlessPro::Resources::BillingRequestFlow do
|
|
209
222
|
'lock_customer_details' => 'lock_customer_details-input',
|
210
223
|
'redirect_uri' => 'redirect_uri-input',
|
211
224
|
'session_token' => 'session_token-input',
|
225
|
+
'show_redirect_buttons' => 'show_redirect_buttons-input',
|
212
226
|
},
|
213
227
|
}.to_json,
|
214
228
|
headers: response_headers
|