<?php


// ===================================
//  Costomize : RAJNI WEB DEVELOPER =====
//  Date   : 23/12/2023 ==============
//  Version : 1.0.2 ==================
//  About  : Paid Payment Gatway =====
//  Insta  : rajni.kant.mahato =======
//  Telegram : Simplehacker1 =========
//  whatsapp : 919771241425 ==========
// ====================================


// LICENCE UDYAM-JH-06-0039636
// ENTERPRISE RAJNI WEB DEVELOPER
// Copyright (c) 2022 - 2023 The SM02

// Permission is hereby granted, free of charge, to any person or MSME (Micro, Small, and Medium Enterprises) obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software with permission from the author, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons or MSMEs to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.

// Usage without explicit permission from the author is strictly prohibited.
// If you have any inquiries or need permission, please contact the author.

// THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

// If you have any problems, please contact the author.
session_start();


$am = $_GET['am'];
$user= $_GET['user'];
function random_strings($length_of_string)
    {
        $str_result = '0123456789AXYZ012345678901234567890123456789';
        return substr(
            str_shuffle($str_result),
            0,
            $length_of_string
        );
    }
$rand=random_strings(22);
error_reporting(0);
require_once('checksum.php');     //checksum
require_once('conn.php'); 

$token = '3eb973-5e7dca-b2fd67-2e5710-494a5e'; // Your Token, (Url:http://example.com/Settings).
$secret = 'AnEnXHu0Bq'; // Your Secret Key, (Url:http://example.com/Settings).
$RECHPAY_ENVIRONMENT = 'PROD'; // PROD, TEST  

$checkSum = "";
$upiuid = "";
$paramList = array();

$gateway_type = "Robotics";
$cust_Mobile = $user;          //cust mobile 
$cust_Email = 'test@gmail.com';     //cust email
$orderId = uniqid().time();  //orderid
$txnAmount = $am;                     //amount
$txnNote = $user;                  //special note
$callback_url = "https://mxwin.in/payment/txnResult.php";  //callback 

if ($gateway_type == "Robotics") {
    $RECHPAY_TXN_URL = 'https://mupi.colorgame.co.in/order/paytm';

    $upiuid = 'paytmqr281005050101ha5gvu9gvmv8@paytm'; // Its Paytm Business UPI Unique ID.

    $paramList["cust_Mobile"] = $cust_Mobile;
    $paramList["cust_Email"] = $cust_Email;
}

// Create an array having all required parameters for creating checksum.
$paramList["upiuid"] = $upiuid;
$paramList["token"] = $token;
$paramList["orderId"] = $orderId;
$paramList["txnAmount"] = $txnAmount;
$paramList["txnNote"] = $txnNote;
$paramList["callback_url"] = $callback_url;
$sql1 = "INSERT INTO recharge (username, recharge,status,upi,utr,rand) VALUES ('$user', '$am','unpaid','$upiuid','$orderId','$rand')";

$checkSum = RechPayChecksum::generateSignature($paramList, $secret);
$conn->query($sql1);
?>
<html>
<head>
<title>Gateway Check Out Page</title>
</head>
<body>
	<center><h1>Please do not refresh this page...</h1></center>
		<form method="post" action="<?php echo $RECHPAY_TXN_URL ?>" name="f1">
		<table border="1">
			<tbody>
			<?php
			foreach ($paramList as $name => $value) {
				echo '<input type="hidden" name="' . $name .'" value="' . $value . '">';
			}
			?>
			<input type="hidden" name="checksum" value="<?php echo $checkSum ?>">
			</tbody>
		</table>
		<script type="text/javascript">
			document.f1.submit();
		</script>
	</form>
</body>
</html>
