-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkout.php
559 lines (540 loc) · 19.6 KB
/
checkout.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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<title>Checkout</title>
<style>
*,
*::before,
*::after {
box-sizing: border-box;
}
html,
body {
min-height: 100%;
font-family: "Open Sans", sans-serif;
}
body {
background: linear-gradient(50deg, #f3c680, #a1e3e2);
}
/*--------------------
Buttons
--------------------*/
.btn {
display: block;
background: #bded7d;
color: white;
text-decoration: none;
margin: 20px 0;
padding: 15px 15px;
border-radius: 5px;
position: relative;
}
.btn::after {
content: "";
position: absolute;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: all 0.2s ease-in-out;
box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0), 0 3px 3px rgba(0, 0, 0, 0.2);
border-radius: 5px;
}
.btn:hover::after {
background: rgba(0, 0, 0, 0.1);
box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.2);
}
/*--------------------
Form
--------------------*/
.form fieldset {
border: none;
padding: 0;
padding: 10px 0;
position: relative;
clear: both;
}
.form fieldset.fieldset-expiration {
float: left;
width: 60%;
}
.form fieldset.fieldset-expiration .select {
width: 84px;
margin-right: 12px;
float: left;
}
.form fieldset.fieldset-ccv {
clear: none;
float: right;
width: 86px;
}
.form fieldset label {
display: block;
text-transform: uppercase;
font-size: 11px;
color: rgba(0, 0, 0, 0.6);
margin-bottom: 5px;
font-weight: bold;
font-family: Inconsolata;
}
.form fieldset input,
.form fieldset .select {
width: 100%;
height: 38px;
color: #333333;
padding: 10px;
border-radius: 5px;
font-size: 15px;
outline: none !important;
border: 1px solid rgba(0, 0, 0, 0.3);
box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2);
}
.form fieldset input.input-cart-number,
.form fieldset .select.input-cart-number {
width: 82px;
display: inline-block;
margin-right: 8px;
}
.form fieldset input.input-cart-number:last-child,
.form fieldset .select.input-cart-number:last-child {
margin-right: 0;
}
.form fieldset .select {
position: relative;
}
.form fieldset .select::after {
content: "";
border-top: 8px solid #222;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
position: absolute;
z-index: 2;
top: 14px;
right: 10px;
pointer-events: none;
}
.form fieldset .select select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
position: absolute;
padding: 0;
border: none;
width: 100%;
outline: none !important;
top: 6px;
left: 6px;
background: none;
}
.form fieldset .select select :-moz-focusring {
color: transparent;
text-shadow: 0 0 0 #000;
}
.form button {
width: 100%;
outline: none !important;
background: linear-gradient(180deg, #49a09b, #3d8291);
text-transform: uppercase;
font-weight: bold;
border: none;
box-shadow: none;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
margin-top: 90px;
}
.form button .fa {
margin-right: 6px;
}
/*--------------------
Checkout
--------------------*/
.checkout {
margin: 150px auto 30px;
position: relative;
width: 460px;
background: white;
border-radius: 15px;
padding: 160px 45px 30px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}
/*--------------------
Credit Card
--------------------*/
.credit-card-box {
perspective: 1000;
width: 400px;
height: 280px;
position: absolute;
top: -112px;
left: 50%;
transform: translateX(-50%);
}
.credit-card-box:hover .flip, .credit-card-box.hover .flip {
transform: rotateY(180deg);
}
.credit-card-box .front,
.credit-card-box .back {
width: 400px;
height: 250px;
border-radius: 15px;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
background: linear-gradient(135deg, #bd6772, #53223f);
position: absolute;
color: #fff;
font-family: Inconsolata;
top: 0;
left: 0;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}
.credit-card-box .front::before,
.credit-card-box .back::before {
content: "";
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: url("http://cdn.flaticon.com/svg/44/44386.svg") no-repeat center;
background-size: cover;
opacity: 0.05;
}
.credit-card-box .flip {
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
.credit-card-box .logo {
position: absolute;
top: 9px;
right: 20px;
width: 60px;
}
.credit-card-box .logo svg {
width: 100%;
height: auto;
fill: #fff;
}
.credit-card-box .front {
z-index: 2;
transform: rotateY(0deg);
}
.credit-card-box .back {
transform: rotateY(180deg);
}
.credit-card-box .back .logo {
top: 185px;
}
.credit-card-box .chip {
position: absolute;
width: 60px;
height: 45px;
top: 20px;
left: 20px;
background: linear-gradient(135deg, #ddccf0 0%, #d1e9f5 44%, #f8ece7 100%);
border-radius: 8px;
}
.credit-card-box .chip::before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
border: 4px solid rgba(128, 128, 128, 0.1);
width: 80%;
height: 70%;
border-radius: 5px;
}
.credit-card-box .strip {
background: linear-gradient(135deg, #404040, #1a1a1a);
position: absolute;
width: 100%;
height: 50px;
top: 30px;
left: 0;
}
.credit-card-box .number {
position: absolute;
margin: 0 auto;
top: 103px;
left: 19px;
font-size: 38px;
}
.credit-card-box label {
font-size: 10px;
letter-spacing: 1px;
text-shadow: none;
text-transform: uppercase;
font-weight: normal;
opacity: 0.5;
display: block;
margin-bottom: 3px;
}
.credit-card-box .card-holder,
.credit-card-box .card-expiration-date {
position: absolute;
margin: 0 auto;
top: 180px;
left: 19px;
font-size: 22px;
text-transform: capitalize;
}
.credit-card-box .card-expiration-date {
text-align: right;
left: auto;
right: 20px;
}
.credit-card-box .ccv {
height: 36px;
background: #fff;
width: 91%;
border-radius: 5px;
top: 110px;
left: 0;
right: 0;
position: absolute;
margin: 0 auto;
color: #000;
text-align: right;
padding: 10px;
}
.credit-card-box .ccv label {
margin: -25px 0 14px;
color: #fff;
}
.the-most {
position: fixed;
z-index: 1;
bottom: 0;
left: 0;
width: 50vw;
max-width: 200px;
padding: 10px;
}
.the-most img {
max-width: 100%;
}
/* vietnamese */
@font-face {
font-family: 'Inconsolata';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
src: url(https://fonts.gstatic.com/s/inconsolata/v21/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp4U8WRL2l2eY.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Inconsolata';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
src: url(https://fonts.gstatic.com/s/inconsolata/v21/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp4U8WRP2l2eY.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Inconsolata';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
src: url(https://fonts.gstatic.com/s/inconsolata/v21/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp4U8WR32lw.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
</style>
</head>
<body>
<div class="checkout">
<div class="credit-card-box">
<div class="flip">
<div class="front">
<div class="chip"></div>
<div class="logo">
<svg version="1.1" id="visa" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="47.834px" height="47.834px" viewBox="0 0 47.834 47.834" style="enable-background:new 0 0 47.834 47.834;">
<g>
<g>
<path d="M44.688,16.814h-3.004c-0.933,0-1.627,0.254-2.037,1.184l-5.773,13.074h4.083c0,0,0.666-1.758,0.817-2.143
c0.447,0,4.414,0.006,4.979,0.006c0.116,0.498,0.474,2.137,0.474,2.137h3.607L44.688,16.814z M39.893,26.01
c0.32-0.819,1.549-3.987,1.549-3.987c-0.021,0.039,0.317-0.825,0.518-1.362l0.262,1.23c0,0,0.745,3.406,0.901,4.119H39.893z
M34.146,26.404c-0.028,2.963-2.684,4.875-6.771,4.875c-1.743-0.018-3.422-0.361-4.332-0.76l0.547-3.193l0.501,0.228
c1.277,0.532,2.104,0.747,3.661,0.747c1.117,0,2.313-0.438,2.325-1.393c0.007-0.625-0.501-1.07-2.016-1.77
c-1.476-0.683-3.43-1.827-3.405-3.876c0.021-2.773,2.729-4.708,6.571-4.708c1.506,0,2.713,0.31,3.483,0.599l-0.526,3.092
l-0.351-0.165c-0.716-0.288-1.638-0.566-2.91-0.546c-1.522,0-2.228,0.634-2.228,1.227c-0.008,0.668,0.824,1.108,2.184,1.77
C33.126,23.546,34.163,24.783,34.146,26.404z M0,16.962l0.05-0.286h6.028c0.813,0.031,1.468,0.29,1.694,1.159l1.311,6.304
C7.795,20.842,4.691,18.099,0,16.962z M17.581,16.812l-6.123,14.239l-4.114,0.007L3.862,19.161
c2.503,1.602,4.635,4.144,5.386,5.914l0.406,1.469l3.808-9.729L17.581,16.812L17.581,16.812z M19.153,16.8h3.89L20.61,31.066
h-3.888L19.153,16.8z" />
</g>
</g>
</svg>
</div>
<div class="number"></div>
<div class="card-holder">
<label>Card holder</label>
<div></div>
</div>
<div class="card-expiration-date">
<label>Expires</label>
<div></div>
</div>
</div>
<div class="back">
<div class="strip"></div>
<div class="logo">
<svg version="1.1" id="visa" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="47.834px" height="47.834px" viewBox="0 0 47.834 47.834" style="enable-background:new 0 0 47.834 47.834;">
<g>
<g>
<path d="M44.688,16.814h-3.004c-0.933,0-1.627,0.254-2.037,1.184l-5.773,13.074h4.083c0,0,0.666-1.758,0.817-2.143
c0.447,0,4.414,0.006,4.979,0.006c0.116,0.498,0.474,2.137,0.474,2.137h3.607L44.688,16.814z M39.893,26.01
c0.32-0.819,1.549-3.987,1.549-3.987c-0.021,0.039,0.317-0.825,0.518-1.362l0.262,1.23c0,0,0.745,3.406,0.901,4.119H39.893z
M34.146,26.404c-0.028,2.963-2.684,4.875-6.771,4.875c-1.743-0.018-3.422-0.361-4.332-0.76l0.547-3.193l0.501,0.228
c1.277,0.532,2.104,0.747,3.661,0.747c1.117,0,2.313-0.438,2.325-1.393c0.007-0.625-0.501-1.07-2.016-1.77
c-1.476-0.683-3.43-1.827-3.405-3.876c0.021-2.773,2.729-4.708,6.571-4.708c1.506,0,2.713,0.31,3.483,0.599l-0.526,3.092
l-0.351-0.165c-0.716-0.288-1.638-0.566-2.91-0.546c-1.522,0-2.228,0.634-2.228,1.227c-0.008,0.668,0.824,1.108,2.184,1.77
C33.126,23.546,34.163,24.783,34.146,26.404z M0,16.962l0.05-0.286h6.028c0.813,0.031,1.468,0.29,1.694,1.159l1.311,6.304
C7.795,20.842,4.691,18.099,0,16.962z M17.581,16.812l-6.123,14.239l-4.114,0.007L3.862,19.161
c2.503,1.602,4.635,4.144,5.386,5.914l0.406,1.469l3.808-9.729L17.581,16.812L17.581,16.812z M19.153,16.8h3.89L20.61,31.066
h-3.888L19.153,16.8z" />
</g>
</g>
</svg>
</div>
<div class="ccv">
<label>CCV</label>
<div></div>
</div>
</div>
</div>
</div>
<form class="form" autocomplete="off" novalidate>
<fieldset>
<label for="card-number">Card Number</label>
<input type="num" id="card-number" class="input-cart-number" maxlength="4" />
<input type="num" id="card-number-1" class="input-cart-number" maxlength="4" />
<input type="num" id="card-number-2" class="input-cart-number" maxlength="4" />
<input type="num" id="card-number-3" class="input-cart-number" maxlength="4" />
</fieldset>
<fieldset>
<label for="card-holder">Card holder</label>
<input type="text" id="card-holder" />
</fieldset>
<fieldset class="fieldset-expiration">
<label for="card-expiration-month">Expiration date</label>
<div class="select">
<select id="card-expiration-month">
<option></option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
</div>
<div class="select">
<select id="card-expiration-year">
<option></option>
<option>2016</option>
<option>2017</option>
<option>2018</option>
<option>2019</option>
<option>2020</option>
<option>2021</option>
<option>2022</option>
<option>2023</option>
<option>2024</option>
<option>2025</option>
</select>
</div>
</fieldset>
<fieldset class="fieldset-ccv">
<label for="card-ccv">CCV</label>
<input type="text" id="card-ccv" maxlength="3" />
</fieldset>
<button class="btn"><i class="fa fa-lock"></i> submit</button>
</form>
</div>
<script>
$(".input-cart-number").on("keyup change", function () {
$t = $(this);
if ($t.val().length > 3) {
$t.next().focus();
}
var card_number = "";
$(".input-cart-number").each(function () {
card_number += $(this).val() + " ";
if ($(this).val().length == 4) {
$(this).next().focus();
}
});
$(".credit-card-box .number").html(card_number);
});
$("#card-holder").on("keyup change", function () {
$t = $(this);
$(".credit-card-box .card-holder div").html($t.val());
});
$("#card-holder").on("keyup change", function () {
$t = $(this);
$(".credit-card-box .card-holder div").html($t.val());
});
$("#card-expiration-month, #card-expiration-year").change(function () {
m = $("#card-expiration-month option").index(
$("#card-expiration-month option:selected")
);
m = m < 10 ? "0" + m : m;
y = $("#card-expiration-year").val().substr(2, 2);
$(".card-expiration-date div").html(m + "/" + y);
});
$("#card-ccv")
.on("focus", function () {
$(".credit-card-box").addClass("hover");
})
.on("blur", function () {
$(".credit-card-box").removeClass("hover");
})
.on("keyup change", function () {
$(".ccv div").html($(this).val());
});
/*--------------------
CodePen Tile Preview
--------------------*/
setTimeout(function () {
$("#card-ccv")
.focus()
.delay(1000)
.queue(function () {
$(this).blur().dequeue();
});
}, 500);
/*function getCreditCardType(accountNumber) {
if (/^5[1-5]/.test(accountNumber)) {
result = 'mastercard';
} else if (/^4/.test(accountNumber)) {
result = 'visa';
} else if ( /^(5018|5020|5038|6304|6759|676[1-3])/.test(accountNumber)) {
result = 'maestro';
} else {
result = 'unknown'
}
return result;
}
$('#card-number').change(function(){
console.log(getCreditCardType($(this).val()));
})*/
</script>
</body>
</html>