<?php
error_reporting(0);
session_start();
require_once('./system/function.php');	
require_once('config.php');
$msg = null;
if ($_POST) {
     $status = $_POST['status'];
     $message = $_POST['message'];
	 $custMobile = $_POST['cust_Mobile'];
	 $amount = $_POST['amount'];
	 $txn_order_id = $_POST['txn_order_id'];
	 $hash = $_POST['hash'];
     if($status == "SUCCESS"){
        $paramList = hash_decrypt($hash,$licence_key);
        $array = json_decode($paramList, true);
        if ($array['txnStatus'] === "TXN_SUCCESS") {
            $totalTxnAmount = $array['txnAmount'];
			$orderId    = $array['orderId'];
            $bank_UTR	= $array['utr'];
            $custEmail = $_POST['cust_Email'];
            $custMobile = $_POST['cust_Mobile'];

        ////////////////// fatch txn ////////////
				echo "<pre>";
			    print_r($array);
				echo "</pre>";
			
            if($_SESSION['txn'] != $orderId){
                $msg = "Subscription Plans updated successfully";
                $_SESSION['txn'] = $orderId;
            } else if($_SESSION['txn'] == $orderId){
                $msg = "Subscription Plans already updated";
            } else{
                $msg = "Invalid Amount";
            }
        ////////////////// fatch txn ////////////
        } else {
            $msg = "Invalid Key";
		}} else {
			$msg = $message;
		}  
    } else {
        $msg =  "Invalid DATA";
    }
 ?>
<html>
<?php require_once('head.php');?>
<body>
  <?php  if($msg != null){?>
  <meta http-equiv = "refresh" content = "<?php echo $redirect_timer."; url =".$url;?>" />
  <?php }?>
   <center> <h2 style="padding-top: 100px;"><?php echo $msg;?></h2> </center>  
   <center> <h1>Please Wait...</h1> </center>
</body>
</html>
