adyen-ruby-api-library 10.3.0 → 11.0.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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -1
  3. data/.github/workflows/codeql.yml +1 -1
  4. data/.github/workflows/release.yml +3 -2
  5. data/.github/workflows/ruby.yml +1 -1
  6. data/.github/workflows/rubygems_release.yml +1 -1
  7. data/Gemfile +1 -1
  8. data/README.md +4 -10
  9. data/VERSION +1 -1
  10. data/lib/adyen/client.rb +61 -15
  11. data/lib/adyen/errors.rb +8 -6
  12. data/lib/adyen/services/{balanceControlService.rb → balanceControl/balance_control_api.rb} +5 -4
  13. data/lib/adyen/services/balanceControl.rb +24 -0
  14. data/lib/adyen/services/balancePlatform/authorized_card_users_api.rb +56 -0
  15. data/lib/adyen/services/balancePlatform/balances_api.rb +2 -2
  16. data/lib/adyen/services/balancePlatform/payment_instruments_api.rb +20 -0
  17. data/lib/adyen/services/balancePlatform/transfer_limits_balance_account_level_api.rb +76 -0
  18. data/lib/adyen/services/balancePlatform/transfer_limits_balance_platform_level_api.rb +56 -0
  19. data/lib/adyen/services/balancePlatform.rb +15 -0
  20. data/lib/adyen/services/binLookup/bin_lookup_api.rb +36 -0
  21. data/lib/adyen/services/binLookup.rb +8 -21
  22. data/lib/adyen/services/checkout/donations_api.rb +1 -1
  23. data/lib/adyen/services/checkout/utility_api.rb +10 -0
  24. data/lib/adyen/services/dataProtection/data_protection_api.rb +26 -0
  25. data/lib/adyen/services/dataProtection.rb +8 -11
  26. data/lib/adyen/services/disputes/disputes_api.rb +66 -0
  27. data/lib/adyen/services/disputes.rb +8 -51
  28. data/lib/adyen/services/legalEntityManagement.rb +1 -1
  29. data/lib/adyen/services/management/split_configuration_merchant_level_api.rb +7 -7
  30. data/lib/adyen/services/openBanking/account_verification_api.rb +36 -0
  31. data/lib/adyen/services/openBanking.rb +24 -0
  32. data/lib/adyen/services/payment/modifications_api.rb +98 -0
  33. data/lib/adyen/services/payment/payments_api.rb +66 -0
  34. data/lib/adyen/services/payment.rb +11 -131
  35. data/lib/adyen/services/paymentsApp/payments_app_api.rb +66 -0
  36. data/lib/adyen/services/paymentsApp.rb +8 -51
  37. data/lib/adyen/services/posMobile/pos_mobile_api.rb +26 -0
  38. data/lib/adyen/services/posMobile.rb +8 -11
  39. data/lib/adyen/services/recurring/recurring_api.rb +80 -0
  40. data/lib/adyen/services/recurring.rb +8 -61
  41. data/lib/adyen/services/sessionAuthentication/session_authentication_api.rb +1 -1
  42. data/lib/adyen/services/storedValue/stored_value_api.rb +76 -0
  43. data/lib/adyen/services/storedValue.rb +8 -61
  44. data/lib/adyen/version.rb +1 -1
  45. data/lib/adyen-ruby-api-library.rb +4 -1
  46. data/spec/balance_control_spec.rb +7 -5
  47. data/spec/balance_platform_spec.rb +344 -63
  48. data/spec/bin_lookup_spec.rb +4 -3
  49. data/spec/client_spec.rb +120 -3
  50. data/spec/data_protection_spec.rb +1 -1
  51. data/spec/disputes_spec.rb +2 -1
  52. data/spec/mocks/requests/BalancePlatform/create_transfer_limit.json +14 -0
  53. data/spec/mocks/requests/BalancePlatform/create_webhook_setting.json +16 -0
  54. data/spec/mocks/requests/OpenBanking/create_account_verification_routes.json +6 -0
  55. data/spec/mocks/requests/SessionAuthentication/create_authentication_session.json +16 -0
  56. data/spec/mocks/responses/BalancePlatform/create_transfer_limit.json +16 -0
  57. data/spec/mocks/responses/BalancePlatform/create_webhook_setting.json +17 -0
  58. data/spec/mocks/responses/BalancePlatform/get_all_authorised_card_users.json +6 -0
  59. data/spec/mocks/responses/BalancePlatform/get_all_webhook_settings.json +38 -0
  60. data/spec/mocks/responses/BalancePlatform/get_specific_transfer_limit.json +17 -0
  61. data/spec/mocks/responses/BalancePlatform/get_transfer_limits.json +38 -0
  62. data/spec/mocks/responses/OpenBanking/create_account_verification_routes.json +11 -0
  63. data/spec/mocks/responses/OpenBanking/get_account_verification_report.json +30 -0
  64. data/spec/mocks/responses/SessionAuthentication/create_authentication_session.json +4 -0
  65. data/spec/open_banking_spec.rb +68 -0
  66. data/spec/payments_spec.rb +1 -1
  67. data/spec/recurring_spec.rb +1 -1
  68. data/spec/session_authentication_spec.rb +40 -0
  69. data/spec/stored_value_spec.rb +1 -1
  70. data/templates/api.mustache +1 -1
  71. metadata +33 -3
