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