diff --git a/lib/adyen/client.rb b/lib/adyen/client.rb index ddc538e6..d11f0efd 100644 --- a/lib/adyen/client.rb +++ b/lib/adyen/client.rb @@ -13,10 +13,10 @@ module Adyen class Client attr_accessor :ws_user, :ws_password, :api_key, :oauth_token, :client, :adapter - attr_reader :env, :connection_options, :adapter_options + attr_reader :env, :connection_options, :adapter_options, :terminal_region def initialize(ws_user: nil, ws_password: nil, api_key: nil, oauth_token: nil, env: :live, adapter: nil, mock_port: 3001, - live_url_prefix: nil, mock_service_url_base: nil, connection_options: nil, adapter_options: nil) + live_url_prefix: nil, mock_service_url_base: nil, connection_options: nil, adapter_options: nil, terminal_region: nil) @ws_user = ws_user @ws_password = ws_password @api_key = api_key @@ -33,6 +33,7 @@ def initialize(ws_user: nil, ws_password: nil, api_key: nil, oauth_token: nil, e @mock_service_url_base = mock_service_url_base || "http://localhost:#{mock_port}" @live_url_prefix = live_url_prefix @connection_options = connection_options || Faraday::ConnectionOptions.new + @terminal_region = terminal_region end # make sure that env can only be :live, :test, or :mock @@ -84,7 +85,11 @@ def service_url_base(service) url = "https://management-#{@env}.adyen.com" supports_live_url_prefix = false when 'TerminalCloudAPI' - url = "https://terminal-api-#{@env}.adyen.com" + url = if !terminal_region.nil? + "https://terminal-api-#{@env}-#{terminal_region}.adyen.com" + else + "https://terminal-api-#{@env}.adyen.com" + end supports_live_url_prefix = false else raise ArgumentError, 'Invalid service specified'