gocardless_pro 2.22.1 → 2.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +3 -3
  3. data/lib/gocardless_pro.rb +24 -0
  4. data/lib/gocardless_pro/client.rb +41 -1
  5. data/lib/gocardless_pro/resources/bank_authorisation.rb +87 -0
  6. data/lib/gocardless_pro/resources/billing_request.rb +86 -0
  7. data/lib/gocardless_pro/resources/billing_request_flow.rb +62 -0
  8. data/lib/gocardless_pro/resources/creditor.rb +2 -3
  9. data/lib/gocardless_pro/resources/event.rb +12 -0
  10. data/lib/gocardless_pro/resources/institution.rb +45 -0
  11. data/lib/gocardless_pro/resources/payer_authorisation.rb +122 -0
  12. data/lib/gocardless_pro/resources/payout.rb +2 -0
  13. data/lib/gocardless_pro/resources/payout_item.rb +6 -0
  14. data/lib/gocardless_pro/resources/scenario_simulator.rb +42 -0
  15. data/lib/gocardless_pro/resources/tax_rate.rb +51 -0
  16. data/lib/gocardless_pro/resources/webhook.rb +62 -0
  17. data/lib/gocardless_pro/services/bank_authorisations_service.rb +82 -0
  18. data/lib/gocardless_pro/services/billing_request_flows_service.rb +47 -0
  19. data/lib/gocardless_pro/services/billing_requests_service.rb +325 -0
  20. data/lib/gocardless_pro/services/institutions_service.rb +56 -0
  21. data/lib/gocardless_pro/services/payer_authorisations_service.rb +208 -0
  22. data/lib/gocardless_pro/services/scenario_simulators_service.rb +148 -0
  23. data/lib/gocardless_pro/services/subscriptions_service.rb +9 -4
  24. data/lib/gocardless_pro/services/tax_rates_service.rb +74 -0
  25. data/lib/gocardless_pro/services/webhooks_service.rb +113 -0
  26. data/lib/gocardless_pro/version.rb +1 -1
  27. data/spec/resources/bank_authorisation_spec.rb +259 -0
  28. data/spec/resources/billing_request_flow_spec.rb +129 -0
  29. data/spec/resources/billing_request_spec.rb +736 -0
  30. data/spec/resources/institution_spec.rb +103 -0
  31. data/spec/resources/payer_authorisation_spec.rb +418 -0
  32. data/spec/resources/payout_item_spec.rb +5 -0
  33. data/spec/resources/payout_spec.rb +8 -0
  34. data/spec/resources/scenario_simulator_spec.rb +63 -0
  35. data/spec/resources/tax_rate_spec.rb +198 -0
  36. data/spec/resources/webhook_spec.rb +323 -0
  37. data/spec/services/bank_authorisations_service_spec.rb +366 -0
  38. data/spec/services/billing_request_flows_service_spec.rb +152 -0
  39. data/spec/services/billing_requests_service_spec.rb +1042 -0
  40. data/spec/services/institutions_service_spec.rb +223 -0
  41. data/spec/services/payer_authorisations_service_spec.rb +572 -0
  42. data/spec/services/payout_items_service_spec.rb +9 -0
  43. data/spec/services/payouts_service_spec.rb +12 -0
  44. data/spec/services/scenario_simulators_service_spec.rb +74 -0
  45. data/spec/services/tax_rates_service_spec.rb +381 -0
  46. data/spec/services/webhooks_service_spec.rb +545 -0
  47. metadata +51 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2380802da7e32b788d03eb0ce5965cb79b27f310c7643bf40078880823dcb2f7
4
- data.tar.gz: ad1ebf6cbec94675df50e0b4a0154fb2eea77f659993625c5d8a9bcb8bd9f7df
3
+ metadata.gz: 36f326b7d949867117fd93ecbe9074fcdb54ee3b690f046c2e48e16ce92281dc
4
+ data.tar.gz: dba0ba60c85f16a5d3c87f311ea6b4b73d93a438441a2ff96c962669c56f7630
5
5
  SHA512:
