forked from arunksv3/Paytm_Web_Sample_Kit_PHP
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsearch.php
104 lines (83 loc) · 3.09 KB
/
search.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
<?php
header("Pragma: no-cache");
header("Cache-Control: no-cache");
header("Expires: 0");
// following files need to be included
require_once("./lib/config_paytm.php");
require_once("./lib/encdec_paytm.php");
$ORDER_ID = "";
$requestParamList = array();
$responseParamList = array();
if (isset($_POST["ORDER_ID"]) && $_POST["ORDER_ID"] != "") {
// In Test Page, we are taking parameters from POST request. In actual implementation these can be collected from session or DB.
$ORDER_ID = $_POST["ORDER_ID"];
// Create an array having all required parameters for status query.
$requestParamList = array("MID" => PAYTM_MERCHANT_MID , "ORDERID" => $ORDER_ID);
$StatusCheckSum = getChecksumFromArray($requestParamList,PAYTM_MERCHANT_KEY);
$requestParamList['CHECKSUMHASH'] = $StatusCheckSum;
// Call the PG's getTxnStatusNew() function for verifying the transaction status.
$responseParamList = getTxnStatusNew($requestParamList);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!------ Include the below in your HEAD tag ---------->
<?php
include "include/head.php";
?>
<!------ Include the above in your HEAD tag ---------->
<body>
<div class="container search-table" style="margin-top:40px;padding: 30px;border-radius: 5px;">
<!------ Include the below in your NAV tag ---------->
<?php
include "include/nav.php";
?>
<!------ Include the above in your NAV tag ---------->
<form method="post" action="">
<div class="search-box">
<div class="row">
<div class="col-md-3">
<h4>Transaction status query</h4>
</div>
<div class="col-md-7">
<input type="text" id="ORDER_ID" name="ORDER_ID" class="form-control" placeholder="Enter ORDER_ID" value="<?php echo $ORDER_ID ?>">
</div>
<div class="col-md-2">
<input value="Search" class="btn btn-success" type="submit" onclick="">
</div>
</div>
</div>
<?php
if (isset($responseParamList) && count($responseParamList)>0 )
{
?>
<div class="search-list">
<h3>Response of status query:</h3>
<table class="table" id="myTable">
<thead>
<tr>
<th>ATTRIBUTE</th>
<th>STATUS</th>
</tr>
</thead>
<tbody>
<?php
foreach($responseParamList as $paramName => $paramValue) {
?>
<tr >
<td><?php echo $paramName?></td>
<td><?php echo $paramValue?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
}
?>
</form>
</div>
</body>
</html>