gocardless_pro 2.25.0 → 2.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -3
- data/lib/gocardless_pro.rb +18 -0
- data/lib/gocardless_pro/client.rb +31 -1
- data/lib/gocardless_pro/resources/bank_authorisation.rb +87 -0
- data/lib/gocardless_pro/resources/billing_request.rb +86 -0
- data/lib/gocardless_pro/resources/billing_request_flow.rb +62 -0
- data/lib/gocardless_pro/resources/creditor.rb +2 -3
- data/lib/gocardless_pro/resources/institution.rb +45 -0
- data/lib/gocardless_pro/resources/payer_authorisation.rb +3 -0
- data/lib/gocardless_pro/resources/scenario_simulator.rb +42 -0
- data/lib/gocardless_pro/resources/webhook.rb +62 -0
- data/lib/gocardless_pro/services/bank_authorisations_service.rb +82 -0
- data/lib/gocardless_pro/services/billing_request_flows_service.rb +47 -0
- data/lib/gocardless_pro/services/billing_requests_service.rb +325 -0
- data/lib/gocardless_pro/services/institutions_service.rb +56 -0
- data/lib/gocardless_pro/services/payer_authorisations_service.rb +5 -5
- data/lib/gocardless_pro/services/scenario_simulators_service.rb +148 -0
- data/lib/gocardless_pro/services/subscriptions_service.rb +8 -3
- data/lib/gocardless_pro/services/webhooks_service.rb +113 -0
- data/lib/gocardless_pro/version.rb +1 -1
- data/spec/resources/bank_authorisation_spec.rb +259 -0
- data/spec/resources/billing_request_flow_spec.rb +129 -0
- data/spec/resources/billing_request_spec.rb +736 -0
- data/spec/resources/institution_spec.rb +103 -0
- data/spec/resources/scenario_simulator_spec.rb +63 -0
- data/spec/resources/webhook_spec.rb +323 -0
- data/spec/services/bank_authorisations_service_spec.rb +366 -0
- data/spec/services/billing_request_flows_service_spec.rb +152 -0
- data/spec/services/billing_requests_service_spec.rb +1042 -0
- data/spec/services/institutions_service_spec.rb +223 -0
- data/spec/services/scenario_simulators_service_spec.rb +74 -0
- data/spec/services/webhooks_service_spec.rb +545 -0
- metadata +39 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36f326b7d949867117fd93ecbe9074fcdb54ee3b690f046c2e48e16ce92281dc
|
4
|
+
data.tar.gz: dba0ba60c85f16a5d3c87f311ea6b4b73d93a438441a2ff96c962669c56f7630
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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"
|
data/lib/gocardless_pro.rb
CHANGED
@@ -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
|
|
@@ -95,10 +107,16 @@ require_relative 'gocardless_pro/services/redirect_flows_service'
|
|
95
107
|
require_relative 'gocardless_pro/resources/refund'
|
96
108
|
require_relative 'gocardless_pro/services/refunds_service'
|
97
109
|
|
110
|
+
require_relative 'gocardless_pro/resources/scenario_simulator'
|
111
|
+
require_relative 'gocardless_pro/services/scenario_simulators_service'
|
112
|
+
|
98
113
|
require_relative 'gocardless_pro/resources/subscription'
|
99
114
|
require_relative 'gocardless_pro/services/subscriptions_service'
|
100
115
|
|
101
116
|
require_relative 'gocardless_pro/resources/tax_rate'
|
102
117
|
require_relative 'gocardless_pro/services/tax_rates_service'
|
103
118
|
|
119
|
+
require_relative 'gocardless_pro/resources/webhook'
|
120
|
+
require_relative 'gocardless_pro/services/webhooks_service'
|
121
|
+
|
104
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)
|
@@ -98,6 +118,11 @@ module GoCardlessPro
|
|
98
118
|
@refunds ||= Services::RefundsService.new(@api_service)
|
99
119
|
end
|
100
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
|
+
|
101
126
|
# Access to the service for subscription to make API calls
|
102
127
|
def subscriptions
|
103
128
|
@subscriptions ||= Services::SubscriptionsService.new(@api_service)
|
@@ -108,6 +133,11 @@ module GoCardlessPro
|
|
108
133
|
@tax_rates ||= Services::TaxRatesService.new(@api_service)
|
109
134
|
end
|
110
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
|
+
|
111
141
|
# Get a Client configured to use HTTP Basic authentication with the GC Api
|
112
142
|
#
|
113
143
|
# @param options [Hash<Symbol,String>] configuration for creating the client
|
@@ -158,7 +188,7 @@ module GoCardlessPro
|
|
158
188
|
'User-Agent' => user_agent.to_s,
|
159
189
|
'Content-Type' => 'application/json',
|
160
190
|
'GoCardless-Client-Library' => 'gocardless-pro-ruby',
|
161
|
-
'GoCardless-Client-Version' => '2.
|
191
|
+
'GoCardless-Client-Version' => '2.27.0',
|
162
192
|
},
|
163
193
|
}
|
164
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
|
-
#
|
21
|
-
#
|
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
|
@@ -0,0 +1,45 @@
|
|
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 institution resource returned from the API
|
14
|
+
|
15
|
+
# Institutions that are supported when creating [Bank
|
16
|
+
# Authorisations](#billing-requests-bank-authorisations).
|
17
|
+
class Institution
|
18
|
+
attr_reader :icon_url
|
19
|
+
attr_reader :id
|
20
|
+
attr_reader :logo_url
|
21
|
+
attr_reader :name
|
22
|
+
|
23
|
+
# Initialize a institution resource instance
|
24
|
+
# @param object [Hash] an object returned from the API
|
25
|
+
def initialize(object, response = nil)
|
26
|
+
@object = object
|
27
|
+
|
28
|
+
@icon_url = object['icon_url']
|
29
|
+
@id = object['id']
|
30
|
+
@logo_url = object['logo_url']
|
31
|
+
@name = object['name']
|
32
|
+
@response = response
|
33
|
+
end
|
34
|
+
|
35
|
+
def api_response
|
36
|
+
ApiResponse.new(@response)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Provides the institution resource as a hash of all its readable attributes
|
40
|
+
def to_h
|
41
|
+
@object
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -53,6 +53,9 @@ module GoCardlessPro
|
|
53
53
|
# is still saved if incomplete data is provided.
|
54
54
|
# We return the list of incomplete data in the `incomplete_fields` along
|
55
55
|
# with the resources in the body of the response.
|
56
|
+
# The bank account details(account_number, bank_code & branch_code) must
|
57
|
+
# be sent together rather than splitting across different request for both
|
58
|
+
# `create` and `update` endpoints.
|
56
59
|
# <br><br>
|
57
60
|
# The API is designed to be flexible and allows you to collect information
|
58
61
|
# in multiple steps without storing any sensitive data in the browser or in
|