17
17
/**
18
18
* Defines the subplugin type 'paymentgateway'
19
19
*
20
- * File paymentgateway.php
21
- * Encoding UTF-8
22
- *
23
20
* @package tool_paymentplugin
24
- * Should the author from the mfa file be put in as author here?
21
+ * @author Mitchell Halpin - Based heavily off code done by 'Catalyst AU'
25
22
*
26
23
* @copyright MAHQ
27
24
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
28
32
29
defined ('MOODLE_INTERNAL ' ) || die ();
33
30
34
- // See https://docs.moodle.org/dev/Subplugins#Settings_pages.
35
31
class paymentgateway extends \core \plugininfo \base {
36
32
37
33
/**
38
- * Finds all payment gateways.
39
- * @author Catalyst AU
34
+ * gets all payment gateways.
40
35
*
41
36
* @return array of gateway objects.
42
37
*/
@@ -52,7 +47,11 @@ public static function get_all_gateway_objects() {
52
47
return self ::sort_gateways_by_order ($ return );
53
48
}
54
49
55
-
50
+ /**
51
+ * Gets all enabled payment gateway objects.
52
+ *
53
+ * @return array of gateway objects
54
+ */
56
55
public static function get_all_enabled_gateway_objects () {
57
56
$ gateways = self ::get_all_gateway_objects ();
58
57
$ returnarr = array ();
@@ -64,7 +63,13 @@ public static function get_all_enabled_gateway_objects() {
64
63
return $ returnarr ;
65
64
}
66
65
67
-
66
+ /**
67
+ * Get specific gateway object
68
+ *
69
+ * @param string name of payment gateway
70
+ *
71
+ * @return paymentgateway or null
72
+ */
68
73
public static function get_gateway_object ($ name ) {
69
74
foreach (\core_plugin_manager::instance ()->get_plugins_of_type ('paymentgateway ' ) as $ gateway ) {
70
75
if ($ gateway ->name == $ name ) {
@@ -76,10 +81,8 @@ public static function get_gateway_object($name) {
76
81
}
77
82
}
78
83
79
-
80
84
/**
81
85
* Sorts payment gateways by configured order.
82
- * @author Catalyst AU
83
86
*
84
87
* @param array of gateway objects
85
88
*
@@ -103,16 +106,15 @@ public static function sort_gateways_by_order($unsorted) {
103
106
return $ sorted ;
104
107
}
105
108
106
- /* Loads factor settings to the settings tree
107
- *
108
- * This function usually includes settings.php file in plugins folder.
109
- * Alternatively it can create a link to some settings page (instance of admin_externalpage)
109
+ /**
110
+ * Loads all payment gateway settings.
110
111
*
111
112
* @param \part_of_admin_tree $adminroot
112
113
* @param string $parentnodename
113
114
* @param bool $hassiteconfig whether the current user has moodle/site:config capability
115
+ *
116
+ * @return void or null
114
117
*/
115
-
116
118
public function load_settings (\part_of_admin_tree $ adminroot , $ parentnodename , $ hassiteconfig ) {
117
119
118
120
if (!$ this ->is_installed_and_upgraded ()) {
0 commit comments