HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /var/www/grapossconnect/adminapi/check_transaction_status.php
<?php 
// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);

include("../config.php");
date_default_timezone_set('Asia/Kolkata');
$curDate = date('Y-m-d H:i:s');
$grp_online_txn_temp = 'grp_online_txn_temp';

$responseBody='';
$responseHead = '';
if(isset($_POST['clicktocheck'])){
    $txndate = $_REQUEST['transaction_date'];
    if(!empty($txndate)){
        $getagentWallet = $conn->query("SELECT `temp_id`, `txn_type`, `agent_id`, `amount`, `net_amount`, `payment_gateway`, `order_id`, `txn_status`, `txn_date` FROM $grp_online_txn_temp WHERE 1 AND date(txn_date) = '$txndate'");
        $i = 1;
        $responseHead .= '<tr><th scope="col">S No</th><th scope="col">Id</th><th scope="col">Transaction Date</th><th scope="col">Transaction Type</th><th scope="col">Agent</th><th scope="col">Amount</th><th scope="col">Net Amount</th><th scope="col">Order Id</th><th scope="col">Gateway</th><th scope="col">Status</th><th scope="col">Verify</th></tr>';
        $responseBody='';
		foreach($getagentWallet as $reg){
			$txnId = $reg['temp_id'];
            $date_added = $reg['txn_date'];
            $txnType = $reg['txn_type'];
            $agent_id = $reg['agent_id'];
            $txn_amount = $reg['amount']; 
            $net_amount = $reg['net_amount']; 
            $order_id = $reg['order_id'];
            $payment_gateway = $reg['payment_gateway'];
            $txn_status = $reg['txn_status'];
            if($txn_status=='S'){
                $verify = "<td><span class='btn btn-secondary btn-sm disabled' style='font-weight: 600;'>verify</span></td>";
            } else {
                $verify = "<td><span class='btn btn-secondary btn-sm' onclick='checkorderstatus($txnId)' style='font-weight: 600;'>verify</span></td>";
            }
            $responseBody .= "<tr><td>".$i."</td><td>".$txnId."</td><td>".$date_added."</td><td>".$txnType."</td><td>".$agent_id."</td><td>".$txn_amount."</td><td>".$net_amount."</td><td>".$order_id."</td><td>".$payment_gateway."</td><td>".$txn_status."</td>".$verify."</tr>";
		$i++;	
		}
    } 
}

//if btn update 
$pgSt = 0;
if(isset($_POST['clicktoupdate'])){
    include '../sample-wp/wp-config.php';
    $vle_temp_id = $_POST['refferal_id'];
    $temp_txn_id = $_POST['order_no'];
    $pay_response_id = $_POST['pay_response'];
    $order_response_id = $_POST['order_response'];
    if (is_numeric($temp_txn_id) && $temp_txn_id != '') {
        $result = $wpdb->get_row("SELECT temp_id, txn_type, agent_id, net_amount, transaction_id, txn_status FROM grp_online_txn_temp WHERE temp_id='$temp_txn_id' AND txn_status='P' LIMIT 1");
        if ($result) {
        $AGENT_ID = $result->agent_id;
        $txn_id = $result->transaction_id;
        $paymentTxn_id = $pay_response_id;
        $paymentOrd_id = $order_response_id;
        $amount = $result->net_amount;
        $txnstatus = 'S';
        $txnMessage = 'Transaction Successful';
        $email = $wpdb->get_var("SELECT email FROM grp_agents WHERE agent_id='$AGENT_ID'");
        $txn_other_data = $txn_id . '||' . $temp_txn_id . '||' . $amount . '||' . $email . '||' . $txnstatus . '||' . $txnMessage;
            if ($paymentTxn_id != '' && $paymentOrd_id !='') {
                include_once('../center-admin/agentFunctions.php');
                $pgSt = 1;
                walletCreditSuccess($AGENT_ID, $txn_id,$paymentTxn_id, $paymentOrd_id,$amount, $txn_other_data, 'Razorpay', $email, 'Test Agent');
                $showMessage = "Success: Transaction successful";
            } else {
                include_once('../center-admin/agentFunctions.php');
                $pgSt = 2;
                walletCreditFail($AGENT_ID, $txn_id, $amount, $txn_other_data, 'Razorpay', $email, 'Test Agent');
                $showMessage = "Error: user details not generated";
            }
        } else {
            $pgSt = 2;
            $showMessage = "Error: Temp detail not fetch";
        }
    }
}    
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>CENTER ADMIN CHECK TRANSACTION</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
    <link href="../css/bootstrap-datepicker.css" rel="stylesheet" />
    <style>
    html,
    body {
      overflow-x: hidden;
    }
    body {
      padding-top: 20px;
    }
  </style>
</head>

<body style="background: #ececec;">
    <main class="container">
        <div class="d-flex align-items-center p-3 my-4 text-white bg-primary rounded shadow-sm">
            <div class="row">
                <div class="my-2" style="background: #0d6efd; margin-top: -30px !important; margin: -4px; border-radius: 5px; padding: 6px 18px 0px; width: 35%;">
                    <h1 class="h6 mb-0 text-white lh-1">CHECK CENTER ADMIN TRANSACTION</h1>
                </div>
                <div class="col-md-12">
                    <div class="col-md-9">
                        <form method="post">    
                            <div class="input-group">
                                <input type="text" name="transaction_date" id="transaction-date" class="form-control" placeholder="Select Date" value="<?php if(isset($_REQUEST['transaction_date'])){ echo $_REQUEST['transaction_date']; } ?>" autocomplete="off">
                                <button type="submit" class="btn btn-secondary" name="clicktocheck">Check Status</button>
                            </div>
                        </form>    
                    </div>
                    <div class="col-md-3"></div>
                </div>
            </div>
        </div>

        <?php if($pgSt==1){ ?>
                <div class="alert alert-success" role="alert"><?php echo $showMessage; ?></div>
        <?php } else if($pgSt==2) { ?>
                <div class="alert alert-danger" role="alert"><?php echo $showMessage; ?></div>
        <?php } ?>
        <div class="my-3 p-3 bg-body rounded shadow-sm">
            <h6 class="border-bottom pb-2 mb-0">Recent updates</h6>
            <table class="table table-bordered">
                <thead>
                    <?php echo $responseHead; ?>
                </thead>
                <tbody>
                    <?php echo $responseBody; ?>
                </tbody>
            </table>
        </div>
       
    </main>
    <!-- modal for verification account -->
    <div class="modal fade" id="orderModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Order Detail</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body" id="show_orderdetail"></div>
            </div>
        </div>
    </div>
    <!-- footer -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
    <script src="../js/bootstrap-datepicker.js" type="text/javascript"></script>
    <script>
        $('#transaction-date').datepicker({
            todayHighlight: true,
            autoclose: true,
            format: 'yyyy-mm-dd'
        });
    </script>
    <script>
        function checkorderstatus(id) {
            $.ajax({
                url: "check_transaction_status_api.php",
                method: "post",
                data: {
                    orderId : id
                },
                success: function(data) {
                    $('#show_orderdetail').html(data);
                    $('#orderModal').modal("show");
                }
            });
        };
    </script>
    <!-- footer -->
</body>

</html>