adyen-ruby-api-library 11.0.0 → 11.2.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/.github/workflows/codeql.yml +4 -4
- data/.github/workflows/label_new_issues.yml +1 -1
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/ruby.yml +11 -3
- data/.github/workflows/rubygems_release.yml +2 -2
- data/.github/workflows/stale.yml +1 -1
- data/AGENTS.md +73 -0
- data/README.md +5 -0
- data/VERSION +1 -1
- data/lib/adyen/client.rb +30 -9
- data/lib/adyen/errors.rb +6 -0
- data/lib/adyen/services/balancePlatform/sca_association_management_api.rb +46 -0
- data/lib/adyen/services/balancePlatform/sca_device_management_api.rb +46 -0
- data/lib/adyen/services/balancePlatform.rb +10 -0
- data/lib/adyen/services/capital/grant_accounts_api.rb +26 -0
- data/lib/adyen/services/capital/grant_offers_api.rb +36 -0
- data/lib/adyen/services/capital/grants_api.rb +76 -0
- data/lib/adyen/services/capital.rb +34 -0
- data/lib/adyen/services/checkout/recurring_api.rb +10 -0
- data/lib/adyen/services/legalEntityManagement/legal_entities_api.rb +10 -0
- data/lib/adyen/services/payment/modifications_api.rb +1 -1
- data/lib/adyen/services/payment/payments_api.rb +1 -1
- data/lib/adyen/services/payment.rb +2 -2
- data/lib/adyen/services/recurring/recurring_api.rb +1 -1
- data/lib/adyen/services/recurring.rb +1 -1
- data/lib/adyen/version.rb +1 -1
- data/lib/adyen-ruby-api-library.rb +1 -0
- data/renovate.json +3 -1
- data/spec/capital_spec.rb +186 -0
- data/spec/checkout_spec.rb +13 -0
- data/spec/client_spec.rb +235 -64
- data/spec/data_protection_spec.rb +2 -2
- data/spec/disputes_spec.rb +3 -3
- data/spec/lem_spec.rb +75 -0
- data/spec/mocks/responses/Capital/get-grant-account-success.json +20 -0
- data/spec/mocks/responses/Capital/get-grant-disbursement-success.json +26 -0
- data/spec/mocks/responses/Capital/get-grant-disbursements-success.json +30 -0
- data/spec/mocks/responses/Capital/get-grant-offer-success.json +31 -0
- data/spec/mocks/responses/Capital/get-grant-success.json +22 -0
- data/spec/mocks/responses/Capital/grant-offers-success.json +19 -0
- data/spec/mocks/responses/Capital/grants-success.json +26 -0
- data/spec/mocks/responses/Capital/request-grant.json +31 -0
- data/spec/mocks/responses/Capital/update-grant-disbursement-success.json +26 -0
- data/spec/mocks/responses/LegalEntityManagement/get_legal_entity.json +14 -0
- data/templates/api-single.mustache +1 -1
- data/templates/api.mustache +1 -1
- metadata +23 -6
- data/Makefile +0 -79
- /data/spec/mocks/requests/{DataProtectionService → DataProtection}/request_subject_erasure.json +0 -0
- /data/spec/mocks/requests/{DisputesService → Disputes}/retrieve_applicable_defense_reasons.json +0 -0
- /data/spec/mocks/responses/{DataProtectionService → DataProtection}/request_subject_erasure.json +0 -0
- /data/spec/mocks/responses/{DisputesService → Disputes}/retrieve_applicable_defense_reasons.json +0 -0
|
@@ -62,6 +62,16 @@ module Adyen
|
|
|
62
62
|
@client.call_adyen_api(@service, action, {}, headers, @version)
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
# Request periodic data review.
|
|
66
|
+
def request_periodic_review(id, headers: {})
|
|
67
|
+
endpoint = '/legalEntities/{id}/requestPeriodicReview'.gsub(/{.+?}/, '%s')
|
|
68
|
+
endpoint = endpoint.gsub(%r{^/}, '')
|
|
69
|
+
endpoint = format(endpoint, id)
|
|
70
|
+
|
|
71
|
+
action = { method: 'post', url: endpoint }
|
|
72
|
+
@client.call_adyen_api(@service, action, {}, headers, @version)
|
|
73
|
+
end
|
|
74
|
+
|
|
65
75
|
# Update a legal entity
|
|
66
76
|
def update_legal_entity(request, id, headers: {})
|
|
67
77
|
endpoint = '/legalEntities/{id}'.gsub(/{.+?}/, '%s')
|
|
@@ -18,11 +18,11 @@ module Adyen
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def modifications_api
|
|
21
|
-
@modifications_api ||= Adyen::
|
|
21
|
+
@modifications_api ||= Adyen::ClassicModificationsApi.new(@client, @version)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def payments_api
|
|
25
|
-
@payments_api ||= Adyen::
|
|
25
|
+
@payments_api ||= Adyen::ClassicPaymentsApi.new(@client, @version)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
end
|
data/lib/adyen/version.rb
CHANGED
data/renovate.json
CHANGED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'json'
|
|
3
|
+
|
|
4
|
+
RSpec.describe Adyen::Capital do
|
|
5
|
+
let(:client) { create_client(:api_key) }
|
|
6
|
+
let(:service) { 'Capital' }
|
|
7
|
+
let(:version) { client.capital.version }
|
|
8
|
+
|
|
9
|
+
describe 'GrantAccountsApi' do
|
|
10
|
+
it 'gets grant account information' do
|
|
11
|
+
response_body = json_from_file('mocks/responses/Capital/get-grant-account-success.json')
|
|
12
|
+
grant_account_id = 'CG00000000000000000000001'
|
|
13
|
+
|
|
14
|
+
url = client.service_url(service, "grantAccounts/#{grant_account_id}", version)
|
|
15
|
+
|
|
16
|
+
WebMock.stub_request(:get, url)
|
|
17
|
+
.with(headers: { 'x-api-key' => client.api_key })
|
|
18
|
+
.to_return(body: response_body)
|
|
19
|
+
|
|
20
|
+
result = client.capital.grant_accounts_api.get_grant_account_information(grant_account_id)
|
|
21
|
+
|
|
22
|
+
expect(result.status).to eq(200)
|
|
23
|
+
expect(result.response).to eq(JSON.parse(response_body))
|
|
24
|
+
expect(result.response).to be_a(Adyen::HashWithAccessors)
|
|
25
|
+
expect(result.response).to be_a(Hash)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe 'GrantOffersApi' do
|
|
30
|
+
it 'gets all grant offers with query params' do
|
|
31
|
+
response_body = json_from_file('mocks/responses/Capital/grant-offers-success.json')
|
|
32
|
+
account_holder_id = 'AH00000000000000000000001'
|
|
33
|
+
|
|
34
|
+
url = client.service_url(service, 'grantOffers', version)
|
|
35
|
+
|
|
36
|
+
WebMock.stub_request(:get, url)
|
|
37
|
+
.with(
|
|
38
|
+
query: { 'accountHolderId' => account_holder_id },
|
|
39
|
+
headers: { 'x-api-key' => client.api_key }
|
|
40
|
+
)
|
|
41
|
+
.to_return(body: response_body)
|
|
42
|
+
|
|
43
|
+
result = client.capital.grant_offers_api.get_all_grant_offers(query_params: { 'accountHolderId' => account_holder_id })
|
|
44
|
+
|
|
45
|
+
expect(result.status).to eq(200)
|
|
46
|
+
expect(result.response).to eq(JSON.parse(response_body))
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 'gets all grant offers without query params' do
|
|
50
|
+
response_body = json_from_file('mocks/responses/Capital/grant-offers-success.json')
|
|
51
|
+
|
|
52
|
+
url = client.service_url(service, 'grantOffers', version)
|
|
53
|
+
|
|
54
|
+
WebMock.stub_request(:get, url)
|
|
55
|
+
.with(headers: { 'x-api-key' => client.api_key })
|
|
56
|
+
.to_return(body: response_body)
|
|
57
|
+
|
|
58
|
+
result = client.capital.grant_offers_api.get_all_grant_offers
|
|
59
|
+
|
|
60
|
+
expect(result.status).to eq(200)
|
|
61
|
+
expect(result.response).to eq(JSON.parse(response_body))
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'gets a specific grant offer' do
|
|
65
|
+
response_body = json_from_file('mocks/responses/Capital/get-grant-offer-success.json')
|
|
66
|
+
id = 'GO00000000000000000000001'
|
|
67
|
+
|
|
68
|
+
url = client.service_url(service, "grantOffers/#{id}", version)
|
|
69
|
+
|
|
70
|
+
WebMock.stub_request(:get, url)
|
|
71
|
+
.with(headers: { 'x-api-key' => client.api_key })
|
|
72
|
+
.to_return(body: response_body)
|
|
73
|
+
|
|
74
|
+
result = client.capital.grant_offers_api.get_grant_offer(id)
|
|
75
|
+
|
|
76
|
+
expect(result.status).to eq(200)
|
|
77
|
+
expect(result.response).to eq(JSON.parse(response_body))
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
describe 'GrantsApi' do
|
|
82
|
+
it 'gets a specific grant' do
|
|
83
|
+
response_body = json_from_file('mocks/responses/Capital/get-grant-success.json')
|
|
84
|
+
id = 'GR00000000000000000000001'
|
|
85
|
+
|
|
86
|
+
url = client.service_url(service, "grants/#{id}", version)
|
|
87
|
+
|
|
88
|
+
WebMock.stub_request(:get, url)
|
|
89
|
+
.with(headers: { 'x-api-key' => client.api_key })
|
|
90
|
+
.to_return(body: response_body)
|
|
91
|
+
|
|
92
|
+
result = client.capital.grants_api.get_grant(id)
|
|
93
|
+
|
|
94
|
+
expect(result.status).to eq(200)
|
|
95
|
+
expect(result.response).to eq(JSON.parse(response_body))
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it 'gets all grants' do
|
|
99
|
+
response_body = json_from_file('mocks/responses/Capital/grants-success.json')
|
|
100
|
+
|
|
101
|
+
url = client.service_url(service, 'grants', version)
|
|
102
|
+
|
|
103
|
+
WebMock.stub_request(:get, url)
|
|
104
|
+
.with(headers: { 'x-api-key' => client.api_key })
|
|
105
|
+
.to_return(body: response_body)
|
|
106
|
+
|
|
107
|
+
result = client.capital.grants_api.get_all_grants
|
|
108
|
+
|
|
109
|
+
expect(result.status).to eq(200)
|
|
110
|
+
expect(result.response).to eq(JSON.parse(response_body))
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
it 'requests a grant' do
|
|
114
|
+
request_payload = { "grantAccountId" => "GR00000000000000000000001" }
|
|
115
|
+
response_body = json_from_file('mocks/responses/Capital/request-grant.json')
|
|
116
|
+
|
|
117
|
+
url = client.service_url(service, 'grants', version)
|
|
118
|
+
|
|
119
|
+
WebMock.stub_request(:post, url)
|
|
120
|
+
.with(
|
|
121
|
+
body: request_payload,
|
|
122
|
+
headers: { 'x-api-key' => client.api_key }
|
|
123
|
+
)
|
|
124
|
+
.to_return(body: response_body)
|
|
125
|
+
|
|
126
|
+
result = client.capital.grants_api.request_grant(request_payload)
|
|
127
|
+
|
|
128
|
+
expect(result.status).to eq(200)
|
|
129
|
+
expect(result.response).to eq(JSON.parse(response_body))
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
it 'gets a grant disbursement' do
|
|
133
|
+
response_body = json_from_file('mocks/responses/Capital/get-grant-disbursement-success.json')
|
|
134
|
+
grant_id = 'GR00000000000000000000001'
|
|
135
|
+
disbursement_id = 'DI00000000000000000000001'
|
|
136
|
+
|
|
137
|
+
url = client.service_url(service, "grants/#{grant_id}/disbursements/#{disbursement_id}", version)
|
|
138
|
+
|
|
139
|
+
WebMock.stub_request(:get, url)
|
|
140
|
+
.with(headers: { 'x-api-key' => client.api_key })
|
|
141
|
+
.to_return(body: response_body)
|
|
142
|
+
|
|
143
|
+
result = client.capital.grants_api.get_grant_disbursement(grant_id, disbursement_id)
|
|
144
|
+
|
|
145
|
+
expect(result.status).to eq(200)
|
|
146
|
+
expect(result.response).to eq(JSON.parse(response_body))
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
it 'gets all grant disbursements' do
|
|
150
|
+
response_body = json_from_file('mocks/responses/Capital/get-grant-disbursements-success.json')
|
|
151
|
+
grant_id = 'GR00000000000000000000001'
|
|
152
|
+
|
|
153
|
+
url = client.service_url(service, "grants/#{grant_id}/disbursements", version)
|
|
154
|
+
|
|
155
|
+
WebMock.stub_request(:get, url)
|
|
156
|
+
.with(headers: { 'x-api-key' => client.api_key })
|
|
157
|
+
.to_return(body: response_body)
|
|
158
|
+
|
|
159
|
+
result = client.capital.grants_api.get_all_grant_disbursements(grant_id)
|
|
160
|
+
|
|
161
|
+
expect(result.status).to eq(200)
|
|
162
|
+
expect(result.response).to eq(JSON.parse(response_body))
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
it 'updates a grant disbursement' do
|
|
166
|
+
response_body = json_from_file('mocks/responses/Capital/update-grant-disbursement-success.json')
|
|
167
|
+
grant_id = 'GR00000000000000000000001'
|
|
168
|
+
disbursement_id = 'DI00000000000000000000001'
|
|
169
|
+
request_payload = {}
|
|
170
|
+
|
|
171
|
+
url = client.service_url(service, "grants/#{grant_id}/disbursements/#{disbursement_id}", version)
|
|
172
|
+
|
|
173
|
+
WebMock.stub_request(:patch, url)
|
|
174
|
+
.with(
|
|
175
|
+
body: request_payload,
|
|
176
|
+
headers: { 'x-api-key' => client.api_key }
|
|
177
|
+
)
|
|
178
|
+
.to_return(body: response_body)
|
|
179
|
+
|
|
180
|
+
result = client.capital.grants_api.update_grant_disbursement(request_payload, grant_id, disbursement_id)
|
|
181
|
+
|
|
182
|
+
expect(result.status).to eq(200)
|
|
183
|
+
expect(result.response).to eq(JSON.parse(response_body))
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|
data/spec/checkout_spec.rb
CHANGED
|
@@ -8,6 +8,19 @@ RSpec.describe Adyen::Checkout, service: 'checkout' do
|
|
|
8
8
|
service: 'Checkout'
|
|
9
9
|
}
|
|
10
10
|
end
|
|
11
|
+
|
|
12
|
+
it 'uses the correct PaymentsApi for the Checkout service' do
|
|
13
|
+
# Load both API files to ensure there's no conflict after the fix.
|
|
14
|
+
load File.expand_path('../lib/adyen/services/payment/payments_api.rb', __dir__)
|
|
15
|
+
load File.expand_path('../lib/adyen/services/checkout/payments_api.rb', __dir__)
|
|
16
|
+
|
|
17
|
+
checkout = Adyen::Checkout.new(@shared_values[:client])
|
|
18
|
+
payments_api = checkout.payments_api
|
|
19
|
+
|
|
20
|
+
# Verify that the Checkout facade uses the correct PaymentsApi class.
|
|
21
|
+
expect(payments_api.class.name).to eq('Adyen::PaymentsApi')
|
|
22
|
+
expect(payments_api.service).to eq('Checkout')
|
|
23
|
+
end
|
|
11
24
|
|
|
12
25
|
# must be created manually because every field in the response is an array
|
|
13
26
|
it 'makes a payment_methods call' do
|