data/spec/client_spec.rb CHANGED
@@ -25,10 +25,10 @@ RSpec.describe Adyen do
25
25
  end
26
26
 
27
27
  it 'fails payments call without WS user and password' do
28
- expect { @shared_values[:client].payment.authorise('{}') }
28
+ expect { @shared_values[:client].payment.payments_api.authorise('{}') }
29
29
  .to raise_error(Adyen::AuthenticationError)
30
30
  @shared_values[:client].ws_user = @shared_values[:ws_user]
31
- expect { @shared_values[:client].payment.authorise('{}') }
31
+ expect { @shared_values[:client].payment.payments_api.authorise('{}') }
32
32
  .to raise_error(Adyen::AuthenticationError)
33
33
  end
34
34
 
@@ -113,10 +113,20 @@ RSpec.describe Adyen do
113
113
  Adyen::Client.new(env: :test, connection_options: connection_options)
114
114
  end
115
115
 
116
+ # test with Ruby 3.2+ only (where Faraday requestOptions timeout is supported)
116
117
  it 'initiates a Faraday connection with the provided options' do
117
- connection_options = Faraday::ConnectionOptions.new
118
+ skip "Only runs on Ruby >= 3.2" unless RUBY_VERSION >= '3.2'
119
+ connection_options = Faraday::ConnectionOptions.new(
120
+ request: {
121
+ open_timeout: 5,
122
+ timeout: 10
123
+ }
124
+ )
118
125
  expect(Faraday::ConnectionOptions).not_to receive(:new)
119
126
  client = Adyen::Client.new(api_key: 'api_key', env: :mock, connection_options: connection_options)
127
+ # verify custom options
128
+ expect(client.connection_options[:request][:open_timeout]).to eq(5)
129
+ expect(client.connection_options[:request][:timeout]).to eq(10)
120
130
 
121
131
  mock_faraday_connection = double(Faraday::Connection)
122
132
  client.service_url(@shared_values[:service], 'payments/details', client.checkout.version)
@@ -130,6 +140,14 @@ RSpec.describe Adyen do
130
140
  client.checkout.payments_api.payments_details(request_body)
131
141
  end
132
142
 
143
+ # test with Ruby 3.2+ only (where Faraday requestOptions timeout is supported)
144
+ it 'initiates a Faraday connection with the expected default timeouts' do
145
+ skip "Only runs on Ruby >= 3.2" unless RUBY_VERSION >= '3.2'
146
+ client = Adyen::Client.new(env: :test)
147
+ expect(client.connection_options[:request][:open_timeout]).to eq(30)
148
+ expect(client.connection_options[:request][:timeout]).to eq(60)
149
+ end
150
+
133
151
  it "checks the creation of checkout url" do
134
152
  client = Adyen::Client.new(api_key: "api_key", env: :test)