6
- metadata.gz: 54622b040fa474ef16f0431e439bef3603d45cdf74c6001bc175fc638057db41231eae81cd9c502e5d16f3a796d6c1e068d27907aeacc1b0bfceb15186bcce0b
7
- data.tar.gz: e89435ce6a6da8761c8b113e93f34fe1c7268e462aeda83fe8183620334c35f939c362efc1027b7bf0e3bef1a0ab9d56bb1eacf09e3ab64fd6596f1cc0055ad1
6
+ metadata.gz: 5e5939895e083285066011907aad6a992fbb1f65b86392482964a4c856f64bf2834d9a63bb20faf2e7d3c00d5fa27e32ec0c2a9c4770f805ef2db2ba2983c79f
7
+ data.tar.gz: da519896309a48029ff7d5fb47f2747234b119fb7b539a8701892fe19ea2c921d3606cd66dc9ed4ce70f891a408a979176de5806881a44ce6a82b600aa8cb91b
data/.circleci/config.yml CHANGED
@@ -22,11 +22,11 @@ workflows:
22
22
  matrix:
23
23
  parameters:
24
24
  faraday-version: ["0.9.2", "1.0"]
25
- ruby-version: ["2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7"]
25
+ ruby-version: ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "3.0"]
26
26
  exclude:
27
- - faraday-version: "1.0"
28
- ruby-version: "2.0"
29
27
  - faraday-version: "1.0"
30
28
  ruby-version: "2.1"
31
29
  - faraday-version: "1.0"
32
30
  ruby-version: "2.2"
31
+ - faraday-version: "0.9.2"
32
+ ruby-version: "3.0"
@@ -38,9 +38,18 @@ require_relative 'gocardless_pro/response'
38
38
  require_relative 'gocardless_pro/api_response'
39
39
  require_relative 'gocardless_pro/webhook'
40
40
 
41
+ require_relative 'gocardless_pro/resources/bank_authorisation'
42
+ require_relative 'gocardless_pro/services/bank_authorisations_service'
43
+
41
44
  require_relative 'gocardless_pro/resources/bank_details_lookup'
42
45
  require_relative 'gocardless_pro/services/bank_details_lookups_service'
43
46
 
47
+ require_relative 'gocardless_pro/resources/billing_request'
48
+ require_relative 'gocardless_pro/services/billing_requests_service'
49
+
50
+ require_relative 'gocardless_pro/resources/billing_request_flow'
51
+ require_relative 'gocardless_pro/services/billing_request_flows_service'
52
+
44
53
  require_relative 'gocardless_pro/resources/creditor'
45
54
  require_relative 'gocardless_pro/services/creditors_service'
46
55
 
@@ -65,6 +74,9 @@ require_relative 'gocardless_pro/services/events_service'
65
74
  require_relative 'gocardless_pro/resources/instalment_schedule'
66
75
  require_relative 'gocardless_pro/services/instalment_schedules_service'
67
76
 
77
+ require_relative 'gocardless_pro/resources/institution'
78
+ require_relative 'gocardless_pro/services/institutions_service'
79
+
68
80
  require_relative 'gocardless_pro/resources/mandate'
69
81
  require_relative 'gocardless_pro/services/mandates_service'
70
82
 
@@ -77,6 +89,9 @@ require_relative 'gocardless_pro/services/mandate_import_entries_service'
77
89
  require_relative 'gocardless_pro/resources/mandate_pdf'
78
90
  require_relative 'gocardless_pro/services/mandate_pdfs_service'
79
91
 
92
+ require_relative 'gocardless_pro/resources/payer_authorisation'
93
+ require_relative 'gocardless_pro/services/payer_authorisations_service'
94
+
80
95
  require_relative 'gocardless_pro/resources/payment'
81
96
  require_relative 'gocardless_pro/services/payments_service'
82
97
 
@@ -92,7 +107,16 @@ require_relative 'gocardless_pro/services/redirect_flows_service'
92
107
  require_relative 'gocardless_pro/resources/refund'
93
108
  require_relative 'gocardless_pro/services/refunds_service'
94
109
 
110
+ require_relative 'gocardless_pro/resources/scenario_simulator'
111
+ require_relative 'gocardless_pro/services/scenario_simulators_service'
112
+
95
113
  require_relative 'gocardless_pro/resources/subscription'
