gocardless_pro 2.44.0 → 2.46.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f18c023fdf2776637fc1228dbd79184ac6f669be1733e9d45a8b0d83fd75811f
4
- data.tar.gz: f38f5cffffeefd3fde896538c9767c89c4e4b9075d8f2b153223ed6a6b235942
3
+ metadata.gz: 48f0431f3dc2e7308c560e95cb938c975ce7d3dc6a731357975779e04c9fb724
4
+ data.tar.gz: 5efc3b834b594cb4ed1a8c8d0355537d69e55ca9a44c036810e5c07f0e7ae86a
5
5
  SHA512:
6
- metadata.gz: b400be69bb579451995ccaa792e3b25429858ba4ea32aa6d26105c5a767bbefb587a3537a6cb9740469ee7c1628d390cab66073aa5d66b0b21dc52428e5774b5
7
- data.tar.gz: 1e8552a627d5bf46361e3871442341d6a464b49065d91c2034535cffad18a6e6476fa4dfc86c85118d532982373de62c5f1d9421ee5239d02813246c5d0bcc94
6
+ metadata.gz: a5d8b6cacedabdf6658e7567f0b4b0cfd5687d7c25fee78d70bc124168f87dd7bdd035d36125378b6ecd797fc3025ec2f785397238d57457a5c0719c5d6d2cb6
7
+ data.tar.gz: 82df3b65a0f45cb0d067ba0f98794cd7a716d6aa5ce515b55a15124f8d9b88b94c4baf05eec3f41a1e2e1bce26e243a965f213b55db06a12a4f1cf02ec8680fc
@@ -98,6 +98,11 @@ module GoCardlessPro
98
98
  @mandate_pdfs ||= Services::MandatePdfsService.new(@api_service)
99
99
  end
100
100
 
101
+ # Access to the service for negative_balance_limit to make API calls
102
+ def negative_balance_limits
103
+ @negative_balance_limits ||= Services::NegativeBalanceLimitsService.new(@api_service)
104
+ end
105
+
101
106
  # Access to the service for payer_authorisation to make API calls
102
107
  def payer_authorisations
103
108
  @payer_authorisations ||= Services::PayerAuthorisationsService.new(@api_service)
@@ -208,7 +213,7 @@ module GoCardlessPro
208
213
  'User-Agent' => "#{user_agent}",
209
214
  'Content-Type' => 'application/json',
210
215
  'GoCardless-Client-Library' => 'gocardless-pro-ruby',
211
- 'GoCardless-Client-Version' => '2.44.0',
216
+ 'GoCardless-Client-Version' => '2.46.0',
212
217
  },
213
218
  }
214
219
  end
@@ -27,6 +27,7 @@ module GoCardlessPro
27
27
  attr_reader :expires_at
28
28
  attr_reader :id
29
29
  attr_reader :last_visited_at
30
+ attr_reader :qr_code_url
30
31
  attr_reader :redirect_uri
31
32
  attr_reader :url
32
33
 
@@ -42,6 +43,7 @@ module GoCardlessPro
42
43
  @id = object['id']
43
44
  @last_visited_at = object['last_visited_at']
44
45
  @links = object['links']
46
+ @qr_code_url = object['qr_code_url']
45
47
  @redirect_uri = object['redirect_uri']
46
48
  @url = object['url']
47
49
  @response = response
@@ -18,10 +18,10 @@ 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
24
+ attr_reader :bank_reference_prefix
25
25
  attr_reader :can_create_refunds
26
26
  attr_reader :city
27
27
  attr_reader :country_code
@@ -44,10 +44,10 @@ module GoCardlessPro
44
44
  def initialize(object, response = nil)
45
45
  @object = object
46
46
 
47
- @activated = object['activated']
48
47
  @address_line1 = object['address_line1']
49
48
  @address_line2 = object['address_line2']
50
49
  @address_line3 = object['address_line3']
50
+ @bank_reference_prefix = object['bank_reference_prefix']
51
51
  @can_create_refunds = object['can_create_refunds']
52
52
  @city = object['city']
53
53
  @country_code = object['country_code']
@@ -17,7 +17,7 @@ module GoCardlessPro
17
17
  # Not all institutions support both Payment Initiation (PIS) and Account
18
18
  # Information (AIS) services.
19
19
  class Institution
20
- attr_reader :bank_redirect
20
+ attr_reader :autocompletes_collect_bank_account
21
21
  attr_reader :country_code
22
22
  attr_reader :icon_url
23
23
  attr_reader :id
@@ -29,7 +29,7 @@ module GoCardlessPro
29
29
  def initialize(object, response = nil)
30
30
  @object = object
31
31
 
32
- @bank_redirect = object['bank_redirect']
32
+ @autocompletes_collect_bank_account = object['autocompletes_collect_bank_account']
33
33
  @country_code = object['country_code']
34
34
  @icon_url = object['icon_url']
35
35
  @id = object['id']
