<?php
define('INCLUDE_STEPS', 'callbackGoogleCheckout');
require_once dirname(__FILE__) . '/../../../common/common.php';

if(isset($_COOKIE['returnToSignup'])){
		if($_COOKIE['returnToSignup'] == 1){
			RedirectPage($GLOBALS['gSettingsArray']['ClientExec URL'].'/signup.php?step=6&pass=1');
		}
		if($_COOKIE['returnToSignup'] == 0){
			RedirectPage($GLOBALS['gSettingsArray']['ClientExec URL'].'/index.php');
		}
		exit;
}

require_once 'classes/class.gateway.plugin.php';
require_once dirname(__FILE__) . '/../../../common/xmlFunctions.php';

// Include Google Checkout Library (modified)
require_once'plugins/gateways/googlecheckout/googlefunctions.php';

$GLOBALS['logger']->log(5,'Google Checkout callback invoked');

// Retrieve the XML sent in the HTTP POST request to the ResponseHandler
$xml_response = $HTTP_RAW_POST_DATA;

// Get rid of PHP's magical escaping of quotes 
if (get_magic_quotes_gpc()) {
    $xml_response = stripslashes($xml_response);
}

// Log the XML received in the HTTP POST request
$GLOBALS['logger']->log(5, print_r($xml_response, true));

ProcessXmlData($xml_response);

?>