From e055e8efc29b1440520001d1d893289d23dae510 Mon Sep 17 00:00:00 2001 From: Lisa Marie Maginnis Date: Mon, 19 May 2014 15:06:08 -0400 Subject: [PATCH] Added logger function --- trustcommerce.php | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/trustcommerce.php b/trustcommerce.php index 4651a9f..a15f3cc 100644 --- a/trustcommerce.php +++ b/trustcommerce.php @@ -121,7 +121,7 @@ class org_fsf_payment_trustcommerce extends CRM_Core_Payment { } /* Call the TC API, and grab the reply */ - $reply = tclink_send($tc_params); + $reply = $this->_getTCRequest($tc_params); /* Parse our reply */ $result = $this->_getTCReply($reply); @@ -142,6 +142,31 @@ class org_fsf_payment_trustcommerce extends CRM_Core_Payment { } } + function _sendTCRequest($request) { + $this->_logger($request); + return tclink_send($request); + } + + function _logger($params) { + foreach ($param as $key => $data) { + /* Delete any data we should not be writing to disk. This includes: + * custid, password, cc, exp, and cvv + */ + $data = ''; + switch($key) { + 'custid': + 'password': + 'cc': + 'exp': + 'cvv': + break; + default: + $data .= ' '.$key.' => '.$data; + } + } + error_log('TrustCommerce:'.$data) + } + /** * Gets the recurring billing fields for the TC API * @param array $fields The fields to modify. @@ -338,8 +363,8 @@ class org_fsf_payment_trustcommerce extends CRM_Core_Payment { $tc_params['password'] = $this->_getParam('password'); $tc_params['action'] = 'unstore'; $tc_params['billingid'] = CRM_Utils_Array::value('trxn_id', $params); - - $result = tclink_send($tc_params); + + $result = $this->_getTCRequest($tc_params); /* Test if call failed */ if(!$result) { -- 2.25.1