X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FPayment%2FMoneris.php;h=48372a2c5aec6a0175b509470466081cd5df8c01;hb=d424ffde71135407dc6297d0d1f0c85fa6413d7d;hp=876fb4b6e0de04e5fc468490b4c756fa1b4f9593;hpb=39de6fd54b9843705d13cb9f70fbcc6296103670;p=civicrm-core.git diff --git a/CRM/Core/Payment/Moneris.php b/CRM/Core/Payment/Moneris.php index 876fb4b6e0..48372a2c5a 100644 --- a/CRM/Core/Payment/Moneris.php +++ b/CRM/Core/Payment/Moneris.php @@ -35,7 +35,7 @@ */ class CRM_Core_Payment_Moneris extends CRM_Core_Payment { # (not used, implicit in the API, might need to convert?) - CONST CHARSET = 'UFT-8'; + const CHARSET = 'UFT-8'; /** * We only need one instance of this object. So we use the singleton @@ -49,13 +49,14 @@ class CRM_Core_Payment_Moneris extends CRM_Core_Payment { /** * 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_Moneris */ - function __construct($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) { + public function __construct($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) { $this->_mode = $mode; $this->_paymentProcessor = $paymentProcessor; $this->_processorName = ts('Moneris'); @@ -78,34 +79,18 @@ class CRM_Core_Payment_Moneris extends CRM_Core_Payment { } } - /** - * 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_Moneris($mode, $paymentProcessor); - } - return self::$_singleton[$processorName]; - } - /** * This function collects all the information from a web/api form and invokes * the relevant payment processor specific functions to perform the transaction * - * @param array $params assoc array of input parameters for this transaction + * @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 */ - function doDirectPayment(&$params) { + public function doDirectPayment(&$params) { //make sure i've been called correctly ... if (!$this->_profile) { return self::error('Unexpected error, missing profile'); @@ -163,10 +148,10 @@ class CRM_Core_Payment_Moneris extends CRM_Core_Payment { // add a recurring payment if requested if ($params['is_recur'] && $params['installments'] > 1) { //Recur Variables - $recurUnit = $params['frequency_unit']; + $recurUnit = $params['frequency_unit']; $recurInterval = $params['frequency_interval']; - $next = time(); - $day = 60 * 60 * 24; + $next = time(); + $day = 60 * 60 * 24; switch ($recurUnit) { case 'day': $next += $recurInterval * $day; @@ -254,7 +239,7 @@ class CRM_Core_Payment_Moneris extends CRM_Core_Payment { * * @return bool */ - function isError(&$response) { + public function isError(&$response) { $responseCode = $response->getResponseCode(); if (is_null($responseCode)) { return TRUE; @@ -268,13 +253,13 @@ class CRM_Core_Payment_Moneris extends CRM_Core_Payment { return TRUE; } - // ignore for now, more elaborate error handling later. /** + * ignore for now, more elaborate error handling later. * @param $response * * @return object */ - function &checkResult(&$response) { + public function &checkResult(&$response) { return $response; $errors = $response->getErrors(); @@ -305,7 +290,7 @@ class CRM_Core_Payment_Moneris extends CRM_Core_Payment { * * @return object */ - function &error($error = NULL) { + public function &error($error = NULL) { $e = CRM_Core_Error::singleton(); if (is_object($error)) { $e->push($error->getResponseCode(), @@ -328,10 +313,10 @@ class CRM_Core_Payment_Moneris extends CRM_Core_Payment { /** * This function checks to see if we have the right config values * - * @return string the error message if any - * @public + * @return string + * the error message if any */ - function checkConfig() { + public function checkConfig() { $error = array(); if (empty($this->_paymentProcessor['signature'])) { @@ -350,4 +335,3 @@ class CRM_Core_Payment_Moneris extends CRM_Core_Payment { } } } -