diff --git a/lib/adyen/client.rb b/lib/adyen/client.rb index b79e2f12..2c1224b4 100644 --- a/lib/adyen/client.rb +++ b/lib/adyen/client.rb @@ -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 @@ -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" diff --git a/spec/client_spec.rb b/spec/client_spec.rb index bdc761c4..074a9fac 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -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 diff --git a/spec/data_protection_spec.rb b/spec/data_protection_spec.rb index cb06abb7..f45ff77c 100644 --- a/spec/data_protection_spec.rb +++ b/spec/data_protection_spec.rb @@ -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) @@ -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 diff --git a/spec/disputes_spec.rb b/spec/disputes_spec.rb index ee2a001e..105e438d 100644 --- a/spec/disputes_spec.rb +++ b/spec/disputes_spec.rb @@ -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), @@ -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) diff --git a/spec/mocks/requests/DataProtectionService/request_subject_erasure.json b/spec/mocks/requests/DataProtection/request_subject_erasure.json similarity index 100% rename from spec/mocks/requests/DataProtectionService/request_subject_erasure.json rename to spec/mocks/requests/DataProtection/request_subject_erasure.json diff --git a/spec/mocks/requests/DisputesService/retrieve_applicable_defense_reasons.json b/spec/mocks/requests/Disputes/retrieve_applicable_defense_reasons.json similarity index 100% rename from spec/mocks/requests/DisputesService/retrieve_applicable_defense_reasons.json rename to spec/mocks/requests/Disputes/retrieve_applicable_defense_reasons.json diff --git a/spec/mocks/responses/DataProtectionService/request_subject_erasure.json b/spec/mocks/responses/DataProtection/request_subject_erasure.json similarity index 100% rename from spec/mocks/responses/DataProtectionService/request_subject_erasure.json rename to spec/mocks/responses/DataProtection/request_subject_erasure.json diff --git a/spec/mocks/responses/DisputesService/retrieve_applicable_defense_reasons.json b/spec/mocks/responses/Disputes/retrieve_applicable_defense_reasons.json similarity index 100% rename from spec/mocks/responses/DisputesService/retrieve_applicable_defense_reasons.json rename to spec/mocks/responses/Disputes/retrieve_applicable_defense_reasons.json