-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
47 lines (40 loc) · 1.97 KB
/
app.py
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
from flask import Flask, render_template, request
from datetime import datetime
app = Flask(__name__)
# Dummy data for transactions
transactions = [
{'user': 'User1', 'amount': 100, 'status': 'completed', 'timestamp': datetime.now()},
{'user': 'User2', 'amount': 200, 'status': 'pending', 'timestamp': datetime.now()},
{'user': 'User3', 'amount': 50, 'status': 'waiting for payment', 'timestamp': datetime.now()},
{'user': 'User4', 'amount': 150, 'status': 'cancelled by user', 'timestamp': datetime.now()},
]
# Transaction statistics
def get_transaction_stats():
completed = len([t for t in transactions if t['status'] == 'completed'])
pending = len([t for t in transactions if t['status'] == 'pending'])
waiting = len([t for t in transactions if t['status'] == 'waiting for payment'])
cancelled = len([t for t in transactions if t['status'] == 'cancelled by user' or t['status'] == 'cancelled by admin'])
return completed, pending, waiting, cancelled
@app.route('/')
def index():
completed, pending, waiting, cancelled = get_transaction_stats()
return render_template('index.html',
transactions=transactions,
completed=completed,
pending=pending,
waiting=waiting,
cancelled=cancelled,
operator_status='online') # Change to 'offline' as needed
@app.route('/exchange', methods=['POST'])
def exchange():
exchange_type = request.form.get('exchange_type')
payeer_account = request.form.get('payeer_account')
amount = request.form.get('amount')
evc_number = request.form.get('evc_number')
return render_template('confirmation.html',
exchange_type=exchange_type,
payeer_account=payeer_account,
amount=amount,
evc_number=evc_number)
if __name__ == '__main__':
app.run(debug=True)