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.
Files changed (80) 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/README.md +6 -10
  8. data/VERSION +1 -1
  9. data/lib/adyen/client.rb +64 -19
  10. data/lib/adyen/errors.rb +11 -3
  11. data/lib/adyen/services/{balanceControlService.rb → balanceControl/balance_control_api.rb} +5 -4
  12. data/lib/adyen/services/balanceControl.rb +24 -0
  13. data/lib/adyen/services/balancePlatform/authorized_card_users_api.rb +2 -2
  14. data/lib/adyen/services/balancePlatform/balances_api.rb +2 -2
  15. data/lib/adyen/services/balancePlatform/transfer_limits_balance_account_level_api.rb +76 -0
  16. data/lib/adyen/services/balancePlatform/transfer_limits_balance_platform_level_api.rb +56 -0
  17. data/lib/adyen/services/balancePlatform.rb +10 -0
  18. data/lib/adyen/services/binLookup/bin_lookup_api.rb +36 -0
  19. data/lib/adyen/services/binLookup.rb +8 -21
  20. data/lib/adyen/services/checkout/donations_api.rb +1 -1
  21. data/lib/adyen/services/checkout/utility_api.rb +10 -0
  22. data/lib/adyen/services/dataProtection/data_protection_api.rb +26 -0
  23. data/lib/adyen/services/dataProtection.rb +8 -11
  24. data/lib/adyen/services/disputes/disputes_api.rb +66 -0
  25. data/lib/adyen/services/disputes.rb +8 -51
  26. data/lib/adyen/services/legalEntityManagement/legal_entities_api.rb +10 -0
  27. data/lib/adyen/services/legalEntityManagement.rb +1 -1
  28. data/lib/adyen/services/management/split_configuration_merchant_level_api.rb +7 -7
  29. data/lib/adyen/services/openBanking/account_verification_api.rb +36 -0
  30. data/lib/adyen/services/openBanking.rb +24 -0
  31. data/lib/adyen/services/payment/modifications_api.rb +98 -0
  32. data/lib/adyen/services/payment/payments_api.rb +66 -0
  33. data/lib/adyen/services/payment.rb +11 -131
  34. data/lib/adyen/services/paymentsApp/payments_app_api.rb +66 -0
  35. data/lib/adyen/services/paymentsApp.rb +8 -51
  36. data/lib/adyen/services/posMobile/pos_mobile_api.rb +26 -0
  37. data/lib/adyen/services/posMobile.rb +8 -11
  38. data/lib/adyen/services/recurring/recurring_api.rb +80 -0
  39. data/lib/adyen/services/recurring.rb +8 -61
  40. data/lib/adyen/services/sessionAuthentication/session_authentication_api.rb +1 -1
  41. data/lib/adyen/services/storedValue/stored_value_api.rb +76 -0
  42. data/lib/adyen/services/storedValue.rb +8 -61
  43. data/lib/adyen/version.rb +1 -1
  44. data/lib/adyen-ruby-api-library.rb +4 -1
  45. data/renovate.json +3 -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/checkout_spec.rb +13 -0
  50. data/spec/client_spec.rb +157 -3
  51. data/spec/data_protection_spec.rb +2 -2
  52. data/spec/disputes_spec.rb +5 -4
  53. data/spec/lem_spec.rb +75 -0
  54. data/spec/mocks/requests/BalancePlatform/create_transfer_limit.json +14 -0
  55. data/spec/mocks/requests/BalancePlatform/create_webhook_setting.json +16 -0
  56. data/spec/mocks/requests/OpenBanking/create_account_verification_routes.json +6 -0
  57. data/spec/mocks/requests/SessionAuthentication/create_authentication_session.json +16 -0
  58. data/spec/mocks/responses/BalancePlatform/create_transfer_limit.json +16 -0
  59. data/spec/mocks/responses/BalancePlatform/create_webhook_setting.json +17 -0
  60. data/spec/mocks/responses/BalancePlatform/get_all_authorised_card_users.json +6 -0
  61. data/spec/mocks/responses/BalancePlatform/get_all_webhook_settings.json +38 -0
  62. data/spec/mocks/responses/BalancePlatform/get_specific_transfer_limit.json +17 -0
  63. data/spec/mocks/responses/BalancePlatform/get_transfer_limits.json +38 -0
  64. data/spec/mocks/responses/LegalEntityManagement/get_legal_entity.json +14 -0
  65. data/spec/mocks/responses/OpenBanking/create_account_verification_routes.json +11 -0
  66. data/spec/mocks/responses/OpenBanking/get_account_verification_report.json +30 -0
  67. data/spec/mocks/responses/SessionAuthentication/create_authentication_session.json +4 -0
  68. data/spec/open_banking_spec.rb +68 -0
  69. data/spec/payments_spec.rb +1 -1
  70. data/spec/recurring_spec.rb +1 -1
  71. data/spec/session_authentication_spec.rb +40 -0
  72. data/spec/stored_value_spec.rb +1 -1
  73. data/templates/api-single.mustache +1 -1
  74. data/templates/api.mustache +2 -2
  75. metadata +36 -7
  76. data/Makefile +0 -79
  77. /data/spec/mocks/requests/{DataProtectionService → DataProtection}/request_subject_erasure.json +0 -0
  78. /data/spec/mocks/requests/{DisputesService → Disputes}/retrieve_applicable_defense_reasons.json +0 -0
  79. /data/spec/mocks/responses/{DataProtectionService → DataProtection}/request_subject_erasure.json +0 -0
  80. /data/spec/mocks/responses/{DisputesService → Disputes}/retrieve_applicable_defense_reasons.json +0 -0
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
 
