Skip to content
Browse files

Turn off Savon logging when gateway's logger is nil, which is the def…

…ault in ActiveMerchant
  • Loading branch information...
1 parent ff8f8a4 commit 3d946e41f797b188c7c34288c8b092b642c44be2 @samleb samleb committed
Showing with 12 additions and 2 deletions.
  1. +12 −2 lib/active_merchant/billing/gateways/payline.rb
View
14 lib/active_merchant/billing/gateways/payline.rb
@@ -21,6 +21,8 @@ class Payline < Gateway
IMPL_NAMESPACE = 'http://impl.ws.payline.experian.com'.freeze
OBJ_NAMESPACE = 'http://obj.ws.payline.experian.com'.freeze
+ LOG_FILTERED_TAGS = %w( number cvx ).freeze
+
DATE_FORMAT = "%d/%m/%Y %H:%M".freeze
EXPIRATION_DATE_FORMAT = "%.2d%.2d".freeze
@@ -97,14 +99,22 @@ def request(method_name)
def savon_client
@savon_client ||= Savon.client do
config.raise_errors = false
- config.logger = self.logger
- config.logger.filter << "number" << "cvx"
+ configure_logger(config)
wsdl.namespace = IMPL_NAMESPACE
wsdl.endpoint = test? ? test_url : live_url
http.headers["Authorization"] = basic_authentication_header
end
end
+ def configure_logger(config)
+ if logger
+ config.logger = logger
+ config.logger.filter.push(*LOG_FILTERED_TAGS)
+ else
+ config.log = false
+ end
+ end
+
def basic_authentication_header
string = [options[:merchant_id], options[:merchant_access_key]].join(':')
"Basic #{strict_encode64(string)}"

0 comments on commit 3d946e4

Please sign in to comment.
Something went wrong with that request. Please try again.