adyen-ruby-api-library 11.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f7ba37ee06a22e3d1f014c6f5db4e64a9953a1b09e3486b343520464cacef8a
4
- data.tar.gz: 42dcac0cf673d4136551db350fa75c19041349499f8d2d401f13f6367f0e6dc4
3
+ metadata.gz: 92b51bd749bf2197660b344467eb810e18fc85c595313444b25b0b1c6e5efd4e
4
+ data.tar.gz: fe1566a9a57a0be999ca83dc1704893050f13756f07529526fa457aa270bec6c
5
5
  SHA512:
6
- metadata.gz: c21b9c1a93ffa502019fec7db2fcdcf6b7d8e2bea6b0acd3974a93274deef99db442027fc2a9477d9fbe69e27c726b01edd4f02adb376cc61ec25c77317d9823
7
- data.tar.gz: f45339daac6e469bdd429ea87eb14e5adf25bf43fee4441c60ad2d70d41fbf8b6713ba9aba715bac0195bed10322c5eded6cf6ea98fb52da4968b5da919bc8e6
6
+ metadata.gz: acf09d5e10e31179b243638b37e9c5528193fad0b3bb0fcb6d667f8a75a045a79efeb8dec96338bbec1bc3f13efd608c9c4c231325c76123a98afb342155c830
7
+ data.tar.gz: e5e9e834d79ef4a52e8ecb5d863394dbdce70050f3f0e72577fa0cfdc39b1475bf984adbb1a02ef4d0376f3cd2aeb99ef976922e02e2c31b3ce207fe82c5cde3
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  ![Ruby](https://user-images.githubusercontent.com/93914435/236416787-3da4dd32-0a7d-43f7-9aa4-8d77697c85f9.png)
2
2
  # Adyen API Library for Ruby
3
3
 
4
+ [![Gem Version](https://img.shields.io/gem/v/adyen-ruby-api-library.svg)](https://rubygems.org/gems/adyen-ruby-api-library)
5
+
4
6
  This is the officially supported Ruby library for using Adyen's APIs.
5
7
 
6
8
  ## Supported APIs
data/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- 11.0.0
1
+ 11.1.0
2
2
 
data/lib/adyen/client.rb CHANGED
@@ -64,8 +64,6 @@ module Adyen
64
64
 
65
65
  # base URL for API given service and @env
66
66
  def service_url_base(service)
67
- # maps 'Disputes' to expected service name 'DisputesService' for URL matching
68
- service = 'DisputesService' if service == 'Disputes'
69
67
  if @env == :mock
70
68
  @mock_service_url_base
71
69
  else
@@ -82,8 +80,11 @@ module Adyen
82
80
  when 'PosTerminalManagement'
83
81
  url = "https://postfmapi-#{@env}.adyen.com/postfmapi/terminal"
84
82
  supports_live_url_prefix = false
85
- when 'DataProtectionService', 'DisputesService'
86
- url = "https://ca-#{@env}.adyen.com/ca/services/#{service}"
83
+ when 'Disputes'
84
+ url = "https://ca-#{@env}.adyen.com/ca/services/DisputeService"
85
+ supports_live_url_prefix = false
86
+ when 'DataProtection'
87
+ url = "https://ca-#{@env}.adyen.com/ca/services/DataProtectionService"
87
88
  supports_live_url_prefix = false
88
89
  when 'LegalEntityManagement'
89
90
  url = "https://kyc-#{@env}.adyen.com/lem"
@@ -107,6 +108,10 @@ module Adyen
107
108
  when 'PosMobile'
108
109
  url = "https://checkout-#{@env}.adyen.com/checkout/possdk"
109
110
  supports_live_url_prefix = true
111
+ when 'SessionAuthentication'
112
+ subdomain = @env == :live ? "authe-#{@env}" : @env
113
+ url = "https://#{subdomain}.adyen.com/authe/api"
114
+ supports_live_url_prefix = false
110
115
  else
111
116
  raise ArgumentError, 'Invalid service specified'
112
117
  end
@@ -140,7 +145,7 @@ module Adyen
140
145
  def call_adyen_api(service, action, request_data, headers, version, _with_application_info: false)
141
146
  # get URL for requested endpoint
142
147
  url = service_url(service, action.is_a?(String) ? action : action.fetch(:url), version)
143
-
148
+
144
149
  auth_type = auth_type(service, request_data)
145
150
 
146
151
  # initialize Faraday connection object
@@ -223,6 +228,9 @@ module Adyen
223
228
  when 403
224
229
  full_message = build_error_message(response.body, 'Authorisation error')
225
230
  raise Adyen::PermissionError.new(full_message, request_data, response.body)
231
+ when 404
232
+ full_message = build_error_message(response.body, 'Not found error')
233
+ raise Adyen::NotFoundError.new(full_message, request_data, response.body)
226
234
  when 422
227
235
  full_message = build_error_message(response.body, 'Validation error')
228
236
  raise Adyen::ValidationError.new(full_message, request_data, response.body)
@@ -368,8 +376,10 @@ module Adyen
368
376
  full_message = default_message
369
377
  begin
370
378
  error_details = response_body
379
+ error_details = JSON.parse(response_body, symbolize_names: true) if response_body.is_a?(String)
380
+
371
381
  # check different attributes to support both RFC 7807 and legacy models
372
- message = error_details[:detail] || error_details[:message]
382
+ message = error_details[:detail] || error_details[:message] || error_details
373
383
  error_code = error_details[:errorCode]
374
384
  if message && error_code
375
385
  full_message = "#{message} ErrorCode: #{error_code}"
data/lib/adyen/errors.rb CHANGED
@@ -105,6 +105,12 @@ module Adyen
105
105
  end
106
106
  end
107
107
 
108
+ class NotFoundError < AdyenError
109
+ def initialize(msg, request, response)
110
+ super(request, response, msg, 404)
111
+ end
112
+ end
113
+
108
114
  # catchall for errors which don't have more specific classes
109
115
  class APIError < AdyenError
110
116
  def initialize(msg, request, response, code)
@@ -62,6 +62,16 @@ module Adyen
62
62
  @client.call_adyen_api(@service, action, {}, headers, @version)
63
63
  end
64
64
 
65
+ # Request periodic data review.
66
+ def request_periodic_review(id, headers: {})
67
+ endpoint = '/legalEntities/{id}/requestPeriodicReview'.gsub(/{.+?}/, '%s')
68
+ endpoint = endpoint.gsub(%r{^/}, '')
69
+ endpoint = format(endpoint, id)
70
+
71
+ action = { method: 'post', url: endpoint }
72
+ @client.call_adyen_api(@service, action, {}, headers, @version)
73
+ end
74
+
65
75
  # Update a legal entity
66
76
  def update_legal_entity(request, id, headers: {})
67
77
  endpoint = '/legalEntities/{id}'.gsub(/{.+?}/, '%s')
@@ -5,7 +5,7 @@ module Adyen
5
5
  # Ref: https://openapi-generator.tech
6
6
  #
7
7
  # Do not edit the class manually.
8
- class ModificationsApi < Service
8
+ class ClassicModificationsApi < Service
9
9
  attr_accessor :service, :version
10
10
 
11
11
  def initialize(client, version = DEFAULT_VERSION)
@@ -5,7 +5,7 @@ module Adyen
5
5
  # Ref: https://openapi-generator.tech
6
6
  #
7
7
  # Do not edit the class manually.
8
- class PaymentsApi < Service
8
+ class ClassicPaymentsApi < Service
9
9
  attr_accessor :service, :version
10
10
 
11
11
  def initialize(client, version = DEFAULT_VERSION)
@@ -18,11 +18,11 @@ module Adyen
18
18
  end
19
19
 
20
20
  def modifications_api
21
- @modifications_api ||= Adyen::ModificationsApi.new(@client, @version)
21
+ @modifications_api ||= Adyen::ClassicModificationsApi.new(@client, @version)
22
22
  end
23
23
 
24
24
  def payments_api
25
- @payments_api ||= Adyen::PaymentsApi.new(@client, @version)
25
+ @payments_api ||= Adyen::ClassicPaymentsApi.new(@client, @version)
26
26
  end
27
27
 
28
28
  end
data/lib/adyen/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Adyen
2
2
  NAME = 'adyen-ruby-api-library'.freeze
3
- VERSION = '11.0.0'.freeze
3
+ VERSION = '11.1.0'.freeze
4
4
  end
data/renovate.json CHANGED
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": ["config:base"],
3
+ "extends": [
4
+ "config:recommended"
5
+ ],
4
6
  "minimumReleaseAge": "21 days"
5
7
  }
@@ -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
data/spec/client_spec.rb CHANGED
@@ -300,9 +300,27 @@ 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
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
+
306
324
  it 'raises FormatError on 400 response and checks content' do
307
325
  client = Adyen::Client.new(api_key: 'api_key', env: :test)
308
326
  mock_faraday_connection = double(Faraday::Connection)
@@ -401,4 +419,41 @@ RSpec.describe Adyen do
401
419
  expect(error.msg).to eq('Unexpected error. ErrorCode: 999')
402
420
  end
403
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
+
404
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.data_protection_api)
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)
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
+ "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
+ }
@@ -23,7 +23,7 @@ module Adyen
23
23
  {{#apiInfo}}
24
24
  {{#apis}}
25
25
  def {{classFilename}}
26
- @{{classFilename}} ||= Adyen::{{classname}}.new(@client, @version)
26
+ @{{classFilename}} ||= Adyen::{{classicPrefix}}{{classname}}.new(@client, @version)
27
27
  end
28
28
 
29
29
  {{/apis}}
@@ -6,7 +6,7 @@ module Adyen
6
6
  # Ref: https://openapi-generator.tech
7
7
  #
8
8
  # Do not edit the class manually.
9
- class {{classname}} < Service
9
+ class {{classicPrefix}}{{classname}} < Service
10
10
  attr_accessor :service, :version
11
11
 
12
12
  def initialize(client, version = DEFAULT_VERSION)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adyen-ruby-api-library
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.0.0
4
+ version: 11.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adyen
@@ -94,7 +94,6 @@ files:
94
94
  - CONTRIBUTING.md
95
95
  - Gemfile
96
96
  - LICENSE
97
- - Makefile
98
97
  - README.md
99
98
  - Rakefile
100
99
  - VERSION
@@ -269,8 +268,8 @@ files:
269
268
  - spec/mocks/requests/Checkout/refund.json
270
269
  - spec/mocks/requests/Checkout/sessions.json
271
270
  - spec/mocks/requests/Checkout/verify.json
272
- - spec/mocks/requests/DataProtectionService/request_subject_erasure.json
273
- - spec/mocks/requests/DisputesService/retrieve_applicable_defense_reasons.json
271
+ - spec/mocks/requests/DataProtection/request_subject_erasure.json
272
+ - spec/mocks/requests/Disputes/retrieve_applicable_defense_reasons.json
274
273
  - spec/mocks/requests/Fund/account_holder_balance.json
275
274
  - spec/mocks/requests/Fund/account_holder_transaction_list.json
276
275
  - spec/mocks/requests/Fund/payout_account_holder.json
@@ -371,8 +370,8 @@ files:
371
370
  - spec/mocks/responses/Checkout/stored_payment_methods.json
372
371
  - spec/mocks/responses/Checkout/update-payment-link.json
373
372
  - spec/mocks/responses/Checkout/verify.json
374
- - spec/mocks/responses/DataProtectionService/request_subject_erasure.json
375
- - spec/mocks/responses/DisputesService/retrieve_applicable_defense_reasons.json
373
+ - spec/mocks/responses/DataProtection/request_subject_erasure.json
374
+ - spec/mocks/responses/Disputes/retrieve_applicable_defense_reasons.json
376
375
  - spec/mocks/responses/Fund/account_holder_balance.json
377
376
  - spec/mocks/responses/Fund/account_holder_transaction_list.json
378
377
  - spec/mocks/responses/Fund/payout_account_holder.json
@@ -382,6 +381,7 @@ files:
382
381
  - spec/mocks/responses/Fund/transfer_funds.json
383
382
  - spec/mocks/responses/Hop/get_onboarding_url.json
384
383
  - spec/mocks/responses/LegalEntityManagement/create_business_line.json
384
+ - spec/mocks/responses/LegalEntityManagement/get_legal_entity.json
385
385
  - spec/mocks/responses/Management/create_store.json
386
386
  - spec/mocks/responses/Management/get_companies.json
387
387
  - spec/mocks/responses/Notification/create_notification_configuration.json
data/Makefile DELETED
@@ -1,79 +0,0 @@
1
- generator:=ruby
2
- openapi-generator-version:=6.4.0
3
- openapi-generator-url:=https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/$(openapi-generator-version)/openapi-generator-cli-$(openapi-generator-version).jar
4
- openapi-generator-jar:=build/openapi-generator-cli.jar
5
- openapi-generator-cli:=java -jar build/openapi-generator-cli.jar
6
- output:=build/out
7
-
8
- services:=balancePlatform checkout legalEntityManagement management payout transfers
9
- singleFileServices:=balanceControlService binLookup dataProtection recurring storedValue payment posTerminalManagement disputes
10
-
11
- binLookup: spec=BinLookupService-v54
12
- checkout: spec=CheckoutService-v71
13
- dataProtection: spec=DataProtectionService-v1
14
- storedValue: spec=StoredValueService-v46
15
- posTerminalManagement: spec=TfmAPIService-v1
16
- payment: spec=PaymentService-v68
17
- recurring: spec=RecurringService-v68
18
- payout: spec=PayoutService-v68
19
- management: spec=ManagementService-v3
20
- legalEntityManagement: spec=LegalEntityService-v3
21
- balancePlatform: spec=BalancePlatformService-v2
22
- balanceControlService: spec=BalanceControlService-v1
23
- transfers: spec=TransferService-v4
24
- disputes: spec=DisputeService-v30
25
-
26
- allServices: $(services) $(singleFileServices)
27
-
28
- $(services): build/spec $(openapi-generator-jar)
29
- wget $(openapi-generator-url) -O build/openapi-generator-cli.jar
30
- rm -rf $(output)
31
- $(openapi-generator-cli) generate \
32
- -i build/spec/json/$(spec).json \
33
- -g $(generator) \
34
- -c ./templates/config.yaml \
35
- -o $(output) \
36
- --global-property apis,apiTests=false,apiDocs=false,supportingFiles=api-single.rb\
37
- --additional-properties serviceName=$@\
38
- --skip-validate-spec
39
- rm -f $(output)/lib/openapi_client/api/*-small.rb
40
- mkdir -p lib/adyen/services/$@
41
- mv $(output)/lib/openapi_client/api/*.rb lib/adyen/services/$@
42
- mv $(output)/api/api-single.rb lib/adyen/services/$@.rb
43
- rm -rf $(output)
44
-
45
- $(singleFileServices): build/spec
46
- wget $(openapi-generator-url) -O build/openapi-generator-cli.jar
47
- jq -e 'del(.paths[][].tags)' build/spec/json/$(spec).json > build/spec/json/$(spec).tmp
48
- mv build/spec/json/$(spec).tmp build/spec/json/$(spec).json
49
- rm -rf $(output)
50
- $(openapi-generator-cli) generate \
51
- -i build/spec/json/$(spec).json \
52
- -g $(generator) \
53
- -c ./templates/config.yaml \
54
- -o $(output) \
55
- --global-property apis,apiTests=false,apiDocs=false\
56
- --additional-properties serviceName=$@\
57
- --skip-validate-spec
58
- mv $(output)/lib/openapi_client/api/*-small.rb lib/adyen/services/$@.rb
59
- rm -rf $(output)
60
-
61
- templates: $(openapi-generator-jar)
62
- $(openapi-generator-cli) author template -g $(generator) -o build/templates
63
-
64
- # Download the generator
65
- $(openapi-generator-jar):
66
- wget --quiet -o /dev/null $(openapi-generator-url) -O $(openapi-generator-jar)
67
-
68
- build/spec:
69
- git clone https://github.com/Adyen/adyen-openapi.git build/spec
70
- perl -i -pe's/"openapi" : "3.[0-9].[0-9]"/"openapi" : "3.0.0"/' build/spec/json/*.json
71
-
72
- # Releases
73
-
74
- version:
75
- perl -lne 'print "currentVersion=$$1" if /(\d+\.\d+\.\d+)/' < lib/adyen/version.rb >> "$$GITHUB_OUTPUT"
76
-
77
- version_files:=lib/adyen/version.rb
78
- bump:
79
- perl -i -pe 's/$$ENV{"CURRENT_VERSION"}/$$ENV{"NEXT_VERSION"}/' $(version_files)