-
Notifications
You must be signed in to change notification settings - Fork 1
/
payment.html
104 lines (95 loc) · 2.97 KB
/
payment.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
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
<!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</title>
<style>
*{
text-align: center;
color: grey;
}
img{
width: 150px;
height: 50px;
}
form{
width: 30%;
margin: auto;
margin-top: 3%;
box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
padding: 1em;
border-radius: 10px;
text-align: left;
}
form>input{
width: 85%;
margin: 2% 1px 5% 1px;
padding: 0.5rem;
border: 1.5px solid rgb(177, 176, 176);
border-radius: 7px;
}
form+button{
margin-top: 2%;
padding: 0.5em;
background-color: red;
border: none;
border-radius: 10px;
cursor: pointer;
color: antiquewhite;
font-size: 18px;
}
input[type="submit"]{
color: antiquewhite;
background-color: rgb(71, 93, 75); ;
}
</style>
</head>
<body>
<h1>Payment Gateway</h1>
<p>Your Total Items</p>
<h3>Your Total Cart Value is</h3>
<form>
<label for="">Full Name</label>
<input type="text" placeholder="ENTER YOUR FULL NAME"><br>
<label for="">Your Card Number </label><img src="https://www.needsondoor.com/assets/images/payment.png" alt="">
<input type="number" id="cdNum" placeholder="ENTER YOUR CARD NUMBER HERE"><br>
<label for="">date of expiry</label>
<input type="date"><br>
<label for="" >Your CVV</label>
<input type="password" id="cvv" placeholder="CVV">
<input type="submit" value="PAY & PROCEED">
</form>
<button> CANCEL PROCESS</button>
</body>
<script>
totalItem = localStorage.getItem("total");
totalAmount = localStorage.getItem("totalA");
document.querySelector("p").innerText += " "+totalItem;
document.querySelector("h3").innerText += " "+totalAmount
let cardDetails = [
{cardNum: "1234567", cvv: 456},
{cardNum: "234567", cvv: 367}
]
document.querySelector("form").addEventListener("submit",checkData)
function checkData(){
event.preventDefault()
cardDetails.forEach(function(elem){
if(elem.cardNum == document.querySelector("#cdNum").value){
console.log(elem)
if(elem.cvv == document.querySelector("#cvv").value){
window.location.href="otp.html"
}
else{
alert("wrong CVV")
}
}
})
}
document.querySelector("form+button").addEventListener("click",cancel)
function cancel(){
window.location.href = "cart.html"
}
</script>
</html>