Skip to content

feat: add support for terminal region #256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
11 changes: 8 additions & 3 deletions lib/adyen/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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'
Expand Down
Loading