@@ -300,6 +300,160 @@ RSpec.describe Adyen do
300
300
  it 'correctly maps Disputes to DisputesService and generates valid URL' do
301
301
  client = Adyen::Client.new(env: :test)
302
302
  expect(client.service_url_base('Disputes'))
303
- .to eq('https://ca-test.adyen.com/ca/services/DisputesService')
303
+ .to eq('https://ca-test.adyen.com/ca/services/DisputeService')
304
304
  end
305
+
306
+ it 'checks the creation of DataProtection url' do
307
+ client = Adyen::Client.new(env: :test)
308
+ expect(client.service_url_base('DataProtection'))
309
+ .to eq('https://ca-test.adyen.com/ca/services/DataProtectionService')
310
+ end
311
+
312
+ it 'checks the creation of SessionAuthentication url for the test env' do
313
+ client = Adyen::Client.new(env: :test)
314
+ expect(client.service_url_base('SessionAuthentication'))
315
+ .to eq('https://test.adyen.com/authe/api')
316
+ end
317
+
318
+ it 'checks the creation of SessionAuthentication url for the live env' do
319
+ client = Adyen::Client.new(env: :live)
320
+ expect(client.service_url_base('SessionAuthentication'))
321
+ .to eq('https://authe-live.adyen.com/authe/api')
322
+ end
323
+
324
+ it 'raises FormatError on 400 response and checks content' do
325
+ client = Adyen::Client.new(api_key: 'api_key', env: :test)
326
+ mock_faraday_connection = double(Faraday::Connection)
327
+ error_body = {
328
+ status: 400,
329
+ errorCode: "702",
330
+ message: "Structure of CreateCheckoutSessionRequest contains the following unknown fields: [paymentMethod]",
331
+ errorType: "validation"
332
+ }
333
+ mock_response = Faraday::Response.new(status: 400, body: error_body)
334
+
335
+ allow(Faraday).to receive(:new).and_return(mock_faraday_connection)
336
+ allow(mock_faraday_connection).to receive_message_chain(:headers, :[]=)
337
+ allow(mock_faraday_connection).to receive(:post).and_return(mock_response)
338
+
339
+ expect {
340
+ client.checkout.payments_api.payments({})
341
+ }.to raise_error(Adyen::FormatError) do |error|
342
+ expect(error.code).to eq(400)
343
+ expect(error.msg).to eq('Structure of CreateCheckoutSessionRequest contains the following unknown fields: [paymentMethod] ErrorCode: 702')
344
+ expect(error.response[:errorCode]).to eq('702')
345
+ end
346
+ end
347
+
348
+ it 'raises ValidationError on 422 response with RestServiceError (based on RFC 7807)' do
349
+ client = Adyen::Client.new(api_key: 'api_key', env: :test)
350
+ mock_faraday_connection = double(Faraday::Connection)
351
+ error_body = {
352
+ type: "https://docs.adyen.com/errors/validation",
353
+ title: "The request is missing required fields or contains invalid data.",
354
+ status: 422,
355
+ detail: "It is mandatory to specify a legalEntityId when creating a new account holder.",
356
+ invalidFields: [{ "name" => "legalEntityId", "message" => "legalEntityId is not provided" }],
357
+ errorCode: "30_011"
358
+ }
359
+ mock_response = Faraday::Response.new(status: 422, body: error_body)
360
+
361
+ allow(Faraday).to receive(:new).and_return(mock_faraday_connection)
362
+ allow(mock_faraday_connection).to receive_message_chain(:headers, :[]=)
363
+ allow(mock_faraday_connection).to receive(:post).and_return(mock_response)
364
+
365
+ expect {
366
+ client.checkout.payments_api.payments({})
367
+ }.to raise_error(Adyen::ValidationError) do |error|
368
+ expect(error.code).to eq(422)
369
+ expect(error.msg).to eq('It is mandatory to specify a legalEntityId when creating a new account holder. ErrorCode: 30_011')
370
+ expect(error.response[:errorCode]).to eq('30_011')
371
+ expect(error.response[:invalidFields]).to have_attributes(size: 1)
372
+ end
373
+ end
374
+
375
+ it 'raises ValidationError on 422 response with ServiceError (legacy)' do
376
+ client = Adyen::Client.new(api_key: 'api_key', env: :test)
377
+ mock_faraday_connection = double(Faraday::Connection)
378
+ error_body = {
379
+ status: 422,
380
+ errorCode: "14_030",
381
+ message: "Return URL is missing.",
382
+ errorType: "validation",
383
+ pspReference: "8816118280275544"
384
+ }
385
+ mock_response = Faraday::Response.new(status: 422, body: error_body)
386
+
387
+ allow(Faraday).to receive(:new).and_return(mock_faraday_connection)
388
+ allow(mock_faraday_connection).to receive_message_chain(:headers, :[]=)
389
+ allow(mock_faraday_connection).to receive(:post).and_return(mock_response)
390
+
391
+ expect {
392
+ client.checkout.payments_api.payments({})
393
+ }.to raise_error(Adyen::ValidationError) do |error|
394
+ expect(error.code).to eq(422)
395
+ expect(error.msg).to eq('Return URL is missing. ErrorCode: 14_030')
396
+ expect(error.response[:errorCode]).to eq('14_030')
397
+ end
398
+ end
399
+
400
+ it 'raises ServerError on 500 response and checks content' do
401
+ client = Adyen::Client.new(api_key: 'api_key', env: :test)
402
+ mock_faraday_connection = double(Faraday::Connection)
403
+ error_body = {
404
+ status: 500,
405
+ errorCode: "999",
406
+ message: "Unexpected error.",
407
+ errorType: "server error"
408
+ }
409
+ mock_response = Faraday::Response.new(status: 500, body: error_body)
410
+
411
+ allow(Faraday).to receive(:new).and_return(mock_faraday_connection)
412
+ allow(mock_faraday_connection).to receive_message_chain(:headers, :[]=)
413
+ allow(mock_faraday_connection).to receive(:post).and_return(mock_response)
414
+
415
+ expect {
416
+ client.checkout.payments_api.payments({})
417
+ }.to raise_error(Adyen::ServerError) do |error|
418
+ expect(error.code).to eq(500)
419
+ expect(error.msg).to eq('Unexpected error. ErrorCode: 999')
420
+ end
421
+ end
422
+
423
+ it 'raises NotFoundError on 404 response and checks content' do
424
+ client = Adyen::Client.new(api_key: 'api_key', env: :test)
425
+ mock_faraday_connection = double(Faraday::Connection)
426
+ error_body = "701 Version 71 is not supported, latest version: 68"
427
+ mock_response = Faraday::Response.new(status: 404, body: error_body)
428
+
429
+ allow(Faraday).to receive(:new).and_return(mock_faraday_connection)
430
+ allow(mock_faraday_connection).to receive_message_chain(:headers, :[]=)
431
+ allow(mock_faraday_connection).to receive(:post).and_return(mock_response)
432
+
433
+ expect {
434
+ client.checkout.payments_api.payments({})
435
+ }.to raise_error(Adyen::NotFoundError) do |error|
436
+ expect(error.code).to eq(404)
437
+ expect(error.msg).to eq('Not found error')
438
+ end
439
+ end
440
+
441
+ it 'raises NotFoundError on 404 response with an invalid JSON body' do
442
+ client = Adyen::Client.new(api_key: 'api_key', env: :test)
443
+ mock_faraday_connection = double(Faraday::Connection)
444
+ error_body = "this is an error message"
445
+ mock_response = Faraday::Response.new(status: 404, body: error_body)
446
+
447
+ allow(Faraday).to receive(:new).and_return(mock_faraday_connection)
448
+ allow(mock_faraday_connection).to receive_message_chain(:headers, :[]=)
449
+ allow(mock_faraday_connection).to receive(:post).and_return(mock_response)
450
+
451
+ expect {
452
+ client.payment.payments_api.authorise({})
453
+ }.to raise_error(Adyen::NotFoundError) do |error|
454
+ expect(error.code).to eq(404)
455
+ expect(error.msg).to eq('Not found error')
456
+ end
457
+ end
458
+
305
459
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- RSpec.describe Adyen::DataProtection, service: 'Data Protection Service' do
3
+ RSpec.describe Adyen::DataProtection, service: 'DataProtection' do
4
4
  # client instance to be used in dynamically generated tests
