gocardless_pro 2.43.0 → 2.45.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfe5bc79f3dd706e3d9dc4e31b84986be8118e699cfda79a3e17f4b495e2aa23
4
- data.tar.gz: 75c9e531d0dab00f03aeecef2d647972c71a9bcffd90d4b75a43909447bbd4bc
3
+ metadata.gz: f933bb05815504fee3eb6ea9893bfc3b3a2588b0672a5bf015b0d91309f98ff6
4
+ data.tar.gz: 151cd4b107edad4c6b6c55edfbbce6119d7d2c9eecee964c825b70e929733383
5
5
  SHA512:
6
- metadata.gz: 394f30d4aa47fd83b1a5c0db1c2774252fc399765bdef738295706c9f323803f2aa9c1758cad4f7acf1030a882c9644e1949e4e5dbdfab8b6e169539a30e2acd
7
- data.tar.gz: '0638aac1d12e70e24614f19f692f0520fd7d28aba525a9708f8f0e99e302f8d04b56d752a89d7d423522ab283036917640b835df3c96f0c3157f2bc60d946924'
6
+ metadata.gz: 77c2b924f6aa8f9866657fc98d7c9c7531c2a1cea2cdd2d91c88adf3a0fc60dd5cbbf4a05a9c614be4fc88441403ff9b29c4eb662a6d8b3094bdfef1bbb12bd5
7
+ data.tar.gz: 0fb451d644a7f14b703857e51f6cb29a07410692f0943caa11561083a8e8119772c4f709f2fb50df62cabdd656f556ea9cbfa0b93e138150b40d01f379cba3ba
@@ -208,7 +208,7 @@ module GoCardlessPro
208
208
  'User-Agent' => "#{user_agent}",
209
209
  'Content-Type' => 'application/json',
210
210
  'GoCardless-Client-Library' => 'gocardless-pro-ruby',
211
- 'GoCardless-Client-Version' => '2.43.0',
211
+ 'GoCardless-Client-Version' => '2.45.0',
212
212
  },
213
213
  }
214
214
  end
@@ -29,6 +29,7 @@ module GoCardlessPro
29
29
  attr_reader :redirect_uri
30
30
  attr_reader :session_token
31
31
  attr_reader :show_redirect_buttons
32
+ attr_reader :show_success_redirect_button
32
33
 
33
34
  # Initialize a billing_request_flow resource instance
34
35
  # @param object [Hash] an object returned from the API
@@ -51,6 +52,7 @@ module GoCardlessPro
51
52
  @redirect_uri = object['redirect_uri']
52
53
  @session_token = object['session_token']
53
54
  @show_redirect_buttons = object['show_redirect_buttons']
55
+ @show_success_redirect_button = object['show_success_redirect_button']
54
56
  @response = response
55
57
  end
56
58
 
@@ -18,7 +18,6 @@ module GoCardlessPro
18
18
  # Currently, for Anti Money Laundering reasons, any creditors you add must
19
19
  # be directly related to your organisation.
20
20
  class Creditor
21
- attr_reader :activated
22
21
  attr_reader :address_line1
23
22
  attr_reader :address_line2
24
23
  attr_reader :address_line3
@@ -44,7 +43,6 @@ module GoCardlessPro
44
43
  def initialize(object, response = nil)
45
44
  @object = object
46
45
 
47
- @activated = object['activated']
48
46
  @address_line1 = object['address_line1']
49
47
  @address_line2 = object['address_line2']
50
48
  @address_line3 = object['address_line3']
@@ -136,6 +136,10 @@ module GoCardlessPro
136
136
  @links['refund']
137
137
  end
138
138
 
139
+ def scheme_identifier
140
+ @links['scheme_identifier']
141
+ end
142
+
139
143
  def subscription
140
144
  @links['subscription']
141
145
  end
@@ -26,7 +26,11 @@ module GoCardlessPro
26
26
  #