135
153
  expect(client.service_url("Checkout", "paymentMethods", "71")).
@@ -284,4 +302,103 @@ RSpec.describe Adyen do
284
302
  expect(client.service_url_base('Disputes'))
285
303
  .to eq('https://ca-test.adyen.com/ca/services/DisputesService')
286
304
  end
305
+
306
+ it 'raises FormatError on 400 response and checks content' do
307
+ client = Adyen::Client.new(api_key: 'api_key', env: :test)
308
+ mock_faraday_connection = double(Faraday::Connection)
309
+ error_body = {
310
+ status: 400,
311
+ errorCode: "702",
312
+ message: "Structure of CreateCheckoutSessionRequest contains the following unknown fields: [paymentMethod]",
313
+ errorType: "validation"
314
+ }
315
+ mock_response = Faraday::Response.new(status: 400, body: error_body)
316
+
317
+ allow(Faraday).to receive(:new).and_return(mock_faraday_connection)
318
+ allow(mock_faraday_connection).to receive_message_chain(:headers, :[]=)
319
+ allow(mock_faraday_connection).to receive(:post).and_return(mock_response)
320
+
321
+ expect {
322
+ client.checkout.payments_api.payments({})
323
+ }.to raise_error(Adyen::FormatError) do |error|
324
+ expect(error.code).to eq(400)
325
+ expect(error.msg).to eq('Structure of CreateCheckoutSessionRequest contains the following unknown fields: [paymentMethod] ErrorCode: 702')
326
+ expect(error.response[:errorCode]).to eq('702')
327
+ end
328
+ end
329
+
330
+ it 'raises ValidationError on 422 response with RestServiceError (based on RFC 7807)' do
331
+ client = Adyen::Client.new(api_key: 'api_key', env: :test)
332
+ mock_faraday_connection = double(Faraday::Connection)
333
+ error_body = {
334
+ type: "https://docs.adyen.com/errors/validation",
335
+ title: "The request is missing required fields or contains invalid data.",
336
+ status: 422,
337
+ detail: "It is mandatory to specify a legalEntityId when creating a new account holder.",
338
+ invalidFields: [{ "name" => "legalEntityId", "message" => "legalEntityId is not provided" }],
339
+ errorCode: "30_011"
340
+ }
341
+ mock_response = Faraday::Response.new(status: 422, body: error_body)
342
+
343
+ allow(Faraday).to receive(:new).and_return(mock_faraday_connection)
344
+ allow(mock_faraday_connection).to receive_message_chain(:headers, :[]=)
345
+ allow(mock_faraday_connection).to receive(:post).and_return(mock_response)
346
+
347
+ expect {
348
+ client.checkout.payments_api.payments({})
349
+ }.to raise_error(Adyen::ValidationError) do |error|
350
+ expect(error.code).to eq(422)
351
+ expect(error.msg).to eq('It is mandatory to specify a legalEntityId when creating a new account holder. ErrorCode: 30_011')
352
+ expect(error.response[:errorCode]).to eq('30_011')
353
+ expect(error.response[:invalidFields]).to have_attributes(size: 1)
354
+ end
355
+ end
356
+
357
+ it 'raises ValidationError on 422 response with ServiceError (legacy)' do
358
+ client = Adyen::Client.new(api_key: 'api_key', env: :test)
359
+ mock_faraday_connection = double(Faraday::Connection)
360
+ error_body = {
361
+ status: 422,
362
+ errorCode: "14_030",
363
+ message: "Return URL is missing.",
364
+ errorType: "validation",
365
+ pspReference: "8816118280275544"
366
+ }
367
+ mock_response = Faraday::Response.new(status: 422, body: error_body)
368
+
369
+ allow(Faraday).to receive(:new).and_return(mock_faraday_connection)
370
+ allow(mock_faraday_connection).to receive_message_chain(:headers, :[]=)
371
+ allow(mock_faraday_connection).to receive(:post).and_return(mock_response)
372
+
373
+ expect {
374
+ client.checkout.payments_api.payments({})
375
+ }.to raise_error(Adyen::ValidationError) do |error|
376
+ expect(error.code).to eq(422)
377
+ expect(error.msg).to eq('Return URL is missing. ErrorCode: 14_030')
378
+ expect(error.response[:errorCode]).to eq('14_030')
379
+ end
380
+ end
381
+
382
+ it 'raises ServerError on 500 response and checks content' do
383
+ client = Adyen::Client.new(api_key: 'api_key', env: :test)
384
+ mock_faraday_connection = double(Faraday::Connection)
385
+ error_body = {
386
+ status: 500,
387
+ errorCode: "999",
388
+ message: "Unexpected error.",
389
+ errorType: "server error"
390
+ }
391
+ mock_response = Faraday::Response.new(status: 500, body: error_body)
392
+
393
+ allow(Faraday).to receive(:new).and_return(mock_faraday_connection)
394
+ allow(mock_faraday_connection).to receive_message_chain(:headers, :[]=)
395
+ allow(mock_faraday_connection).to receive(:post).and_return(mock_response)
396
+
397
+ expect {
398
+ client.checkout.payments_api.payments({})
399
+ }.to raise_error(Adyen::ServerError) do |error|
400
+ expect(error.code).to eq(500)
401
+ expect(error.msg).to eq('Unexpected error. ErrorCode: 999')
402
+ end
403
+ end
287
404
  end
