-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgResponse.php
69 lines (57 loc) · 1.87 KB
/
pgResponse.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
<?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");
session_start();
include('database.inc.php');
include('function.inc.php');
include('constant.inc.php');
include('smtp/PHPMailerAutoload.php');
$paytmChecksum = "";
$paramList = array();
$isValidChecksum = "FALSE";
$paramList = $_POST;
$paytmChecksum = isset($_POST["CHECKSUMHASH"]) ? $_POST["CHECKSUMHASH"] : "";
$isValidChecksum = verifychecksum_e($paramList, PAYTM_MERCHANT_KEY, $paytmChecksum); //will return TRUE or FALSE string.
if($isValidChecksum == "TRUE") {
if ($_POST["STATUS"] == "TXN_SUCCESS") {
$TXNID=$_POST['TXNID'];
$amt=$_POST['TXNAMOUNT'];
//if(isset($_SESSION['IS_WALLET'])){
//manageWallet($_SESSION['FOOD_USER_ID'],$amt,'in','Added',$TXNID);
//unset($_SESSION['IS_WALLET']);
//redirect(FRONT_SITE_PATH.'wallet');
//}else{
$oid=$_POST['ORDERID'];
$oArr=explode('_',$oid);
$oid=$oArr[0];
$uid=$oArr[1];
$getUserDetailsBy=getUserDetailsByid($uid);
$email=$getUserDetailsBy['email'];
$emailHTML=orderEmail($oid,$uid);
$_SESSION['ORDER_ID']=$oid;
mysqli_query($con,"update order_master set payment_status='success', payment_id='$TXNID' where id='$oid'");
send_email($email,$emailHTML,'Order Placed');
redirect(FRONT_SITE_PATH.'success');
//}
}
else {
$oid=$_POST['ORDERID'];
$oArr=explode('_',$oid);
$oid=$oArr[0];
$TXNID=$_POST['TXNID'];
mysqli_query($con,"update payment_status='failed', payment_id='$TXNID' where id='$oid'");
redirect(FRONT_SITE_PATH.'error');
}
}else{
$oid=$_POST['ORDERID'];
$oArr=explode('_',$oid);
$oid=$oArr[0];
$TXNID=$_POST['TXNID'];
mysqli_query($con,"update payment_status='failed', payment_id='$TXNID' where id='$oid'");
redirect(FRONT_SITE_PATH.'error');
}
?>