@@ -0,0 +1,69 @@
1
+ #
2
+ # This client is automatically generated from a template and JSON schema definition.
3
+ # See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
4
+ #
5
+
6
+ require 'uri'
7
+
8
+ module GoCardlessPro
9
+ # A module containing classes for each of the resources in the GC Api
10
+ module Resources
11
+ # Represents an instance of a negative_balance_limit resource returned from the API
12
+
13
+ # The negative balance limit for a creditor. If the creditor would exceed
14
+ # this limit, we will not allow the creation of refunds.
15
+ class NegativeBalanceLimit
16
+ attr_reader :active
17
+ attr_reader :balance_limit
18
+ attr_reader :created_at
19
+ attr_reader :currency
20
+ attr_reader :id
21
+ attr_reader :reason
22
+ attr_reader :updated_at
23
+
24
+ # Initialize a negative_balance_limit resource instance
25
+ # @param object [Hash] an object returned from the API
26
+ def initialize(object, response = nil)
27
+ @object = object
28
+
29
+ @active = object['active']
30
+ @balance_limit = object['balance_limit']
31
+ @created_at = object['created_at']
32
+ @currency = object['currency']
33
+ @id = object['id']
34
+ @links = object['links']
35
+ @reason = object['reason']
36
+ @updated_at = object['updated_at']
37
+ @response = response
38
+ end
39
+
40
+ def api_response
41
+ ApiResponse.new(@response)
42
+ end
43
+
44
+ # Return the links that the resource has
45
+ def links
46
+ @negative_balance_limit_links ||= Links.new(@links)
47
+ end
48
+
49
+ # Provides the negative_balance_limit resource as a hash of all its readable attributes
50
+ def to_h
51
+ @object
52
+ end
53
+
54
+ class Links
55
+ def initialize(links)
56
+ @links = links || {}
57
+ end
58
+
59
+ def creator_user
60
+ @links['creator_user']
61
+ end
62
+
63
+ def creditor
64
+ @links['creditor']
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -17,7 +17,6 @@ module GoCardlessPro
17
17
  #
18
18
  # The following rules apply when specifying recurrence:
19
19
  #
20
- # - The first payment must be charged within 1 year.
21
20
  # - If `day_of_month` and `start_date` are not provided `start_date` will be
22
21
  # the [mandate](#core-endpoints-mandates)'s `next_possible_charge_date` and
23
22
  # the subscription will then recur based on the `interval` & `interval_unit`
@@ -117,52 +117,6 @@ module GoCardlessPro
117
117
  Resources::Creditor.new(unenvelope_body(response.body), response)
118
118
  end
119
119
 
120
- # Applies a [scheme identifier](#core-endpoints-scheme-identifiers) to a
121
- # creditor.
122
- # If the creditor already has a scheme identifier for the scheme, it will be
123
- # 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.
127
- #
128
- # Example URL: /creditors/:identity/actions/apply_scheme_identifier
129
- #
130
- # @param identity # Unique identifier, beginning with "CR".
131
- # @param options [Hash] parameters as a hash, under a params key.
132
- def apply_scheme_identifier(identity, options = {})
133
- path = sub_url('/creditors/:identity/actions/apply_scheme_identifier', {
134
- 'identity' => identity,
135
- })
136
-
137
- params = options.delete(:params) || {}
138
- options[:params] = {}
139
- options[:params]['data'] = params
140
-
141
- options[:retry_failures] = false
142
-
143
- begin
144
- response = make_request(:post, path, options)
145
-
146
- # Response doesn't raise any errors until #body is called
147
- response.tap(&:body)
148
- rescue InvalidStateError => e
149
- if e.idempotent_creation_conflict?
150
- case @api_service.on_idempotency_conflict
151
- when :raise
152
- raise IdempotencyConflict, e.error
153
- when :fetch
154
- return get(e.conflicting_resource_id)
155
- end
156
- end
157
-
158
- raise e
159
- end
160
-
161
- return if response.body.nil?
162
-
163
- Resources::Creditor.new(unenvelope_body(response.body), response)
164
- end
165
-
166
120
  private
167
121
 
168
122
  # Unenvelope the response of the body using the service's `envelope_key`
@@ -0,0 +1,77 @@
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 NegativeBalanceLimit endpoints
12
+ class NegativeBalanceLimitsService < BaseService
13
+ # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of negative
14
+ # balance limits.
15
+ # Example URL: /negative_balance_limits
16
+ # @param options [Hash] parameters as a hash, under a params key.
17
+ def list(options = {})
18
+ path = '/negative_balance_limits'
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::NegativeBalanceLimit
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
+ # Creates a new negative balance limit, which also deactivates the existing
43
+ # limit (if present) for that currency and creditor combination.
44
+ # Example URL: /negative_balance_limits
45
+ # @param options [Hash] parameters as a hash, under a params key.
46
+ def create(options = {})
47
+ path = '/negative_balance_limits'
48
+
49
+ params = options.delete(:params) || {}
50
+ options[:params] = {}
51
+ options[:params][envelope_key] = params
52
+
53
+ options[:retry_failures] = true
54
+
55
+ response = make_request(:post, path, options)
56
+
57
+ return if response.body.nil?
58
+
59
+ Resources::NegativeBalanceLimit.new(unenvelope_body(response.body), response)
60
+ end
61
+
62
+ private
63
+
64
+ # Unenvelope the response of the body using the service's `envelope_key`
65
+ #
66
+ # @param body [Hash]
67
+ def unenvelope_body(body)
68
+ body[envelope_key] || body['data']
69
+ end
70
+
71
+ # return the key which API responses will envelope data under
72
+ def envelope_key
73
+ 'negative_balance_limits'
74
+ end
75
+ end
76
+ end
77
+ end
@@ -15,33 +15,39 @@ module GoCardlessPro
15
15
  # are taken
