-
Notifications
You must be signed in to change notification settings - Fork 4
/
payment.php
282 lines (257 loc) · 11.7 KB
/
payment.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<?php
require("loginheader.php");
if($_GET['seatno']=="" || $_GET['inputdate']=="" || $_GET['TicketPrice']=="" || $_GET['scheduleno']==""){
header("location:searchbus.php");
}
if($_GET['PromoCode']=="none" ){
$promopercent = 0;
}
$sql = "SELECT *
FROM bus_schedule
LEFT JOIN bus ON bus_schedule.BusNo = bus.BusNo
WHERE ScheduleNo =".$_GET['scheduleno'];
$query = mysqli_query($con,$sql);
$row = mysqli_fetch_array($query);
if($row)
{
$BusCompany = $row['BusCompany'];
$scheduleno = $row['ScheduleNo'];
$busno = $row['BusNo'];
$inputFrom = $row['ScheduleDepart'];
$inputTo = $row['ScheduleArrive'];
$inputTime = $row['ScheduleStartTime'];
$ScheduleDuration = $row['ScheduleDuration'];
$TicketPrice = $row['TicketPrice'];
}
$seatno = $_GET["seatno"];
$inputDepartDate = $_GET['inputdate'];
if(isset($_GET['PromoCode']))
{
$promocode = $_GET['PromoCode'];
$sql = "SELECT * FROM promo_code WHERE PromoCode ='".$promocode."'";
$query = mysqli_query($con,$sql);
$row = mysqli_fetch_array($query);
if($row)
{
$promopercent = $row['PromoPercentage'];
}
$TotalPrice = $TicketPrice - ($TicketPrice * ($promopercent/100));
}
else
{
$promocode = "";
$TotalPrice = $TicketPrice;
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../../../favicon.ico">
<title>blueBus - Payment</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- Custom styles for this template -->
<link href="css/offcanvas.css" rel="stylesheet">
<link href="css/form-validation.css" rel="stylesheet">
<!-- Aos.js -->
<link href="https://unpkg.com/[email protected]/dist/aos.css" rel="stylesheet">
</head>
<body class="bg-light">
<!-- HEADER-->
<?php
include('assets/header.php');
?>
<div class="container">
<div class="py-5 text-center">
<h2>Almost Done!</h2>
<p class="lead">Please read your booking details clearly before make payment.</p>
</div>
<div class="row">
<div class="col-md-4 order-md-2 mb-4">
<h4 class="d-flex justify-content-between align-items-center mb-3">
<span class="text-muted">Your Booking Details</span>
</h4>
<ul class="list-group mb-3">
<li class="list-group-item d-flex justify-content-between lh-condensed" style="border:0px">
<div>
<h6 class="my-0">Bus Company</h6>
</div>
<span class="text-muted"><?php echo"$BusCompany"; ?></span>
</li>
<li class="list-group-item d-flex justify-content-between lh-condensed" style="border:0px">
<div>
<h6 class="my-0">Bus No</h6>
</div>
<span class="text-muted"><?php echo"$busno"; ?></span>
</li>
<li class="list-group-item d-flex justify-content-between lh-condensed " style="border:0px">
<div>
<h6 class="my-0">Origin</h6>
</div>
<span class="text-muted"><?php echo"$inputFrom"; ?></span>
</li>
<li class="list-group-item d-flex justify-content-between lh-condensed" style="border:0px">
<div>
<h6 class="my-0">Destination</h6>
</div>
<span class="text-muted"><?php echo"$inputTo"; ?></span>
</li>
<li class="list-group-item d-flex justify-content-between lh-condensed" style="border:0px">
<div>
<h6 class="my-0">Duration</h6>
</div>
<span class="text-muted"><?php echo"$ScheduleDuration"; ?></span>
</li>
<li class="list-group-item d-flex justify-content-between lh-condensed " style="border:0px">
<div>
<h6 class="my-0">Seat No</h6>
</div>
<span class="text-muted"><?php echo"$seatno"; ?></span>
</li>
<li class="list-group-item d-flex justify-content-between lh-condensed" >
<div>
<h6 class="my-0">Ticket Price</h6>
</div>
<span class="text-muted"><?php echo"$TicketPrice"; ?></span>
</li>
<li class="list-group-item d-flex justify-content-between bg-light">
<div class="text-success">
<h6 class="my-0">Promo code</h6>
</div>
<span class="text-success"><?=$promocode?></span>
</li>
<li class="list-group-item d-flex justify-content-between">
<span>Total (MYR)</span>
<strong><?php echo"$TotalPrice"; ?></strong>
</li>
</ul>
<form class="card p-2" action = "promo_valid.php?seatno=<?=$_GET['seatno']?>&inputdate=<?=$_GET['inputdate']?>&scheduleno=<?=$_GET['scheduleno']?>&TicketPrice=<?=$_GET['TicketPrice']?>" method="POST">
<div class="input-group">
<input type="text" class="form-control" name="PromoCode" placeholder="Promo code">
<div class="input-group-append">
<button type="submit" name="Reedem" class="btn btn-secondary">Redeem</button>
</div>
</div>
</form>
</div>
<div class="col-md-8 order-md-1">
<div class="row">
<div class="col-md-6 mb-3">
<div class="media text-muted pt-3">
<img src="images/calendar.png" alt="" class="mr-2 rounded" style="width:10%; max-width:25px;">
<label for="cc-name">Date</label>
</div>
<strong><?php echo"$inputDepartDate";?></strong>
</div>
<div class="col-md-6 mb-3">
<div class="media text-muted pt-3">
<img src="images/clock.svg" alt="" class="mr-2 rounded" style="width:10%; max-width:25px;">
<label for="cc-number">Time</label>
</div>
<strong><?php echo"$inputTime"; ?></strong>
<div class="invalid-feedback">
Credit card number is required
</div>
</div>
</div>
<form action = "payment.inc.php?promocode=<?=$promocode?>&seatno=<?=$_GET['seatno']?>&inputdate=<?=$_GET['inputdate']?>&scheduleno=<?=$_GET['scheduleno']?>&TicketPrice=<?=$_GET['TicketPrice']?>" method="POST">
<hr class="mb-4">
<h4 class="mb-3">Payment</h4>
<div class="d-block my-3">
<div class="custom-control custom-radio">
<input id="credit" type="radio" name="PaymentType" value="Credit Card" class="custom-control-input" checked required>
<label class="custom-control-label" for="credit">Credit card</label>
</div>
<div class="custom-control custom-radio">
<input id="debit" name="PaymentType" value= "Debit Card" type="radio" class="custom-control-input" required>
<label class="custom-control-label" for="debit">Debit card</label>
</div>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label for="cc-name">Name on card</label>
<input type="text" class="form-control" name="CardName" id="cc-name" placeholder="" required>
<small class="text-muted">Full name as displayed on card</small>
<div class="invalid-feedback">
Name on card is required
</div>
</div>
<div class="col-md-6 mb-3">
<label for="cc-number">Credit card number</label>
<input type="text" class="form-control" maxlength="16" pattern="[1-9][0-9][0-9][0-9]{13}" name="CardNumber" id="cc-number" placeholder="" required>
<div class="invalid-feedback">
Credit card number is required
</div>
</div>
</div>
<div class="row">
<div class="col-md-3 mb-3">
<label for="cc-expiration">Expiration Month</label>
<input type="text" class="form-control" maxlength="2" pattern="[0-1][0-9]{1}" name="ExpireMonth" id="cc-expiration" placeholder="MM" required>
<div class="invalid-feedback">
Expiration date required
</div>
</div>
<div class="col-md-3 mb-3">
<label for="cc-expiration">Year</label>
<input type="text" class="form-control" maxlength="4" pattern="[2-3][0][2-5][0-9]{1}" name="ExpireYear" id="cc-expiration" placeholder="YYYY" required>
<div class="invalid-feedback">
Expiration date required
</div>
</div>
<div class="col-md-3 mb-3">
<label for="cc-expiration">CVV</label>
<input type="text" maxlength="3" pattern="\d{3}" class="form-control" name="CVV" id="cc-cvv" placeholder="" required>
<div class="invalid-feedback">
Security code required
</div>
</div>
</div>
<hr class="mb-4">
<button class="btn btn-primary btn-lg btn-block" name="checkout" type="submit">Continue to checkout</button>
</form>
</div>
</div>
<footer class="my-5 pt-5 text-muted text-center text-small">
<p class="mb-1">© 2017-2018 Company Name</p>
<ul class="list-inline">
<li class="list-inline-item"><a href="#">Privacy</a></li>
<li class="list-inline-item"><a href="#">Terms</a></li>
<li class="list-inline-item"><a href="#">Support</a></li>
</ul>
</footer>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="../../../../assets/js/vendor/jquery-slim.min.js"><\/script>')</script>
<script src="../../../../assets/js/vendor/popper.min.js"></script>
<script src="../../../../dist/js/bootstrap.min.js"></script>
<script src="../../../../assets/js/vendor/holder.min.js"></script>
<!-- Placed <script>
// Example starter JavaScript for disabling form submissions if there are invalid fields
(function() {
'use strict';
window.addEventListener('load', function() {
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.getElementsByClassName('needs-validation');
// Loop over them and prevent submission
var validation = Array.prototype.filter.call(forms, function(form) {
form.addEventListener('submit', function(event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
}, false);
})();
</script>-->
</body>
</html>