Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/adyen/services/payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ def initialize(client, version = DEFAULT_VERSION)
end

def modifications_api
@modifications_api ||= Adyen::ModificationsApi.new(@client, @version)
@modifications_api ||= Adyen::ClassicModificationsApi.new(@client, @version)
end

def payments_api
@payments_api ||= Adyen::PaymentsApi.new(@client, @version)
@payments_api ||= Adyen::ClassicPaymentsApi.new(@client, @version)
end

end
Expand Down
2 changes: 1 addition & 1 deletion lib/adyen/services/payment/modifications_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Adyen
# Ref: https://openapi-generator.tech
#
# Do not edit the class manually.
class ModificationsApi < Service
class ClassicModificationsApi < Service
attr_accessor :service, :version

def initialize(client, version = DEFAULT_VERSION)
Expand Down
2 changes: 1 addition & 1 deletion lib/adyen/services/payment/payments_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Adyen
# Ref: https://openapi-generator.tech
#
# Do not edit the class manually.
class PaymentsApi < Service
class ClassicPaymentsApi < Service
attr_accessor :service, :version

def initialize(client, version = DEFAULT_VERSION)
Expand Down
13 changes: 13 additions & 0 deletions spec/checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
service: 'Checkout'
}
end

it 'uses the correct PaymentsApi for the Checkout service' do
# Load both API files to ensure there's no conflict after the fix.
load File.expand_path('../lib/adyen/services/payment/payments_api.rb', __dir__)
load File.expand_path('../lib/adyen/services/checkout/payments_api.rb', __dir__)

checkout = Adyen::Checkout.new(@shared_values[:client])
payments_api = checkout.payments_api

# Verify that the Checkout facade uses the correct PaymentsApi class.
expect(payments_api.class.name).to eq('Adyen::PaymentsApi')
expect(payments_api.service).to eq('Checkout')
end

# must be created manually because every field in the response is an array
it 'makes a payment_methods call' do
Expand Down
2 changes: 1 addition & 1 deletion templates/api-single.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module Adyen
{{#apiInfo}}
{{#apis}}
def {{classFilename}}
@{{classFilename}} ||= Adyen::{{classname}}.new(@client, @version)
@{{classFilename}} ||= Adyen::{{classicPrefix}}{{classname}}.new(@client, @version)
end

{{/apis}}
Expand Down
2 changes: 1 addition & 1 deletion templates/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Adyen
# Ref: https://openapi-generator.tech
#
# Do not edit the class manually.
class {{classname}} < Service
class {{classicPrefix}}{{classname}} < Service
attr_accessor :service, :version

def initialize(client, version = DEFAULT_VERSION)
Expand Down