eb22a9975e03171094599ef4d5f46c1285e5c93f
[civicrm-core.git] / tests / extensions / test.extension.manager.paymenttest / main.php
1 <?php
2 class test_extension_manager_paymenttest extends CRM_Core_Payment {
3 static private $_singleton = NULL;
4
5 /**
6 * singleton function used to manage this object
7 *
8 * @param string $mode the mode of operation: live or test
9 * @param array $paymentProcessor the details of the payment processor being invoked
10 * @param object $paymentForm reference to the form object if available
11 * @param boolean $force should we force a reload of this payment object
12 *
13 * @return object
14 * @static
15 *
16 */
17 static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
18 $processorName = $paymentProcessor['name'];
19 if (self::$_singleton[$processorName] === NULL) {
20 self::$_singleton[$processorName] = new test_extension_manager_paymenttest();
21 }
22 return self::$_singleton[$processorName];
23 }
24
25 static $counts = array();
26
27 function install() {
28 self::$counts['install'] = 1 + (int) self::$counts['install'];
29 }
30
31 function uninstall() {
32 self::$counts['uninstall'] = 1 + (int) self::$counts['uninstall'];
33 }
34
35 function disable() {
36 self::$counts['disable'] = 1 + (int) self::$counts['disable'];
37 }
38
39 function enable() {
40 self::$counts['enable'] = 1 + (int) self::$counts['enable'];
41 }
42
43 /**
44 * This function collects all the information from a web/api form and invokes
45 * the relevant payment processor specific functions to perform the transaction
46 *
47 * @param array $params assoc array of input parameters for this transaction
48 *
49 * @return array the result in an nice formatted array (or an error object)
50 * @abstract
51 */
52 function doDirectPayment(&$params) {
53 }
54
55 function checkConfig() {
56 }
57 }