Merge pull request #6269 from yashodha/CRM-15564
[civicrm-core.git] / CRM / Core / Payment / PayflowPro.php
index 0ecaa28ba7874d25fafa0e1205fdac7c2e18e890..c50c11d44a4fb2ea436fbfbb124fe93ae709700b 100644 (file)
 class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
   // (not used, implicit in the API, might need to convert?)
   const
-  CHARSET = 'UFT-8';
+    CHARSET = 'UFT-8';
 
   /**
    * We only need one instance of this object. So we use the singleton
    * pattern and cache the instance in this variable
    *
    * @var object
-   * @static
    */
   static private $_singleton = NULL;
 
@@ -45,31 +44,6 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
     $this->_processorName = ts('Payflow Pro');
   }
 
-  /**
-   * Singleton function used to manage this object
-   *
-   * @param string $mode
-   *   The mode of operation: live or test.
-   *
-   * @param object $paymentProcessor
-   *
-   * @return object
-   * @static
-   */
-   public static function &singleton($mode, &$paymentProcessor) {
-     if (!empty($paymentProcessor['id'])) {
-       $cacheKey = $paymentProcessor['id'];
-     }
-     else {
-       //@todo eliminated instances of this in favour of id-specific instances.
-       $cacheKey = $mode . '_' . $paymentProcessor['name'];
-     }
-    if (self::$_singleton[$cacheKey] === NULL) {
-      self::$_singleton[$cacheKey] = new CRM_Core_Payment_PayflowPro($mode, $paymentProcessor);
-    }
-    return self::$_singleton[$cacheKey];
-   }
-
   /*
    * This function  sends request and receives response from
    * the processor. It is the main function for processing on-server
@@ -82,7 +56,8 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
    * @param array $params
    *   Assoc array of input parameters for this transaction.
    *
-   * @return array the result in an nice formatted array (or an error object)
+   * @return array
+   *   the result in an nice formatted array (or an error object)
    * @abstract
    */
   public function doDirectPayment(&$params) {
@@ -313,16 +288,16 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
     // get the result code to validate.
     $result_code = $nvpArray['RESULT'];
     /*debug
-      echo "<p>Params array</p><br>";
-      print_r($params);
-      echo "<p></p><br>";
-      echo "<p>Values to Payment Processor</p><br>";
-      print_r($payflow_query_array);
-      echo "<p></p><br>";
-      echo "<p>Results from Payment Processor</p><br>";
-      print_r($nvpArray);
-      echo "<p></p><br>";
-    */
+    echo "<p>Params array</p><br>";
+    print_r($params);
+    echo "<p></p><br>";
+    echo "<p>Values to Payment Processor</p><br>";
+    print_r($payflow_query_array);
+    echo "<p></p><br>";
+    echo "<p>Results from Payment Processor</p><br>";
+    print_r($nvpArray);
+    echo "<p></p><br>";
+     */
 
     switch ($result_code) {
       case 0:
@@ -334,7 +309,6 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
          * the cvv check, the avs check. This is stored in
          * CiviCRM as part of the transact
          * but not further processing is done. Business rules would need to be defined
-
          *******************************************************/
         $params['trxn_id'] = $nvpArray['PNREF'] . $nvpArray['TRXPNREF'];
         //'trxn_id' is varchar(255) field. returned value is length 12
@@ -372,12 +346,13 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
   }
 
   /**
-   * Checks to see if invoice_id already exists in db
+   * Checks to see if invoice_id already exists in db.
    *
    * @param int $invoiceId
    *   The ID to check.
    *
-   * @return bool                  True if ID exists, else false
+   * @return bool
+   *   True if ID exists, else false
    */
   public function _checkDupe($invoiceId) {
     //copied from Eway but not working and not really sure it should!
@@ -430,18 +405,18 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
    *   The mode we are operating in (live or test) - not used.
    *
    * returns string $errorMsg if any errors found - null if OK
-   *
    */
 
   //  function checkConfig( $mode )          // CiviCRM V1.9 Declaration
 
-  // CiviCRM V2.0 Declaration
   /**
+   * CiviCRM V2.0 Declaration
    * This function checks to see if we have the right config values
    *
    * @internal param string $mode the mode we are operating in (live or test)
    *
-   * @return string the error message if any
+   * @return string
+   *   the error message if any
    */
   public function checkConfig() {
     $errorMsg = array();
@@ -483,7 +458,6 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
    * Submit transaction using CuRL
    * @submiturl string Url to direct HTTPS GET to
    * @payflow_query value string to be posted
-   *
    */
   /**
    * @param $submiturl
@@ -710,4 +684,5 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
     //RESPMSG=Invalid Profile ID: Invalid recurring profile ID
     //RT0000000001
   }
+
 }