-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuccess.php
88 lines (78 loc) · 3.36 KB
/
success.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
<!DOCTYPE html>
<html>
<head>
<title>Transaction Successful</title>
</head>
<body>
<div style='text-align: center;'><h1>Transaction Successful</h1>
<?php
include_once 'config.php';
error_reporting(0);
ini_set('display_errors', 0);
$tran_id = $_POST['tran_id'];
$val_id = $_POST['val_id'];
$amount = $_POST['amount'];
$currency = $_POST['currency'];
if (!empty($val_id)) {
$validationUrl = API_URL . "/validator/api/validationserverAPI.php";
$data = [
'val_id' => $val_id,
'store_id' => STORE_ID,
'store_passwd' => STORE_PASSWD,
'format' => json,
];
$queryString = http_build_query($data);
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $validationUrl . "?" . $queryString);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
$return = curl_exec($handle);
curl_close($handle);
$content = json_decode($return);
$status = $content->status;
if (in_array($status, ['VALID', 'VALIDATED'])) {
echo "<h2 style='color: green;'>Congratulations! Your Transaction is Successful.</h2>";
?>
<table border="1" class="table">
<thead>
<tr>
<th colspan="2">Payment Status</th>
</tr>
</thead>
<tr>
<td>Transaction ID</td>
<td><?php echo $_POST['tran_id'] ?></td>
</tr>
<tr>
<td>Card Type</td>
<td><?php echo $_POST['card_type'] ?></td>
</tr>
<tr>
<td>Bank Transaction ID</td>
<td><?php echo $_POST['bank_tran_id'] ?></td>
</tr>
<tr>
<td>Card Type</td>
<td><?php echo $_POST['card_type'] ?></td>
</tr>
<tr>
<td>Amount</td>
<td><?php echo $_POST['currency_amount'] ?></td>
</tr>
</table>
</div>
<?php
// } else {
// }
} else {
echo "<h2 style='color: green; text-align: center;'>Congratulations! Your Transaction is Successful </h2>";
echo "<span style='color: red;'>But validation failed.</span><h2> Transaction ID: " . $_POST['tran_id'] . "</h2>";
if(DEBUG) {
echo '<pre>';
print_r($content);
}
}
} else {
}
?>
</body>
</html>