<?php
include("connection.inc.php");
include("global.inc.php");
if(strlen(PEAR_PATH)>0)
{
ini_set("include_path", "/home/eklavya/public_html/pear/PEAR");
require_once "Mail.php";
require_once "Mail/mime.php";
}
$order_id = isset($_REQUEST['reference_no'])?trim($_REQUEST['reference_no']):'';
$ResponseCode = isset($_REQUEST['ResponseCode'])?trim($_REQUEST['ResponseCode']):'';
$DateCreated = isset($_REQUEST['DateCreated'])?trim($_REQUEST['DateCreated']):'';
$TransactionNumber = isset($_REQUEST['TransactionNumber'])?trim($_REQUEST['TransactionNumber']):'';
$Amount = isset($_REQUEST['Amount'])?trim($_REQUEST['Amount']):'';
$message = isset($_REQUEST['message'])?trim($_REQUEST['message']):'';
if($ResponseCode == 1)
{
$order_status = ORDER_PENDING_CODE;
}else
{
$order_status = PAYMENT_FAILURE_CODE;
$Amount = 0;
}
$VarQuery = "UPDATE customer_order SET order_transaction_id = '".$TransactionNumber."', ".
"order_status = '".$order_status."', order_paid_amount = '".$Amount."', ".
"order_pg_error_message = '".$message."'".
"WHERE order_id = '".$order_id."'";
$VarResult = mysql_query($VarQuery) or die(mysql_error());
if($ResponseCode)
{
$found = orderDetails($order_id, $status, $name, $CustEmail, $CustMsgCC, $order_data, $cust_data, $cust_shipping_data, $link, $custArray, $ShippingDtlArray);
if($found)
{
$content = formatMailContent($name, $order_id, $order_data, $cust_data, $cust_shipping_data, $link);
if(strlen(PEAR_PATH)>0)
{
$subject = 'Your pitara order (Number: '.$order_id.')';
# Send order mail
sendmail($name, $CustEmail, $subject, $content);
}
$message = "<h2>Thank you</h2>An email has been sent to you with order details and further instructions.";
}else
{
$message = "<br>The order email cannot send. Please try after some time.";
}
header('Location:thank-you.php?message='.urlencode($message));
exit();
}else
{
header('Location:thank-you.php?message='.urlencode($message));
exit();
}
?>