-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpay.html
79 lines (71 loc) · 1.87 KB
/
pay.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Payment | My Hours</title>
<link
rel="icon"
href="https://gdm-catalog-fmapi-prod.imgix.net/ProductLogo/b5f28d17-3a80-4bf3-aa0c-82ca5cdcccf2.png?w=100&q=50"
type="image/x-icon"
/>
<style>
img {
margin-left: 38%;
}
h1 {
margin-left: 44%;
}
button {
margin-left: 45%;
width: 200px;
height: 50px;
font-size: 25px;
cursor: pointer;
border-radius: 5px;
border: 1px solid #208fe4;
background-color: #c3eaff;
}
</style>
</head>
<body>
<img
src="https://c.tenor.com/xnZaQ3O98dMAAAAC/thinking-processing.gif"
id="pay_img"
/>
<h1 id="text">payment processing ...</h1>
<button onclick="back()">Go Back</button>
</body>
</html>
<script>
let back = () => {
window.location.href = "homep.html";
};
let bankserver = () => {
return true;
};
let payment_promise = new Promise(function (resolve, reject) {
let pin = bankserver();
setTimeout(function () {
if (pin) {
resolve("Payment succesfull");
} else {
reject("try again");
}
}, 2000);
});
let image = document.getElementById("pay_img");
let caption = document.getElementById("text");
payment_promise.then(function (res) {
caption.innerText = res;
caption.style.color = "green";
image.src = "https://c.tenor.com/xVfFIHxAzW4AAAAC/success.gif";
});
payment_promise.catch(function (rej) {
caption.innerText = res;
caption.style.color = "red";
image.src = "https://c.tenor.com/flmQIupAKBkAAAAC/steven-he-failure.gif";
});
// console.log(payment_promise);
</script>