Remove instances of fatal
[civicrm-core.git] / CRM / Core / Payment / PayflowPro.php
index 2fcdf724084bed9138a4353755af8aef66ea2609..1d4b92c5e96ce64fb9fad1c3c35985c721dcc6b7 100644 (file)
@@ -44,6 +44,7 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
    * the processor. It is the main function for processing on-server
    * credit card transactions
    */
+
   /**
    * This function collects all the information from a web/api form and invokes
    * the relevant payment processor specific functions to perform the transaction
@@ -89,7 +90,7 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
      *
      */
 
-    $payflow_query_array = array(
+    $payflow_query_array = [
       'USER' => $user,
       'VENDOR' => $this->_paymentProcessor['user_name'],
       'PARTNER' => $this->_paymentProcessor['signature'],
@@ -121,7 +122,7 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
       'ORDERDESC' => urlencode($params['description']),
       'VERBOSITY' => 'MEDIUM',
       'BILLTOCOUNTRY' => urlencode($params['country']),
-    );
+    ];
 
     if ($params['installments'] == 1) {
       $params['is_recur'] = FALSE;
@@ -272,7 +273,7 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
       return self::errorExit(9016, "No RESULT code from PayPal.");
     }
 
-    $nvpArray = array();
+    $nvpArray = [];
     while (strlen($result)) {
       // name
       $keypos = strpos($result, '=');
@@ -363,7 +364,6 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
     return $e;
   }
 
-
   /**
    * NOTE: 'doTransferCheckout' not implemented
    *
@@ -386,13 +386,13 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
    *   the error message if any, null if OK
    */
   public function checkConfig() {
-    $errorMsg = array();
+    $errorMsg = [];
     if (empty($this->_paymentProcessor['user_name'])) {
       $errorMsg[] = ' ' . ts('ssl_merchant_id is not set for this payment processor');
     }
 
     if (empty($this->_paymentProcessor['url_site'])) {
-      $errorMsg[] = ' ' . ts('URL is not set for %1', array(1 => $this->_paymentProcessor['name']));
+      $errorMsg[] = ' ' . ts('URL is not set for %1', [1 => $this->_paymentProcessor['name']]);
     }
 
     if (!empty($errorMsg)) {
@@ -567,85 +567,4 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
     return $responseData;
   }
 
-  /**
-   * @param int $recurringProfileID
-   * @param int $processorID
-   *
-   * @throws Exception
-   */
-  public function getRecurringTransactionStatus($recurringProfileID, $processorID) {
-    if (!defined('CURLOPT_SSLCERT')) {
-      CRM_Core_Error::fatal(ts('Payflow Pro requires curl with SSL support'));
-    }
-
-    /*
-     * define variables for connecting with the gateway
-     */
-
-    //if you have not set up a separate user account the vendor name is used as the username
-    if (!$this->_paymentProcessor['subject']) {
-      $user = $this->_paymentProcessor['user_name'];
-    }
-    else {
-      $user = $this->_paymentProcessor['subject'];
-    }
-    //$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
-     *
-     */
-
-    $payflow_query_array = array(
-      'USER' => $user,
-      'VENDOR' => $this->_paymentProcessor['user_name'],
-      'PARTNER' => $this->_paymentProcessor['signature'],
-      'PWD' => $this->_paymentProcessor['password'],
-      // C - Direct Payment using credit card
-      'TENDER' => 'C',
-      // A - Authorization, S - Sale
-      'TRXTYPE' => 'R',
-      'ACTION' => 'I',
-      //A for add recurring
-      //(M-modify,C-cancel,R-reactivate,
-      //I-inquiry,P-payment
-      'ORIGPROFILEID' => $recurringProfileID,
-      'PAYMENTHISTORY' => 'Y',
-    );
-
-    $payflow_query = $this->convert_to_nvp($payflow_query_array);
-    echo $payflow_query;
-    $submiturl = $this->_paymentProcessor['url_site'];
-    //ie. url at payment processor to submit to.
-    $responseData = self::submit_transaction($submiturl, $payflow_query);
-    /*
-     * Payment successfully sent to gateway - process the response now
-     */
-
-    $result = strstr($responseData, "RESULT");
-    $nvpArray = array();
-    while (strlen($result)) {
-      // name
-      $keypos = strpos($result, '=');
-      $keyval = substr($result, 0, $keypos);
-      // value
-      $valuepos = strpos($result, '&') ? strpos($result, '&') : strlen($result);
-      $valval = substr($result, $keypos + 1, $valuepos - $keypos - 1);
-      // decoding the respose
-      $nvpArray[$keyval] = $valval;
-      $result = substr($result, $valuepos + 1, strlen($result));
-    }
-
-    // @TODO Function is named getRecurringTransactionStatus() which
-    // suggests it returns a result. It sets a $result_code but doesn't return
-    // it, printing output instead?
-    $result_code = $nvpArray['RESULT'];
-    print_r($responseData);
-
-    //RESPMSG=Invalid Profile ID: Invalid recurring profile ID
-    //RT0000000001
-  }
-
 }