INFRA-132 - Docblock formatting fixes
[civicrm-core.git] / CRM / Core / Payment / PayflowPro.php
index e103f278c10b70bd8b16477915e253b17ebeb888..c62d3b0b14a400520958e5c25f38e145a9a65e5b 100644 (file)
@@ -15,7 +15,7 @@
 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
@@ -45,31 +45,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 +57,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) {
@@ -202,8 +178,7 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
 
         case '2 weeks':
           $params['next_sched_contribution_date'] = mktime(0, 0, 0, date("m"), date("d") + 14, date("Y"));
-          $params['end_date'] = mktime(0, 0, 0, date("m"), date("d") + (14 * $payflow_query_array['TERM'])
-            , date("Y ")
+          $params['end_date'] = mktime(0, 0, 0, date("m"), date("d") + (14 * $payflow_query_array['TERM']), date("Y ")
           );
           $payflow_query_array['START'] = date('mdY', $params['next_sched_contribution_date']);
           $payflow_query_array['PAYPERIOD'] = "BIWK";
@@ -214,8 +189,7 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
         case '4 weeks':
           $params['next_sched_contribution_date'] = mktime(0, 0, 0, date("m"), date("d") + 28, date("Y")
           );
-          $params['end_date'] = mktime(0, 0, 0, date("m"), date("d") + (28 * $payflow_query_array['TERM'])
-            , date("Y")
+          $params['end_date'] = mktime(0, 0, 0, date("m"), date("d") + (28 * $payflow_query_array['TERM']), date("Y")
           );
           $payflow_query_array['START'] = date('mdY', $params['next_sched_contribution_date']);
           $payflow_query_array['PAYPERIOD'] = "FRWK";
@@ -238,8 +212,7 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
           break;
 
         case '3 months':
-          $params['next_sched_contribution_date'] = mktime(0, 0, 0, date("m") + 3, date("d")
-            , date("Y")
+          $params['next_sched_contribution_date'] = mktime(0, 0, 0, date("m") + 3, date("d"), date("Y")
           );
           $params['end_date'] = mktime(0, 0, 0, date("m") +
             (3 * $payflow_query_array['TERM']),
@@ -259,8 +232,7 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
             (6 * $payflow_query_array['TERM']),
             date("d"), date("Y")
           );
-          $payflow_query_array['START'] = date('mdY', $params['next_sched_contribution_date'
-            ]
+          $payflow_query_array['START'] = date('mdY', $params['next_sched_contribution_date']
           );
           $payflow_query_array['PAYPERIOD'] = "SMYR";
           $params['frequency_unit'] = "month";
@@ -338,7 +310,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
@@ -381,7 +352,8 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
    * @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!
@@ -434,18 +406,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();
@@ -487,7 +459,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
@@ -589,12 +560,14 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
       $errorDesc = curl_error($ch);
 
       //Paranoia - in the unlikley event that 'curl' errno fails
-      if ($errorNum == 0)
-      $errorNum = 9005;
+      if ($errorNum == 0) {
+        $errorNum = 9005;
+      }
 
       // Paranoia - in the unlikley event that 'curl' error fails
-      if (strlen($errorDesc) == 0)
-      $errorDesc = "Connection to payment gateway failed";
+      if (strlen($errorDesc) == 0) {
+        $errorDesc = "Connection to payment gateway failed";
+      }
       if ($errorNum = 60) {
         return self::errorExit($errorNum, "Curl error - " . $errorDesc .
           " Try this link for more information http://curl.haxx.se/d
@@ -660,7 +633,6 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
     //$recurringProfileID = "RT0000000001";
     //     c  $trythis =        $this->getRecurringTransactionStatus($recurringProfileID,17);
 
-
     /*
      *Create the array of variables to be sent to the processor from the $params array
      * passed into this function