adyen-ruby-api-library 10.4.0 → 11.1.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/CODEOWNERS +1 -1
- data/.github/workflows/codeql.yml +1 -1
- data/.github/workflows/release.yml +3 -2
- data/.github/workflows/ruby.yml +1 -1
- data/.github/workflows/rubygems_release.yml +1 -1
- data/README.md +6 -10
- data/VERSION +1 -1
- data/lib/adyen/client.rb +64 -19
- data/lib/adyen/errors.rb +11 -3
- data/lib/adyen/services/{balanceControlService.rb → balanceControl/balance_control_api.rb} +5 -4
- data/lib/adyen/services/balanceControl.rb +24 -0
- data/lib/adyen/services/balancePlatform/authorized_card_users_api.rb +2 -2
- data/lib/adyen/services/balancePlatform/balances_api.rb +2 -2
- data/lib/adyen/services/balancePlatform/transfer_limits_balance_account_level_api.rb +76 -0
- data/lib/adyen/services/balancePlatform/transfer_limits_balance_platform_level_api.rb +56 -0
- data/lib/adyen/services/balancePlatform.rb +10 -0
- data/lib/adyen/services/binLookup/bin_lookup_api.rb +36 -0
- data/lib/adyen/services/binLookup.rb +8 -21
- data/lib/adyen/services/checkout/donations_api.rb +1 -1
- data/lib/adyen/services/checkout/utility_api.rb +10 -0
- data/lib/adyen/services/dataProtection/data_protection_api.rb +26 -0
- data/lib/adyen/services/dataProtection.rb +8 -11
- data/lib/adyen/services/disputes/disputes_api.rb +66 -0
- data/lib/adyen/services/disputes.rb +8 -51
- data/lib/adyen/services/legalEntityManagement/legal_entities_api.rb +10 -0
- data/lib/adyen/services/legalEntityManagement.rb +1 -1
- data/lib/adyen/services/management/split_configuration_merchant_level_api.rb +7 -7
- data/lib/adyen/services/openBanking/account_verification_api.rb +36 -0
- data/lib/adyen/services/openBanking.rb +24 -0
- data/lib/adyen/services/payment/modifications_api.rb +98 -0
- data/lib/adyen/services/payment/payments_api.rb +66 -0
- data/lib/adyen/services/payment.rb +11 -131
- data/lib/adyen/services/paymentsApp/payments_app_api.rb +66 -0
- data/lib/adyen/services/paymentsApp.rb +8 -51
- data/lib/adyen/services/posMobile/pos_mobile_api.rb +26 -0
- data/lib/adyen/services/posMobile.rb +8 -11
- data/lib/adyen/services/recurring/recurring_api.rb +80 -0
- data/lib/adyen/services/recurring.rb +8 -61
- data/lib/adyen/services/sessionAuthentication/session_authentication_api.rb +1 -1
- data/lib/adyen/services/storedValue/stored_value_api.rb +76 -0
- data/lib/adyen/services/storedValue.rb +8 -61
- data/lib/adyen/version.rb +1 -1
- data/lib/adyen-ruby-api-library.rb +4 -1
- data/renovate.json +3 -1
- data/spec/balance_control_spec.rb +7 -5
- data/spec/balance_platform_spec.rb +344 -63
- data/spec/bin_lookup_spec.rb +4 -3
- data/spec/checkout_spec.rb +13 -0
- data/spec/client_spec.rb +157 -3
- data/spec/data_protection_spec.rb +2 -2
- data/spec/disputes_spec.rb +5 -4
- data/spec/lem_spec.rb +75 -0
- data/spec/mocks/requests/BalancePlatform/create_transfer_limit.json +14 -0
- data/spec/mocks/requests/BalancePlatform/create_webhook_setting.json +16 -0
- data/spec/mocks/requests/OpenBanking/create_account_verification_routes.json +6 -0
- data/spec/mocks/requests/SessionAuthentication/create_authentication_session.json +16 -0
- data/spec/mocks/responses/BalancePlatform/create_transfer_limit.json +16 -0
- data/spec/mocks/responses/BalancePlatform/create_webhook_setting.json +17 -0
- data/spec/mocks/responses/BalancePlatform/get_all_authorised_card_users.json +6 -0
- data/spec/mocks/responses/BalancePlatform/get_all_webhook_settings.json +38 -0
- data/spec/mocks/responses/BalancePlatform/get_specific_transfer_limit.json +17 -0
- data/spec/mocks/responses/BalancePlatform/get_transfer_limits.json +38 -0
- data/spec/mocks/responses/LegalEntityManagement/get_legal_entity.json +14 -0
- data/spec/mocks/responses/OpenBanking/create_account_verification_routes.json +11 -0
- data/spec/mocks/responses/OpenBanking/get_account_verification_report.json +30 -0
- data/spec/mocks/responses/SessionAuthentication/create_authentication_session.json +4 -0
- data/spec/open_banking_spec.rb +68 -0
- data/spec/payments_spec.rb +1 -1
- data/spec/recurring_spec.rb +1 -1
- data/spec/session_authentication_spec.rb +40 -0
- data/spec/stored_value_spec.rb +1 -1
- data/templates/api-single.mustache +1 -1
- data/templates/api.mustache +2 -2
- metadata +36 -7
- 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
|
@@ -1,76 +1,23 @@
|
|
|
1
|
-
require_relative '
|
|
1
|
+
require_relative 'storedValue/stored_value_api'
|
|
2
|
+
|
|
2
3
|
module Adyen
|
|
3
4
|
|
|
4
5
|
# NOTE: This class is auto generated by OpenAPI Generator
|
|
5
6
|
# Ref: https://openapi-generator.tech
|
|
6
7
|
#
|
|
7
8
|
# Do not edit the class manually.
|
|
8
|
-
class StoredValue
|
|
9
|
+
class StoredValue
|
|
9
10
|
attr_accessor :service, :version
|
|
10
11
|
|
|
11
12
|
DEFAULT_VERSION = 46
|
|
12
13
|
def initialize(client, version = DEFAULT_VERSION)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# Changes the status of the payment method.
|
|
17
|
-
def change_status(request, headers: {})
|
|
18
|
-
endpoint = '/changeStatus'.gsub(/{.+?}/, '%s')
|
|
19
|
-
endpoint = endpoint.gsub(%r{^/}, '')
|
|
20
|
-
endpoint = format(endpoint)
|
|
21
|
-
|
|
22
|
-
action = { method: 'post', url: endpoint }
|
|
23
|
-
@client.call_adyen_api(@service, action, request, headers, @version)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Checks the balance.
|
|
27
|
-
def check_balance(request, headers: {})
|
|
28
|
-
endpoint = '/checkBalance'.gsub(/{.+?}/, '%s')
|
|
29
|
-
endpoint = endpoint.gsub(%r{^/}, '')
|
|
30
|
-
endpoint = format(endpoint)
|
|
31
|
-
|
|
32
|
-
action = { method: 'post', url: endpoint }
|
|
33
|
-
@client.call_adyen_api(@service, action, request, headers, @version)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# Issues a new card.
|
|
37
|
-
def issue(request, headers: {})
|
|
38
|
-
endpoint = '/issue'.gsub(/{.+?}/, '%s')
|
|
39
|
-
endpoint = endpoint.gsub(%r{^/}, '')
|
|
40
|
-
endpoint = format(endpoint)
|
|
41
|
-
|
|
42
|
-
action = { method: 'post', url: endpoint }
|
|
43
|
-
@client.call_adyen_api(@service, action, request, headers, @version)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# Loads the payment method.
|
|
47
|
-
def load(request, headers: {})
|
|
48
|
-
endpoint = '/load'.gsub(/{.+?}/, '%s')
|
|
49
|
-
endpoint = endpoint.gsub(%r{^/}, '')
|
|
50
|
-
endpoint = format(endpoint)
|
|
51
|
-
|
|
52
|
-
action = { method: 'post', url: endpoint }
|
|
53
|
-
@client.call_adyen_api(@service, action, request, headers, @version)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# Merge the balance of two cards.
|
|
57
|
-
def merge_balance(request, headers: {})
|
|
58
|
-
endpoint = '/mergeBalance'.gsub(/{.+?}/, '%s')
|
|
59
|
-
endpoint = endpoint.gsub(%r{^/}, '')
|
|
60
|
-
endpoint = format(endpoint)
|
|
61
|
-
|
|
62
|
-
action = { method: 'post', url: endpoint }
|
|
63
|
-
@client.call_adyen_api(@service, action, request, headers, @version)
|
|
14
|
+
@service = 'StoredValue'
|
|
15
|
+
@client = client
|
|
16
|
+
@version = version
|
|
64
17
|
end
|
|
65
18
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
endpoint = '/voidTransaction'.gsub(/{.+?}/, '%s')
|
|
69
|
-
endpoint = endpoint.gsub(%r{^/}, '')
|
|
70
|
-
endpoint = format(endpoint)
|
|
71
|
-
|
|
72
|
-
action = { method: 'post', url: endpoint }
|
|
73
|
-
@client.call_adyen_api(@service, action, request, headers, @version)
|
|
19
|
+
def stored_value_api
|
|
20
|
+
@stored_value_api ||= Adyen::StoredValueApi.new(@client, @version)
|
|
74
21
|
end
|
|
75
22
|
|
|
76
23
|
end
|
data/lib/adyen/version.rb
CHANGED
|
@@ -18,6 +18,9 @@ require_relative 'adyen/services/balancePlatform'
|
|
|
18
18
|
require_relative 'adyen/services/transfers'
|
|
19
19
|
require_relative 'adyen/services/management'
|
|
20
20
|
require_relative 'adyen/services/storedValue'
|
|
21
|
-
require_relative 'adyen/services/balanceControlService'
|
|
22
21
|
require_relative 'adyen/services/terminalCloudAPI'
|
|
23
22
|
require_relative 'adyen/services/posMobile'
|
|
23
|
+
require_relative 'adyen/services/openBanking'
|
|
24
|
+
require_relative 'adyen/services/sessionAuthentication'
|
|
25
|
+
require_relative 'adyen/services/balanceControl'
|
|
26
|
+
|
data/renovate.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
require 'json'
|
|
3
3
|
|
|
4
|
-
RSpec.describe Adyen::
|
|
4
|
+
RSpec.describe Adyen::BalanceControl, service: 'balanceControl' do
|
|
5
5
|
before(:all) do
|
|
6
6
|
@shared_values = {
|
|
7
7
|
client: create_client(:api_key),
|
|
8
|
-
service: '
|
|
8
|
+
service: 'BalanceControl'
|
|
9
9
|
}
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -15,8 +15,10 @@ RSpec.describe Adyen::BalancePlatform, service: 'balancePlatform' do
|
|
|
15
15
|
|
|
16
16
|
response_body = json_from_file('mocks/responses/BalanceControl/balance_transfer.json')
|
|
17
17
|
|
|
18
|
-
url = @shared_values[:client].service_url(
|
|
19
|
-
|
|
18
|
+
url = @shared_values[:client].service_url(
|
|
19
|
+
@shared_values[:service],
|
|
20
|
+
'balanceTransfer',
|
|
21
|
+
@shared_values[:client].balance_control.version)
|
|
20
22
|
WebMock.stub_request(:post, url)
|
|
21
23
|
.with(
|
|
22
24
|
body: request_body,
|
|
@@ -28,7 +30,7 @@ RSpec.describe Adyen::BalancePlatform, service: 'balancePlatform' do
|
|
|
28
30
|
body: response_body
|
|
29
31
|
)
|
|
30
32
|
|
|
31
|
-
result = @shared_values[:client].
|
|
33
|
+
result = @shared_values[:client].balance_control.balance_control_api.balance_transfer(request_body)
|
|
32
34
|
response_hash = result.response
|
|
33
35
|
|
|
34
36
|
expect(result.status)
|
|
@@ -10,54 +10,46 @@ RSpec.describe Adyen::BalancePlatform, service: 'balancePlatform' do
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
# must be created manually because every field in the response is an array
|
|
13
|
-
it 'makes
|
|
13
|
+
it 'makes an account_holder POST call' do
|
|
14
14
|
request_body = JSON.parse(json_from_file('mocks/requests/BalancePlatform/create_account_holder.json'))
|
|
15
|
-
|
|
16
15
|
response_body = json_from_file('mocks/responses/BalancePlatform/create_account_holder.json')
|
|
17
16
|
|
|
18
|
-
url = @shared_values[:client].service_url(
|
|
19
|
-
|
|
17
|
+
url = @shared_values[:client].service_url(
|
|
18
|
+
@shared_values[:service],
|
|
19
|
+
'accountHolders',
|
|
20
|
+
@shared_values[:client].balance_platform.version
|
|
21
|
+
)
|
|
20
22
|
WebMock.stub_request(:post, url)
|
|
21
23
|
.with(
|
|
22
24
|
body: request_body,
|
|
23
|
-
headers: {
|
|
24
|
-
'x-api-key' => @shared_values[:client].api_key
|
|
25
|
-
}
|
|
26
|
-
)
|
|
27
|
-
.to_return(
|
|
28
|
-
body: response_body
|
|
25
|
+
headers: { 'x-api-key' => @shared_values[:client].api_key }
|
|
29
26
|
)
|
|
27
|
+
.to_return(body: response_body)
|
|
30
28
|
|
|
31
29
|
result = @shared_values[:client].balance_platform.account_holders_api.create_account_holder(request_body)
|
|
32
30
|
response_hash = result.response
|
|
33
31
|
|
|
34
|
-
expect(result.status)
|
|
35
|
-
|
|
36
|
-
expect(response_hash)
|
|
37
|
-
|
|
38
|
-
expect(response_hash)
|
|
39
|
-
.to be_a Adyen::HashWithAccessors
|
|
40
|
-
expect(response_hash)
|
|
41
|
-
.to be_a_kind_of Hash
|
|
32
|
+
expect(result.status).to eq(200)
|
|
33
|
+
expect(response_hash).to eq(JSON.parse(response_body))
|
|
34
|
+
expect(response_hash).to be_a Adyen::HashWithAccessors
|
|
35
|
+
expect(response_hash).to be_a_kind_of Hash
|
|
42
36
|
end
|
|
43
37
|
|
|
44
|
-
it 'makes
|
|
38
|
+
it 'makes an account_holder PATCH call' do
|
|
45
39
|
request_body = JSON.parse(json_from_file('mocks/requests/BalancePlatform/update_account_holder.json'))
|
|
46
|
-
|
|
47
40
|
response_body = json_from_file('mocks/responses/BalancePlatform/update_account_holder.json')
|
|
48
41
|
|
|
49
|
-
url = @shared_values[:client].service_url(
|
|
50
|
-
|
|
42
|
+
url = @shared_values[:client].service_url(
|
|
43
|
+
@shared_values[:service],
|
|
44
|
+
'accountHolders/AH3227C223222C5GKR23686TF',
|
|
45
|
+
@shared_values[:client].balance_platform.version
|
|
46
|
+
)
|
|
51
47
|
WebMock.stub_request(:patch, url)
|
|
52
48
|
.with(
|
|
53
49
|
body: request_body,
|
|
54
|
-
headers: {
|
|
55
|
-
'x-api-key' => @shared_values[:client].api_key
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
.to_return(
|
|
59
|
-
body: response_body
|
|
50
|
+
headers: { 'x-api-key' => @shared_values[:client].api_key }
|
|
60
51
|
)
|
|
52
|
+
.to_return(body: response_body)
|
|
61
53
|
|
|
62
54
|
result = @shared_values[:client].balance_platform.account_holders_api.update_account_holder(
|
|
63
55
|
request_body,
|
|
@@ -65,43 +57,32 @@ RSpec.describe Adyen::BalancePlatform, service: 'balancePlatform' do
|
|
|
65
57
|
)
|
|
66
58
|
response_hash = result.response
|
|
67
59
|
|
|
68
|
-
expect(result.status)
|
|
69
|
-
|
|
70
|
-
expect(response_hash)
|
|
71
|
-
|
|
72
|
-
expect(response_hash)
|
|
73
|
-
.to be_a Adyen::HashWithAccessors
|
|
74
|
-
expect(response_hash)
|
|
75
|
-
.to be_a_kind_of Hash
|
|
60
|
+
expect(result.status).to eq(200)
|
|
61
|
+
expect(response_hash).to eq(JSON.parse(response_body))
|
|
62
|
+
expect(response_hash).to be_a Adyen::HashWithAccessors
|
|
63
|
+
expect(response_hash).to be_a_kind_of Hash
|
|
76
64
|
end
|
|
77
65
|
|
|
78
66
|
it 'makes a balance_account GET call' do
|
|
79
67
|
response_body = json_from_file('mocks/responses/BalancePlatform/get_balance_account.json')
|
|
80
68
|
|
|
81
|
-
url = @shared_values[:client].service_url(
|
|
82
|
-
|
|
69
|
+
url = @shared_values[:client].service_url(
|
|
70
|
+
@shared_values[:service],
|
|
71
|
+
'balanceAccounts/BA3227C223222B5BLP6JQC3FD',
|
|
72
|
+
@shared_values[:client].balance_platform.version
|
|
73
|
+
)
|
|
83
74
|
WebMock.stub_request(:get, url)
|
|
84
|
-
.with(
|
|
85
|
-
|
|
86
|
-
'x-api-key' => @shared_values[:client].api_key
|
|
87
|
-
}
|
|
88
|
-
)
|
|
89
|
-
.to_return(
|
|
90
|
-
body: response_body
|
|
91
|
-
)
|
|
75
|
+
.with(headers: { 'x-api-key' => @shared_values[:client].api_key })
|
|
76
|
+
.to_return(body: response_body)
|
|
92
77
|
|
|
93
78
|
result = @shared_values[:client].balance_platform.balance_accounts_api
|
|
94
79
|
.get_balance_account('BA3227C223222B5BLP6JQC3FD')
|
|
95
80
|
response_hash = result.response
|
|
96
81
|
|
|
97
|
-
expect(result.status)
|
|
98
|
-
|
|
99
|
-
expect(response_hash)
|
|
100
|
-
|
|
101
|
-
expect(response_hash)
|
|
102
|
-
.to be_a Adyen::HashWithAccessors
|
|
103
|
-
expect(response_hash)
|
|
104
|
-
.to be_a_kind_of Hash
|
|
82
|
+
expect(result.status).to eq(200)
|
|
83
|
+
expect(response_hash).to eq(JSON.parse(response_body))
|
|
84
|
+
expect(response_hash).to be_a Adyen::HashWithAccessors
|
|
85
|
+
expect(response_hash).to be_a_kind_of Hash
|
|
105
86
|
end
|
|
106
87
|
|
|
107
88
|
it 'makes a balance_account/sweeps DELETE call' do
|
|
@@ -111,19 +92,319 @@ RSpec.describe Adyen::BalancePlatform, service: 'balancePlatform' do
|
|
|
111
92
|
@shared_values[:client].balance_platform.version
|
|
112
93
|
)
|
|
113
94
|
WebMock.stub_request(:delete, url)
|
|
95
|
+
.with(headers: { 'x-api-key' => @shared_values[:client].api_key })
|
|
96
|
+
.to_return(body: '{}')
|
|
97
|
+
|
|
98
|
+
result = @shared_values[:client].balance_platform.balance_accounts_api.delete_sweep('balanceAccountID', 'sweepID')
|
|
99
|
+
result.response
|
|
100
|
+
|
|
101
|
+
expect(result.status).to eq(200)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
## balancePlatform level transferLimits
|
|
105
|
+
it 'makes a create_transfer_limit POST call' do
|
|
106
|
+
request_body = JSON.parse(json_from_file('mocks/requests/BalancePlatform/create_transfer_limit.json'))
|
|
107
|
+
response_body = json_from_file('mocks/responses/BalancePlatform/create_transfer_limit.json')
|
|
108
|
+
balance_platform_id = 'YOUR_BALANCE_PLATFORM_ID'
|
|
109
|
+
|
|
110
|
+
url = @shared_values[:client].service_url(
|
|
111
|
+
@shared_values[:service],
|
|
112
|
+
"balancePlatforms/#{balance_platform_id}/transferLimits",
|
|
113
|
+
@shared_values[:client].balance_platform.version
|
|
114
|
+
)
|
|
115
|
+
WebMock.stub_request(:post, url)
|
|
114
116
|
.with(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
117
|
+
body: request_body,
|
|
118
|
+
headers: { 'x-api-key' => @shared_values[:client].api_key }
|
|
118
119
|
)
|
|
119
|
-
.to_return(
|
|
120
|
-
|
|
120
|
+
.to_return(body: response_body)
|
|
121
|
+
|
|
122
|
+
result = @shared_values[:client].balance_platform.transfer_limits_balance_platform_level_api
|
|
123
|
+
.create_transfer_limit(request_body, balance_platform_id)
|
|
124
|
+
response_hash = result.response
|
|
125
|
+
|
|
126
|
+
expect(result.status).to eq(200)
|
|
127
|
+
expect(response_hash).to eq(JSON.parse(response_body))
|
|
128
|
+
expect(response_hash).to be_a Adyen::HashWithAccessors
|
|
129
|
+
expect(response_hash).to be_a_kind_of Hash
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
it 'makes a get_transfer_limits GET call' do
|
|
133
|
+
response_body = json_from_file('mocks/responses/BalancePlatform/get_transfer_limits.json')
|
|
134
|
+
balance_platform_id = 'YOUR_BALANCE_PLATFORM_ID'
|
|
135
|
+
|
|
136
|
+
url = @shared_values[:client].service_url(
|
|
137
|
+
@shared_values[:service],
|
|
138
|
+
"balancePlatforms/#{balance_platform_id}/transferLimits",
|
|
139
|
+
@shared_values[:client].balance_platform.version
|
|
140
|
+
)
|
|
141
|
+
WebMock.stub_request(:get, url)
|
|
142
|
+
.with(headers: { 'x-api-key' => @shared_values[:client].api_key })
|
|
143
|
+
.to_return(body: response_body)
|
|
144
|
+
|
|
145
|
+
result = @shared_values[:client].balance_platform.transfer_limits_balance_platform_level_api
|
|
146
|
+
.get_transfer_limits(balance_platform_id)
|
|
147
|
+
response_hash = result.response
|
|
148
|
+
|
|
149
|
+
expect(result.status).to eq(200)
|
|
150
|
+
expect(response_hash).to eq(JSON.parse(response_body))
|
|
151
|
+
expect(response_hash).to be_a Adyen::HashWithAccessors
|
|
152
|
+
expect(response_hash).to be_a_kind_of Hash
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
it 'makes a get_specific_transfer_limit GET call' do
|
|
156
|
+
response_body = json_from_file('mocks/responses/BalancePlatform/get_specific_transfer_limit.json')
|
|
157
|
+
balance_platform_id = 'YOUR_BALANCE_PLATFORM_ID'
|
|
158
|
+
transfer_limit_id = 'YOUR_TRANSFER_LIMIT_ID'
|
|
159
|
+
|
|
160
|
+
url = @shared_values[:client].service_url(
|
|
161
|
+
@shared_values[:service],
|
|
162
|
+
"balancePlatforms/#{balance_platform_id}/transferLimits/#{transfer_limit_id}",
|
|
163
|
+
@shared_values[:client].balance_platform.version
|
|
164
|
+
)
|
|
165
|
+
WebMock.stub_request(:get, url)
|
|
166
|
+
.with(headers: { 'x-api-key' => @shared_values[:client].api_key })
|
|
167
|
+
.to_return(body: response_body)
|
|
168
|
+
|
|
169
|
+
result = @shared_values[:client].balance_platform.transfer_limits_balance_platform_level_api
|
|
170
|
+
.get_specific_transfer_limit(balance_platform_id, transfer_limit_id)
|
|
171
|
+
response_hash = result.response
|
|
172
|
+
|
|
173
|
+
expect(result.status).to eq(200)
|
|
174
|
+
expect(response_hash).to eq(JSON.parse(response_body))
|
|
175
|
+
expect(response_hash).to be_a Adyen::HashWithAccessors
|
|
176
|
+
expect(response_hash).to be_a_kind_of Hash
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
it 'makes a delete_pending_transfer_limit DELETE call' do
|
|
180
|
+
balance_platform_id = 'YOUR_BALANCE_PLATFORM_ID'
|
|
181
|
+
transfer_limit_id = 'YOUR_TRANSFER_LIMIT_ID'
|
|
182
|
+
|
|
183
|
+
url = @shared_values[:client].service_url(
|
|
184
|
+
@shared_values[:service],
|
|
185
|
+
"balancePlatforms/#{balance_platform_id}/transferLimits/#{transfer_limit_id}",
|
|
186
|
+
@shared_values[:client].balance_platform.version
|
|
187
|
+
)
|
|
188
|
+
WebMock.stub_request(:delete, url)
|
|
189
|
+
.with(headers: { 'x-api-key' => @shared_values[:client].api_key })
|
|
190
|
+
.to_return(status: 204, body: '')
|
|
191
|
+
|
|
192
|
+
result = @shared_values[:client].balance_platform.transfer_limits_balance_platform_level_api
|
|
193
|
+
.delete_pending_transfer_limit(balance_platform_id, transfer_limit_id)
|
|
194
|
+
|
|
195
|
+
expect(result.status).to eq(204)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
## balanceAccount level transferLimits
|
|
199
|
+
it 'makes a create_transfer_limit POST call' do
|
|
200
|
+
request_body = JSON.parse(json_from_file('mocks/requests/BalancePlatform/create_transfer_limit.json'))
|
|
201
|
+
response_body = json_from_file('mocks/responses/BalancePlatform/create_transfer_limit.json')
|
|
202
|
+
balance_account_id = 'YOUR_BALANCE_ACCOUNT_ID'
|
|
203
|
+
|
|
204
|
+
url = @shared_values[:client].service_url(
|
|
205
|
+
@shared_values[:service],
|
|
206
|
+
"balanceAccounts/#{balance_account_id}/transferLimits",
|
|
207
|
+
@shared_values[:client].balance_platform.version
|
|
208
|
+
)
|
|
209
|
+
WebMock.stub_request(:post, url)
|
|
210
|
+
.with(
|
|
211
|
+
body: request_body,
|
|
212
|
+
headers: { 'x-api-key' => @shared_values[:client].api_key }
|
|
121
213
|
)
|
|
214
|
+
.to_return(body: response_body)
|
|
122
215
|
|
|
123
|
-
result = @shared_values[:client].balance_platform.
|
|
124
|
-
|
|
216
|
+
result = @shared_values[:client].balance_platform.transfer_limits_balance_account_level_api
|
|
217
|
+
.create_transfer_limit(request_body, balance_account_id)
|
|
218
|
+
response_hash = result.response
|
|
219
|
+
|
|
220
|
+
expect(result.status).to eq(200)
|
|
221
|
+
expect(response_hash).to eq(JSON.parse(response_body))
|
|
222
|
+
expect(response_hash).to be_a Adyen::HashWithAccessors
|
|
223
|
+
expect(response_hash).to be_a_kind_of Hash
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
it 'makes a get_transfer_limits GET call' do
|
|
227
|
+
response_body = json_from_file('mocks/responses/BalancePlatform/get_transfer_limits.json')
|
|
228
|
+
balance_account_id = 'YOUR_BALANCE_ACCOUNT_ID'
|
|
229
|
+
|
|
230
|
+
url = @shared_values[:client].service_url(
|
|
231
|
+
@shared_values[:service],
|
|
232
|
+
"balanceAccounts/#{balance_account_id}/transferLimits",
|
|
233
|
+
@shared_values[:client].balance_platform.version
|
|
234
|
+
)
|
|
235
|
+
WebMock.stub_request(:get, url)
|
|
236
|
+
.with(headers: { 'x-api-key' => @shared_values[:client].api_key })
|
|
237
|
+
.to_return(body: response_body)
|
|
238
|
+
|
|
239
|
+
result = @shared_values[:client].balance_platform.transfer_limits_balance_account_level_api
|
|
240
|
+
.get_transfer_limits(balance_account_id)
|
|
241
|
+
response_hash = result.response
|
|
242
|
+
|
|
243
|
+
expect(result.status).to eq(200)
|
|
244
|
+
expect(response_hash).to eq(JSON.parse(response_body))
|
|
245
|
+
expect(response_hash).to be_a Adyen::HashWithAccessors
|
|
246
|
+
expect(response_hash).to be_a_kind_of Hash
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
it 'makes a get_specific_transfer_limit GET call' do
|
|
250
|
+
response_body = json_from_file('mocks/responses/BalancePlatform/get_specific_transfer_limit.json')
|
|
251
|
+
balance_account_id = 'YOUR_BALANCE_ACCOUNT_ID'
|
|
252
|
+
transfer_limit_id = 'YOUR_TRANSFER_LIMIT_ID'
|
|
253
|
+
|
|
254
|
+
url = @shared_values[:client].service_url(
|
|
255
|
+
@shared_values[:service],
|
|
256
|
+
"balanceAccounts/#{balance_account_id}/transferLimits/#{transfer_limit_id}",
|
|
257
|
+
@shared_values[:client].balance_platform.version
|
|
258
|
+
)
|
|
259
|
+
WebMock.stub_request(:get, url)
|
|
260
|
+
.with(headers: { 'x-api-key' => @shared_values[:client].api_key })
|
|
261
|
+
.to_return(body: response_body)
|
|
262
|
+
|
|
263
|
+
result = @shared_values[:client].balance_platform.transfer_limits_balance_account_level_api
|
|
264
|
+
.get_specific_transfer_limit(balance_account_id, transfer_limit_id)
|
|
265
|
+
response_hash = result.response
|
|
266
|
+
|
|
267
|
+
expect(result.status).to eq(200)
|
|
268
|
+
expect(response_hash).to eq(JSON.parse(response_body))
|
|
269
|
+
expect(response_hash).to be_a Adyen::HashWithAccessors
|
|
270
|
+
expect(response_hash).to be_a_kind_of Hash
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
it 'makes a delete_pending_transfer_limit DELETE call' do
|
|
274
|
+
balance_account_id = 'YOUR_BALANCE_ACCOUNT_ID'
|
|
275
|
+
transfer_limit_id = 'YOUR_TRANSFER_LIMIT_ID'
|
|
276
|
+
|
|
277
|
+
url = @shared_values[:client].service_url(
|
|
278
|
+
@shared_values[:service],
|
|
279
|
+
"balanceAccounts/#{balance_account_id}/transferLimits/#{transfer_limit_id}",
|
|
280
|
+
@shared_values[:client].balance_platform.version
|
|
281
|
+
)
|
|
282
|
+
WebMock.stub_request(:delete, url)
|
|
283
|
+
.with(headers: { 'x-api-key' => @shared_values[:client].api_key })
|
|
284
|
+
.to_return(status: 204, body: '')
|
|
285
|
+
|
|
286
|
+
result = @shared_values[:client].balance_platform.transfer_limits_balance_account_level_api
|
|
287
|
+
.delete_pending_transfer_limit(balance_account_id, transfer_limit_id)
|
|
288
|
+
|
|
289
|
+
expect(result.status).to eq(204)
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
it 'makes an approve_pending_transfer_limits POST call' do
|
|
293
|
+
request_body = ['TRLI00000000000000000000000001', 'TRLI00000000000000000000000002']
|
|
294
|
+
balance_account_id = 'YOUR_BALANCE_ACCOUNT_ID'
|
|
295
|
+
|
|
296
|
+
url = @shared_values[:client].service_url(
|
|
297
|
+
@shared_values[:service],
|
|
298
|
+
"balanceAccounts/#{balance_account_id}/transferLimits/approve",
|
|
299
|
+
@shared_values[:client].balance_platform.version
|
|
300
|
+
)
|
|
301
|
+
WebMock.stub_request(:post, url)
|
|
302
|
+
.with(
|
|
303
|
+
body: request_body,
|
|
304
|
+
headers: { 'x-api-key' => @shared_values[:client].api_key }
|
|
305
|
+
)
|
|
306
|
+
.to_return(status: 204, body: '')
|
|
307
|
+
|
|
308
|
+
result = @shared_values[:client].balance_platform.transfer_limits_balance_account_level_api
|
|
309
|
+
.approve_pending_transfer_limits(request_body, balance_account_id)
|
|
310
|
+
|
|
311
|
+
expect(result.status).to eq(204)
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
## webhook settings
|
|
315
|
+
it 'makes a create_webhook_setting POST call' do
|
|
316
|
+
request_body = JSON.parse(json_from_file('mocks/requests/BalancePlatform/create_webhook_setting.json'))
|
|
317
|
+
response_body = json_from_file('mocks/responses/BalancePlatform/create_webhook_setting.json')
|
|
318
|
+
balance_platform_id = 'YOUR_BALANCE_PLATFORM_ID'
|
|
319
|
+
webhook_id = 'YOUR_WEBHOOK_ID'
|
|
320
|
+
|
|
321
|
+
url = @shared_values[:client].service_url(
|
|
322
|
+
@shared_values[:service],
|
|
323
|
+
"balancePlatforms/#{balance_platform_id}/webhooks/#{webhook_id}/settings",
|
|
324
|
+
@shared_values[:client].balance_platform.version
|
|
325
|
+
)
|
|
326
|
+
WebMock.stub_request(:post, url)
|
|
327
|
+
.with(
|
|
328
|
+
body: request_body,
|
|
329
|
+
headers: { 'x-api-key' => @shared_values[:client].api_key }
|
|
330
|
+
)
|
|
331
|
+
.to_return(body: response_body)
|
|
332
|
+
|
|
333
|
+
result = @shared_values[:client].balance_platform.balances_api
|
|
334
|
+
.create_webhook_setting(request_body, balance_platform_id, webhook_id)
|
|
335
|
+
response_hash = result.response
|
|
336
|
+
|
|
337
|
+
expect(result.status).to eq(200)
|
|
338
|
+
expect(response_hash).to eq(JSON.parse(response_body))
|
|
339
|
+
expect(response_hash).to be_a Adyen::HashWithAccessors
|
|
340
|
+
expect(response_hash).to be_a_kind_of Hash
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
it 'makes a delete_webhook_setting DELETE call' do
|
|
344
|
+
balance_platform_id = 'YOUR_BALANCE_PLATFORM_ID'
|
|
345
|
+
webhook_id = 'YOUR_WEBHOOK_ID'
|
|
346
|
+
setting_id = 'BWHS000000000000001'
|
|
347
|
+
|
|
348
|
+
url = @shared_values[:client].service_url(
|
|
349
|
+
@shared_values[:service],
|
|
350
|
+
"balancePlatforms/#{balance_platform_id}/webhooks/#{webhook_id}/settings/#{setting_id}",
|
|
351
|
+
@shared_values[:client].balance_platform.version
|
|
352
|
+
)
|
|
353
|
+
WebMock.stub_request(:delete, url)
|
|
354
|
+
.with(headers: { 'x-api-key' => @shared_values[:client].api_key })
|
|
355
|
+
.to_return(status: 204, body: '')
|
|
356
|
+
|
|
357
|
+
result = @shared_values[:client].balance_platform.balances_api
|
|
358
|
+
.delete_webhook_setting(balance_platform_id, webhook_id, setting_id)
|
|
359
|
+
|
|
360
|
+
expect(result.status).to eq(204)
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
it 'makes a get_all_webhook_settings GET call' do
|
|
364
|
+
response_body = json_from_file('mocks/responses/BalancePlatform/get_all_webhook_settings.json')
|
|
365
|
+
balance_platform_id = 'YOUR_BALANCE_PLATFORM_ID'
|
|
366
|
+
webhook_id = 'YOUR_WEBHOOK_ID'
|
|
367
|
+
|
|
368
|
+
url = @shared_values[:client].service_url(
|
|
369
|
+
@shared_values[:service],
|
|
370
|
+
"balancePlatforms/#{balance_platform_id}/webhooks/#{webhook_id}/settings",
|
|
371
|
+
@shared_values[:client].balance_platform.version
|
|
372
|
+
)
|
|
373
|
+
WebMock.stub_request(:get, url)
|
|
374
|
+
.with(headers: { 'x-api-key' => @shared_values[:client].api_key })
|
|
375
|
+
.to_return(body: response_body)
|
|
376
|
+
|
|
377
|
+
result = @shared_values[:client].balance_platform.balances_api
|
|
378
|
+
.get_all_webhook_settings(balance_platform_id, webhook_id)
|
|
379
|
+
response_hash = result.response
|
|
380
|
+
|
|
381
|
+
expect(result.status).to eq(200)
|
|
382
|
+
expect(response_hash).to eq(JSON.parse(response_body))
|
|
383
|
+
expect(response_hash).to be_a Adyen::HashWithAccessors
|
|
384
|
+
expect(response_hash).to be_a_kind_of Hash
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
## authorisedCardUsers
|
|
388
|
+
it 'makes a get_all_authorised_card_users GET call' do
|
|
389
|
+
response_body = json_from_file('mocks/responses/BalancePlatform/get_all_authorised_card_users.json')
|
|
390
|
+
payment_instrument_id = 'PI01234567890'
|
|
391
|
+
|
|
392
|
+
url = @shared_values[:client].service_url(
|
|
393
|
+
@shared_values[:service],
|
|
394
|
+
"paymentInstruments/#{payment_instrument_id}/authorisedCardUsers",
|
|
395
|
+
@shared_values[:client].balance_platform.version
|
|
396
|
+
)
|
|
397
|
+
WebMock.stub_request(:get, url)
|
|
398
|
+
.with(headers: { 'x-api-key' => @shared_values[:client].api_key })
|
|
399
|
+
.to_return(body: response_body)
|
|
400
|
+
|
|
401
|
+
result = @shared_values[:client].balance_platform.authorized_card_users_api
|
|
402
|
+
.get_all_authorised_card_users(payment_instrument_id)
|
|
403
|
+
response_hash = result.response
|
|
125
404
|
|
|
126
|
-
expect(result.status)
|
|
127
|
-
|
|
405
|
+
expect(result.status).to eq(200)
|
|
406
|
+
expect(response_hash).to eq(JSON.parse(response_body))
|
|
407
|
+
expect(response_hash).to be_a Adyen::HashWithAccessors
|
|
408
|
+
expect(response_hash).to be_a_kind_of Hash
|
|
128
409
|
end
|
|
129
410
|
end
|
data/spec/bin_lookup_spec.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
require 'json'
|
|
3
3
|
|
|
4
|
-
RSpec.describe Adyen::BinLookup, service: '
|
|
4
|
+
RSpec.describe Adyen::BinLookup, service: 'binLookup' do
|
|
5
5
|
before(:all) do
|
|
6
6
|
@shared_values = {
|
|
7
7
|
client: create_client(:api_key),
|
|
@@ -28,7 +28,7 @@ RSpec.describe Adyen::BinLookup, service: 'BinLookup' do
|
|
|
28
28
|
body: response_body
|
|
29
29
|
)
|
|
30
30
|
|
|
31
|
-
result = @shared_values[:client].bin_lookup.get_cost_estimate(request_body)
|
|
31
|
+
result = @shared_values[:client].bin_lookup.bin_lookup_api.get_cost_estimate(request_body)
|
|
32
32
|
response_hash = result.response
|
|
33
33
|
|
|
34
34
|
expect(result.status)
|
|
@@ -58,7 +58,8 @@ RSpec.describe Adyen::BinLookup, service: 'BinLookup' do
|
|
|
58
58
|
body: response_body
|
|
59
59
|
)
|
|
60
60
|
|
|
61
|
-
result = @shared_values[:client].bin_lookup.get3ds_availability(request_body)
|
|
61
|
+
result = @shared_values[:client].bin_lookup.bin_lookup_api.get3ds_availability(request_body)
|
|
62
|
+
|
|
62
63
|
response_hash = result.response
|
|
63
64
|
|
|
64
65
|
expect(result.status)
|
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
|