diff --git a/CRM/Core/Payment/AuthorizeNet.php b/CRM/Core/Payment/AuthorizeNet.php index 7e891d9b9626..efb0c89d9c87 100644 --- a/CRM/Core/Payment/AuthorizeNet.php +++ b/CRM/Core/Payment/AuthorizeNet.php @@ -64,36 +64,6 @@ public function __construct($mode, &$paymentProcessor) { $this->_setParam('sequence', rand(1, 1000)); } - /** - * Singleton function used to manage this object - * - * @param string $mode - * The mode of operation: live or test. - * @param array $paymentProcessor - * The details of the payment processor being invoked. - * @param CRM_Core_Form $paymentForm - * Reference to the form object if available. - * @param bool $force - * Should we force a reload of this payment object. - * - * @return object - * @static - * - */ - public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - if (!isset(self::$_singleton[$cacheKey]) || self::$_singleton[$cacheKey] === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_AuthorizeNet($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /** * Should the first payment date be configurable when setting up back office recurring payments * In the case of Authorize.net this is an option diff --git a/CRM/Core/Payment/Dummy.php b/CRM/Core/Payment/Dummy.php index 93f07389c067..f003ff4174fb 100644 --- a/CRM/Core/Payment/Dummy.php +++ b/CRM/Core/Payment/Dummy.php @@ -58,33 +58,6 @@ public function __construct($mode, &$paymentProcessor) { $this->_processorName = ts('Dummy Processor'); } - /** - * Singleton function used to manage this object - * - * @param string $mode - * The mode of operation: live or test. - * - * @param object $paymentProcessor - * @param null $paymentForm - * @param bool $force - * - * @return object - * @static - */ - public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - if (CRM_Utils_Array::value($cacheKey, self::$_singleton) === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_Dummy($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /** * Submit a payment using Advanced Integration Method * diff --git a/CRM/Core/Payment/Elavon.php b/CRM/Core/Payment/Elavon.php index d514873e2c9a..79569fa36e20 100644 --- a/CRM/Core/Payment/Elavon.php +++ b/CRM/Core/Payment/Elavon.php @@ -54,31 +54,6 @@ public function __construct($mode, &$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 - */ - public static function &singleton($mode, &$paymentProcessor) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - if (self::$_singleton[$cacheKey] === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_Elavon($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /********************************************************** * 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 diff --git a/CRM/Core/Payment/FirstData.php b/CRM/Core/Payment/FirstData.php index ff83bbe9f423..241d08cf6238 100644 --- a/CRM/Core/Payment/FirstData.php +++ b/CRM/Core/Payment/FirstData.php @@ -78,31 +78,6 @@ public function __construct($mode, &$paymentProcessor) { $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 - */ - public static function &singleton($mode, &$paymentProcessor) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - if (self::$_singleton[$cacheKey] === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_FirstData($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /********************************************************** * 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 diff --git a/CRM/Core/Payment/Google.php b/CRM/Core/Payment/Google.php index bf219b8de035..5d5f7c760e88 100644 --- a/CRM/Core/Payment/Google.php +++ b/CRM/Core/Payment/Google.php @@ -75,31 +75,6 @@ public function __construct($mode, &$paymentProcessor) { $this->_processorName = ts('Google Checkout'); } - /** - * Singleton function used to manage this object - * - * @param string $mode - * The mode of operation: live or test. - * - * @param object $paymentProcessor - * - * @return object - * @static - */ - public static function &singleton($mode, &$paymentProcessor) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - if (!isset(self::$_singleton[$cacheKey]) || self::$_singleton[$cacheKey] === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_Google($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /** * This function checks to see if we have the right config values * diff --git a/CRM/Core/Payment/GoogleIPN.php b/CRM/Core/Payment/GoogleIPN.php index 6dbd487545ac..595b2271c508 100644 --- a/CRM/Core/Payment/GoogleIPN.php +++ b/CRM/Core/Payment/GoogleIPN.php @@ -397,6 +397,8 @@ public function completeRecur($input, $ids, $objects) { } /** + * @deprecated + * Payment processor singletons removed - this is an IPN so left but probably can go * Singleton function used to manage this object * * @param string $mode diff --git a/CRM/Core/Payment/IATS.php b/CRM/Core/Payment/IATS.php index 616d26d28817..8c4f9a47fbe9 100644 --- a/CRM/Core/Payment/IATS.php +++ b/CRM/Core/Payment/IATS.php @@ -75,27 +75,6 @@ public function __construct($mode, &$paymentProcessor) { } } - /** - * @param string $mode - * @param array $paymentProcessor - * - * @return mixed - */ - public static function &singleton($mode, &$paymentProcessor) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - - if (self::$_singleton[$cacheKey] === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_IATS($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /** * This function collects all the information from a web/api form and invokes * the relevant payment processor specific functions to perform the transaction diff --git a/CRM/Core/Payment/Moneris.php b/CRM/Core/Payment/Moneris.php index 5226b9ca46cd..d86b48da4644 100644 --- a/CRM/Core/Payment/Moneris.php +++ b/CRM/Core/Payment/Moneris.php @@ -79,31 +79,6 @@ public function __construct($mode, &$paymentProcessor, &$paymentForm = NULL, $fo } } - /** - * Singleton function used to manage this object - * - * @param string $mode - * The mode of operation: live or test. - * - * @param object $paymentProcessor - * - * @return object - * @static - */ - public static function &singleton($mode, &$paymentProcessor) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - if (self::$_singleton[$cacheKey] === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_Moneris($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /** * This function collects all the information from a web/api form and invokes * the relevant payment processor specific functions to perform the transaction diff --git a/CRM/Core/Payment/PayJunction.php b/CRM/Core/Payment/PayJunction.php index c25ea1fb3e2f..0c7c73bb30e7 100644 --- a/CRM/Core/Payment/PayJunction.php +++ b/CRM/Core/Payment/PayJunction.php @@ -47,33 +47,6 @@ public function __construct($mode, &$paymentProcessor) { $this->_processorName = ts('PayJunction'); } - /** - * Singleton function used to manage this object - * - * @param string $mode - * The mode of operation: live or test. - * - * @param object $paymentProcessor - * @param null $paymentForm - * @param bool $force - * - * @return object - * @static - */ - public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - if (self::$_singleton[$cacheKey] === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_PayJunction($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /* * This function sends request and receives response from * PayJunction payment process diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index 0368b5c36290..84199205af34 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -75,33 +75,6 @@ public function __construct($mode, &$paymentProcessor) { } } - /** - * Singleton function used to manage this object - * - * @param string $mode - * The mode of operation: live or test. - * - * @param object $paymentProcessor - * @param null $paymentForm - * @param bool $force - * - * @return object - * @static - */ - public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - if (!isset(self::$_singleton[$cacheKey]) || self::$_singleton[$cacheKey] === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_PaypalImpl($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /** * Are back office payments supported - e.g paypal standard won't permit you to enter a credit card associated with someone else's login * @return bool diff --git a/CRM/Core/Payment/PayflowPro.php b/CRM/Core/Payment/PayflowPro.php index 0ecaa28ba787..e09842608101 100644 --- a/CRM/Core/Payment/PayflowPro.php +++ b/CRM/Core/Payment/PayflowPro.php @@ -45,31 +45,6 @@ public function __construct($mode, &$paymentProcessor) { $this->_processorName = ts('Payflow Pro'); } - /** - * Singleton function used to manage this object - * - * @param string $mode - * The mode of operation: live or test. - * - * @param object $paymentProcessor - * - * @return object - * @static - */ - public static function &singleton($mode, &$paymentProcessor) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - if (self::$_singleton[$cacheKey] === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_PayflowPro($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /* * This function sends request and receives response from * the processor. It is the main function for processing on-server diff --git a/CRM/Core/Payment/PaymentExpress.php b/CRM/Core/Payment/PaymentExpress.php index ffe15b8abb30..fdc6a146aaf8 100644 --- a/CRM/Core/Payment/PaymentExpress.php +++ b/CRM/Core/Payment/PaymentExpress.php @@ -67,33 +67,6 @@ public function __construct($mode, &$paymentProcessor) { $this->_processorName = ts('DPS Payment Express'); } - /** - * Singleton function used to manage this object - * - * @param string $mode - * The mode of operation: live or test. - * - * @param object $paymentProcessor - * @param null $paymentForm - * @param bool $force - * - * @return object - * @static - */ - public static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - if (self::$_singleton[$cacheKey] === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_PaymentExpress($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /** * This function checks to see if we have the right config values * diff --git a/CRM/Core/Payment/PaymentExpressIPN.php b/CRM/Core/Payment/PaymentExpressIPN.php index 8ad592d8b838..f500076b996d 100644 --- a/CRM/Core/Payment/PaymentExpressIPN.php +++ b/CRM/Core/Payment/PaymentExpressIPN.php @@ -98,26 +98,6 @@ public function __construct($mode, &$paymentProcessor) { $this->_paymentProcessor = $paymentProcessor; } - /** - * Singleton function used to manage this object - * - * @param string $mode - * The mode of operation: live or test. - * - * @param $paymentProcessor - * @param null $paymentForm - * @param bool $force - * - * @return object - * @static - */ - public static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) { - if (self::$_singleton === NULL) { - self::$_singleton = new CRM_Core_Payment_PaymentExpressIPN($mode, $paymentProcessor); - } - return self::$_singleton; - } - /** * The function gets called when a new order takes place. * diff --git a/CRM/Core/Payment/ProcessorForm.php b/CRM/Core/Payment/ProcessorForm.php index 114b527607a2..4161479355a9 100644 --- a/CRM/Core/Payment/ProcessorForm.php +++ b/CRM/Core/Payment/ProcessorForm.php @@ -61,7 +61,7 @@ public static function preProcess(&$form, $type = NULL, $mode = NULL) { // also set cancel subscription url if (!empty($form->_paymentProcessor['is_recur']) && !empty($form->_values['is_recur'])) { - $form->_paymentObject = &CRM_Core_Payment::singleton($mode, $form->_paymentProcessor, $form); + $form->_paymentObject = CRM_Core_Payment::singleton($mode, $form->_paymentProcessor, $form); $form->_values['cancelSubscriptionUrl'] = $form->_paymentObject->subscriptionURL(); } diff --git a/CRM/Core/Payment/Realex.php b/CRM/Core/Payment/Realex.php index c1901c60019a..02f1363ddba2 100644 --- a/CRM/Core/Payment/Realex.php +++ b/CRM/Core/Payment/Realex.php @@ -78,31 +78,6 @@ public function __construct($mode, &$paymentProcessor) { $this->_setParam('sequence', rand(1, 1000)); } - /** - * Singleton function used to manage this object - * - * @param string $mode - * The mode of operation: live or test. - * - * @param object $paymentProcessor - * - * @return object - * @static - */ - public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - if (self::$_singleton[$cacheKey] === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_Realex($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /** * @param array $params * diff --git a/CRM/Core/Payment/eWAY.php b/CRM/Core/Payment/eWAY.php index 4dfce475e741..ea00761daf44 100644 --- a/CRM/Core/Payment/eWAY.php +++ b/CRM/Core/Payment/eWAY.php @@ -124,34 +124,6 @@ public function __construct($mode, &$paymentProcessor) { $this->_processorName = ts('eWay'); } - /** - * Singleton function used to manage this object - * - * @param string $mode - * The mode of operation: live or test. - * - * @param object $paymentProcessor - * @param null $paymentForm - * @param bool $force - * - * @return object - * @static - */ - public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) { - if (!empty($paymentProcessor['id'])) { - $cacheKey = $paymentProcessor['id']; - } - else { - //@todo eliminated instances of this in favour of id-specific instances. - $cacheKey = $mode . '_' . $paymentProcessor['name']; - } - - if (self::$_singleton[$cacheKey] === NULL) { - self::$_singleton[$cacheKey] = new CRM_Core_Payment_eWAY($mode, $paymentProcessor); - } - return self::$_singleton[$cacheKey]; - } - /********************************************************** * This function sends request and receives response from * eWAY payment process