<?php
/*****************************************************************************************************/
/*  CALL BACK CODE FROM AUTHORIZE.NET : This code needs to be called from your processor upon completion */
/*****************************************************************************************************/
// $cPlugin->GetPluginVariable takes queries in the form of plugin_[pluginname]_[variable]

//Normal plugin would include gateway class via the line below
//include_once("../../../classes/class.gateway.plugin.php");
//calling from the plugin directory so I do not need to go up in dir

include_once("classes/class.gateway.plugin.php");
//Create plug in class to interact with CE
$cPlugin = new Plugin($params["invoiceNumber"]);

//create transaction code
if ($authnet_results["x_response_code"]==1) $responsetext = "This transaction has been approved";
elseif ($authnet_results["x_response_code"]==2) $responsetext = "This transaction has been declined";
elseif ($authnet_results["x_response_code"]==3) $responsetext = "There has been an error processing this transaction";
if ($authnet_results["x_response_reason_text"]==""){ $transaction = "Transaction (0): No response string returned"; }
else{    $transaction = " ".$authnet_results["x_response_reason_text"]." (AN Trans:".$authnet_results["x_trans_id"].")"; }
$transactioncode=$transaction;

//check to see if transaction was accepted
if ($authnet_results["x_response_code"]==1){
	$cPlugin->PaymentAccepted($authnet_results["x_amount"],$transactioncode,0);
}else{
	//Only add transaction if we are NOT coming from signup
	if (!$bolInSignup) $cPlugin->PaymentRejected($transactioncode);
}
?>
