Skip to content
Merged
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
9 changes: 5 additions & 4 deletions lib/adyen/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ def live_url_prefix=(value)

# base URL for API given service and @env
def service_url_base(service)
# maps 'Disputes' to expected service name 'DisputesService' for URL matching
service = 'DisputesService' if service == 'Disputes'
if @env == :mock
@mock_service_url_base
else
Expand All @@ -82,8 +80,11 @@ def service_url_base(service)
when 'PosTerminalManagement'
url = "https://postfmapi-#{@env}.adyen.com/postfmapi/terminal"
supports_live_url_prefix = false
when 'DataProtectionService', 'DisputesService'
url = "https://ca-#{@env}.adyen.com/ca/services/#{service}"
when 'Disputes'
url = "https://ca-#{@env}.adyen.com/ca/services/DisputeService"
supports_live_url_prefix = false
when 'DataProtection'
url = "https://ca-#{@env}.adyen.com/ca/services/DataProtectionService"
supports_live_url_prefix = false
when 'LegalEntityManagement'
url = "https://kyc-#{@env}.adyen.com/lem"
Expand Down
8 changes: 7 additions & 1 deletion spec/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,13 @@
it 'correctly maps Disputes to DisputesService and generates valid URL' do
client = Adyen::Client.new(env: :test)
expect(client.service_url_base('Disputes'))
.to eq('https://ca-test.adyen.com/ca/services/DisputesService')
.to eq('https://ca-test.adyen.com/ca/services/DisputeService')
end

it 'checks the creation of DataProtection url' do
client = Adyen::Client.new(env: :test)
expect(client.service_url_base('DataProtection'))
.to eq('https://ca-test.adyen.com/ca/services/DataProtectionService')
end

it 'checks the creation of SessionAuthentication url for the test env' do
Expand Down
4 changes: 2 additions & 2 deletions spec/data_protection_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

RSpec.describe Adyen::DataProtection, service: 'Data Protection Service' do
RSpec.describe Adyen::DataProtection, service: 'DataProtection' do
# client instance to be used in dynamically generated tests
client = create_client(:basic)

Expand All @@ -10,5 +10,5 @@
%w[request_subject_erasure result SUCCESS]
]

generate_tests(client, 'DataProtectionService', test_sets, client.data_protection.data_protection_api)
generate_tests(client, 'DataProtection', test_sets, client.data_protection.data_protection_api)
end
6 changes: 3 additions & 3 deletions spec/disputes_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

RSpec.describe Adyen::Disputes, service: 'disputes service' do
RSpec.describe Adyen::Disputes, service: 'Disputes' do
before(:all) do
@shared_values = {
client: create_client(:api_key),
Expand All @@ -11,9 +11,9 @@
# methods / values to test for
# format is defined in spec_helper
it 'makes a retrieve_applicable_defense_reasons call' do
request_body = JSON.parse(json_from_file('mocks/requests/DisputesService/retrieve_applicable_defense_reasons.json'))
request_body = JSON.parse(json_from_file('mocks/requests/Disputes/retrieve_applicable_defense_reasons.json'))

response_body = json_from_file('mocks/responses/DisputesService/retrieve_applicable_defense_reasons.json')
response_body = json_from_file('mocks/responses/Disputes/retrieve_applicable_defense_reasons.json')

url = @shared_values[:client].service_url(@shared_values[:service], 'retrieveApplicableDefenseReasons',
@shared_values[:client].disputes.version)
Expand Down