-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
131 lines (126 loc) · 4.36 KB
/
index.html
File metadata and controls
131 lines (126 loc) · 4.36 KB
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
!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Virtual Account Creator</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
}
input {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
}
button {
background-color: #007bff;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#result {
margin-top: 20px;
padding: 15px;
border: 1px solid #ddd;
border-radius: 4px;
display: none;
}
.success {
background-color: #d4edda;
border-color: #c3e6cb;
}
.error {
background-color: #f8d7da;
border-color: #f5c6cb;
}
</style>
</head>
<body>
<h1>Create Virtual Account</h1>
<form id="accountForm">
<div class="form-group">
<label for="firstname">First Name:</label>
<input type="text" id="firstname" name="firstname" required>
</div>
<div class="form-group">
<label for="lastname">Last Name:</label>
<input type="text" id="lastname" name="lastname" required>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
</div>
<div class="form-group">
<label for="phonenumber">Phone Number:</label>
<input type="tel" id="phonenumber" name="phonenumber" required>
</div>
<div class="form-group">
<label for="bvn">BVN (required for permanent account):</label>
<input type="text" id="bvn" name="bvn">
</div>
<div class="form-group">
<label>
<input type="checkbox" id="is_permanent" name="is_permanent" checked>
Create Permanent Account
</label>
</div>
<button type="submit">Create Account</button>
</form>
<div id="result"></div>
<script>
document.getElementById('accountForm').addEventListener('submit', async (e) => {
e.preventDefault();
const resultDiv = document.getElementById('result');
resultDiv.style.display = 'block';
resultDiv.innerHTML = 'Creating virtual account...';
resultDiv.className = '';
const formData = new FormData(e.target);
const data = Object.fromEntries(formData);
data.is_permanent = document.getElementById('is_permanent').checked;
try {
const response = await fetch('/api/virtual-account', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
const result = await response.json();
if (result.status === 'success') {
resultDiv.className = 'success';
resultDiv.innerHTML = `
<h3>Virtual Account Created!</h3>
<p>Account Number: ${result.data.account_number}</p>
<p>Bank Name: ${result.data.bank_name}</p>
<p>Reference: ${result.data.flw_ref}</p>
<p>Note: ${result.data.note}</p>
`;
} else {
resultDiv.className = 'error';
resultDiv.innerHTML = `Error: ${result.message}`;
}
} catch (error) {
resultDiv.className = 'error';
resultDiv.innerHTML = `Error: ${error.message}`;
}
});
</script>
</body>
</html>