function __construct()
 {
     beGateway_Settings::$shopId = BGW_SHOP_ID;
     beGateway_Settings::$shopKey = BGW_SHOP_KEY;
     beGateway_Settings::$gatewayBase = "https://" . BGW_GW_DOMAIN;
     beGateway_Settings::$checkoutBase = "https://" . BGW_PP_DOMAIN;
 }
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName(__FILE__);
require_once CLASSPATH . "payment/ps_begateway.cfg.php";
require_once CLASSPATH . "begateway/begateway-api-php/lib/beGateway.php";
global $VM_LANG;
$VM_LANG->load('begateway');
if (!isset($_REQUEST["token"]) || empty($_REQUEST["token"]) || !isset($_REQUEST["uid"]) || empty($_REQUEST["uid"])) {
    echo $VM_LANG->_('VM_CHECKOUT_ORDERIDNOTSET');
} else {
    beGateway_Settings::$shopId = BGW_SHOP_ID;
    beGateway_Settings::$shopKey = BGW_SHOP_KEY;
    beGateway_Settings::$gatewayBase = "https://" . BGW_GW_DOMAIN;
    beGateway_Settings::$checkoutBase = "https://" . BGW_PP_DOMAIN;
    $query = new beGateway_QueryByUid();
    $query->setUid($_REQUEST["uid"]);
    $query_response = $query->submit();
    list($order_id, $order_number, $user_id, $user_info_id) = explode('|', $query_response->getTrackingId());
    $q = "SELECT order_status FROM #__{vm}_orders WHERE ";
    $q .= "#__{vm}_orders.user_id= " . $auth["user_id"] . " ";
    $q .= "AND #__{vm}_orders.order_id= {$order_id} ";
    $db->query($q);
    if ($db->next_record()) {
        $order_status = $db->f("order_status");
        if ($query_response->isSuccess() || $order_status == BGW_VERIFIED_STATUS) {
            ?>
      <img src="<?php 
            echo VM_THEMEURL;
            ?>
 require_once ADMINPATH . 'global.php';
 require_once CLASSPATH . 'ps_main.php';
 $sess = new ps_session();
 /* load the VirtueMart Language File */
 if (file_exists(ADMINPATH . 'languages/admin/' . $mosConfig_lang . '.php')) {
     require_once ADMINPATH . 'languages/admin/' . $mosConfig_lang . '.php';
 } else {
     require_once ADMINPATH . 'languages/admin/english.php';
 }
 /* Load the VirtueMart database class */
 require_once CLASSPATH . 'ps_database.php';
 /*** END VirtueMart part ***/
 require_once CLASSPATH . "/payment/ps_begateway.cfg.php";
 require_once CLASSPATH . "/begateway/begateway-api-php/lib/beGateway.php";
 beGateway_Settings::$shopId = BGW_SHOP_ID;
 beGateway_Settings::$shopKey = BGW_SHOP_KEY;
 $webhook = new beGateway_Webhook();
 if ($webhook->isAuthorized()) {
     list($order_id, $order_number, $user_id, $user_info_id) = explode('|', $webhook->getTrackingId());
     $d['order_id'] = (int) $order_id;
     //this identifies the order record
     if ($d['order_id'] > 0) {
         if ($webhook->isSuccess()) {
             $d['order_status'] = BGW_VERIFIED_STATUS;
             //this is the new value for the database field I think X for cancelled, C for confirmed
             $d['order_comment'] = 'UID: ' . $webhook->getUid();
         } else {
             if ($webhook->isFailed()) {
                 $d['order_status'] = BGW_INVALID_STATUS;
                 //this is the new value for the database field I think X for cancelled, C for confirmed
                 $d['order_comment'] = 'UID: ' . $webhook->getUid();