X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FPayment%2FElavon.php;h=8e1b720504a23f20c45c8727fa6154911004497d;hb=46bcf5978e35c7f061b3ce70f98108df028eef1d;hp=8dd4e6a4dbb55bb0895ed8d442173e97bca893d1;hpb=ab2e3179d57fbd8b60c0730ec38b6cb678100a28;p=civicrm-core.git diff --git a/CRM/Core/Payment/Elavon.php b/CRM/Core/Payment/Elavon.php index 8dd4e6a4db..8e1b720504 100644 --- a/CRM/Core/Payment/Elavon.php +++ b/CRM/Core/Payment/Elavon.php @@ -1,7 +1,7 @@ _mode = $mode; $this->_paymentProcessor = $paymentProcessor; $this->_processorName = ts('Elavon'); } - /** - * 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_Elavon($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) { /********************************************************** * compile array @@ -114,7 +97,6 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { $requestFields['ssl_customer_code'] = '1111'; $requestFields['ssl_salestax'] = 0.0; - /************************************************************************************ * Fields available from civiCRM not implemented for Elavon * @@ -134,7 +116,7 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { * This function sends request and receives response from * the processor **********************************************************/ - function doDirectPayment(&$params) { + public function doDirectPayment(&$params) { if (isset($params['is_recur']) && $params['is_recur'] == TRUE) { CRM_Core_Error::fatal(ts('Elavon - recurring payments not implemented')); } @@ -218,12 +200,14 @@ class CRM_Core_Payment_Elavon 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"); } @@ -265,7 +249,6 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { * fix for CRM-2566 **********************************************************/ - if ($processorResponse['errorCode']) { return self::errorExit(9010, "Error: [" . $processorResponse['errorCode'] . " " . $processorResponse['errorName'] . " " . $processorResponse['errorMessage'] . "] - from payment processor"); } @@ -309,11 +292,13 @@ class CRM_Core_Payment_Elavon 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(); @@ -322,7 +307,7 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { /************************************************** * 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) { $e->push($errorCode, 0, NULL, $errorMessage); @@ -336,7 +321,7 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { /************************************************** * NOTE: 'doTransferCheckout' not implemented **************************************************/ - function doTransferCheckout(&$params, $component) { + public function doTransferCheckout(&$params, $component) { CRM_Core_Error::fatal(ts('This function is not implemented')); } @@ -355,7 +340,7 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { */ // function checkConfig( $mode ) // CiviCRM V1.9 Declaration // CiviCRM V2.0 Declaration - function checkConfig() { + public function checkConfig() { $errorMsg = array(); if (empty($this->_paymentProcessor['user_name'])) { @@ -379,7 +364,7 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { * * @return string */ - function buildXML($requestFields) { + public function buildXML($requestFields) { $xmlFieldLength['ssl_first_name'] = 15; // credit card name $xmlFieldLength['ssl_last_name'] = 15; @@ -424,7 +409,7 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { * * @return string */ - function tidyStringforXML($value, $fieldlength) { + public function tidyStringforXML($value, $fieldlength) { // the xml is posted to a url so must not contain spaces etc. It also needs to be cut off at a certain // length to match the processor's field length. The cut needs to be made after spaces etc are // transformed but must not include a partial transformed character e.g. %20 must be in or out not half-way @@ -442,7 +427,7 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { * It returns the NodeValue for a given NodeName * or returns an empty string. ************************************************************************/ - function GetNodeValue($NodeName, &$strXML) { + public function GetNodeValue($NodeName, &$strXML) { $OpeningNodeName = "<" . $NodeName . ">"; $ClosingNodeName = ""; @@ -469,7 +454,7 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { * * @return mixed */ - function decodeXMLresponse($Xml) { + public function decodeXMLresponse($Xml) { /** * $xtr = simplexml_load_string($Xml) or die ("Unable to load XML string!"); @@ -488,4 +473,3 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { return $processorResponse; } } -