Class 'tygh\registry' Not Found

I have created a new page that sends a payment request (via POST) to a hosted payment provider. However when that page calls back to cscart (to the same page) it throws an error :

Fatal error: Uncaught Error: Class 'Tygh\Registry' not found in C:\wamp\www\cscart\app\payments\payzone_hosted.php on line 12

The oddity of course is that processing goes through that page without causing an error, then falls over on callback from the hosted page.

Anyone got any suggestions for getting around this?


This is the code it should be calling:

* payzone_hosted Class Doc Comment
* @category Class
* @package MyPackage
* @author David Quick
* @license General Public License
* @link
use Tygh\Http;
use Tygh\Registry;
if (!defined('AREA')) {
if (!empty($_REQUEST['OrderID']) && !empty($_REQUEST['HashDigest'])) {
DEFINE('AREA_NAME', 'customer');
$order_id = (strpos($_REQUEST['OrderID'], '_')) ? substr($_REQUEST['OrderID'], 0, strpos($_REQUEST['OrderID'], '_')) : $_REQUEST['OrderID'];
$redirect_url = Registry::get('config.current_location') . "/" . Registry::get('config.customer_index') . "$index_script?dispatch=payment_notification.notify&payment=payzone_hosted&order_id=$order_id";
echo $redirect_url;
fn_redirect(Registry::get('config.current_location') . "/" . Registry::get('config.customer_index') . "$index_script?dispatch=payment_notification.notify&payment=payzone_hosted&order_id=$order_id", false, false);
} else {
echo('AREA is already defined');
die('Access denied');

Please use

require './init_payment.php';

instead of

DEFINE('AREA_NAME', 'customer');

Many thanks - that appears to have cracked it. The code is from an older version of CsCart (v2) that I am trying to bring up to date, but I am no PHP expert.