5
5
  client = create_client(:basic)
6
6
 
@@ -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, 'DataProtection', test_sets, client.data_protection.data_protection_api)
14
14
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- RSpec.describe Adyen::Disputes, service: 'disputes service' do
3
+ RSpec.describe Adyen::Disputes, service: 'Disputes' do
4
4
  before(:all) do
5
5
  @shared_values = {
6
6
  client: create_client(:api_key),
@@ -11,9 +11,9 @@ RSpec.describe Adyen::Disputes, service: 'disputes service' do
11
11
  # methods / values to test for
12
12
  # format is defined in spec_helper
13
13
  it 'makes a retrieve_applicable_defense_reasons call' do
14
- request_body = JSON.parse(json_from_file('mocks/requests/DisputesService/retrieve_applicable_defense_reasons.json'))
14
+ request_body = JSON.parse(json_from_file('mocks/requests/Disputes/retrieve_applicable_defense_reasons.json'))
15
15
 
16
- response_body = json_from_file('mocks/responses/DisputesService/retrieve_applicable_defense_reasons.json')
16
+ response_body = json_from_file('mocks/responses/Disputes/retrieve_applicable_defense_reasons.json')
17
17
 
18
18
  url = @shared_values[:client].service_url(@shared_values[:service], 'retrieveApplicableDefenseReasons',
19
19
  @shared_values[:client].disputes.version)
@@ -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)
data/spec/lem_spec.rb CHANGED
@@ -60,4 +60,79 @@ RSpec.describe Adyen::LegalEntityManagement, service: 'LegalEntityManagement' do
60
60
  expect(result.status)
