X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FPayment%2FFirstData.php;h=089838d49e7cea29ad90b0fdf5b83f68a797ad67;hb=266a559f66f8242321969f8181b9c0f8c1ef5799;hp=87ce7263c4d2e1c4d0766ea6231da903091a33eb;hpb=e3a363809875b227257e2247d43ed96115817c65;p=civicrm-core.git diff --git a/CRM/Core/Payment/FirstData.php b/CRM/Core/Payment/FirstData.php index 87ce7263c4..089838d49e 100644 --- a/CRM/Core/Payment/FirstData.php +++ b/CRM/Core/Payment/FirstData.php @@ -1,7 +1,7 @@ _mode = $mode; $this->_paymentProcessor = $paymentProcessor; } /** - * singleton function used to manage this object - * - * @param string $mode the mode of operation: live or test - * - * @param object $paymentProcessor - * - * @return object - * @static - */ - static function &singleton($mode, &$paymentProcessor) { - $processorName = $paymentProcessor['name']; - if (self::$_singleton[$processorName] === NULL) { - self::$_singleton[$processorName] = new CRM_Core_Payment_FirstData($mode, $paymentProcessor); - } - return self::$_singleton[$processorName]; - } - - /********************************************************** * This function is set up and put here to make the mapping of fields * from the params object as visually clear as possible for easy editing * * Comment out irrelevant fields - **********************************************************/ - function mapProcessorFieldstoParams($params) { + */ + public function mapProcessorFieldstoParams($params) { /*concatenate full customer name first - code from EWAY gateway */ @@ -155,11 +139,11 @@ class CRM_Core_Payment_FirstData extends CRM_Core_Payment { return $requestFields; } - /********************************************************** + /** * This function sends request and receives response from * the processor - **********************************************************/ - function doDirectPayment(&$params) { + */ + public function doDirectPayment(&$params) { if ($params['is_recur'] == TRUE) { CRM_Core_Error::fatal(ts('%1 - recurring payments not implemented', array(1 => $paymentProcessor))); } @@ -191,7 +175,6 @@ class CRM_Core_Payment_FirstData extends CRM_Core_Payment { $port = "1129"; $host = $this->_paymentProcessor['url_site'] . ":" . $port . "/LSGSXML"; - //---------------------------------------------------------------------------------------------------- // Check to see if we have a duplicate before we send //---------------------------------------------------------------------------------------------------- @@ -203,20 +186,16 @@ class CRM_Core_Payment_FirstData extends CRM_Core_Payment { //---------------------------------------------------------------------------------------------------- $requestxml = lphp::buildXML($requestFields); - - /*---------------------------------------------------------------------------------------------------- // Send to the payment information using cURL /---------------------------------------------------------------------------------------------------- */ - $ch = curl_init($host); if (!$ch) { return self::errorExit(9004, 'Could not initiate connection to payment gateway'); } - curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $requestxml); curl_setopt($ch, CURLOPT_SSLCERT, $key); @@ -245,12 +224,14 @@ class CRM_Core_Payment_FirstData 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/docs/sslcerts.html"); } @@ -322,20 +303,22 @@ class CRM_Core_Payment_FirstData extends CRM_Core_Payment { /** * Checks to see if invoice_id already exists in db * - * @param int $invoiceId The ID to check + * @param int $invoiceId + * The ID to check. * - * @return bool True if ID exists, else false + * @return bool + * True if ID exists, else false */ - function _checkDupe($invoiceId) { + public function _checkDupe($invoiceId) { $contribution = new CRM_Contribute_DAO_Contribution(); $contribution->invoice_id = $invoiceId; return $contribution->find(); } - /************************************************** + /** * Produces error message and returns from class - **************************************************/ - function &errorExit($errorCode = NULL, $errorMessage = NULL) { + */ + public function &errorExit($errorCode = NULL, $errorMessage = NULL) { $e = CRM_Core_Error::singleton(); if ($errorCode) { @@ -347,14 +330,14 @@ class CRM_Core_Payment_FirstData extends CRM_Core_Payment { return $e; } - /************************************************** + /** * NOTE: 'doTransferCheckout' not implemented - **************************************************/ - function doTransferCheckout(&$params, $component) { + */ + public function doTransferCheckout(&$params, $component) { CRM_Core_Error::fatal(ts('This function is not implemented')); } - /******************************************************************************************** + /** * This public function checks to see if we have the right processor config values set * * NOTE: Called by Events and Contribute to check config params are set prior to trying @@ -365,11 +348,10 @@ class CRM_Core_Payment_FirstData extends CRM_Core_Payment { * * returns string $errorMsg if any errors found - null if OK * - ****************************************************************************************** + * function checkConfig( $mode ) CiviCRM V1.9 Declaration + * CiviCRM V2.0 Declaration */ - // function checkConfig( $mode ) // CiviCRM V1.9 Declaration - // CiviCRM V2.0 Declaration - function checkConfig() { + public function checkConfig() { $errorMsg = array(); if (empty($this->_paymentProcessor['user_name'])) { @@ -389,6 +371,3 @@ class CRM_Core_Payment_FirstData extends CRM_Core_Payment { } } // end class CRM_Core_Payment_FirstData - - -