13
13
module Adyen
14
14
class Client
15
15
attr_accessor :ws_user , :ws_password , :api_key , :oauth_token , :client , :adapter
16
- attr_reader :env , :connection_options , :adapter_options
16
+ attr_reader :env , :connection_options , :adapter_options , :terminal_region
17
17
18
18
def initialize ( ws_user : nil , ws_password : nil , api_key : nil , oauth_token : nil , env : :live , adapter : nil , mock_port : 3001 ,
19
- live_url_prefix : nil , mock_service_url_base : nil , connection_options : nil , adapter_options : nil )
19
+ live_url_prefix : nil , mock_service_url_base : nil , connection_options : nil , adapter_options : nil , terminal_region : nil )
20
20
@ws_user = ws_user
21
21
@ws_password = ws_password
22
22
@api_key = api_key
@@ -33,6 +33,7 @@ def initialize(ws_user: nil, ws_password: nil, api_key: nil, oauth_token: nil, e
33
33
@mock_service_url_base = mock_service_url_base || "http://localhost:#{ mock_port } "
34
34
@live_url_prefix = live_url_prefix
35
35
@connection_options = connection_options || Faraday ::ConnectionOptions . new
36
+ @terminal_region = terminal_region
36
37
end
37
38
38
39
# make sure that env can only be :live, :test, or :mock
@@ -84,7 +85,11 @@ def service_url_base(service)
84
85
url = "https://management-#{ @env } .adyen.com"
85
86
supports_live_url_prefix = false
86
87
when 'TerminalCloudAPI'
87
- url = "https://terminal-api-#{ @env } .adyen.com"
88
+ url = if !terminal_region . nil?
89
+ "https://terminal-api-#{ @env } -#{ terminal_region } .adyen.com"
90
+ else
91
+ "https://terminal-api-#{ @env } .adyen.com"
92
+ end
88
93
supports_live_url_prefix = false
89
94
else
90
95
raise ArgumentError , 'Invalid service specified'
0 commit comments