96
114
  require_relative 'gocardless_pro/services/subscriptions_service'
97
115
 
116
+ require_relative 'gocardless_pro/resources/tax_rate'
117
+ require_relative 'gocardless_pro/services/tax_rates_service'
118
+
119
+ require_relative 'gocardless_pro/resources/webhook'
120
+ require_relative 'gocardless_pro/services/webhooks_service'
121
+
98
122
  require_relative 'gocardless_pro/client.rb'
@@ -3,11 +3,26 @@ module GoCardlessPro
3
3
  class Client
4
4
  extend Forwardable
5
5
 
6
+ # Access to the service for bank_authorisation to make API calls
7
+ def bank_authorisations
8
+ @bank_authorisations ||= Services::BankAuthorisationsService.new(@api_service)
9
+ end
10
+
6
11
  # Access to the service for bank_details_lookup to make API calls
7
12
  def bank_details_lookups
8
13
  @bank_details_lookups ||= Services::BankDetailsLookupsService.new(@api_service)
9
14
  end
10
15
 
16
+ # Access to the service for billing_request to make API calls
17
+ def billing_requests
18
+ @billing_requests ||= Services::BillingRequestsService.new(@api_service)
19
+ end
20
+
21
+ # Access to the service for billing_request_flow to make API calls
22
+ def billing_request_flows
23
+ @billing_request_flows ||= Services::BillingRequestFlowsService.new(@api_service)
24
+ end
25
+
11
26
  # Access to the service for creditor to make API calls
12
27
  def creditors
13
28
  @creditors ||= Services::CreditorsService.new(@api_service)
@@ -48,6 +63,11 @@ module GoCardlessPro
48
63
  @instalment_schedules ||= Services::InstalmentSchedulesService.new(@api_service)
49
64
  end
50
65
 
66
+ # Access to the service for institution to make API calls
67
+ def institutions
68
+ @institutions ||= Services::InstitutionsService.new(@api_service)
69
+ end
70
+
51
71
  # Access to the service for mandate to make API calls
52
72
  def mandates
53
73
  @mandates ||= Services::MandatesService.new(@api_service)
@@ -68,6 +88,11 @@ module GoCardlessPro
68
88
  @mandate_pdfs ||= Services::MandatePdfsService.new(@api_service)
69
89
  end
70
90
 
91
+ # Access to the service for payer_authorisation to make API calls
92
+ def payer_authorisations
93
+ @payer_authorisations ||= Services::PayerAuthorisationsService.new(@api_service)
94
+ end
95
+
71
96
  # Access to the service for payment to make API calls
72
97
  def payments
73
98
  @payments ||= Services::PaymentsService.new(@api_service)
@@ -93,11 +118,26 @@ module GoCardlessPro
93
118
  @refunds ||= Services::RefundsService.new(@api_service)
94
119
  end
95
120
 
121
+ # Access to the service for scenario_simulator to make API calls
122
+ def scenario_simulators
123
+ @scenario_simulators ||= Services::ScenarioSimulatorsService.new(@api_service)
124
+ end
125
+
96
126
  # Access to the service for subscription to make API calls
97
127
  def subscriptions
98
128
  @subscriptions ||= Services::SubscriptionsService.new(@api_service)
99
129
  end
100
130
 
131
+ # Access to the service for tax_rate to make API calls
132
+ def tax_rates
133
+ @tax_rates ||= Services::TaxRatesService.new(@api_service)
134
+ end
135
+
136
+ # Access to the service for webhook to make API calls
137
+ def webhooks
138
+ @webhooks ||= Services::WebhooksService.new(@api_service)
139
+ end
140
+
101
141
  # Get a Client configured to use HTTP Basic authentication with the GC Api
102
142
  #
103
143
  # @param options [Hash<Symbol,String>] configuration for creating the client
@@ -148,7 +188,7 @@ module GoCardlessPro
148
188
  'User-Agent' => user_agent.to_s,
149
189
  'Content-Type' => 'application/json',
150
190
  'GoCardless-Client-Library' => 'gocardless-pro-ruby',
