<?php /** * Moodec DPS Payment Success * * @package local * @subpackage local_moodec * @author Thomas Threadgold * @copyright 2015 LearningWorks Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once dirname(__FILE__) . '/../../../../config.php'; require_once $CFG->dirroot . '/local/moodec/lib.php'; require_login(); // This is the result of the transaction from DPS $data = required_param('result', PARAM_CLEAN); // We instantiate the cart in order to get the transaction id $cart = new MoodecCart(); // Then we can set up the gateway using the cart transaction id $gateway = new MoodecGatewayDPS($cart->get_transaction_id()); // Now handle the data from DPS $response = $gateway->handle($data); // If we successfully handle the data, then redirect if (!!$response) { redirect(new moodle_url($CFG->wwwroot . '/my')); // PERHAPS MAKE CONFIGURABLE? } else { print_error('error_enrolfail', 'local_moodec'); }