@@ -10,5 +10,5 @@ RSpec.describe Adyen::DataProtection, service: 'Data Protection Service' do
10
10
  %w[request_subject_erasure result SUCCESS]
11
11
  ]
12
12
 
13
- generate_tests(client, 'DataProtectionService', test_sets, client.data_protection)
13
+ generate_tests(client, 'DataProtectionService', test_sets, client.data_protection.data_protection_api)
14
14
  end
@@ -28,7 +28,8 @@ RSpec.describe Adyen::Disputes, service: 'disputes service' do
28
28
  body: response_body
29
29
  )
30
30
 
31
- result = @shared_values[:client].disputes.retrieve_applicable_defense_reasons(request_body)
31
+ result = @shared_values[:client].disputes.disputes_api.retrieve_applicable_defense_reasons(request_body)
32
+
32
33
  response_hash = result.response
33
34
 
34
35
  expect(result.status)
@@ -0,0 +1,14 @@
1
+ {
2
+ "amount": {
3
+ "currency": "EUR",
4
+ "value": 10000
5
+ },
6
+ "reference": "Your reference for the transfer limit",
7
+ "scaInformation": {
8
+ "scaOnApproval": true
9
+ },
10
+ "scope": "perTransaction",
11
+ "startsAt": "2025-08-15T06:36:20+01:00",
12
+ "endsAt": "2026-08-14T00:00:00+01:00",
13
+ "transferType": "all"
14
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "type": "balance",
3
+ "target": {
4
+ "type": "balanceAccount",
5
+ "id": "BA00000000000000000LIABLE"
6
+ },
7
+ "currency": "USD",
8
+ "status": "active",
9
+ "conditions": [
10
+ {
11
+ "balanceType": "available",
12
+ "conditionType": "lessThan",
13
+ "value": 500000
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "country": "NL",
3
+ "locale": "en-US",
4
+ "state": "11a1e60a-18b0-4dda-9258-e0ae29e1e2a3",
5
+ "redirectUrl": "https://merchanturl.example.org/redirect/url"
6
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "allowOrigin": "https://www.your-website.com",
3
+ "product": "platform",
4
+ "policy": {
5
+ "resources": [
6
+ {
7
+ "type": "accountHolder",
8
+ "accountHolderId": "AH00000000000000000000001"
9
+ }
10
+ ],
11
+ "roles": [
12
+ "Transactions Overview Component: View",
13
+ "Payouts Overview Component: View"
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "amount": {
3
+ "value": 10000,
4
+ "currency": "EUR"
5
+ },
6
+ "id": "TRLI00000000000000000000000001",
7
+ "scope": "perTransaction",
8
+ "reference": "Your reference for the transfer limit",
9
+ "scaInformation": {
10
+ "status": "pending"
11
+ },
12
+ "startsAt": "2025-08-15T06:36:20+01:00",
13
+ "endsAt": "2026-08-13T23:00:00+01:00",
14
+ "limitStatus": "pendingSCA",
15
+ "transferType": "all"
16
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "id": "BWHS00000000000000000000000001",
3
+ "type": "balance",
4
+ "target": {
5
+ "type": "balanceAccount",
6
+ "id": "BA00000000000000000LIABLE"
7
+ },
8
+ "currency": "USD",
9
+ "status": "active",
10
+ "conditions": [
11
+ {
12
+ "balanceType": "available",
13
+ "conditionType": "lessThan",
14
+ "value": 500000
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "legalEntityIds": [
3
+ "LE328V522322685LV3KTNF35M",
4
+ "LE328SW223226B5LWVWNQ8THN"
5
+ ]
6
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "webhookSettings": [
3
+ {
4
+ "id": "BWHS00000000000000000000000001",
5
+ "type": "balance",
6
+ "target": {
7
+ "type": "balancePlatform",
8
+ "id": "YOUR_BALANCE_PLATFORM"
9
+ },
10
+ "currency": "USD",
11
+ "status": "active",
12
+ "conditions": [
13
+ {
14
+ "balanceType": "available",
15
+ "conditionType": "lessThan",
16
+ "value": 500000
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ "id": "BWHS00000000000000000000000002",
22
+ "type": "balance",
23
+ "target": {
24
+ "type": "balanceAccount",
25
+ "id": "BA00000000000000000LIABLE"
26
+ },
27
+ "currency": "USD",
28
+ "status": "active",
29
+ "conditions": [
30
+ {
31
+ "balanceType": "available",
32
+ "conditionType": "greaterThan",
33
+ "value": 1000000
34
+ }
35
+ ]
36
+ }
37
+ ]
38
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "amount": {
3
+ "value": 10000,
4
+ "currency": "EUR"
5
+ },
6
+ "id": "TRLI00000000000000000000000001",
7
+ "endsAt": "2026-08-13T23:00:00+01:00",
8
+ "scope": "perTransaction",
9
+ "reference": "Your reference for the transfer limit",
10
+ "scaInformation": {
11
+ "exemption": "initialLimit",
12
+ "status": "notPerformed"
13
+ },
14
+ "startsAt": "2025-08-13T23:00:00+01:00",
15
+ "limitStatus": "active",
16
+ "transferType": "all"
17
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "transferLimits": [
3
+ {
4
+ "amount": {
5
+ "value": 10000,
6
+ "currency": "EUR"
7
+ },
8
+ "id": "TRLI00000000000000000000000001",
9
+ "endsAt": "2026-08-13T23:00:00+01:00",
10
+ "scope": "perTransaction",
11
+ "reference": "Your reference for the transfer limit",
12
+ "scaInformation": {
13
+ "exemption": "initialLimit",
14
+ "status": "notPerformed"
15
+ },
16
+ "startsAt": "2025-08-13T23:00:00+01:00",
17
+ "limitStatus": "active",
18
+ "transferType": "instant"
19
+ },
20
+ {
21
+ "amount": {
22
+ "value": 20000,
23
+ "currency": "EUR"
24
+ },
25
+ "id": "TRLI00000000000000000000000002",
26
+ "endsAt": "2026-08-13T23:00:00+01:00",
27
+ "scope": "perTransaction",
28
+ "reference": "Your reference for the transfer limit",
29
+ "scaInformation": {
30
+ "exemption": "initialLimit",
31
+ "status": "notPerformed"
32
+ },
33
+ "startsAt": "2025-08-13T23:00:00+01:00",
34
+ "limitStatus": "active",
35
+ "transferType": "all"
36
+ }
37
+ ]
38
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "routes": [
3
+ {
4
+ "provider": {
5
+ "name": "Tink",
6
+ "logoURL": "https://obgateway.adyen.com/obgateway/static/provider/images/tink-logo.svg"
7
+ },
8
+ "link": "https://obgateway.adyen.com/obgateway/provider/outgoing/tink/redirect/13ec4802-c987-4f8c-8909-9a75ff567256"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "id": "69ee9452ef824fe092f1417f37535755",
3
+ "country": "ES",
4
+ "accounts": [
5
+ {
6
+ "accountId": "ed5080e4f485430290475d246534c8fd",
7
+ "accountType": "CURRENT",
8
+ "accountName": "Checking Account 1",
9
+ "accountNumber": "ES1376230223254275408743",
10
+ "currency": "EUR",
11
+ "identifiers": {
12
+ "iban": {
13
+ "iban": "ES1376230223254275408743",
14
+ "bban": "76230223254275408743",
15
+ "bic": "BIC001"
16
+ }
17
+ },
18
+ "parties": [
19
+ {
20
+ "identity": {
21
+ "fullLegalName": "Alberta Bobbeth Charleson",
22
+ "name": "Alberta Bobbeth Charleson"
23
+ },
24
+ "role": "HOLDER"
25
+ }
26
+ ],
27
+ "bankName": "Tink Demo Bank"
28
+ }
29
+ ]
30
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "sessionToken": "long_session_token_string",
3
+ "expiresAt": "2025-10-07T12:00:00Z"
4
+ }
@@ -0,0 +1,68 @@
1
+ require 'spec_helper'
2
+ require 'json'
3
+
4
+ RSpec.describe Adyen::OpenBanking, service: 'OpenBanking' do
5
+ before(:all) do
6
+ @shared_values = {
7
+ client: create_client(:api_key),
8
+ service: 'OpenBanking'
9
+ }
10
+ end
11
+
12
+ it 'makes a create_account_verification_routes POST call' do
13
+ request_body = JSON.parse(json_from_file('mocks/requests/OpenBanking/create_account_verification_routes.json'))
14
+ response_body = json_from_file('mocks/responses/OpenBanking/create_account_verification_routes.json')
15
+
16
+ url = @shared_values[:client].service_url(
17
+ @shared_values[:service],
18
+ 'accountVerification/routes',
19
+ @shared_values[:client].open_banking.version
20
+ )
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
+ )
31
+
32
+ result = @shared_values[:client].open_banking.account_verification_api.create_account_verification_routes(request_body)
33
+ response_hash = result.response
34
+
35
+ expect(result.status).to eq(200)
36
+ expect(response_hash).to eq(JSON.parse(response_body))
37
+ expect(response_hash).to be_a Adyen::HashWithAccessors
38
+ expect(response_hash).to be_a_kind_of Hash
39
+ end
40
+
41
+ it 'makes a get_account_verification_report GET call' do
42
+ response_body = json_from_file('mocks/responses/OpenBanking/get_account_verification_report.json')
43
+ code = 'some-verification-code'
44
+
45
+ url = @shared_values[:client].service_url(
46
+ @shared_values[:service],
47
+ "accountVerification/reports/#{code}",
48
+ @shared_values[:client].open_banking.version
49
+ )
50
+ WebMock.stub_request(:get, url)
51
+ .with(
52
+ headers: {
53
+ 'x-api-key' => @shared_values[:client].api_key
54
+ }
55
+ )
56
+ .to_return(
57
+ body: response_body
58
+ )
59
+
60
+ result = @shared_values[:client].open_banking.account_verification_api.get_account_verification_report(code)
61
+ response_hash = result.response
62
+
63
+ expect(result.status).to eq(200)
64
+ expect(response_hash).to eq(JSON.parse(response_body))
65
+ expect(response_hash).to be_a Adyen::HashWithAccessors
66
+ expect(response_hash).to be_a_kind_of Hash
67
+ end
68
+ end
@@ -28,7 +28,7 @@ RSpec.describe Adyen::Payment, service: 'Payment' do
28
28
  body: response_body
29
29
  )
30
30
 
31
- result = @shared_values[:client].payment.adjust_authorisation(request_body)
31
+ result = @shared_values[:client].payment.modifications_api.adjust_authorisation(request_body)
32
32
  response_hash = result.response
33
33
 
34
34
  expect(result.status)
@@ -14,5 +14,5 @@ RSpec.describe Adyen::Payment, service: 'recurring service' do
14
14
  ['schedule_account_updater', 'result', 'Success']
15
15
  ]
16
16
 
17
- generate_tests(client, 'Recurring', test_sets, client.recurring)
17
+ generate_tests(client, 'Recurring', test_sets, client.recurring.recurring_api)
18
18
  end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+ require 'json'
3
+
4
+ RSpec.describe Adyen::SessionAuthentication, service: 'SessionAuthentication' do
5
+ before(:all) do
6
+ @shared_values = {
7
+ client: create_client(:api_key),
8
+ service: 'SessionAuthentication'
9
+ }
10
+ end
11
+
12
+ it 'makes a create_authentication_session POST call' do
13
+ request_body = JSON.parse(json_from_file('mocks/requests/SessionAuthentication/create_authentication_session.json'))
14
+ response_body = json_from_file('mocks/responses/SessionAuthentication/create_authentication_session.json')
15
+
16
+ url = @shared_values[:client].service_url(
17
+ @shared_values[:service],
18
+ 'sessions',
19
+ @shared_values[:client].session_authentication.version
20
+ )
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
+ )
31
+
32
+ result = @shared_values[:client].session_authentication.session_authentication_api.create_authentication_session(request_body)
33
+ response_hash = result.response
34
+
35
+ expect(result.status).to eq(200)
36
+ expect(response_hash).to eq(JSON.parse(response_body))
37
+ expect(response_hash).to be_a Adyen::HashWithAccessors
38
+ expect(response_hash).to be_a_kind_of Hash
39
+ end
40
+ end
@@ -28,7 +28,7 @@ RSpec.describe Adyen::BalancePlatform, service: 'balancePlatform' do
28
28
  body: response_body
29
29
  )
30
30
 
31
- result = @shared_values[:client].stored_value.issue(request_body)
31
+ result = @shared_values[:client].stored_value.stored_value_api.issue(request_body)
32
32
  response_hash = result.response
33
33
 
34
34
  expect(result.status)
@@ -18,7 +18,7 @@ module Adyen
18
18
  #
19
19
  # Deprecated {{#vendorExtensions.x-deprecatedInVersion}}since {{#appName}}{{{.}}}{{/appName}} v{{.}}{{/vendorExtensions.x-deprecatedInVersion}}{{#vendorExtensions.x-deprecatedMessage}}
20
20
  # {{{.}}}{{/vendorExtensions.x-deprecatedMessage}}{{/isDeprecated}}
21
- def {{#lambda.snakecase}}{{#vendorExtensions.x-methodName}}{{.}}{{/vendorExtensions.x-methodName}}{{^vendorExtensions.x-methodName}}{{nickname}}{{/vendorExtensions.x-methodName}}{{/lambda.snakecase}}({{#bodyParams}}request, {{/bodyParams}}{{#requiredParams}}{{^isQueryParam}}{{#lambda.snakecase}}{{paramName}}{{/lambda.snakecase}}, {{/isQueryParam}}{{/requiredParams}}headers: {}{{#queryParams}}{{#-first}}, query_params: {}{{/-first}}{{/queryParams}})
21
+ def {{#lambda.snakecase}}{{#vendorExtensions.x-methodName}}{{.}}{{/vendorExtensions.x-methodName}}{{^vendorExtensions.x-methodName}}{{nickname}}{{/vendorExtensions.x-methodName}}{{/lambda.snakecase}}({{#bodyParams}}request, {{/bodyParams}}{{#pathParams}}{{#lambda.snakecase}}{{paramName}}{{/lambda.snakecase}}, {{/pathParams}}headers: {}{{#queryParams}}{{#-first}}, query_params: {}{{/-first}}{{/queryParams}})
22
22
  endpoint = '{{path}}'.gsub(/{.+?}/, '%s')
23
23
  endpoint = endpoint.gsub(%r{^/}, '')
24
24
  endpoint = format(endpoint{{#pathParams}}, {{#lambda.snakecase}}{{paramName}}{{/lambda.snakecase}}{{/pathParams}})