27
27
  # The Payout Items API allows you to view, on a per-payout basis, the credit
28
28
  # and debit
29
- # items that make up that payout's amount.
29
+ # items that make up that payout's amount. Payout items can only be
30
+ # retrieved for payouts
31
+ # created in the last 6 months. Requests for older payouts will return an
32
+ # HTTP status
33
+ # <code>410 Gone</code>.
30
34
  #
31
35
  class PayoutItem
32
36
  attr_reader :amount
@@ -10,6 +10,12 @@ module GoCardlessPro
10
10
  module Resources
11
11
  # Represents an instance of a redirect_flow resource returned from the API
12
12
 
13
+ # <p class="deprecated-notice"><strong>Deprecated</strong>: Redirect Flows
14
+ # are our legacy APIs for setting up
15
+ # mandates and will no longer be supported in the future. We strongly
16
+ # recommend using the
17
+ # [Billing Request flow](#billing-requests) instead.</p>
18
+ #
13
19
  # Redirect flows enable you to use GoCardless' [hosted payment
14
20
  # pages](https://pay-sandbox.gocardless.com/AL000000AKFPFF) to set up
15
21
  # mandates with your customers. These pages are fully compliant and have
@@ -10,7 +10,17 @@ module GoCardlessPro
10
10
  module Resources
11
11
  # Represents an instance of a verification_detail resource returned from the API
12
12
 
13
- # Details of a creditor that are required for verification
13
+ # Verification details represent any information needed by GoCardless to
14
+ # verify a creditor.
15
+ #
16
+ # <p class="restricted-notice"><strong>Restricted</strong>:
17
+ # These endpoints are restricted to customers who want to collect their
18
+ # merchant's
19
+ # verification details and pass them to GoCardless via our API. Please
20
+ # [get in
21
+ # touch](mailto:help@gocardless.com) if you wish to enable this feature on
22
+ # your
23
+ # account.</p>
14
24
  class VerificationDetail
15
25
  attr_reader :address_line1
16
26
  attr_reader :address_line2
@@ -10,25 +10,6 @@ module GoCardlessPro
10
10
  module Services
11
11
  # Service for making requests to the BankAuthorisation endpoints
12
12
  class BankAuthorisationsService < BaseService
13
- # Fetches a bank authorisation
14
- # Example URL: /bank_authorisations/:identity
15
- #
16
- # @param identity # Unique identifier, beginning with "BAU".
17
- # @param options [Hash] parameters as a hash, under a params key.
18
- def get(identity, options = {})
19
- path = sub_url('/bank_authorisations/:identity', {
20
- 'identity' => identity,
21
- })
22
-
23
- options[:retry_failures] = true
24
-
25
- response = make_request(:get, path, options)
26
-
27
- return if response.body.nil?
28
-
29
- Resources::BankAuthorisation.new(unenvelope_body(response.body), response)
30
- end
31
-
32
13
  # Create a Bank Authorisation.
33
14
  # Example URL: /bank_authorisations
34
15
  # @param options [Hash] parameters as a hash, under a params key.
@@ -64,6 +45,25 @@ module GoCardlessPro
64
45
  Resources::BankAuthorisation.new(unenvelope_body(response.body), response)
65
46
  end
66
47
 
