Added logger function
authorLisa Marie Maginnis <lisam@fsf.org>
Mon, 19 May 2014 19:06:08 +0000 (15:06 -0400)
committerLisa Marie Maginnis <lisam@fsf.org>
Mon, 19 May 2014 19:06:08 +0000 (15:06 -0400)
trustcommerce.php

index 4651a9f91fb72db826e186063173892c115e744b..a15f3cc58f33bd31c2afb5a83261c32d7791dafa 100644 (file)
@@ -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) {