Refactoring
This commit is contained in:
73
README.md
73
README.md
@@ -1,61 +1,8 @@
|
||||
# Banking System
|
||||
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||
|
||||
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
||||
|
||||
## Add your files
|
||||
|
||||
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
||||
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
||||
|
||||
```
|
||||
cd existing_repo
|
||||
git remote add origin https://git.fhict.nl/I522499/banking-system.git
|
||||
git branch -M main
|
||||
git push -uf origin main
|
||||
```
|
||||
|
||||
## Integrate with your tools
|
||||
|
||||
- [ ] [Set up project integrations](https://git.fhict.nl/I522499/banking-system/-/settings/integrations)
|
||||
|
||||
## Collaborate with your team
|
||||
|
||||
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
||||
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
||||
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
||||
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
||||
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
||||
|
||||
## Test and Deploy
|
||||
|
||||
Use the built-in continuous integration in GitLab.
|
||||
|
||||
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
||||
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
||||
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
||||
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
||||
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
||||
|
||||
***
|
||||
|
||||
# Editing this README
|
||||
|
||||
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
||||
|
||||
## Suggestions for a good README
|
||||
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
||||
|
||||
## Name
|
||||
Choose a self-explaining name for your project.
|
||||
This repository contains the files for a Banking system for Fontys Semester 2 Programming.
|
||||
|
||||
## Description
|
||||
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
||||
|
||||
|
||||
## Badges
|
||||
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
||||
@@ -69,22 +16,6 @@ Within a particular ecosystem, there may be a common way of installing things, s
|
||||
## Usage
|
||||
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
||||
|
||||
## Support
|
||||
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
||||
|
||||
## Roadmap
|
||||
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
||||
|
||||
## Contributing
|
||||
State if you are open to contributions and what your requirements are for accepting them.
|
||||
|
||||
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
||||
|
||||
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
||||
|
||||
## Authors and acknowledgment
|
||||
Show your appreciation to those who have contributed to the project.
|
||||
|
||||
## License
|
||||
For open source projects, say how it is licensed.
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -73,7 +73,7 @@ def on_transaction_double_click(event):
|
||||
try:
|
||||
selected_transaction = transactions_table.item(transactions_table.selection())
|
||||
transaction_id = selected_transaction['values'][-1]
|
||||
command = f"python application\\transaction.py {transaction_id} \"{selected_transaction['values'][4]}\""
|
||||
command = f"python transaction.py {transaction_id} \"{selected_transaction['values'][4]}\""
|
||||
return_code = os.system(command)
|
||||
if return_code != 0:
|
||||
print(f"Error: The command failed with return code {return_code}")
|
||||
@@ -82,7 +82,7 @@ def on_transaction_double_click(event):
|
||||
|
||||
def add_transaction():
|
||||
"""Open the add transaction dialog."""
|
||||
command = f"python application\\new_transaction.py {account_id}"
|
||||
command = f"python new_transaction.py {account_id}"
|
||||
return_code = os.system(command)
|
||||
if return_code != 0:
|
||||
print(f"Error: The command failed with return code {return_code}")
|
||||
@@ -92,7 +92,7 @@ def edit_account_details():
|
||||
global edit_window, otp_entry, description_entry, notes_entry
|
||||
edit_window = customtkinter.CTkToplevel(root)
|
||||
edit_window.title("Edit Account Details")
|
||||
edit_window.iconbitmap("application/luxbank.ico")
|
||||
edit_window.iconbitmap("luxbank.ico")
|
||||
edit_window.geometry("300x350")
|
||||
edit_window.attributes('-topmost', True)
|
||||
|
||||
@@ -155,8 +155,8 @@ def save_details():
|
||||
def open_transaction_window():
|
||||
"""Opens a new window for creating a new transaction."""
|
||||
try:
|
||||
session = json.load(open('application\\session_data.json', 'r'))
|
||||
command = f"python application\\new_transaction.py {session['client_id']}"
|
||||
session = json.load(open('session_data.json', 'r'))
|
||||
command = f"python new_transaction.py {session['client_id']}"
|
||||
return_code = os.system(command)
|
||||
if return_code != 0:
|
||||
print(f"Error: The command failed with return code {return_code}")
|
||||
@@ -170,7 +170,7 @@ def open_transaction_window():
|
||||
# Initialise the main window
|
||||
root = customtkinter.CTk()
|
||||
root.title(f"Transactions for: {account_description}")
|
||||
root.iconbitmap("application/luxbank.ico")
|
||||
root.iconbitmap("luxbank.ico")
|
||||
root.geometry("800x450")
|
||||
|
||||
if CONFIG["preferences"]["dark_theme"] == "dark": # Check if dark mode is enabled
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
import configparser
|
||||
|
||||
CONFIG = configparser.ConfigParser()
|
||||
CONFIG.read("application/app.ini")
|
||||
CONFIG.read("app.ini")
|
||||
|
||||
@@ -38,7 +38,7 @@ def authenticate_client(client_id, client_hash):
|
||||
def logout_client():
|
||||
"""Logs out the current client."""
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
response = requests.post(CONFIG["server"]["url"] + "/Client/Logout", cookies=session_data['session_cookie'])
|
||||
return response
|
||||
@@ -52,7 +52,7 @@ def logout_client():
|
||||
def get_client(client_id):
|
||||
"""Retrieves the client details for the given client_id."""
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
response = requests.get(CONFIG["server"]["url"] + "/Client", cookies=session_data['session_cookie'], params={'client_id': client_id})
|
||||
response.raise_for_status()
|
||||
@@ -64,7 +64,7 @@ def get_client(client_id):
|
||||
def update_client(client_id, otp_code, email=None, phone_number=None, address=None):
|
||||
"""Updates the client details for the given client_id."""
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
params = {'client_id': client_id, 'otp_code': otp_code}
|
||||
if email is not None:
|
||||
@@ -88,7 +88,7 @@ def update_client(client_id, otp_code, email=None, phone_number=None, address=No
|
||||
def get_accounts(client_id):
|
||||
"""Retrieves the accounts associated with the given client_id."""
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
response = requests.get(CONFIG["server"]["url"] + "/Client/Accounts", cookies=session_data['session_cookie'], params={'client_id': client_id})
|
||||
response.raise_for_status()
|
||||
@@ -103,7 +103,7 @@ def get_accounts(client_id):
|
||||
def get_transactions(account_id):
|
||||
"""Retrieves the transactions for the given account_id."""
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
response = requests.get(CONFIG["server"]["url"] + "/Transaction/History", cookies=session_data['session_cookie'], params={'account_id': account_id})
|
||||
response.raise_for_status()
|
||||
@@ -118,7 +118,7 @@ def get_transactions(account_id):
|
||||
def get_account(account_id):
|
||||
"""Retrieves the account details for the given account_id."""
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
response = requests.get(CONFIG["server"]["url"] + "/Account", cookies=session_data['session_cookie'], params={'account_id': account_id})
|
||||
response.raise_for_status()
|
||||
@@ -134,7 +134,7 @@ def get_account(account_id):
|
||||
def get_transaction(transaction_id):
|
||||
"""Retrieves the transaction details for the given transaction_id."""
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
response = requests.get(CONFIG["server"]["url"] + "/Transaction", cookies=session_data['session_cookie'], params={'transaction_id': transaction_id})
|
||||
response.raise_for_status()
|
||||
@@ -150,7 +150,7 @@ def get_transaction(transaction_id):
|
||||
def update_account(account_id, otp_code:int, description=None, notes=None):
|
||||
"""Updates the account details for the given account_id."""
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
params = {'account_id': account_id, 'otp_code': otp_code}
|
||||
if description is not None:
|
||||
@@ -172,7 +172,7 @@ def update_account(account_id, otp_code:int, description=None, notes=None):
|
||||
def new_transaction(account_id, description, amount, recipient_account_id, otp_code):
|
||||
"""Creates a new transaction for the given account."""
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
# Prepare the query parameters
|
||||
params = {
|
||||
@@ -205,7 +205,7 @@ def new_transaction(account_id, description, amount, recipient_account_id, otp_c
|
||||
def generate_otp():
|
||||
"""Generates a new OTP for the current client, which is sent by Email."""
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
client_id = session_data['client_id']
|
||||
response = requests.post(f"{CONFIG['server']['url']}/OTP/Generate", cookies=session_data['session_cookie'], params={'client_id': client_id})
|
||||
@@ -227,7 +227,7 @@ def change_password(client_id, old_password, new_password, otp_code):
|
||||
return {'success': False, 'message': "Invalid OTP code format: must be an integer."}
|
||||
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
payload = { # Prepare the payload to be sent in the request body
|
||||
'client_id': client_id,
|
||||
|
||||
@@ -21,7 +21,7 @@ frame = None
|
||||
def go_to_login():
|
||||
"""Closes the current window and opens the login page."""
|
||||
root.destroy()
|
||||
os.system("python application/login.py")
|
||||
os.system("python login.py")
|
||||
|
||||
def logout():
|
||||
"""Logs out the client and redirects to the login page."""
|
||||
@@ -54,7 +54,7 @@ def display_client_info():
|
||||
frame = customtkinter.CTkFrame(root)
|
||||
frame.grid(row=1, column=0, padx=20, pady=20)
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
client_id = session_data['client_id']
|
||||
client_info = get_client(client_id)
|
||||
@@ -79,7 +79,7 @@ def edit_details():
|
||||
global edit_window, email_entry, phone_entry, address_entry, otp_entry
|
||||
edit_window = customtkinter.CTkToplevel(root)
|
||||
edit_window.title("Edit Details")
|
||||
edit_window.iconbitmap("application/luxbank.ico")
|
||||
edit_window.iconbitmap("luxbank.ico")
|
||||
edit_window.geometry("300x330")
|
||||
edit_window.attributes('-topmost', True)
|
||||
|
||||
@@ -122,7 +122,7 @@ def save_details():
|
||||
if not otp_code:
|
||||
messagebox.showerror("Error", "OTP code must be entered.")
|
||||
return
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
client_id = session_data['client_id']
|
||||
if not messagebox.askyesno("Confirmation", "Are you sure you want to update the details?"):
|
||||
@@ -146,7 +146,7 @@ def populate_table():
|
||||
for row in table.get_children(): # Clear the table before populating it
|
||||
table.delete(row)
|
||||
try:
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
client_id = session_data['client_id']
|
||||
response = get_accounts(client_id)
|
||||
@@ -163,9 +163,9 @@ def on_account_double_click(event):
|
||||
"""Handles double-click event on an account in the table."""
|
||||
try:
|
||||
selected_account = table.item(table.selection())
|
||||
session = json.load(open('application\\session_data.json', 'r'))
|
||||
session = json.load(open('session_data.json', 'r'))
|
||||
account_description = selected_account['values'][0]
|
||||
command = f"python application\\account.py {selected_account['values'][1]} {session['client_id']} \"{account_description}\""
|
||||
command = f"python account.py {selected_account['values'][1]} {session['client_id']} \"{account_description}\""
|
||||
return_code = os.system(command)
|
||||
if return_code != 0:
|
||||
print(f"Error: The command failed with return code {return_code}")
|
||||
@@ -182,7 +182,7 @@ def change_password_box():
|
||||
global edit_window,password_entry, old_password_entry, confirm_password_entry, otp_entry
|
||||
edit_window = customtkinter.CTkToplevel(root)
|
||||
edit_window.title("Change Password")
|
||||
edit_window.iconbitmap("application/luxbank.ico")
|
||||
edit_window.iconbitmap("luxbank.ico")
|
||||
edit_window.geometry("300x350")
|
||||
edit_window.attributes('-topmost', True)
|
||||
|
||||
@@ -233,7 +233,7 @@ def change_password_save():
|
||||
if new_password != confirm_password:
|
||||
messagebox.showerror("Error", "New password and confirm password do not match.")
|
||||
return
|
||||
with open('application\\session_data.json', 'r') as f:
|
||||
with open('session_data.json', 'r') as f:
|
||||
session_data = json.load(f)
|
||||
client_id = session_data['client_id']
|
||||
if not messagebox.askyesno("Confirmation", "Are you sure you want to change the password?"):
|
||||
@@ -251,8 +251,8 @@ def change_password_save():
|
||||
def open_transaction_window():
|
||||
"""Opens a new window for creating a new transaction."""
|
||||
try:
|
||||
session = json.load(open('application\\session_data.json', 'r'))
|
||||
command = f"python application\\new_transaction.py {session['client_id']}"
|
||||
session = json.load(open('session_data.json', 'r'))
|
||||
command = f"python new_transaction.py {session['client_id']}"
|
||||
return_code = os.system(command)
|
||||
if return_code != 0:
|
||||
print(f"Error: The command failed with return code {return_code}")
|
||||
@@ -265,7 +265,7 @@ def open_transaction_window():
|
||||
|
||||
root = customtkinter.CTk()
|
||||
root.title("Luxbank Dashboard")
|
||||
root.iconbitmap("application/luxbank.ico")
|
||||
root.iconbitmap("luxbank.ico")
|
||||
root.geometry("800x350")
|
||||
|
||||
# Set appearance mode based on configuration
|
||||
|
||||
@@ -26,10 +26,10 @@ def login():
|
||||
'session_cookie': response.cookies.get_dict(),
|
||||
'client_id': client_id
|
||||
}
|
||||
with open('application/session_data.json', 'w') as f: # Save the session data to a file
|
||||
with open('session_data.json', 'w') as f: # Save the session data to a file
|
||||
json.dump(session_data, f)
|
||||
root.destroy()
|
||||
os.system("python application/dashboard.py")
|
||||
os.system("python dashboard.py")
|
||||
elif response.status_code == 401:
|
||||
messagebox.showerror("Login failed", "Invalid client ID or password.")
|
||||
else:
|
||||
@@ -42,12 +42,12 @@ def login():
|
||||
def change_dark_theme():
|
||||
"""Change the theme between dark and light."""
|
||||
config = configparser.ConfigParser()
|
||||
config.read('application/app.ini')
|
||||
config.read('app.ini')
|
||||
if 'preferences' in config:
|
||||
current_theme = config.get('preferences', 'dark_theme')
|
||||
new_theme = 'light' if current_theme == 'dark' else 'dark'
|
||||
config.set('preferences', 'dark_theme', new_theme)
|
||||
with open('application/app.ini', 'w') as configfile:
|
||||
with open('app.ini', 'w') as configfile:
|
||||
config.write(configfile)
|
||||
os.execl(sys.executable, sys.executable, *sys.argv)
|
||||
else:
|
||||
@@ -69,7 +69,7 @@ else:
|
||||
# Initialize the main window
|
||||
root = customtkinter.CTk()
|
||||
root.title("Luxbank Login")
|
||||
root.iconbitmap("application/luxbank.ico")
|
||||
root.iconbitmap("luxbank.ico")
|
||||
root.geometry("400x300")
|
||||
|
||||
# Create and pack the label for the title
|
||||
|
||||
@@ -100,7 +100,7 @@ def populate_accounts(client_id):
|
||||
# Initialise the main window
|
||||
root = customtkinter.CTk()
|
||||
root.title("New Transaction")
|
||||
root.iconbitmap("application/luxbank.ico")
|
||||
root.iconbitmap("luxbank.ico")
|
||||
root.geometry("400x600")
|
||||
|
||||
if CONFIG["preferences"]["dark_theme"] == "dark": # Check if dark mode is enabled
|
||||
|
||||
@@ -44,7 +44,7 @@ def display_transaction_info(transaction_id):
|
||||
# Initialise the main window
|
||||
root = customtkinter.CTk()
|
||||
root.title("Banking System Transaction Page")
|
||||
root.iconbitmap("application/luxbank.ico")
|
||||
root.iconbitmap("luxbank.ico")
|
||||
root.geometry("370x300")
|
||||
|
||||
# Create a close button at the top of the window
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
flask
|
||||
connexion[swagger-ui]==2.14.2
|
||||
requests
|
||||
sqlalchemy
|
||||
flask-session
|
||||
faker
|
||||
customtkinter
|
||||
schedule
|
||||
Reference in New Issue
Block a user