adyen-ruby-api-library 7.0.1 → 7.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -1
- data/.github/release.yml +18 -0
- data/.github/workflows/gh_release.yml +16 -0
- data/.github/workflows/release_request.yml +15 -0
- data/.github/workflows/ruby.yml +1 -1
- data/.github/workflows/services.yml +28 -0
- data/.rubocop.yml +8 -0
- data/Gemfile +7 -7
- data/Makefile +16 -10
- data/README.md +13 -10
- data/Rakefile +3 -3
- data/adyen-ruby-api-library.gemspec +6 -3
- data/bin/console +2 -2
- data/lib/adyen/client.rb +91 -75
- data/lib/adyen/errors.rb +23 -18
- data/lib/adyen/hash_with_accessors.rb +12 -7
- data/lib/adyen/services/balanceControlService.rb +7 -14
- data/lib/adyen/services/balancePlatform/account_holders_api.rb +22 -38
- data/lib/adyen/services/balancePlatform/balance_accounts_api.rb +48 -79
- data/lib/adyen/services/balancePlatform/bank_account_validation_api.rb +6 -13
- data/lib/adyen/services/balancePlatform/grant_accounts_api.rb +6 -13
- data/lib/adyen/services/balancePlatform/grant_offers_api.rb +12 -22
- data/lib/adyen/services/balancePlatform/payment_instrument_groups_api.rb +16 -29
- data/lib/adyen/services/balancePlatform/payment_instruments_api.rb +26 -45
- data/lib/adyen/services/balancePlatform/platform_api.rb +12 -22
- data/lib/adyen/services/balancePlatform/transaction_rules_api.rb +21 -37
- data/lib/adyen/services/balancePlatform.rb +38 -40
- data/lib/adyen/services/binLookup.rb +12 -22
- data/lib/adyen/services/checkout/classic_checkout_sdk_api.rb +11 -21
- data/lib/adyen/services/checkout/modifications_api.rb +31 -53
- data/lib/adyen/services/checkout/orders_api.rb +16 -29
- data/lib/adyen/services/checkout/payment_links_api.rb +16 -29
- data/lib/adyen/services/checkout/payments_api.rb +40 -53
- data/lib/adyen/services/checkout/recurring_api.rb +13 -23
- data/lib/adyen/services/checkout/utility_api.rb +11 -21
- data/lib/adyen/services/checkout.rb +32 -34
- data/lib/adyen/services/dataProtection.rb +7 -14
- data/lib/adyen/services/dispute.rb +6 -5
- data/lib/adyen/services/legalEntityManagement/business_lines_api.rb +21 -37
- data/lib/adyen/services/legalEntityManagement/documents_api.rb +21 -37
- data/lib/adyen/services/legalEntityManagement/hosted_onboarding_api.rb +16 -29
- data/lib/adyen/services/legalEntityManagement/legal_entities_api.rb +26 -45
- data/lib/adyen/services/legalEntityManagement/pci_questionnaires_api.rb +21 -37
- data/lib/adyen/services/legalEntityManagement/terms_of_service_api.rb +25 -29
- data/lib/adyen/services/legalEntityManagement/transfer_instruments_api.rb +21 -37
- data/lib/adyen/services/legalEntityManagement.rb +32 -34
- data/lib/adyen/services/management/account_company_level_api.rb +18 -31
- data/lib/adyen/services/management/account_merchant_level_api.rb +22 -38
- data/lib/adyen/services/management/account_store_level_api.rb +43 -71
- data/lib/adyen/services/management/allowed_origins_company_level_api.rb +21 -37
- data/lib/adyen/services/management/allowed_origins_merchant_level_api.rb +21 -37
- data/lib/adyen/services/management/api_credentials_company_level_api.rb +22 -38
- data/lib/adyen/services/management/api_credentials_merchant_level_api.rb +22 -38
- data/lib/adyen/services/management/api_key_company_level_api.rb +6 -13
- data/lib/adyen/services/management/api_key_merchant_level_api.rb +6 -13
- data/lib/adyen/services/management/client_key_company_level_api.rb +6 -13
- data/lib/adyen/services/management/client_key_merchant_level_api.rb +6 -13
- data/lib/adyen/services/management/my_api_credential_api.rb +26 -45
- data/lib/adyen/services/management/payment_methods_merchant_level_api.rb +32 -54
- data/lib/adyen/services/management/payout_settings_merchant_level_api.rb +26 -45
- data/lib/adyen/services/management/split_configuration_merchant_level_api.rb +92 -0
- data/lib/adyen/services/management/terminal_actions_company_level_api.rb +24 -40
- data/lib/adyen/services/management/terminal_actions_terminal_level_api.rb +6 -13
- data/lib/adyen/services/management/terminal_orders_company_level_api.rb +55 -89
- data/lib/adyen/services/management/terminal_orders_merchant_level_api.rb +55 -89
- data/lib/adyen/services/management/terminal_settings_company_level_api.rb +23 -39
- data/lib/adyen/services/management/terminal_settings_merchant_level_api.rb +23 -39
- data/lib/adyen/services/management/terminal_settings_store_level_api.rb +45 -73
- data/lib/adyen/services/management/terminal_settings_terminal_level_api.rb +21 -37
- data/lib/adyen/services/management/terminals_terminal_level_api.rb +7 -14
- data/lib/adyen/services/management/users_company_level_api.rb +22 -38
- data/lib/adyen/services/management/users_merchant_level_api.rb +22 -38
- data/lib/adyen/services/management/webhooks_company_level_api.rb +37 -62
- data/lib/adyen/services/management/webhooks_merchant_level_api.rb +37 -62
- data/lib/adyen/services/management.rb +99 -96
- data/lib/adyen/services/marketpay.rb +42 -36
- data/lib/adyen/services/payment.rb +67 -110
- data/lib/adyen/services/payout/initialization_api.rb +16 -29
- data/lib/adyen/services/payout/instant_payouts_api.rb +6 -13
- data/lib/adyen/services/payout/reviewing_api.rb +11 -21
- data/lib/adyen/services/payout.rb +19 -21
- data/lib/adyen/services/posTerminalManagement.rb +27 -46
- data/lib/adyen/services/recurring.rb +32 -54
- data/lib/adyen/services/service.rb +5 -4
- data/lib/adyen/services/storedValue.rb +32 -54
- data/lib/adyen/services/transfers/capital_api.rb +38 -0
- data/lib/adyen/services/transfers/transactions_api.rb +12 -22
- data/lib/adyen/services/transfers/transfers_api.rb +6 -13
- data/lib/adyen/services/transfers.rb +20 -17
- data/lib/adyen/utils/hmac_validator.rb +18 -7
- data/lib/adyen/version.rb +3 -3
- data/lib/adyen-ruby-api-library.rb +21 -21
- data/spec/account_spec.rb +20 -20
- data/spec/balance_control_spec.rb +28 -29
- data/spec/balance_platform_spec.rb +108 -102
- data/spec/bin_lookup_spec.rb +50 -50
- data/spec/checkout_spec.rb +573 -524
- data/spec/client_spec.rb +117 -70
- data/spec/data_protection_spec.rb +4 -4
- data/spec/dispute_spec.rb +7 -7
- data/spec/errors_spec.rb +37 -17
- data/spec/fund_spec.rb +10 -10
- data/spec/hash_with_accessors_spec.rb +18 -8
- data/spec/hop_spec.rb +4 -4
- data/spec/lem_spec.rb +44 -49
- data/spec/management_spec.rb +46 -48
- data/spec/notification_spec.rb +9 -9
- data/spec/payments_spec.rb +29 -30
- data/spec/payouts_spec.rb +29 -32
- data/spec/pos_terminal_management_spec.rb +30 -32
- data/spec/recurring_spec.rb +8 -8
- data/spec/service_spec.rb +4 -0
- data/spec/spec_helper.rb +37 -35
- data/spec/stored_value_spec.rb +28 -27
- data/spec/transfers_spec.rb +48 -47
- data/spec/utils/hmac_validator_spec.rb +15 -14
- data/templates/api-single.mustache +13 -15
- data/templates/api-small.mustache +8 -15
- data/templates/api.mustache +7 -14
- metadata +25 -18
- data/.github/dependabot.yml +0 -8
- /data/spec/mocks/responses/Webhooks/{backslash_notification.json → backslash_webhook.json} +0 -0
- /data/spec/mocks/responses/Webhooks/{colon_notification.json → colon_webhook.json} +0 -0
- /data/spec/mocks/responses/Webhooks/{forwardslash_notification.json → forwardslash_webhook.json} +0 -0
- /data/spec/mocks/responses/Webhooks/{mixed_notification.json → mixed_webhook.json} +0 -0
@@ -1,123 +1,129 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
RSpec.describe Adyen::BalancePlatform, service: "balancePlatform" do
|
4
|
+
RSpec.describe Adyen::BalancePlatform, service: 'balancePlatform' do
|
7
5
|
before(:all) do
|
8
6
|
@shared_values = {
|
9
7
|
client: create_client(:api_key),
|
10
|
-
service:
|
8
|
+
service: 'BalancePlatform'
|
11
9
|
}
|
12
10
|
end
|
13
11
|
|
14
12
|
# must be created manually because every field in the response is an array
|
15
|
-
it
|
16
|
-
request_body = JSON.parse(json_from_file(
|
17
|
-
|
18
|
-
response_body = json_from_file(
|
19
|
-
|
20
|
-
url = @shared_values[:client].service_url(@shared_values[:service],
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
13
|
+
it 'makes a account_holder POST call' do
|
14
|
+
request_body = JSON.parse(json_from_file('mocks/requests/BalancePlatform/create_account_holder.json'))
|
15
|
+
|
16
|
+
response_body = json_from_file('mocks/responses/BalancePlatform/create_account_holder.json')
|
17
|
+
|
18
|
+
url = @shared_values[:client].service_url(@shared_values[:service], 'accountHolders',
|
19
|
+
@shared_values[:client].balance_platform.version)
|
20
|
+
WebMock.stub_request(:post, url)
|
21
|
+
.with(
|
22
|
+
body: request_body,
|
23
|
+
headers: {
|
24
|
+
'x-api-key' => @shared_values[:client].api_key
|
25
|
+
}
|
26
|
+
)
|
27
|
+
.to_return(
|
28
|
+
body: response_body
|
29
|
+
)
|
31
30
|
|
32
31
|
result = @shared_values[:client].balance_platform.account_holders_api.create_account_holder(request_body)
|
33
32
|
response_hash = result.response
|
34
33
|
|
35
|
-
expect(result.status)
|
36
|
-
to eq(200)
|
37
|
-
expect(response_hash)
|
38
|
-
to eq(JSON.parse(response_body))
|
39
|
-
expect(response_hash)
|
40
|
-
to be_a Adyen::HashWithAccessors
|
41
|
-
expect(response_hash)
|
42
|
-
to be_a_kind_of Hash
|
34
|
+
expect(result.status)
|
35
|
+
.to eq(200)
|
36
|
+
expect(response_hash)
|
37
|
+
.to eq(JSON.parse(response_body))
|
38
|
+
expect(response_hash)
|
39
|
+
.to be_a Adyen::HashWithAccessors
|
40
|
+
expect(response_hash)
|
41
|
+
.to be_a_kind_of Hash
|
43
42
|
end
|
44
43
|
|
45
|
-
it
|
46
|
-
request_body = JSON.parse(json_from_file(
|
47
|
-
|
48
|
-
response_body = json_from_file(
|
49
|
-
|
50
|
-
url = @shared_values[:client].service_url(@shared_values[:service],
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
44
|
+
it 'makes a account_holder PATCH call' do
|
45
|
+
request_body = JSON.parse(json_from_file('mocks/requests/BalancePlatform/update_account_holder.json'))
|
46
|
+
|
47
|
+
response_body = json_from_file('mocks/responses/BalancePlatform/update_account_holder.json')
|
48
|
+
|
49
|
+
url = @shared_values[:client].service_url(@shared_values[:service], 'accountHolders/AH3227C223222C5GKR23686TF',
|
50
|
+
@shared_values[:client].balance_platform.version)
|
51
|
+
WebMock.stub_request(:patch, url)
|
52
|
+
.with(
|
53
|
+
body: request_body,
|
54
|
+
headers: {
|
55
|
+
'x-api-key' => @shared_values[:client].api_key
|
56
|
+
}
|
57
|
+
)
|
58
|
+
.to_return(
|
59
|
+
body: response_body
|
60
|
+
)
|
61
|
+
|
62
|
+
result = @shared_values[:client].balance_platform.account_holders_api.update_account_holder(
|
63
|
+
request_body,
|
64
|
+
'AH3227C223222C5GKR23686TF'
|
65
|
+
)
|
63
66
|
response_hash = result.response
|
64
67
|
|
65
|
-
expect(result.status)
|
66
|
-
to eq(200)
|
67
|
-
expect(response_hash)
|
68
|
-
to eq(JSON.parse(response_body))
|
69
|
-
expect(response_hash)
|
70
|
-
to be_a Adyen::HashWithAccessors
|
71
|
-
expect(response_hash)
|
72
|
-
to be_a_kind_of Hash
|
68
|
+
expect(result.status)
|
69
|
+
.to eq(200)
|
70
|
+
expect(response_hash)
|
71
|
+
.to eq(JSON.parse(response_body))
|
72
|
+
expect(response_hash)
|
73
|
+
.to be_a Adyen::HashWithAccessors
|
74
|
+
expect(response_hash)
|
75
|
+
.to be_a_kind_of Hash
|
73
76
|
end
|
74
|
-
|
75
|
-
it "makes a balance_account GET call" do
|
76
|
-
|
77
|
-
response_body = json_from_file("mocks/responses/BalancePlatform/get_balance_account.json")
|
78
|
-
|
79
|
-
url = @shared_values[:client].service_url(@shared_values[:service], "balanceAccounts/BA3227C223222B5BLP6JQC3FD", @shared_values[:client].balance_platform.version)
|
80
|
-
WebMock.stub_request(:get, url).
|
81
|
-
with(
|
82
|
-
headers: {
|
83
|
-
"x-api-key" => @shared_values[:client].api_key
|
84
|
-
}
|
85
|
-
).
|
86
|
-
to_return(
|
87
|
-
body: response_body
|
88
|
-
)
|
89
|
-
|
90
|
-
result = @shared_values[:client].balance_platform.balance_accounts_api.get_balance_account(id = "BA3227C223222B5BLP6JQC3FD")
|
91
|
-
response_hash = result.response
|
92
77
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
}
|
111
|
-
).
|
112
|
-
to_return(
|
113
|
-
body: "{}"
|
114
|
-
)
|
115
|
-
|
116
|
-
result = @shared_values[:client].balance_platform.balance_accounts_api.delete_sweep("balanceAccountID", "sweepID")
|
78
|
+
it 'makes a balance_account GET call' do
|
79
|
+
response_body = json_from_file('mocks/responses/BalancePlatform/get_balance_account.json')
|
80
|
+
|
81
|
+
url = @shared_values[:client].service_url(@shared_values[:service], 'balanceAccounts/BA3227C223222B5BLP6JQC3FD',
|
82
|
+
@shared_values[:client].balance_platform.version)
|
83
|
+
WebMock.stub_request(:get, url)
|
84
|
+
.with(
|
85
|
+
headers: {
|
86
|
+
'x-api-key' => @shared_values[:client].api_key
|
87
|
+
}
|
88
|
+
)
|
89
|
+
.to_return(
|
90
|
+
body: response_body
|
91
|
+
)
|
92
|
+
|
93
|
+
result = @shared_values[:client].balance_platform.balance_accounts_api
|
94
|
+
.get_balance_account('BA3227C223222B5BLP6JQC3FD')
|
117
95
|
response_hash = result.response
|
118
96
|
|
119
|
-
expect(result.status)
|
120
|
-
to eq(200)
|
121
|
-
|
97
|
+
expect(result.status)
|
98
|
+
.to eq(200)
|
99
|
+
expect(response_hash)
|
100
|
+
.to eq(JSON.parse(response_body))
|
101
|
+
expect(response_hash)
|
102
|
+
.to be_a Adyen::HashWithAccessors
|
103
|
+
expect(response_hash)
|
104
|
+
.to be_a_kind_of Hash
|
105
|
+
end
|
122
106
|
|
123
|
-
|
107
|
+
it 'makes a balance_account/sweeps DELETE call' do
|
108
|
+
url = @shared_values[:client].service_url(
|
109
|
+
@shared_values[:service],
|
110
|
+
'balanceAccounts/balanceAccountID/sweeps/sweepID',
|
111
|
+
@shared_values[:client].balance_platform.version
|
112
|
+
)
|
113
|
+
WebMock.stub_request(:delete, url)
|
114
|
+
.with(
|
115
|
+
headers: {
|
116
|
+
'x-api-key' => @shared_values[:client].api_key
|
117
|
+
}
|
118
|
+
)
|
119
|
+
.to_return(
|
120
|
+
body: '{}'
|
121
|
+
)
|
122
|
+
|
123
|
+
result = @shared_values[:client].balance_platform.balance_accounts_api.delete_sweep('balanceAccountID', 'sweepID')
|
124
|
+
result.response
|
125
|
+
|
126
|
+
expect(result.status)
|
127
|
+
.to eq(200)
|
128
|
+
end
|
129
|
+
end
|
data/spec/bin_lookup_spec.rb
CHANGED
@@ -1,73 +1,73 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
RSpec.describe Adyen::BinLookup, service: "BinLookup" do
|
4
|
+
RSpec.describe Adyen::BinLookup, service: 'BinLookup' do
|
7
5
|
before(:all) do
|
8
6
|
@shared_values = {
|
9
7
|
client: create_client(:api_key),
|
10
|
-
service:
|
8
|
+
service: 'BinLookup'
|
11
9
|
}
|
12
10
|
end
|
13
11
|
|
14
12
|
# must be created manually because every field in the response is an array
|
15
|
-
it
|
16
|
-
request_body = JSON.parse(json_from_file(
|
13
|
+
it 'makes a get_cost_estimate POST call' do
|
14
|
+
request_body = JSON.parse(json_from_file('mocks/requests/BinLookup/get_cost_estimate.json'))
|
17
15
|
|
18
|
-
response_body = json_from_file(
|
16
|
+
response_body = json_from_file('mocks/responses/BinLookup/get_cost_estimate.json')
|
19
17
|
|
20
|
-
url = @shared_values[:client].service_url(@shared_values[:service],
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
18
|
+
url = @shared_values[:client].service_url(@shared_values[:service], 'getCostEstimate',
|
19
|
+
@shared_values[:client].bin_lookup.version)
|
20
|
+
WebMock.stub_request(:post, url)
|
21
|
+
.with(
|
22
|
+
body: request_body,
|
23
|
+
headers: {
|
24
|
+
'x-api-key' => @shared_values[:client].api_key
|
25
|
+
}
|
26
|
+
)
|
27
|
+
.to_return(
|
28
|
+
body: response_body
|
29
|
+
)
|
31
30
|
|
32
31
|
result = @shared_values[:client].bin_lookup.get_cost_estimate(request_body)
|
33
32
|
response_hash = result.response
|
34
33
|
|
35
|
-
expect(result.status)
|
36
|
-
to eq(200)
|
37
|
-
expect(response_hash)
|
38
|
-
to eq(JSON.parse(response_body))
|
39
|
-
expect(response_hash)
|
40
|
-
to be_a Adyen::HashWithAccessors
|
41
|
-
expect(response_hash)
|
42
|
-
to be_a_kind_of Hash
|
34
|
+
expect(result.status)
|
35
|
+
.to eq(200)
|
36
|
+
expect(response_hash)
|
37
|
+
.to eq(JSON.parse(response_body))
|
38
|
+
expect(response_hash)
|
39
|
+
.to be_a Adyen::HashWithAccessors
|
40
|
+
expect(response_hash)
|
41
|
+
.to be_a_kind_of Hash
|
43
42
|
end
|
44
|
-
it
|
45
|
-
request_body = JSON.parse(json_from_file(
|
43
|
+
it 'makes a get3ds_availability POST call' do
|
44
|
+
request_body = JSON.parse(json_from_file('mocks/requests/BinLookup/get_3ds_availability.json'))
|
46
45
|
|
47
|
-
response_body = json_from_file(
|
46
|
+
response_body = json_from_file('mocks/responses/BinLookup/get_3ds_availability.json')
|
48
47
|
|
49
|
-
url = @shared_values[:client].service_url(@shared_values[:service],
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
48
|
+
url = @shared_values[:client].service_url(@shared_values[:service], 'get3dsAvailability',
|
49
|
+
@shared_values[:client].bin_lookup.version)
|
50
|
+
WebMock.stub_request(:post, url)
|
51
|
+
.with(
|
52
|
+
body: request_body,
|
53
|
+
headers: {
|
54
|
+
'x-api-key' => @shared_values[:client].api_key
|
55
|
+
}
|
56
|
+
)
|
57
|
+
.to_return(
|
58
|
+
body: response_body
|
59
|
+
)
|
60
60
|
|
61
61
|
result = @shared_values[:client].bin_lookup.get3ds_availability(request_body)
|
62
62
|
response_hash = result.response
|
63
63
|
|
64
|
-
expect(result.status)
|
65
|
-
to eq(200)
|
66
|
-
expect(response_hash)
|
67
|
-
to eq(JSON.parse(response_body))
|
68
|
-
expect(response_hash)
|
69
|
-
to be_a Adyen::HashWithAccessors
|
70
|
-
expect(response_hash)
|
71
|
-
to be_a_kind_of Hash
|
64
|
+
expect(result.status)
|
65
|
+
.to eq(200)
|
66
|
+
expect(response_hash)
|
67
|
+
.to eq(JSON.parse(response_body))
|
68
|
+
expect(response_hash)
|
69
|
+
.to be_a Adyen::HashWithAccessors
|
70
|
+
expect(response_hash)
|
71
|
+
.to be_a_kind_of Hash
|
72
72
|
end
|
73
73
|
end
|