151
- 'GoCardless-Client-Version' => '2.22.1',
191
+ 'GoCardless-Client-Version' => '2.27.0',
152
192
  },
153
193
  }
154
194
  end
@@ -0,0 +1,87 @@
1
+ # encoding: utf-8
2
+
3
+ #
4
+ # This client is automatically generated from a template and JSON schema definition.
5
+ # See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
6
+ #
7
+
8
+ require 'uri'
9
+
10
+ module GoCardlessPro
11
+ # A module containing classes for each of the resources in the GC Api
12
+ module Resources
13
+ # Represents an instance of a bank_authorisation resource returned from the API
14
+
15
+ # Bank Authorisations can be used to authorise Billing Requests.
16
+ # Authorisations
17
+ # are created against a specific bank, usually the bank that provides the
18
+ # payer's
19
+ # account.
20
+ #
21
+ # Creation of Bank Authorisations is only permitted from GoCardless hosted
22
+ # UIs
23
+ # (see Billing Request Flows) to ensure we meet regulatory requirements for
24
+ # checkout flows. The exceptions are integrators with the custom payment
25
+ # pages
26
+ # upgrade, who have been audited to check their flows meet requirements.
27
+ class BankAuthorisation
28
+ attr_reader :authorisation_type
29
+ attr_reader :created_at
30
+ attr_reader :expires_at
31
+ attr_reader :id
32
+ attr_reader :last_visited_at
33
+ attr_reader :redirect_uri
34
+ attr_reader :short_url
35
+ attr_reader :url
36
+
37
+ # Initialize a bank_authorisation resource instance
38
+ # @param object [Hash] an object returned from the API
39
+ def initialize(object, response = nil)
40
+ @object = object
41
+
42
+ @authorisation_type = object['authorisation_type']
43
+ @created_at = object['created_at']
44
+ @expires_at = object['expires_at']
45
+ @id = object['id']
46
+ @last_visited_at = object['last_visited_at']
47
+ @links = object['links']
48
+ @redirect_uri = object['redirect_uri']
49
+ @short_url = object['short_url']
50
+ @url = object['url']
51
+ @response = response
52
+ end
53
+
54
+ def api_response
55
+ ApiResponse.new(@response)
56
+ end
57
+
58
+ # Return the links that the resource has
59
+ def links
60
+ @bank_authorisation_links ||= Links.new(@links)
61
+ end
62
+
63
+ # Provides the bank_authorisation resource as a hash of all its readable attributes
64
+ def to_h
65
+ @object
66
+ end
67
+
68
+ class Links
69
+ def initialize(links)
70
+ @links = links || {}
71
+ end
72
+
73
+ def billing_request
74
+ @links['billing_request']
75
+ end
76
+
77
+ def institution
78
+ @links['institution']
79
+ end
80
+
81
+ def payment_request
82
+ @links['payment_request']
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,86 @@
1
+ # encoding: utf-8
2
+
3
+ #
4
+ # This client is automatically generated from a template and JSON schema definition.
5
+ # See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
6
+ #
7
+
8
+ require 'uri'
9
+
10
+ module GoCardlessPro
11
+ # A module containing classes for each of the resources in the GC Api
12
+ module Resources
13
+ # Represents an instance of a billing_request resource returned from the API
14
+
15
+ # Billing Requests
16
+ class BillingRequest
17
+ attr_reader :actions
18
+ attr_reader :auto_fulfil
19
+ attr_reader :created_at
20
+ attr_reader :id
21
+ attr_reader :mandate_request
22
+ attr_reader :metadata
23
+ attr_reader :payment_request
24
+ attr_reader :resources
25
+ attr_reader :status
26
+
27
+ # Initialize a billing_request resource instance
28
+ # @param object [Hash] an object returned from the API
29
+ def initialize(object, response = nil)
30
+ @object = object
31
+
32
+ @actions = object['actions']
33
+ @auto_fulfil = object['auto_fulfil']
34
+ @created_at = object['created_at']
35
+ @id = object['id']
36
+ @links = object['links']
37
+ @mandate_request = object['mandate_request']
38
+ @metadata = object['metadata']
39
+ @payment_request = object['payment_request']
40
+ @resources = object['resources']
41
+ @status = object['status']
42
+ @response = response
43
+ end
44
+
45
+ def api_response
46
+ ApiResponse.new(@response)
47
+ end
48
+
49
+ # Return the links that the resource has
50
+ def links
51
+ @billing_request_links ||= Links.new(@links)
52
+ end
53
+
54
+ # Provides the billing_request resource as a hash of all its readable attributes
55
+ def to_h
56
+ @object
57
+ end
58
+
59
+ class Links
60
+ def initialize(links)
61
+ @links = links || {}
62
+ end
63
+
64
+ def customer
65
+ @links['customer']
66
+ end
67
+
68
+ def customer_bank_account
69
+ @links['customer_bank_account']
70
+ end
71
+
72
+ def customer_billing_detail
73
+ @links['customer_billing_detail']
74
+ end
75
+
76
+ def mandate_bank_authorisation
77
+ @links['mandate_bank_authorisation']
78
+ end
79
+
80
+ def payment_bank_authorisation
81
+ @links['payment_bank_authorisation']
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,62 @@
1
+ # encoding: utf-8
2
+
3
+ #
4
+ # This client is automatically generated from a template and JSON schema definition.
5
+ # See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
6
+ #
7
+
8
+ require 'uri'
9
+
10
+ module GoCardlessPro
11
+ # A module containing classes for each of the resources in the GC Api
12
+ module Resources
13
+ # Represents an instance of a billing_request_flow resource returned from the API
14
+
15
+ # Billing Request Flows can be created to enable a payer to authorise a
16
+ # payment created for a scheme with strong payer
17
+ # authorisation (such as open banking single payments).
18
+ class BillingRequestFlow
19
+ attr_reader :authorisation_url
20
+ attr_reader :created_at
21
+ attr_reader :expires_at
22
+ attr_reader :redirect_uri
23
+
24
+ # Initialize a billing_request_flow resource instance
25
+ # @param object [Hash] an object returned from the API
26
+ def initialize(object, response = nil)
27
+ @object = object
28
+
29
+ @authorisation_url = object['authorisation_url']
30
+ @created_at = object['created_at']
31
+ @expires_at = object['expires_at']
32
+ @links = object['links']
33
+ @redirect_uri = object['redirect_uri']
34
+ @response = response
35
+ end
36
+
37
+ def api_response
38
+ ApiResponse.new(@response)
39
+ end
40
+
41
+ # Return the links that the resource has
42
+ def links
43
+ @billing_request_flow_links ||= Links.new(@links)
44
+ end
45
+
46
+ # Provides the billing_request_flow resource as a hash of all its readable attributes
47
+ def to_h
48
+ @object
49
+ end
50
+
51
+ class Links
52
+ def initialize(links)
53
+ @links = links || {}
54
+ end
55
+
56
+ def billing_request
57
+ @links['billing_request']
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -17,9 +17,8 @@ module GoCardlessPro
17
17
  # organisation will have a single "creditor", but the API also supports
18
18
  # collecting payments on behalf of others.
19
19
  #
20
- # Please get in touch if you wish to use this endpoint. Currently, for Anti
21
- # Money Laundering reasons, any creditors you add must be directly related
22
- # to your organisation.
20
+ # Currently, for Anti Money Laundering reasons, any creditors you add must
21
+ # be directly related to your organisation.
23
22
  class Creditor
24
23
  attr_reader :address_line1
25
24
  attr_reader :address_line2
@@ -64,6 +64,14 @@ module GoCardlessPro
64
64
  @links['creditor']
65
65
  end
66
66
 
67
+ def customer
68
+ @links['customer']
69
+ end
70
+
71
+ def customer_bank_account
72
+ @links['customer_bank_account']
73
+ end
74
+
67
75
  def instalment_schedule
68
76
  @links['instalment_schedule']
69
77
  end
@@ -88,6 +96,10 @@ module GoCardlessPro
88
96
  @links['parent_event']
89
97
  end
90
98
 
99
+ def payer_authorisation
100
+ @links['payer_authorisation']
101
+ end
102
+
91
103
  def payment
92
104
  @links['payment']
93
105
  end