-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcancelitem.php
93 lines (81 loc) · 3.24 KB
/
cancelitem.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
<?php
#20111214 #1581:sougata
include("LIB/lib.php");
//$hapi = new HAPI();
$hapi = new HAPI(CH_KEY, CH_SEC);
$orderId = $_REQUEST['orderId'];
$itemId = $_REQUEST['itemId'];
if(!isset($orderId))
{
echo'<script> window.location="'.site_url().'/session-expire?e=Order Id Not found"; </script> ';
//header("location: session-expire.php?e=Order Id Not found");
}
if(!isset($itemId))
{
echo'<script> window.location="'.site_url().'/session-expire?e=Order Item Not Found"; </script> ';
//header("location: session-expire.php?e=Order Item Not Found");
}
if(isset($_POST["ispost"]) && $_POST["ispost"]==1)
{
$charge = $_POST["txtCharge"];
$description = $_POST["txtDesc"];
$cancelDom = $hapi->cancelOrderItem(array(
'orderId'=>$orderId,
'reservationId'=>$itemId,
'cancelCharge'=>$charge,
'description'=>$description
)
);
//header("location: view-order.php?orderId=$orderId");
echo'<script> window.location="'.site_url().'/view-order?orderId='.$orderId.'"; </script> ';
}
//$hapi = new HAPI();
$hapi = new HAPI(CH_KEY, CH_SEC);
$dom = $hapi->getCancellationCharge(array('orderId' => $orderId,'reservationId' => $itemId));
print $dom->saveXML();
//
//
//$dom = new DOMDocument();
//$dom->load("cancelcharge.xml");
//print_r($dom->saveXML());
$responseStatus = $dom->getElementsByTagName('status')->item(0)->getAttribute("code");
$cancelAmount = $dom->getElementsByTagName('charge')->item(0)->getAttribute("amount");
if ($responseStatus != 1605)
{
echo "There is reponse error! ";
die();
}
?>
<html>
<body>
<form method="post" >
<table border="1" style="width:50%;border-width :1;border-style: none;"
cellspacing="2" cellpadding="5" align="center">
<tr>
<td align="center" colspan="2" ><strong>Cancellation Policy for Reservation :: <?php echo $itemId ?></strong></td>
</tr>
<tr>
<td width="60%"><b>Policy Cancellation Amount</b><input type="hidden" id="ispost" name="ispost" value="1"/> </td>
<td width="40%"><?php echo $cancelAmount ?></td>
</tr>
<tr>
<td width="60%"><b>Cancellation Amount</b></td>
<td width="40%"><input type="text" id="txtCharge" name="txtCharge" value="<?php echo $cancelAmount ?>"/></td>
</tr>
<tr>
<td width="60%"><b>Cancellation Description</b></td>
<td width="40%"><input type="text" id="txtDesc" name="txtDesc" value=""/></td>
</tr>
<tr height="50px">
<td width="60%"></td>
<td width="40%"></td>
</tr>
<tr>
<td width="60%" align="right"><input type="submit" value="Cancel Reservation"/></td>
<td width="40%"><input type="button" onclick="javascript:window.history.back();"
value="Back"/></td>
</tr>
</table>
</form>
</body>
</html>