Skip to content

Commit b9f27a5

Browse files
authored
Merge pull request #328 from Adyen/323-disputes-service-url
Fix: Disputes Service URL
2 parents d329696 + 1385f0d commit b9f27a5

File tree

8 files changed

+17
-10
lines changed

8 files changed

+17
-10
lines changed

lib/adyen/client.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ def live_url_prefix=(value)
6464

6565
# base URL for API given service and @env
6666
def service_url_base(service)
67-
# maps 'Disputes' to expected service name 'DisputesService' for URL matching
68-
service = 'DisputesService' if service == 'Disputes'
6967
if @env == :mock
7068
@mock_service_url_base
7169
else
@@ -82,8 +80,11 @@ def service_url_base(service)
8280
when 'PosTerminalManagement'
8381
url = "https://postfmapi-#{@env}.adyen.com/postfmapi/terminal"
8482
supports_live_url_prefix = false
85-
when 'DataProtectionService', 'DisputesService'
86-
url = "https://ca-#{@env}.adyen.com/ca/services/#{service}"
83+
when 'Disputes'
84+
url = "https://ca-#{@env}.adyen.com/ca/services/DisputeService"
85+
supports_live_url_prefix = false
86+
when 'DataProtection'
87+
url = "https://ca-#{@env}.adyen.com/ca/services/DataProtectionService"
8788
supports_live_url_prefix = false
8889
when 'LegalEntityManagement'
8990
url = "https://kyc-#{@env}.adyen.com/lem"

spec/client_spec.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,13 @@
300300
it 'correctly maps Disputes to DisputesService and generates valid URL' do
301301
client = Adyen::Client.new(env: :test)
302302
expect(client.service_url_base('Disputes'))
303-
.to eq('https://ca-test.adyen.com/ca/services/DisputesService')
303+
.to eq('https://ca-test.adyen.com/ca/services/DisputeService')
304+
end
305+
306+
it 'checks the creation of DataProtection url' do
307+
client = Adyen::Client.new(env: :test)
308+
expect(client.service_url_base('DataProtection'))
309+
.to eq('https://ca-test.adyen.com/ca/services/DataProtectionService')
304310
end
305311

306312
it 'checks the creation of SessionAuthentication url for the test env' do

spec/data_protection_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

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

@@ -10,5 +10,5 @@
1010
%w[request_subject_erasure result SUCCESS]
1111
]
1212

13-
generate_tests(client, 'DataProtectionService', test_sets, client.data_protection.data_protection_api)
13+
generate_tests(client, 'DataProtection', test_sets, client.data_protection.data_protection_api)
1414
end

spec/disputes_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

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

16-
response_body = json_from_file('mocks/responses/DisputesService/retrieve_applicable_defense_reasons.json')
16+
response_body = json_from_file('mocks/responses/Disputes/retrieve_applicable_defense_reasons.json')
1717

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

0 commit comments

Comments
 (0)