<?php
	/***********************************************************************************
	*   Copyright Keysoft Pty Ltd 2009
	***********************************************************************************/

	/******************** Global Settings ********************/
	require_once '../phpobjects/common/global.php';

	/********************* Page Settings *********************/
	$gaPage['title'] = 'Petsafe.com.au';
	$gaPage['root_directory'] = '..';

	/********************* Page Defaults *********************/
	fDefaultParameter('err_code', $_GET, '');
	fDefaultParameter('id', $_GET, '');
	$id = $_GET['id'];

	if ($id == ''){
		// no transaction id - throw to cart page
		fRedirect('register_cart.php');
		fCleanup();
	}

	//invalid transaction id check
	$aRequest = array();
	$aRequest['_pk_record_id'] = '="' . $id . '"';
	$fmrTransaction = fFMPerformFind('petsafe', 'All Fields - Web_Payments', $aRequest);
	if ($fmrTransaction === FALSE || $fmrTransaction["response"]["dataInfo"]["foundCount"] != 1){
		// invalid id
		fRedirect('register_cart.php');
		fCleanup();

	} else {
		// transaction exists - delete
		$fmcTransaction = $fmrTransaction["response"]["data"][0]['recordId'];
		$deleteresult = fFMDelete('petsafe', 'All Fields - Web_Payments', $fmcTransaction);
	}

	fRedirect('register_cart.php');
	fCleanup();

?>