61
61
  .to eq(200)
62
62
  end
63
+
64
+ it 'makes a legal_entities GET call' do
65
+ legal_entity_id = 'LE322JV223222D5F4K62J7465'
66
+ response_body = json_from_file('mocks/responses/LegalEntityManagement/get_legal_entity.json')
67
+
68
+ url = @shared_values[:client].service_url(@shared_values[:service], "legalEntities/#{legal_entity_id}",
69
+ @shared_values[:client].legal_entity_management.version)
70
+ WebMock.stub_request(:get, url)
71
+ .with(
72
+ headers: {
73
+ 'x-api-key' => @shared_values[:client].api_key
74
+ }
75
+ )
76
+ .to_return(
77
+ body: response_body
78
+ )
79
+
80
+ result = @shared_values[:client].legal_entity_management.legal_entities_api.get_legal_entity(legal_entity_id)
81
+ response_hash = result.response
82
+
83
+ expect(result.status)
84
+ .to eq(200)
85
+ expect(response_hash)
86
+ .to eq(JSON.parse(response_body))
87
+ expect(response_hash)
88
+ .to be_a Adyen::HashWithAccessors
89
+ expect(response_hash)
90
+ .to be_a_kind_of Hash
91
+ end
92
+
93
+ it 'raises an error when calling legal_entities GET call' do
94
+ invalid_legal_entity_id = 'NON_EXISTENT_ID'
95
+ error_response_body = { status: 404, errorCode: '100', message: 'Legal entity not found', errorType: 'validation' }.to_json
96
+
97
+ url = @shared_values[:client].service_url(@shared_values[:service], "legalEntities/#{invalid_legal_entity_id}",
98
+ @shared_values[:client].legal_entity_management.version)
99
+ WebMock.stub_request(:get, url)
100
+ .with(
101
+ headers: {
102
+ 'x-api-key' => @shared_values[:client].api_key
103
+ }
104
+ )
105
+ .to_return(
106
+ status: 404,
107
+ body: error_response_body
108
+ )
109
+
110
+ expect do
111
+ @shared_values[:client].legal_entity_management.legal_entities_api.get_legal_entity(invalid_legal_entity_id)
112
+ end.to raise_error(Adyen::NotFoundError) do |error|
113
+ expect(error.code).to eq(404)
114
+ expect(error.msg).to eq('Legal entity not found ErrorCode: 100')
115
+ end
116
+ end
117
+
118
+ it 'makes a LegaleEntity /requestPeriodicReview call' do
119
+ url = @shared_values[:client].service_url(@shared_values[:service], "legalEntities/LE123/requestPeriodicReview",
120
+ @shared_values[:client].legal_entity_management.version)
121
+ WebMock.stub_request(:post, url)
122
+ .with(
123
+ headers: {
124
+ 'x-api-key' => @shared_values[:client].api_key
125
+ }
126
+ )
127
+ .to_return(
128
+ body: '{}'
129
+ )
130
+
131
+ result = @shared_values[:client].legal_entity_management.legal_entities_api.request_periodic_review('LE123')
132
+ result.response
133
+
134
+ expect(result.status)
135
+ .to eq(200)
136
+ end
137
+
63
138
  end
@@ -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,14 @@
1
+ {
2
+ "id": "LE322JV223222D5F4K62J7465",
3
+ "type": "Organization",
4
+ "status": "Active",
5
+ "legalEntityCode": "LE322JV223222D5F4K62J7465",
6
+ "reference": "MyCompany",
7
+ "capabilities": [
8
+ {
9
+ "id": "capability_1",
10
+ "requested": true,
11
+ "allowed": true
12
+ }
13
+ ]
14
+ }
@@ -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