gocardless_pro 2.20.0 → 2.24.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 +4 -4
- data/.circleci/config.yml +25 -43
- data/Gemfile +7 -0
- data/gocardless_pro.gemspec +2 -2
- data/lib/gocardless_pro.rb +3 -0
- data/lib/gocardless_pro/api_service.rb +1 -1
- data/lib/gocardless_pro/client.rb +6 -1
- data/lib/gocardless_pro/resources/event.rb +12 -0
- data/lib/gocardless_pro/resources/payout.rb +2 -0
- data/lib/gocardless_pro/resources/payout_item.rb +2 -0
- data/lib/gocardless_pro/resources/tax_rate.rb +51 -0
- data/lib/gocardless_pro/services/bank_details_lookups_service.rb +0 -10
- data/lib/gocardless_pro/services/base_service.rb +11 -0
- data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +0 -10
- data/lib/gocardless_pro/services/creditors_service.rb +0 -10
- data/lib/gocardless_pro/services/currency_exchange_rates_service.rb +0 -10
- data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +0 -10
- data/lib/gocardless_pro/services/customer_notifications_service.rb +0 -10
- data/lib/gocardless_pro/services/customers_service.rb +0 -10
- data/lib/gocardless_pro/services/events_service.rb +0 -10
- data/lib/gocardless_pro/services/instalment_schedules_service.rb +0 -10
- data/lib/gocardless_pro/services/mandate_import_entries_service.rb +0 -10
- data/lib/gocardless_pro/services/mandate_imports_service.rb +0 -10
- data/lib/gocardless_pro/services/mandate_pdfs_service.rb +0 -10
- data/lib/gocardless_pro/services/mandates_service.rb +0 -10
- data/lib/gocardless_pro/services/payments_service.rb +0 -10
- data/lib/gocardless_pro/services/payout_items_service.rb +0 -10
- data/lib/gocardless_pro/services/payouts_service.rb +0 -10
- data/lib/gocardless_pro/services/redirect_flows_service.rb +0 -10
- data/lib/gocardless_pro/services/refunds_service.rb +6 -11
- data/lib/gocardless_pro/services/subscriptions_service.rb +1 -11
- data/lib/gocardless_pro/services/tax_rates_service.rb +74 -0
- data/lib/gocardless_pro/version.rb +1 -1
- data/spec/resources/payout_item_spec.rb +5 -0
- data/spec/resources/payout_spec.rb +8 -0
- data/spec/resources/tax_rate_spec.rb +198 -0
- data/spec/services/creditor_bank_accounts_service_spec.rb +1 -1
- data/spec/services/customer_bank_accounts_service_spec.rb +1 -1
- data/spec/services/customer_notifications_service_spec.rb +1 -1
- data/spec/services/customers_service_spec.rb +1 -1
- data/spec/services/instalment_schedules_service_spec.rb +1 -1
- data/spec/services/mandate_imports_service_spec.rb +2 -2
- data/spec/services/mandates_service_spec.rb +2 -2
- data/spec/services/payments_service_spec.rb +2 -2
- data/spec/services/payout_items_service_spec.rb +9 -0
- data/spec/services/payouts_service_spec.rb +12 -0
- data/spec/services/redirect_flows_service_spec.rb +1 -1
- data/spec/services/subscriptions_service_spec.rb +3 -3
- data/spec/services/tax_rates_service_spec.rb +381 -0
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bac8c2899f9fd824c6dd5f94bcfa506694dc9f97839cb86a1b64149ccfc92e48
|
4
|
+
data.tar.gz: f12c865ed4d9eaa0def7d20fea5e2b15e2c225898de92bee5758d9a6757e476c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3c76aad9bbaace084b8449366edc8b1f8b33f0b705e22050137bc3d2c31b43228addbea11943b337e8ac6c0a7da52117979dea6ee8e1e425dbca026d159e467
|
7
|
+
data.tar.gz: '097fd8d09e04a316d2e37010eb78d36b8278e7ec8e9cbed867c772ccf3b522957d1fae644c4357a2b560917a16e90b6284841679c79e8525f8f3324795715139'
|
data/.circleci/config.yml
CHANGED
@@ -1,50 +1,32 @@
|
|
1
|
-
version: 2
|
2
|
-
|
3
|
-
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
jobs:
|
4
|
+
test: &test
|
4
5
|
parallelism: 1
|
6
|
+
parameters:
|
7
|
+
faraday-version: { type: string }
|
8
|
+
ruby-version: { type: string }
|
9
|
+
docker:
|
10
|
+
- image: ruby:<<parameters.ruby-version>>
|
11
|
+
environment:
|
12
|
+
- FARADAY_VERSION=<<parameters.faraday-version>>
|
5
13
|
steps:
|
6
14
|
- checkout
|
7
|
-
- run:
|
8
|
-
bundle install
|
9
|
-
bundle exec rspec
|
10
|
-
jobs:
|
11
|
-
test_ruby_2_5:
|
12
|
-
<<: *test_library
|
13
|
-
docker:
|
14
|
-
- image: ruby:2.5
|
15
|
-
|
16
|
-
test_ruby_2_4:
|
17
|
-
<<: *test_library
|
18
|
-
docker:
|
19
|
-
- image: ruby:2.4
|
20
|
-
|
21
|
-
test_ruby_2_3:
|
22
|
-
<<: *test_library
|
23
|
-
docker:
|
24
|
-
- image: ruby:2.3
|
25
|
-
|
26
|
-
test_ruby_2_2:
|
27
|
-
<<: *test_library
|
28
|
-
docker:
|
29
|
-
- image: ruby:2.2
|
30
|
-
|
31
|
-
test_ruby_2_1:
|
32
|
-
<<: *test_library
|
33
|
-
docker:
|
34
|
-
- image: ruby:2.1
|
35
|
-
|
36
|
-
test_ruby_2_0:
|
37
|
-
<<: *test_library
|
38
|
-
docker:
|
39
|
-
- image: ruby:2.0
|
15
|
+
- run: bundle install && bundle exec rspec
|
40
16
|
|
41
17
|
workflows:
|
42
18
|
version: 2
|
43
|
-
|
19
|
+
tests:
|
44
20
|
jobs:
|
45
|
-
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
21
|
+
- test:
|
22
|
+
matrix:
|
23
|
+
parameters:
|
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"]
|
26
|
+
exclude:
|
27
|
+
- faraday-version: "1.0"
|
28
|
+
ruby-version: "2.0"
|
29
|
+
- faraday-version: "1.0"
|
30
|
+
ruby-version: "2.1"
|
31
|
+
- faraday-version: "1.0"
|
32
|
+
ruby-version: "2.2"
|
data/Gemfile
CHANGED
@@ -1,2 +1,9 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
|
+
|
4
|
+
# We support both pre-1.x and post-1.x Faraday versions, but to ensure compatibility we
|
5
|
+
# pin this gem against each in separate runs of CI, using the FARADAY_VERSION env var. For
|
6
|
+
# more details on the values, see .circleci/config.yml.
|
7
|
+
if ENV.key?("FARADAY_VERSION")
|
8
|
+
gem 'faraday', "~> #{ENV["FARADAY_VERSION"]}"
|
9
|
+
end
|
data/gocardless_pro.gemspec
CHANGED
@@ -17,10 +17,10 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
|
-
spec.add_dependency 'faraday', ['>= 0.9.2', '<
|
20
|
+
spec.add_dependency 'faraday', ['>= 0.9.2', '< 2']
|
21
21
|
|
22
22
|
spec.add_development_dependency 'rspec', '~> 3.7.0'
|
23
|
-
spec.add_development_dependency 'webmock', '~>
|
23
|
+
spec.add_development_dependency 'webmock', '~> 3.8.3'
|
24
24
|
spec.add_development_dependency 'rubocop', '~> 0.49.1'
|
25
25
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
26
26
|
|
data/lib/gocardless_pro.rb
CHANGED
@@ -95,4 +95,7 @@ require_relative 'gocardless_pro/services/refunds_service'
|
|
95
95
|
require_relative 'gocardless_pro/resources/subscription'
|
96
96
|
require_relative 'gocardless_pro/services/subscriptions_service'
|
97
97
|
|
98
|
+
require_relative 'gocardless_pro/resources/tax_rate'
|
99
|
+
require_relative 'gocardless_pro/services/tax_rates_service'
|
100
|
+
|
98
101
|
require_relative 'gocardless_pro/client.rb'
|
@@ -23,7 +23,7 @@ module GoCardlessPro
|
|
23
23
|
@url = url
|
24
24
|
root_url, @path_prefix = unpack_url(url)
|
25
25
|
http_adapter = options[:http_adapter] || [:net_http]
|
26
|
-
connection_options = options
|
26
|
+
connection_options = options.fetch(:connection_options, {})
|
27
27
|
|
28
28
|
@connection = Faraday.new(root_url, connection_options) do |faraday|
|
29
29
|
faraday.response :raise_gocardless_errors
|
@@ -98,6 +98,11 @@ module GoCardlessPro
|
|
98
98
|
@subscriptions ||= Services::SubscriptionsService.new(@api_service)
|
99
99
|
end
|
100
100
|
|
101
|
+
# Access to the service for tax_rate to make API calls
|
102
|
+
def tax_rates
|
103
|
+
@tax_rates ||= Services::TaxRatesService.new(@api_service)
|
104
|
+
end
|
105
|
+
|
101
106
|
# Get a Client configured to use HTTP Basic authentication with the GC Api
|
102
107
|
#
|
103
108
|
# @param options [Hash<Symbol,String>] configuration for creating the client
|
@@ -148,7 +153,7 @@ module GoCardlessPro
|
|
148
153
|
'User-Agent' => user_agent.to_s,
|
149
154
|
'Content-Type' => 'application/json',
|
150
155
|
'GoCardless-Client-Library' => 'gocardless-pro-ruby',
|
151
|
-
'GoCardless-Client-Version' => '2.
|
156
|
+
'GoCardless-Client-Version' => '2.24.0',
|
152
157
|
},
|
153
158
|
}
|
154
159
|
end
|
@@ -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
|
@@ -30,6 +30,7 @@ module GoCardlessPro
|
|
30
30
|
attr_reader :payout_type
|
31
31
|
attr_reader :reference
|
32
32
|
attr_reader :status
|
33
|
+
attr_reader :tax_currency
|
33
34
|
|
34
35
|
# Initialize a payout resource instance
|
35
36
|
# @param object [Hash] an object returned from the API
|
@@ -48,6 +49,7 @@ module GoCardlessPro
|
|
48
49
|
@payout_type = object['payout_type']
|
49
50
|
@reference = object['reference']
|
50
51
|
@status = object['status']
|
52
|
+
@tax_currency = object['tax_currency']
|
51
53
|
@response = response
|
52
54
|
end
|
53
55
|
|
@@ -32,6 +32,7 @@ module GoCardlessPro
|
|
32
32
|
#
|
33
33
|
class PayoutItem
|
34
34
|
attr_reader :amount
|
35
|
+
attr_reader :taxes
|
35
36
|
attr_reader :type
|
36
37
|
|
37
38
|
# Initialize a payout_item resource instance
|
@@ -41,6 +42,7 @@ module GoCardlessPro
|
|
41
42
|
|
42
43
|
@amount = object['amount']
|
43
44
|
@links = object['links']
|
45
|
+
@taxes = object['taxes']
|
44
46
|
@type = object['type']
|
45
47
|
@response = response
|
46
48
|
end
|
@@ -0,0 +1,51 @@
|
|
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 tax_rate resource returned from the API
|
14
|
+
|
15
|
+
# Tax rates from tax authority.
|
16
|
+
#
|
17
|
+
# We also maintain a [static list of the tax rates for each
|
18
|
+
# jurisdiction](#appendix-tax-rates).
|
19
|
+
class TaxRate
|
20
|
+
attr_reader :end_date
|
21
|
+
attr_reader :id
|
22
|
+
attr_reader :jurisdiction
|
23
|
+
attr_reader :percentage
|
24
|
+
attr_reader :start_date
|
25
|
+
attr_reader :type
|
26
|
+
|
27
|
+
# Initialize a tax_rate resource instance
|
28
|
+
# @param object [Hash] an object returned from the API
|
29
|
+
def initialize(object, response = nil)
|
30
|
+
@object = object
|
31
|
+
|
32
|
+
@end_date = object['end_date']
|
33
|
+
@id = object['id']
|
34
|
+
@jurisdiction = object['jurisdiction']
|
35
|
+
@percentage = object['percentage']
|
36
|
+
@start_date = object['start_date']
|
37
|
+
@type = object['type']
|
38
|
+
@response = response
|
39
|
+
end
|
40
|
+
|
41
|
+
def api_response
|
42
|
+
ApiResponse.new(@response)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Provides the tax_rate resource as a hash of all its readable attributes
|
46
|
+
def to_h
|
47
|
+
@object
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative './base_service'
|
2
|
-
require 'uri'
|
3
2
|
|
4
3
|
# encoding: utf-8
|
5
4
|
#
|
@@ -59,15 +58,6 @@ module GoCardlessPro
|
|
59
58
|
def envelope_key
|
60
59
|
'bank_details_lookups'
|
61
60
|
end
|
62
|
-
|
63
|
-
# take a URL with placeholder params and substitute them out for the actual value
|
64
|
-
# @param url [String] the URL with placeholders in
|
65
|
-
# @param param_map [Hash] a hash of placeholders and their actual values (which will be escaped)
|
66
|
-
def sub_url(url, param_map)
|
67
|
-
param_map.reduce(url) do |new_url, (param, value)|
|
68
|
-
new_url.gsub(":#{param}", URI.escape(value))
|
69
|
-
end
|
70
|
-
end
|
71
61
|
end
|
72
62
|
end
|
73
63
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
1
3
|
module GoCardlessPro
|
2
4
|
# Module that contains all services for making requests to the API.
|
3
5
|
module Services
|
@@ -23,6 +25,15 @@ module GoCardlessPro
|
|
23
25
|
def envelope_key
|
24
26
|
raise NotImplementedError
|
25
27
|
end
|
28
|
+
|
29
|
+
# take a URL with placeholder params and substitute them out for the actual value
|
30
|
+
# @param url [String] the URL with placeholders in
|
31
|
+
# @param param_map [Hash] a hash of placeholders and their actual values (which will be escaped)
|
32
|
+
def sub_url(url, param_map)
|
33
|
+
param_map.reduce(url) do |new_url, (param, value)|
|
34
|
+
new_url.gsub(":#{param}", CGI.escape(value))
|
35
|
+
end
|
36
|
+
end
|
26
37
|
end
|
27
38
|
end
|
28
39
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative './base_service'
|
2
|
-
require 'uri'
|
3
2
|
|
4
3
|
# encoding: utf-8
|
5
4
|
#
|
@@ -153,15 +152,6 @@ module GoCardlessPro
|
|
153
152
|
def envelope_key
|
154
153
|
'creditor_bank_accounts'
|
155
154
|
end
|
156
|
-
|
157
|
-
# take a URL with placeholder params and substitute them out for the actual value
|
158
|
-
# @param url [String] the URL with placeholders in
|
159
|
-
# @param param_map [Hash] a hash of placeholders and their actual values (which will be escaped)
|
160
|
-
def sub_url(url, param_map)
|
161
|
-
param_map.reduce(url) do |new_url, (param, value)|
|
162
|
-
new_url.gsub(":#{param}", URI.escape(value))
|
163
|
-
end
|
164
|
-
end
|
165
155
|
end
|
166
156
|
end
|
167
157
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative './base_service'
|
2
|
-
require 'uri'
|
3
2
|
|
4
3
|
# encoding: utf-8
|
5
4
|
#
|
@@ -129,15 +128,6 @@ module GoCardlessPro
|
|
129
128
|
def envelope_key
|
130
129
|
'creditors'
|
131
130
|
end
|
132
|
-
|
133
|
-
# take a URL with placeholder params and substitute them out for the actual value
|
134
|
-
# @param url [String] the URL with placeholders in
|
135
|
-
# @param param_map [Hash] a hash of placeholders and their actual values (which will be escaped)
|
136
|
-
def sub_url(url, param_map)
|
137
|
-
param_map.reduce(url) do |new_url, (param, value)|
|
138
|
-
new_url.gsub(":#{param}", URI.escape(value))
|
139
|
-
end
|
140
|
-
end
|
141
131
|
end
|
142
132
|
end
|
143
133
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative './base_service'
|
2
|
-
require 'uri'
|
3
2
|
|
4
3
|
# encoding: utf-8
|
5
4
|
#
|
@@ -53,15 +52,6 @@ module GoCardlessPro
|
|
53
52
|
def envelope_key
|
54
53
|
'currency_exchange_rates'
|
55
54
|
end
|
56
|
-
|
57
|
-
# take a URL with placeholder params and substitute them out for the actual value
|
58
|
-
# @param url [String] the URL with placeholders in
|
59
|
-
# @param param_map [Hash] a hash of placeholders and their actual values (which will be escaped)
|
60
|
-
def sub_url(url, param_map)
|
61
|
-
param_map.reduce(url) do |new_url, (param, value)|
|
62
|
-
new_url.gsub(":#{param}", URI.escape(value))
|
63
|
-
end
|
64
|
-
end
|
65
55
|
end
|
66
56
|
end
|
67
57
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative './base_service'
|
2
|
-
require 'uri'
|
3
2
|
|
4
3
|
# encoding: utf-8
|
5
4
|
#
|
@@ -186,15 +185,6 @@ module GoCardlessPro
|
|
186
185
|
def envelope_key
|
187
186
|
'customer_bank_accounts'
|
188
187
|
end
|
189
|
-
|
190
|
-
# take a URL with placeholder params and substitute them out for the actual value
|
191
|
-
# @param url [String] the URL with placeholders in
|
192
|
-
# @param param_map [Hash] a hash of placeholders and their actual values (which will be escaped)
|
193
|
-
def sub_url(url, param_map)
|
194
|
-
param_map.reduce(url) do |new_url, (param, value)|
|
195
|
-
new_url.gsub(":#{param}", URI.escape(value))
|
196
|
-
end
|
197
|
-
end
|
198
188
|
end
|
199
189
|
end
|
200
190
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative './base_service'
|
2
|
-
require 'uri'
|
3
2
|
|
4
3
|
# encoding: utf-8
|
5
4
|
#
|
@@ -52,15 +51,6 @@ module GoCardlessPro
|
|
52
51
|
def envelope_key
|
53
52
|
'customer_notifications'
|
54
53
|
end
|
55
|
-
|
56
|
-
# take a URL with placeholder params and substitute them out for the actual value
|
57
|
-
# @param url [String] the URL with placeholders in
|
58
|
-
# @param param_map [Hash] a hash of placeholders and their actual values (which will be escaped)
|
59
|
-
def sub_url(url, param_map)
|
60
|
-
param_map.reduce(url) do |new_url, (param, value)|
|
61
|
-
new_url.gsub(":#{param}", URI.escape(value))
|
62
|
-
end
|
63
|
-
end
|
64
54
|
end
|
65
55
|
end
|
66
56
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative './base_service'
|
2
|
-
require 'uri'
|
3
2
|
|
4
3
|
# encoding: utf-8
|
5
4
|
#
|
@@ -153,15 +152,6 @@ module GoCardlessPro
|
|
153
152
|
def envelope_key
|
154
153
|
'customers'
|
155
154
|
end
|
156
|
-
|
157
|
-
# take a URL with placeholder params and substitute them out for the actual value
|
158
|
-
# @param url [String] the URL with placeholders in
|
159
|
-
# @param param_map [Hash] a hash of placeholders and their actual values (which will be escaped)
|
160
|
-
def sub_url(url, param_map)
|
161
|
-
param_map.reduce(url) do |new_url, (param, value)|
|
162
|
-
new_url.gsub(":#{param}", URI.escape(value))
|
163
|
-
end
|
164
|
-
end
|
165
155
|
end
|
166
156
|
end
|
167
157
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative './base_service'
|
2
|
-
require 'uri'
|
3
2
|
|
4
3
|
# encoding: utf-8
|
5
4
|
#
|
@@ -70,15 +69,6 @@ module GoCardlessPro
|
|
70
69
|
def envelope_key
|
71
70
|
'events'
|
72
71
|
end
|
73
|
-
|
74
|
-
# take a URL with placeholder params and substitute them out for the actual value
|
75
|
-
# @param url [String] the URL with placeholders in
|
76
|
-
# @param param_map [Hash] a hash of placeholders and their actual values (which will be escaped)
|
77
|
-
def sub_url(url, param_map)
|
78
|
-
param_map.reduce(url) do |new_url, (param, value)|
|
79
|
-
new_url.gsub(":#{param}", URI.escape(value))
|
80
|
-
end
|
81
|
-
end
|
82
72
|
end
|
83
73
|
end
|
84
74
|
end
|