From 7c27f2db5739cd508c2181f8160fdb0ebe7fe4c0 Mon Sep 17 00:00:00 2001 From: Dr Nic Williams Date: Mon, 21 Jul 2025 16:17:52 +1000 Subject: [PATCH 1/3] Support Adyen::Client.new(logger: Logger.new($stdout)) --- lib/adyen/client.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/adyen/client.rb b/lib/adyen/client.rb index cde5468..b6c7a37 100644 --- a/lib/adyen/client.rb +++ b/lib/adyen/client.rb @@ -12,11 +12,12 @@ module Adyen class Client - attr_accessor :ws_user, :ws_password, :api_key, :oauth_token, :client, :adapter + attr_accessor :ws_user, :ws_password, :api_key, :oauth_token, :client, :adapter, :logger 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, terminal_region: nil) + logger: 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 @@ -32,6 +33,7 @@ def initialize(ws_user: nil, ws_password: nil, api_key: nil, oauth_token: nil, e end @mock_service_url_base = mock_service_url_base || "http://localhost:#{mock_port}" @live_url_prefix = live_url_prefix + @logger = logger if RUBY_VERSION >= '3.2' # set default timeouts @connection_options = connection_options || Faraday::ConnectionOptions.new( @@ -162,6 +164,10 @@ def call_adyen_api(service, action, request_data, headers, version, _with_applic # add library headers faraday.headers['adyen-library-name'] = Adyen::NAME faraday.headers['adyen-library-version'] = Adyen::VERSION + + if @logger + faraday.response :logger, @logger, bodies: true + end end # if json string convert to hash # needed to add applicationInfo From 63a9c8baad64c351938664fe9fc0b0523a9f3655 Mon Sep 17 00:00:00 2001 From: Dr Nic Williams Date: Sat, 26 Jul 2025 07:22:31 +1000 Subject: [PATCH 2/3] Drop body logging --- lib/adyen/client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adyen/client.rb b/lib/adyen/client.rb index b6c7a37..657b3ae 100644 --- a/lib/adyen/client.rb +++ b/lib/adyen/client.rb @@ -166,7 +166,7 @@ def call_adyen_api(service, action, request_data, headers, version, _with_applic faraday.headers['adyen-library-version'] = Adyen::VERSION if @logger - faraday.response :logger, @logger, bodies: true + faraday.response :logger, @logger end end # if json string convert to hash From 839d9cfbbf4efffc4c956d93949bc569124124c3 Mon Sep 17 00:00:00 2001 From: Beppe Catanese <1771700+gcatanese@users.noreply.github.com> Date: Mon, 6 Oct 2025 11:55:31 +0200 Subject: [PATCH 3/3] Update lib/adyen/client.rb Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- lib/adyen/client.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/adyen/client.rb b/lib/adyen/client.rb index 657b3ae..b8107cf 100644 --- a/lib/adyen/client.rb +++ b/lib/adyen/client.rb @@ -166,6 +166,7 @@ def call_adyen_api(service, action, request_data, headers, version, _with_applic faraday.headers['adyen-library-version'] = Adyen::VERSION if @logger + # Configures Faraday's response logger middleware to log HTTP requests and responses when a logger is provided. faraday.response :logger, @logger end end