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