Corrected issue polulating custid,password. RT#1251268, RT#1268789
[trustcommerce.git] / CRM / Core / Payment / TrustCommerce.php
index 91011365e6c31bed4851a31e86cd390dbd0d8141..ac1f36bf434599d83790938aa824dc85e1b2e871 100644 (file)
@@ -96,13 +96,13 @@ class CRM_Core_Payment_TrustCommerce extends CRM_Core_Payment {
    * @static
    * @var string
    */
-  static protected $_mode = NULL;
+  protected $_mode = NULL;
   /**
    * The array of params cooked and passed to the TC API via tc_link().
    * @static
    * @var array
    */
-  static protected $_params = array();
+  protected $_params = array();
 
   /**
    * We only need one instance of this object. So we use the singleton
@@ -123,7 +123,7 @@ class CRM_Core_Payment_TrustCommerce extends CRM_Core_Payment {
    * @return void
    */
   function __construct($mode, &$paymentProcessor) {
-    self::$_mode = $mode;
+    $this->_mode = $mode;
 
     $this->_paymentProcessor = $paymentProcessor;
 
@@ -526,8 +526,10 @@ class CRM_Core_Payment_TrustCommerce extends CRM_Core_Payment {
       $amount = $this->_getParam('amount');
     }
     $fields = array();
-    $fields['custid'] = $this->_getParam('user_name');
-    $fields['password'] = $this->_getParam('password');
+
+    $fields['custid'] = $this->_paymentProcessor['user_name'];
+    $fields['password'] = $this->_paymentProcessor['password'];
+
     $fields['action'] = 'sale';
 
     // Enable address verification
@@ -554,7 +556,7 @@ class CRM_Core_Payment_TrustCommerce extends CRM_Core_Payment {
     $exp_year = substr($this->_getParam('year'),-2);
     $fields['exp'] = "$exp_month$exp_year";
 
-    if (self::$_mode != 'live') {
+    if ($this->_mode != 'live') {
       $fields['demo'] = 'y';
     }
     return $fields;
@@ -583,7 +585,11 @@ class CRM_Core_Payment_TrustCommerce extends CRM_Core_Payment {
    * not set
    */
   function _getParam($field) {
-    return CRM_Utils_Array::value($field, self::$_params, '');
+    $value = CRM_Utils_Array::value($field, $this->_params, '');
+    if ($xmlSafe) {
+      $value = str_replace(array('&', '"', "'", '<', '>'), '', $value);
+    }
+    return $value;
   }
 
   /**
@@ -619,7 +625,7 @@ class CRM_Core_Payment_TrustCommerce extends CRM_Core_Payment {
       return FALSE;
     }
     else {
-      self::$_params[$field] = $value;
+      $this->_params[$field] = $value;
     }
   }