Current File : /home/inlingua/www/noida/icentex/evaluation/include/pg/protx/success.php |
<?
include('../../config/config.php');
//include(DIR_FS_SITE.'include/pg/protx/protx.php');
include(DIR_FS_SITE.'include/pg/protx/config.php');
// Now check we have a Crypt field passed to this page
$strCrypt=$_REQUEST["crypt"];
if (strlen($strCrypt)==0) {
ob_end_flush();
redirect("home");
}
// Now decode the Crypt field and extract the results
$strDecoded=simpleXor(Base64Decode($strCrypt),PROTX_ENT_PASSWORD);
$values = getToken($strDecoded);
// Split out the useful information into variables we can use
$strStatus=$values['Status'];
$strStatusDetail=$values['StatusDetail'];
$strVendorTxCode=$values["VendorTxCode"];
$strVPSTxId=$values["VPSTxId"];
$strTxAuthNo=$values["TxAuthNo"];
$strAmount=$values["Amount"];
$strAVSCV2=$values["AVSCV2"];
$strAddressResult=$values["AddressResult"];
$strPostCodeResult=$values["PostCodeResult"];
$strCV2Result=$values["CV2Result"];
$strGiftAid=$values["GiftAid"];
$str3DSecureStatus=$values["3DSecureStatus"];
//$strCAVV=$values["CAVV"];
// Empty the cart, we're done with it now because the order is successful
#1. regenerate the cartid.
$cart_obj->empty_cart();
$cart_obj->regenerate_cart_id();
#2. release the onhold quantity and update the actual quantity of all the products.
$order_id=split('_', $strVendorTxCode);
$oid=$order_id['0'];
//print_r($oid);exit;
#3. update payment status.
$order= new query('orders');
$order->Data['payment_status']='1';
$order->Data['id']=$oid;
$order->Update();
//$cart_obj->setbilling(array());
//$cart_obj->setshipping(array());
#4. send order receipt to customer.
# ???????????????????
#delete records from cart that belong to this order id.
$protx_cart= new query('cart');
$protx_cart->Where="where cart_id='".$oid."'";
$protx_cart->Delete_where();
#sending mail
$order1=new query('orders');
$order1->Where="where id='$oid'";
$order=$order1->DisplayOne();
#update coupon status if used.
if($order->voucher_code!=''):
$cart_obj->mark_coupon_as_used($order->voucher_code);
endif;
//print_r($order);exit;
$order_detail=new query('order_detail');
$order_detail->Where="where order_id='$oid'";
$order_detail->DisplayAll();
//print_r($order_detail);exit;
include_once(DIR_FS_SITE_INCLUDE_EMAIL.'order.php');
send_email(SITE_NAME." | ".$order->id, $order->billing_email, ADMIN_EMAIL, SITE_NAME, $contents, BCC_EMAIL);
//print_r($contents);exit;
$cart_obj->empty_cart();
$cart_obj->regenerate_cart_id();
Redirect(make_url('success'));
?>