Skip to content

Commit d329696

Browse files
authored
Merge pull request #326 from Adyen/use-classic-prefix
Add prefix for Classic Payments
2 parents 8f23adf + c7ffb12 commit d329696

File tree

6 files changed

+19
-6
lines changed

6 files changed

+19
-6
lines changed

lib/adyen/services/payment.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ def initialize(client, version = DEFAULT_VERSION)
1818
end
1919

2020
def modifications_api
21-
@modifications_api ||= Adyen::ModificationsApi.new(@client, @version)
21+
@modifications_api ||= Adyen::ClassicModificationsApi.new(@client, @version)
2222
end
2323

2424
def payments_api
25-
@payments_api ||= Adyen::PaymentsApi.new(@client, @version)
25+
@payments_api ||= Adyen::ClassicPaymentsApi.new(@client, @version)
2626
end
2727

2828
end

lib/adyen/services/payment/modifications_api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Adyen
55
# Ref: https://openapi-generator.tech
66
#
77
# Do not edit the class manually.
8-
class ModificationsApi < Service
8+
class ClassicModificationsApi < Service
99
attr_accessor :service, :version
1010

1111
def initialize(client, version = DEFAULT_VERSION)

lib/adyen/services/payment/payments_api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Adyen
55
# Ref: https://openapi-generator.tech
66
#
77
# Do not edit the class manually.
8-
class PaymentsApi < Service
8+
class ClassicPaymentsApi < Service
99
attr_accessor :service, :version
1010

1111
def initialize(client, version = DEFAULT_VERSION)

spec/checkout_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88
service: 'Checkout'
99
}
1010
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
1124

1225
# must be created manually because every field in the response is an array
1326
it 'makes a payment_methods call' do

templates/api-single.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module Adyen
2323
{{#apiInfo}}
2424
{{#apis}}
2525
def {{classFilename}}
26-
@{{classFilename}} ||= Adyen::{{classname}}.new(@client, @version)
26+
@{{classFilename}} ||= Adyen::{{classicPrefix}}{{classname}}.new(@client, @version)
2727
end
2828

2929
{{/apis}}

templates/api.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Adyen
66
# Ref: https://openapi-generator.tech
77
#
88
# Do not edit the class manually.
9-
class {{classname}} < Service
9+
class {{classicPrefix}}{{classname}} < Service
1010
attr_accessor :service, :version
1111

1212
def initialize(client, version = DEFAULT_VERSION)

0 commit comments

Comments
 (0)