Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/monara/public_html/test.athavaneng.com/themes.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
.
/**
* Payment module test data generator class
*
* @package core_payment
* @category test
* @copyright 2020 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_payment_generator extends component_generator_base {
/** @var int */
protected $accountcounter = 0;
/**
* Create a payment account
*
* @param array $data account data (name, idnumber, enabled) and additionally field 'gateways' that can include
* a list of gateways that should be mock-enabled for this account.
*/
public function create_payment_account(array $data = []): \core_payment\account {
$this->accountcounter++;
$gateways = [];
if (!empty($data['gateways'])) {
$gateways = preg_split('/,/', $data['gateways']);
}
unset($data['gateways']);
$account = \core_payment\helper::save_payment_account(
(object)($data + ['name' => 'Test '.$this->accountcounter, 'idnumber' => '', 'enabled' => 1]));
foreach ($gateways as $gateway) {
\core_payment\helper::save_payment_gateway(
(object)['accountid' => $account->get('id'), 'gateway' => $gateway, 'enabled' => 1]);
}
return $account;
}
/**
* Create a payment account
*
* @param array $data
*/
public function create_payment(array $data): int {
global $DB;
if (empty($data['accountid']) || !\core_payment\account::get_record(['id' => $data['accountid']])) {
throw new coding_exception('Account id is not specified or does not exist');
}
if (empty($data['amount'])) {
throw new coding_exception('Amount must be specified');
}
$gateways = \core\plugininfo\paygw::get_enabled_plugins();
if (empty($data['gateway'])) {
$data['gateway'] = reset($gateways);
}
$id = $DB->insert_record('payments', $data +
[
'component' => 'testcomponent',
'paymentarea' => 'teatarea',
'itemid' => 0,
'currency' => 'AUD',
]);
return $id;
}
}