Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion lib/adyen/services/recurring.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(client, version = DEFAULT_VERSION)
end

def recurring_api
@recurring_api ||= Adyen::RecurringApi.new(@client, @version)
@recurring_api ||= Adyen::LegacyRecurringApi.new(@client, @version)
end

end
Expand Down
2 changes: 1 addition & 1 deletion lib/adyen/services/recurring/recurring_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 RecurringApi < Service
class LegacyRecurringApi < Service
attr_accessor :service, :version

def initialize(client, version = DEFAULT_VERSION)
Expand Down
44 changes: 44 additions & 0 deletions spec/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,42 @@
@shared_values[:client].api_key = 'api_key'
end

it 'is Checkout service when using checkout.payments_api' do
client = Adyen::Client.new(env: :mock, mock_service_url_base: 'https://mock.test')

Check failure on line 47 in spec/client_spec.rb

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "https://mock.test" 8 times.

See more on https://sonarcloud.io/project/issues?id=Adyen_adyen-ruby-api-library&issues=AZsDNzmRQNPNOZ9aZjq3&open=AZsDNzmRQNPNOZ9aZjq3&pullRequest=331
expect(client.checkout.payments_api.service)
.to eq('Checkout')
end

it 'is Checkout service when using checkout.recurring_api' do
client = Adyen::Client.new(env: :mock, mock_service_url_base: 'https://mock.test')
expect(client.checkout.recurring_api.service)
.to eq('Checkout')
end

it 'is Recurring service when using recurring.recurring_api' do
client = Adyen::Client.new(env: :mock, mock_service_url_base: 'https://mock.test')
expect(client.recurring.recurring_api.service)
.to eq('Recurring')
end

it 'is Payment service when using payment.payments_api' do
client = Adyen::Client.new(env: :mock, mock_service_url_base: 'https://mock.test')
expect(client.payment.payments_api.service)
.to eq('Payment')
end

it 'is Payment service when using payment.modifications_api' do
client = Adyen::Client.new(env: :mock, mock_service_url_base: 'https://mock.test')
expect(client.payment.modifications_api.service)
.to eq('Payment')
end

it 'is Payout service when using payout.instant_payouts_api' do
client = Adyen::Client.new(env: :mock, mock_service_url_base: 'https://mock.test')
expect(client.payout.instant_payouts_api.service)
.to eq('Payout')
end

it 'uses the specified mock service URL' do
client = Adyen::Client.new(env: :mock, mock_service_url_base: 'https://mock.test')
expect(client.service_url_base('Account'))
Expand Down Expand Up @@ -206,6 +242,7 @@
expect(client.service_url('Checkout', 'paymentMethods', '70'))
.to eq('https://YourLiveUrlPrefix-checkout-live.adyenpayments.com/checkout/v70/paymentMethods')
end

it 'checks the creation of lem url' do
client = Adyen::Client.new(api_key: 'api_key', env: :live)
expect(client.service_url('LegalEntityManagement', 'businessLines', '3'))
Expand Down Expand Up @@ -321,6 +358,13 @@
.to eq('https://authe-live.adyen.com/authe/api')
end

it 'checks the creation of Recurring API url for the test env' do
client = Adyen::Client.new(env: :test)
expect(client.service_url_base('Recurring'))
.to eq('https://pal-test.adyen.com/pal/servlet/Recurring')
end


it 'raises FormatError on 400 response and checks content' do
client = Adyen::Client.new(api_key: 'api_key', env: :test)
mock_faraday_connection = double(Faraday::Connection)
Expand Down