-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp2pofflinepayment.html
More file actions
226 lines (197 loc) · 6.63 KB
/
p2pofflinepayment.html
File metadata and controls
226 lines (197 loc) · 6.63 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>SADC CBDC Platform</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
min-height: 100vh;
}
.container {
background-color: #fff;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 600px;
margin: auto;
}
h1, h2, h3 {
color: #003366;
}
input, select, button {
width: 100%;
padding: 10px;
margin: 6px 0;
border-radius: 5px;
border: 1px solid #ccc;
}
button {
background-color: #0066cc;
color: white;
cursor: pointer;
}
button:hover {
background-color: #004c99;
}
#transactions p {
background-color: #e9f3ff;
padding: 8px;
border-radius: 4px;
margin-bottom: 5px;
}
footer {
text-align: center;
padding: 15px;
font-size: 0.9em;
color: #555;
}
</style>
</head>
<body>
<div class="container">
<h1>SADC CBDC Platform</h1>
<nav>
<a href="index.html">CBDC Portal</a> |
<a href="home.html">Home</a> |
<a href="p2p.html">Wallet</a>
</nav>
<div id="auth">
<select id="countryCode">
<option value="+27">+27 (South Africa)</option>
<option value="+263">+263 (Zimbabwe)</option>
<option value="+260">+260 (Zambia)</option>
</select>
<select id="nationality">
<option value="South Africa">South Africa</option>
<option value="Zimbabwe">Zimbabwe</option>
<option value="Zambia">Zambia</option>
<option value="Namibia">Namibia</option>
<option value="Botswana">Botswana</option>
<option value="Lesotho">Lesotho</option>
<option value="Eswatini">Eswatini</option>
<option value="Mozambique">Mozambique</option>
<option value="Malawi">Malawi</option>
<option value="Angola">Angola</option>
<option value="Tanzania">Tanzania</option>
<option value="DRC">DRC</option>
<option value="Seychelles">Seychelles</option>
<option value="Mauritius">Mauritius</option>
</select>
<input type="text" id="name" placeholder="Treasury Name">
<input type="email" id="email" placeholder="Email Address">
<input type="text" id="house" placeholder="Office Address">
<input type="text" id="phone" placeholder="Phone Number">
<input type="text" id="bankName" placeholder="Bank Name">
<input type="text" id="bankAcc" placeholder="Bank Account Number">
<button onclick="register()">Register</button>
<button onclick="login()">Login</button>
</div>
<div id="dashboard" style="display:none;">
<h2>Welcome, <span id="userPhone"></span></h2>
<p>Name: <span id="userName"></span></p>
<p>Account Balance: R<span id="cbdcBalance">0</span></p>
<p>Linked Bank Account: <span id="linkedBank"></span></p>
<p>Bank Account Balance: R<span id="bankBalance">0</span></p>
<h3>Transfer CBDC to Bank Account</h3>
<input type="number" id="transferAmount" placeholder="Amount">
<button onclick="transferToBank()">Transfer</button>
<h3>Transaction History</h3>
<div id="transactions"></div>
</div>
</div>
<footer>
© 2025 SADC Digital Payment Platform — Licensed for financial applications within SADC member states.
</footer>
<script>
let user = null;
function sendSMS(phone, message) {
console.log(`SMS to ${phone}: ${message}`);
}
function fetchBankBalance(accountNumber) {
// Simulate different balances for different account numbers
const balances = {
"0001": 50000000,
"123456": 1000000000,
"8888": 777777777,
};
return balances[accountNumber] || Math.floor(Math.random() * 90000000 + 10000000);
}
function register() {
const code = document.getElementById('countryCode').value;
const phone = code + document.getElementById('phone').value.trim();
const accountNumber = document.getElementById('bankAcc').value.trim();
const bankBal = fetchBankBalance(accountNumber);
user = {
phone: phone,
name: document.getElementById('name').value,
email: document.getElementById('email').value,
office: document.getElementById('house').value,
nationality: document.getElementById('nationality').value,
bankName: document.getElementById('bankName').value,
bankAcc: accountNumber,
cbdcBalance: 1000000000000, // 1 Trillion
bankBalance: bankBal,
transactions: []
};
sendSMS(phone, `Welcome ${user.name}. R1,000,000,000,000 CBDC credited.`);
alert('Treasury Registered Successfully!');
showDashboard();
}
function login() {
const code = document.getElementById('countryCode').value;
const phone = code + document.getElementById('phone').value.trim();
if (user && user.phone === phone) {
showDashboard();
} else {
alert('User not found. Please register.');
}
}
function showDashboard() {
document.getElementById('auth').style.display = 'none';
document.getElementById('dashboard').style.display = 'block';
document.getElementById('userPhone').innerText = user.phone;
document.getElementById('userName').innerText = `${user.name} (${user.nationality})`;
document.getElementById('linkedBank').innerText = `${user.bankName} ${user.bankAcc}`;
updateBalances();
renderTransactions();
}
function updateBalances() {
document.getElementById('cbdcBalance').innerText = user.cbdcBalance.toLocaleString();
document.getElementById('bankBalance').innerText = user.bankBalance.toLocaleString();
}
function transferToBank() {
const amount = parseFloat(document.getElementById('transferAmount').value);
if (isNaN(amount) || amount <= 0) {
alert('Enter a valid amount.');
return;
}
if (amount > user.cbdcBalance) {
alert('Insufficient CBDC funds.');
return;
}
user.cbdcBalance -= amount;
user.bankBalance += amount;
user.transactions.push({ type: "Transfer", amount, date: new Date().toLocaleString() });
updateBalances();
renderTransactions();
sendSMS(user.phone, `R${amount.toLocaleString()} transferred to your linked bank account.`);
alert('Transfer successful.');
}
function renderTransactions() {
const txContainer = document.getElementById('transactions');
txContainer.innerHTML = "";
user.transactions.forEach(tx => {
txContainer.innerHTML += `<p>${tx.date} - ${tx.type}: R${tx.amount.toLocaleString()}</p>`;
});
}
</script>
</body>
</html>