-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpgRedirect.php
105 lines (91 loc) · 3.66 KB
/
pgRedirect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
header("Pragma: no-cache");
header("Cache-Control: no-cache");
header("Expires: 0");
include_once("./lib/config_paytm.php");
include_once("./lib/encdec_paytm.php");
$checkSum = "";
$paramList = array();
$ORDER_ID = $_POST["ORDER_ID"];
$CUST_ID = $_POST["CUST_ID"];
$INDUSTRY_TYPE_ID = $_POST["INDUSTRY_TYPE_ID"];
$CHANNEL_ID = $_POST["CHANNEL_ID"];
$TXN_AMOUNT = $_POST["TXN_AMOUNT"];
$DONOR_NAME = $_POST["DONOR_NAME"];
$MOBILE_NUMBER = $_POST["MOBILE_NUMBER"];
$EMAIL_ID = $_POST["EMAIL_ID"];
$Anonymous = isset($_POST['Anonymous']) ? 'YES' : 'NO';
setcookie('NAME', $DONOR_NAME , time() +60*60*3);
setcookie('EMAIL_ID', $EMAIL_ID , time() +60*60*3);
setcookie('CUST_ID', $CUST_ID , time() +60*60*3);
setcookie('Anonymous', $Anonymous , time() +60*60*3);
if(!isset($_COOKIE['NAME']) && !isset($_COOKIE['CUST_ID']) && !isset($_COOKIE['EMAIL_ID'])){
$_COOKIE['NAME'] = "NAN";
$_COOKIE['CUST_ID'] = "NAN";
$_COOKIE['EMAIL_ID'] = "NAN";
?>
<script>
alert("Please Enable Cookies for this site");
window.location = 'index.php';
</script>
<?php
}
// Create an array having all required parameters for creating checksum.
$paramList["MID"] = PAYTM_MERCHANT_MID;
$paramList["ORDER_ID"] = $ORDER_ID;
$paramList["CUST_ID"] = $CUST_ID;
$paramList["INDUSTRY_TYPE_ID"] = $INDUSTRY_TYPE_ID;
$paramList["CHANNEL_ID"] = $CHANNEL_ID;
$paramList["TXN_AMOUNT"] = $TXN_AMOUNT;
$paramList["WEBSITE"] = PAYTM_MERCHANT_WEBSITE;
$paramList["CALLBACK_URL"] = "http://localhost/ver_2/pgResponse.php";
$paramList["EMAIL"] = $EMAIL_ID;
/*
$paramList["MSISDN"] = $MSISDN; //Mobile number of customer
*/
//Here checksum string will return by getChecksumFromArray() function.
$checkSum = getChecksumFromArray($paramList,PAYTM_MERCHANT_KEY);
?>
<html>
<head>
<title>Merchant Check Out Page</title>
<!-- Bootstamp CSS for Spinner -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<body>
<h1 class='text-center'>Please do not refresh this page...</h1>
<div class="d-flex justify-content-center">
<i class="fa fa-spinner fa-pulse fa-3x fa-fw text-center"></i>
</div>
<!-- Finally Sending Data to paytm -->
<form method="post" action="<?php echo PAYTM_TXN_URL ?>" name="paytm">
<table style="border: 1px solid black;">
<tbody>
<?php
foreach($paramList as $name => $value) { ?>
<input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>">
<?php
}
?>
<input type="hidden" name="CHECKSUMHASH" value="<?php echo $checkSum ?>">
</tbody>
</table>
<script type="text/javascript">
setTimeout(() => {
document.paytm.submit()
}, 2000);
</script>
</form>
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous">
</script>
</body>
</html>