16
16
  # using it. The scheme identifier must also have the `status` of active before
17
17
  # it can be
18
- # used. For some schemes e.g. faster_payments this will happen instantly. For
19
- # other schemes
20
- # e.g. bacs this can take several days.
18
+ # used. On Bacs, this will take 5 working days. On other schemes, this happens
19
+ # instantly.
21
20
  #
22
- # ### Scheme identifier name validations
21
+ # #### Scheme identifier name validations
23
22
  #
24
- # Each scheme has different rules for the length and permitted characters in the
25
- # scheme identifier
26
- # name field. The rules are:
23
+ # The `name` field of a scheme identifier can contain alphanumeric characters,
24
+ # spaces and
25
+ # special characters.
27
26
  #
28
- # | __scheme__ | __maximum length__ | __allowed characters__ | __spaces__
29
- # |
30
- # | :-------------- | :----------------- | :----------------------- | :---------
31
- # |
32
- # | bacs | 18 characters | `a-zA-Z0-9/.&-` | yes
33
- # |
34
- # | sepa_core | 70 characters | `a-zA-Z0-9/?:().,+&<>'"` | yes
35
- # |
36
- # | ach | 16 characters | `a-zA-Z0-9/?:().,'+-` | yes
37
- # |
38
- # | faster_payments | 18 characters | `a-zA-Z0-9/?:().,'+-` | yes
39
- # |
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` | 70 characters | `/` `?` `:` `(` `)` `.` `,` `+` `&`
37
+ # `<` `>` `'` `"` |
38
+ # | `ach` | 16 characters | `/` `?` `:` `(` `)` `.` `,` `'` `+`
39
+ # `-` |
40
+ # | `faster_payments` | 18 characters | `/` `?` `:` `(` `)` `.` `,` `'` `+`
41
+ # `-` |
40
42
  #
41
43
  # The validation error that gets returned for an invalid name will contain a
42
44
  # suggested name
43
45
  # in the metadata that is guaranteed to pass name validations.
44
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.
50
+ #
45
51
  # Example URL: /scheme_identifiers
46
52
  # @param options [Hash] parameters as a hash, under a params key.
47
53
  def create(options = {})
@@ -3,5 +3,5 @@ end
3
3
 
4
4
  module GoCardlessPro
5
5
  # Current version of the GC gem
6
- VERSION = '2.44.0'
6
+ VERSION = '2.46.0'
7
7
  end
@@ -96,6 +96,9 @@ require_relative 'gocardless_pro/services/mandate_import_entries_service'
96
96
  require_relative 'gocardless_pro/resources/mandate_pdf'
97
97
  require_relative 'gocardless_pro/services/mandate_pdfs_service'
98
98
 
99
+ require_relative 'gocardless_pro/resources/negative_balance_limit'
100
+ require_relative 'gocardless_pro/services/negative_balance_limits_service'
101
+
99
102
  require_relative 'gocardless_pro/resources/payer_authorisation'
100
103
  require_relative 'gocardless_pro/services/payer_authorisations_service'
101
104
 
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.44.0
4
+ version: 2.46.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-03-16 00:00:00.000000000 Z
11
+ date: 2023-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -131,6 +131,7 @@ files:
131
131
  - lib/gocardless_pro/resources/mandate_import.rb
132
132
  - lib/gocardless_pro/resources/mandate_import_entry.rb
133
133
  - lib/gocardless_pro/resources/mandate_pdf.rb
134
+ - lib/gocardless_pro/resources/negative_balance_limit.rb
134
135
  - lib/gocardless_pro/resources/payer_authorisation.rb
135
136
  - lib/gocardless_pro/resources/payment.rb
136
137
  - lib/gocardless_pro/resources/payout.rb
@@ -164,6 +165,7 @@ files:
164
165
  - lib/gocardless_pro/services/mandate_imports_service.rb
165
166
  - lib/gocardless_pro/services/mandate_pdfs_service.rb
166
167
  - lib/gocardless_pro/services/mandates_service.rb
168
+ - lib/gocardless_pro/services/negative_balance_limits_service.rb
167
169
  - lib/gocardless_pro/services/payer_authorisations_service.rb
168
170
  - lib/gocardless_pro/services/payments_service.rb
169
171
  - lib/gocardless_pro/services/payout_items_service.rb
@@ -197,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
199
  - !ruby/object:Gem::Version
198
200
  version: '0'
199
201
  requirements: []
200
- rubygems_version: 3.4.6
202
+ rubygems_version: 3.4.10
201
203
  signing_key:
202
204
  specification_version: 4
203
205
  summary: A gem for calling the GoCardless Pro API