48
+ # Get a single bank authorisation.
49
+ # Example URL: /bank_authorisations/:identity
50
+ #
51
+ # @param identity # Unique identifier, beginning with "BAU".
52
+ # @param options [Hash] parameters as a hash, under a params key.
53
+ def get(identity, options = {})
54
+ path = sub_url('/bank_authorisations/: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::BankAuthorisation.new(unenvelope_body(response.body), response)
65
+ end
66
+
67
67
  private
68
68
 
69
69
  # Unenvelope the response of the body using the service's `envelope_key`
@@ -10,35 +10,6 @@ module GoCardlessPro
10
10
  module Services
11
11
  # Service for making requests to the BillingRequest endpoints
12
12
  class BillingRequestsService < BaseService
13
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
14
- # billing requests.
15
- # Example URL: /billing_requests
16
- # @param options [Hash] parameters as a hash, under a params key.
17
- def list(options = {})
18
- path = '/billing_requests'
19
-
20
- options[:retry_failures] = true
21
-
22
- response = make_request(:get, path, options)
23
-
24
- ListResponse.new(
25
- response: response,
26
- unenveloped_body: unenvelope_body(response.body),
27
- resource_class: Resources::BillingRequest
28
- )
29
- end
30
-
31
- # Get a lazily enumerated list of all the items returned. This is similar to the `list` method but will paginate for you automatically.
32
- #
33
- # @param options [Hash] parameters as a hash. If the request is a GET, these will be converted to query parameters.
34
- # Otherwise they will be the body of the request.
35
- def all(options = {})
36
- Paginator.new(
37
- service: self,
38
- options: options
39
- ).enumerator
40
- end
41
-
42
13
  #
43
14
  # Example URL: /billing_requests
44
15
  # @param options [Hash] parameters as a hash, under a params key.
@@ -74,25 +45,6 @@ module GoCardlessPro
74
45
  Resources::BillingRequest.new(unenvelope_body(response.body), response)
75
46
  end
76
47
 
77
- # Fetches a billing request
78
- # Example URL: /billing_requests/:identity
79
- #
80
- # @param identity # Unique identifier, beginning with "BRQ".
81
- # @param options [Hash] parameters as a hash, under a params key.
82
- def get(identity, options = {})
83
- path = sub_url('/billing_requests/:identity', {
84
- 'identity' => identity,
85
- })
86
-
87
- options[:retry_failures] = true
88
-
89
- response = make_request(:get, path, options)
90
-
91
- return if response.body.nil?
92
-
93
- Resources::BillingRequest.new(unenvelope_body(response.body), response)
94
- end
95
-
96
48
  # If the billing request has a pending <code>collect_customer_details</code>
97
49
  # action, this endpoint can be used to collect the details in order to
98
50
  # complete it.
@@ -192,6 +144,47 @@ module GoCardlessPro
192
144
  Resources::BillingRequest.new(unenvelope_body(response.body), response)
193
145
  end
194
146
 
147
+ # This is needed when you have a mandate request. As a scheme compliance rule we
148
+ # are required to
149
+ # allow the payer to crosscheck the details entered by them and confirm it.
150
+ # Example URL: /billing_requests/:identity/actions/confirm_payer_details
151
+ #
152
+ # @param identity # Unique identifier, beginning with "BRQ".
153
+ # @param options [Hash] parameters as a hash, under a params key.
154
+ def confirm_payer_details(identity, options = {})
155
+ path = sub_url('/billing_requests/:identity/actions/confirm_payer_details', {
156
+ 'identity' => identity,
157
+ })
158
+
159
+ params = options.delete(:params) || {}
160
+ options[:params] = {}
161
+ options[:params]['data'] = params
162
+
163
+ options[:retry_failures] = false
164
+
165
+ begin
166
+ response = make_request(:post, path, options)
167
+
168
+ # Response doesn't raise any errors until #body is called
169
+ response.tap(&:body)
170
+ rescue InvalidStateError => e
171
+ if e.idempotent_creation_conflict?
172
+ case @api_service.on_idempotency_conflict
173
+ when :raise
174
+ raise IdempotencyConflict, e.error
175
+ when :fetch
176
+ return get(e.conflicting_resource_id)
177
+ end
178
+ end
179
+
180
+ raise e
181
+ end
182
+
183
+ return if response.body.nil?
184
+
185
+ Resources::BillingRequest.new(unenvelope_body(response.body), response)
186
+ end
187
+
195
188
  # If a billing request is ready to be fulfilled, call this endpoint to cause
196
189
  # it to fulfil, executing the payment.
197
190
  # Example URL: /billing_requests/:identity/actions/fulfil
@@ -232,19 +225,14 @@ module GoCardlessPro
232
225
  Resources::BillingRequest.new(unenvelope_body(response.body), response)
233
226
  end
234
227
 
235
- # This will allow for the updating of the currency and subsequently the scheme
236
- # if
237
- # needed for a Billing Request. This will only be available for mandate only
238
- # flows
239
- # which do not have the lock_currency flag set to true on the Billing Request
240
- # Flow. It
241
- # will also not support any request which has a payments request.
242
- # Example URL: /billing_requests/:identity/actions/choose_currency
228
+ # Immediately cancels a billing request, causing all billing request flows
229
+ # to expire.
230
+ # Example URL: /billing_requests/:identity/actions/cancel
243
231
  #
244
232
  # @param identity # Unique identifier, beginning with "BRQ".
245
233
  # @param options [Hash] parameters as a hash, under a params key.
246
- def choose_currency(identity, options = {})
247
- path = sub_url('/billing_requests/:identity/actions/choose_currency', {
234
+ def cancel(identity, options = {})
235
+ path = sub_url('/billing_requests/:identity/actions/cancel', {
248
236
  'identity' => identity,
249
237
  })
250
238
 
@@ -277,15 +265,66 @@ module GoCardlessPro
277
265
  Resources::BillingRequest.new(unenvelope_body(response.body), response)
278
266
  end
279
267
 
280
- # This is needed when you have a mandate request. As a scheme compliance rule we
281
- # are required to
282
- # allow the payer to crosscheck the details entered by them and confirm it.
283
- # Example URL: /billing_requests/:identity/actions/confirm_payer_details
268
+ # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
269
+ # billing requests.
270
+ # Example URL: /billing_requests
271
+ # @param options [Hash] parameters as a hash, under a params key.
272
+ def list(options = {})
273
+ path = '/billing_requests'
274
+
275
+ options[:retry_failures] = true
276
+
277
+ response = make_request(:get, path, options)
278
+
279
+ ListResponse.new(
280
+ response: response,
281
+ unenveloped_body: unenvelope_body(response.body),
282
+ resource_class: Resources::BillingRequest
283
+ )
284
+ end
285
+
286
+ # Get a lazily enumerated list of all the items returned. This is similar to the `list` method but will paginate for you automatically.
287
+ #
288
+ # @param options [Hash] parameters as a hash. If the request is a GET, these will be converted to query parameters.
289
+ # Otherwise they will be the body of the request.
290
+ def all(options = {})
291
+ Paginator.new(
292
+ service: self,
293
+ options: options
294
+ ).enumerator
295
+ end
296
+
297
+ # Fetches a billing request
298
+ # Example URL: /billing_requests/:identity
284
299
  #
285
300
  # @param identity # Unique identifier, beginning with "BRQ".
286
301
  # @param options [Hash] parameters as a hash, under a params key.
287
- def confirm_payer_details(identity, options = {})
288
- path = sub_url('/billing_requests/:identity/actions/confirm_payer_details', {
302
+ def get(identity, options = {})
303
+ path = sub_url('/billing_requests/:identity', {
304
+ 'identity' => identity,
305
+ })
306
+
307
+ options[:retry_failures] = true
308
+
309
+ response = make_request(:get, path, options)
310
+
311
+ return if response.body.nil?
312
+
313
+ Resources::BillingRequest.new(unenvelope_body(response.body), response)
314
+ end
315
+
316
+ # Notifies the customer linked to the billing request, asking them to authorise
317
+ # it.
318
+ # Currently, the customer can only be notified by email.
319
+ #
320
+ # This endpoint is currently supported only for Instant Bank Pay Billing
321
+ # Requests.
322
+ # Example URL: /billing_requests/:identity/actions/notify
323
+ #
324
+ # @param identity # Unique identifier, beginning with "BRQ".
325
+ # @param options [Hash] parameters as a hash, under a params key.
326
+ def notify(identity, options = {})
327
+ path = sub_url('/billing_requests/:identity/actions/notify', {
289
328
  'identity' => identity,
290
329
  })
291
330
 
@@ -318,14 +357,14 @@ module GoCardlessPro
318
357
  Resources::BillingRequest.new(unenvelope_body(response.body), response)
319
358
  end
320
359
 
321
- # Immediately cancels a billing request, causing all billing request flows
322
- # to expire.
323
- # Example URL: /billing_requests/:identity/actions/cancel
360
+ # Triggers a fallback from the open-banking flow to direct debit. Note, the
361
+ # billing request must have fallback enabled.
362
+ # Example URL: /billing_requests/:identity/actions/fallback
324
363
  #
325
364
  # @param identity # Unique identifier, beginning with "BRQ".
326
365
  # @param options [Hash] parameters as a hash, under a params key.
327
- def cancel(identity, options = {})
328
- path = sub_url('/billing_requests/:identity/actions/cancel', {
366
+ def fallback(identity, options = {})
367
+ path = sub_url('/billing_requests/:identity/actions/fallback', {
329
368
  'identity' => identity,
330
369
  })
331
370
 
@@ -358,15 +397,19 @@ module GoCardlessPro
358
397
  Resources::BillingRequest.new(unenvelope_body(response.body), response)
359
398
  end
360
399
 
361
- # Notifies the customer linked to the billing request, asking them to authorise
362
- # it.
363
- # Currently, the customer can only be notified by email.
364
- # Example URL: /billing_requests/:identity/actions/notify
400
+ # This will allow for the updating of the currency and subsequently the scheme
401
+ # if
402
+ # needed for a Billing Request. This will only be available for mandate only
403
+ # flows
404
+ # which do not have the lock_currency flag set to true on the Billing Request
405
+ # Flow. It
406
+ # will also not support any request which has a payments request.
407
+ # Example URL: /billing_requests/:identity/actions/choose_currency
365
408
  #
366
409
  # @param identity # Unique identifier, beginning with "BRQ".
367
410
  # @param options [Hash] parameters as a hash, under a params key.
368
- def notify(identity, options = {})
369
- path = sub_url('/billing_requests/:identity/actions/notify', {
411
+ def choose_currency(identity, options = {})
412
+ path = sub_url('/billing_requests/:identity/actions/choose_currency', {
370
413
  'identity' => identity,
371
414
  })
372
415
 
@@ -399,14 +442,13 @@ module GoCardlessPro
399
442
  Resources::BillingRequest.new(unenvelope_body(response.body), response)
400
443
  end
401
444
 
402
- # Triggers a fallback from the open-banking flow to direct debit. Note, the
403
- # billing request must have fallback enabled.
404
- # Example URL: /billing_requests/:identity/actions/fallback
445
+ # Creates an Institution object and attaches it to the Billing Request
446
+ # Example URL: /billing_requests/:identity/actions/select_institution
405
447
  #
406
448
  # @param identity # Unique identifier, beginning with "BRQ".
407
449
  # @param options [Hash] parameters as a hash, under a params key.
408
- def fallback(identity, options = {})
409
- path = sub_url('/billing_requests/:identity/actions/fallback', {
450
+ def select_institution(identity, options = {})
451
+ path = sub_url('/billing_requests/:identity/actions/select_institution', {
410
452
  'identity' => identity,
411
453
  })
412
454
 
@@ -119,11 +119,20 @@ module GoCardlessPro
119
119
 
120
120
  # Applies a [scheme identifier](#core-endpoints-scheme-identifiers) to a
121
121
  # creditor.
122
+ #
123
+ # If the scheme identifier has a `pending` status, it will be applied
124
+ # asynchronously
125
+ # once it becomes `active`.
126
+ #
122
127
  # If the creditor already has a scheme identifier for the scheme, it will be
123
128
  # replaced,
124
- # and any mandates attached to it transferred asynchronously.
125
- # For some schemes, the application of the scheme identifier will be performed
126
- # asynchronously.
129
+ # and any mandates attached to it transferred asynchronously. On Bacs and SEPA,
130
+ # if
131
+ # payments were about to be submitted, they will be delayed. To minimise this
132
+ # delay, we
133
+ # recommend that you apply the new scheme identifier after the daily payment
134
+ # submission
135
+ # time (4 PM Europe/London time).
127
136
  #
128
137
  # Example URL: /creditors/:identity/actions/apply_scheme_identifier
129
138
  #
@@ -11,6 +11,13 @@ module GoCardlessPro
11
11
  # Service for making requests to the Institution endpoints
12
12
  class InstitutionsService < BaseService
13
13
  # Returns a list of supported institutions.
14
+ #
15
+ # <p class="deprecated-notice"><strong>Deprecated</strong>: This list
16
+ # institutions endpoint
17
+ # is no longer supported. We strongly recommend using the
18
+ # [List Institutions For Billing
19
+ # Request](#institutions-list-institutions-for-billing-request)
20
+ # instead.</p>
14
21
  # Example URL: /institutions
15
22
  # @param options [Hash] parameters as a hash, under a params key.
16
23
  def list(options = {})
@@ -38,6 +45,29 @@ module GoCardlessPro
38
45
  ).enumerator
39
46
  end
40
47
 
48
+ # Returns all institutions valid for a Billing Request.
49
+ #
50
+ # This endpoint is currently supported only for FasterPayments.
51
+ # Example URL: /billing_requests/:identity/institutions
52
+ #
53
+ # @param identity # Unique identifier, beginning with "BRQ".
54
+ # @param options [Hash] parameters as a hash, under a params key.
55
+ def list_for_billing_request(identity, options = {})
56
+ path = sub_url('/billing_requests/:identity/institutions', {
57
+ 'identity' => identity,
58
+ })
59
+
60
+ options[:retry_failures] = false
61
+
62
+ response = make_request(:get, path, options)
63
+
64
+ ListResponse.new(
65
+ response: response,
66
+ unenveloped_body: unenvelope_body(response.body),
67
+ resource_class: Resources::Institution
68
+ )
69
+ end
70
+
41
71
  private
42
72
 
43
73
  # Unenvelope the response of the body using the service's `envelope_key`
@@ -13,11 +13,9 @@ module GoCardlessPro
13
13
  # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of items in
14
14
  # the payout.
15
15
  #
16
- # <div class="notice notice--warning u-block">
17
- # <strong>Note</strong>: From 1 March 2023 onwards, we will only serve
18
- # requests for payout items created in the last 6 months. Requests for older
19
- # payouts will return an HTTP status <code>410 Gone</code>.
20
- # </div>
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>
21
19
  #
22
20
  # Example URL: /payout_items
23
21
  # @param options [Hash] parameters as a hash, under a params key.
@@ -10,11 +10,43 @@ module GoCardlessPro
10
10
  module Services
11
11
  # Service for making requests to the SchemeIdentifier endpoints
12
12
  class SchemeIdentifiersService < BaseService
13
- # Creates a new scheme identifier. The scheme identifier must be [applied to a
14
- # creditor](#creditors-apply-a-scheme-identifier) before payments are taken
13
+ # Creates a new scheme identifier. The scheme identifier must be
14
+ # [applied to a creditor](#creditors-apply-a-scheme-identifier) before payments
15
+ # are taken
15
16
  # using it. The scheme identifier must also have the `status` of active before
16
- # it can be used. For some schemes e.g. faster_payments this will happen
17
- # instantly. For other schemes e.g. bacs this can take several days.
17
+ # it can be
18
+ # used. On Bacs, this will take 5 working days. On other schemes, this happens
19
+ # instantly.
20
+ #
21
+ # #### Scheme identifier name validations
22
+ #
23
+ # The `name` field of a scheme identifier can contain alphanumeric characters,
24
+ # spaces and
25
+ # special characters.
26
+ #
27
+ # Its maximum length and the special characters it supports depend on the
28
+ # scheme:
29
+ #
30
+ # | __scheme__ | __maximum length__ | __special characters allowed__
31
+ # |
32
+ # | :---------------- | :----------------- |
33
+ # :-------------------------------------------------- |
34
+ # | `bacs` | 18 characters | `/` `.` `&` `-`
35
+ # |
36
+ # | `sepa_core` | 70 characters | `/` `?` `:` `(` `)` `.` `,` `+` `&`
37
+ # `<` `>` `'` `"` |
38
+ # | `ach` | 16 characters | `/` `?` `:` `(` `)` `.` `,` `'` `+`
39
+ # `-` |
40
+ # | `faster_payments` | 18 characters | `/` `?` `:` `(` `)` `.` `,` `'` `+`
41
+ # `-` |
42
+ #
43
+ # The validation error that gets returned for an invalid name will contain a
44
+ # suggested name
45
+ # in the metadata that is guaranteed to pass name validations.
46
+ #
47
+ # You should ensure that the name you set matches the legal name or the trading
48
+ # name of
49
+ # the creditor, otherwise, there is an increased risk of chargeback.
18
50
  #
19
51
  # Example URL: /scheme_identifiers
20
52
  # @param options [Hash] parameters as a hash, under a params key.
@@ -10,6 +10,25 @@ module GoCardlessPro
10
10
  module Services
11
11
  # Service for making requests to the VerificationDetail endpoints
12
12
  class VerificationDetailsService < BaseService
13
+ # Creates a new verification detail
14
+ # Example URL: /verification_details
15
+ # @param options [Hash] parameters as a hash, under a params key.
16
+ def create(options = {})
17
+ path = '/verification_details'
18
+
19
+ params = options.delete(:params) || {}
20
+ options[:params] = {}
21
+ options[:params][envelope_key] = params
22
+
23
+ options[:retry_failures] = true
24
+
25
+ response = make_request(:post, path, options)
26
+
27
+ return if response.body.nil?
28
+
29
+ Resources::VerificationDetail.new(unenvelope_body(response.body), response)
30
+ end
31
+
13
32
  # Returns a list of verification details belonging to a creditor.
14
33
  # Example URL: /verification_details
15
34
  # @param options [Hash] parameters as a hash, under a params key.
@@ -38,29 +57,6 @@ module GoCardlessPro
38
57
  ).enumerator
39
58
  end
40
59
 
41
- # Verification details represent any information needed by GoCardless to verify
42
- # a creditor.
43
- # Currently, only UK-based companies are supported.
44
- # In other words, to submit verification details for a creditor, their
45
- # creditor_type must be company and their country_code must be GB.
46
- # Example URL: /verification_details
47
- # @param options [Hash] parameters as a hash, under a params key.
48
- def create(options = {})
49
- path = '/verification_details'
50
-
51
- params = options.delete(:params) || {}
52
- options[:params] = {}
53
- options[:params][envelope_key] = params
54
-
55
- options[:retry_failures] = true
56
-
57
- response = make_request(:post, path, options)
58
-
59
- return if response.body.nil?
60
-
61
- Resources::VerificationDetail.new(unenvelope_body(response.body), response)
62
- end
63
-
64
60
  private
65
61
 
66
62
  # Unenvelope the response of the body using the service's `envelope_key`
@@ -3,5 +3,5 @@ end
3
3
 
4
4
  module GoCardlessPro
5
5
  # Current version of the GC gem
6
- VERSION = '2.43.0'
6
+ VERSION = '2.45.0'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gocardless_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.43.0
4
+ version: 2.45.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCardless
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-10 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  requirements: []
200
- rubygems_version: 3.4.6
200
+ rubygems_version: 3.4.10
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: A gem for calling the GoCardless Pro API