<?php
/*
+----------------------------------------------------------------------------+
- | Elavon (Nova) Virtual Merchant Core Payment Module for CiviCRM version 4.5 |
+ | Elavon (Nova) Virtual Merchant Core Payment Module for CiviCRM version 4.6 |
+----------------------------------------------------------------------------+
| Licensed to CiviCRM under the Academic Free License version 3.0 |
| |
**/
class CRM_Core_Payment_Elavon extends CRM_Core_Payment {
// (not used, implicit in the API, might need to convert?)
- CONST
+ const
CHARSET = 'UFT-8';
/**
/**********************************************************
* Constructor
*
- * @param string $mode the mode of operation: live or test
+ * @param string $mode
+ * The mode of operation: live or test.
*
* @param $paymentProcessor
*
* @return \CRM_Core_Payment_Elavon *******************************************************
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
// live or test
$this->_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
$requestFields['ssl_customer_code'] = '1111';
$requestFields['ssl_salestax'] = 0.0;
-
/************************************************************************************
* Fields available from civiCRM not implemented for Elavon
*
* 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'));
}
$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");
}
* fix for CRM-2566
**********************************************************/
-
if ($processorResponse['errorCode']) {
return self::errorExit(9010, "Error: [" . $processorResponse['errorCode'] . " " . $processorResponse['errorName'] . " " . $processorResponse['errorMessage'] . "] - from payment processor");
}
/**
* 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) {
$e->push($errorCode, 0, NULL, $errorMessage);
/**************************************************
* NOTE: 'doTransferCheckout' not implemented
**************************************************/
- function doTransferCheckout(&$params, $component) {
+ public function doTransferCheckout(&$params, $component) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
*/
// function checkConfig( $mode ) // CiviCRM V1.9 Declaration
// CiviCRM V2.0 Declaration
- function checkConfig() {
+ public function checkConfig() {
$errorMsg = array();
if (empty($this->_paymentProcessor['user_name'])) {
*
* @return string
*/
- function buildXML($requestFields) {
+ public function buildXML($requestFields) {
$xmlFieldLength['ssl_first_name'] = 15;
// credit card name
$xmlFieldLength['ssl_last_name'] = 15;
*
* @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
* 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 = "</" . $NodeName . ">";
*
* @return mixed
*/
- function decodeXMLresponse($Xml) {
+ public function decodeXMLresponse($Xml) {
/**
* $xtr = simplexml_load_string($Xml) or die ("Unable to load XML string!");
return $processorResponse;
}
}
-