Skip to content

Commit

Permalink
Merge pull request #68 from Group-02-CS3043/yasantha
Browse files Browse the repository at this point in the history
Added Documentation
  • Loading branch information
yasanthaniroshan authored May 22, 2024
2 parents 6cf1514 + 8f5fda6 commit c07b745
Show file tree
Hide file tree
Showing 237 changed files with 2,575 additions and 1,255 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Secret file
.env
*.pyc
*.pyc
bin/
lib/
include/
lib64
*.cfg
Binary file added Assets/Aspire_Trust.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
422 changes: 0 additions & 422 deletions BankAccount/bank_account.py

This file was deleted.

Empty file removed BankAccount/transaction.py
Empty file.
77 changes: 77 additions & 0 deletions Docs/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Banking System Project - Aspire Trust
![Aspire Trust](../Assets/Aspire_Trust.png)

![Flask](https://img.shields.io/badge/Flask-2.0.1-green)
![MySQL](https://img.shields.io/badge/MySQL-8.0.26-orange)
![HTML](https://img.shields.io/badge/HTML-5-red)
![CSS](https://img.shields.io/badge/CSS-3-blue)
![JavaScript](https://img.shields.io/badge/JavaScript-ES6-yellow)


## Introduction
**The Bank Transaction and Loan Processing System** *Aspire Trust* will be a web-based application that includes features such as account management, internal fund transfers, loan processing, and reporting. It is designed to modernize the bank's operations and enhance customer service .

## System Features
- **Customer Account Management**

Allows customers to open and manage checking and savings accounts, view real-time account status, and receive notifications .
- **Fixed Deposit Management**

Enables customers to create fixed deposits linked to their savings accounts, with automated interest calculations .
- **Transaction Management**

Supports deposits, withdrawals, and fund transfers between accounts, both online and via ATMs .
- **Loan Services**

Facilitates loan applications, interest rate calculations, and loan management .
- **Security and User Authentication**

Ensures secure access through user authentication, data encryption, and access control mechanisms .
- **Branch-wise Reports**

Generates detailed reports on transactions and loan payments for each branch .

## Technologies Used
- **Frontend** : HTML, CSS, JavaScript
- **Backend** : Flask
- **Database** : MySQL

## Installation
1. Clone the repository
```bash
git clone https://github.com/Group-02-CS3043/AspireTrust
```
2. Install the Virtual Environment
```bash
cd WebApp && pip install virtualenv
```
3. Create a Virtual Environment
```bash
python -m venv .
```
4. Activate the Virtual Environment

- if you are using Windows
```bash
.\Scripts\activate
```
- if you are using Linux
```bash
source bin/activate
```
5. Install the Required Libraries
```bash
pip install -r requirements.txt
```
6. Run the Application
```bash
python app.py
```


## Contributors
- [Yasantha Niroshan](https://github.com/yasanthaniroshan)
- [Shyamal De Silva](https://github.com/dilumin)
- [Sithum Jeevantha](https://github.com/sithumjee)
- [Akindu Induwara](https://github.com/AkinduID)
- [Abisherk Sivakumar](https://github.com/SivakumarAbisherk)
13 changes: 0 additions & 13 deletions Home/home.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 26 additions & 1 deletion sqlquaries/triggers.sql → SqlStatements/triggers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ end;
-- then the trigger will check if the account has enough balance to perform the operation
-- if it does not then the trigger will throw an error
CREATE TRIGGER IF NOT EXISTS check_operation_validity
-- THIS TRIGGER WORKS
-- THIS TRIGGER NOT WORKS
BEFORE INSERT ON operation FOR EACH ROW
BEGIN
DECLARE Message VARCHAR(250);
Expand All @@ -79,4 +79,29 @@ BEGIN
END IF;
END IF;
END;



-- Changed Trigger
DROP TRIGGER IF EXISTS check_operation_validity;
DELIMITER //
CREATE TRIGGER check_operation_validity
BEFORE INSERT ON operation FOR EACH ROW
BEGIN
DECLARE _account_id INT;
DECLARE _account_balance DECIMAL(10,2);
DECLARE _plan VARCHAR(20);
SET _account_id = NEW.account_id;
IF EXISTS(SELECT 1 FROM savings_account WHERE savings_account.account_id = _account_id) THEN
SELECT balance INTO _account_balance FROM account WHERE account.account_id = _account_id;
SELECT plan INTO _plan FROM savings_account WHERE savings_account.account_id = _account_id;
IF (_plan IN ('ADULT','SENIOR') AND (_account_balance - NEW.amount < 1000)) OR ((_plan = 'Teen') AND (_account_balance - NEW.amount < 500) ) THEN
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Your account balance is not enough for this transaction';
end if;

end if;

END;
//

DELIMITER ;
File renamed without changes.
20 changes: 10 additions & 10 deletions Auth/auth.py → WebApp/Auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
@auth_app.route('/login',methods = DEFUALT_SUBMISSION_METHODS,endpoint='login')
def login()->str:
if 'user_id' in session :
flash("You are already logged in", 'Login')
return redirect('/dashboard')


if request.method == 'GET':
return render_template('auth/login.html')

Expand All @@ -25,26 +25,29 @@ def login()->str:
user_id = authenticate_user(request.form,connector)
if user_id:
session['user_id'] = int(user_id)
print(user_id)
session['user_role'] = get_user_role(int(user_id),connector)
flash("Login Successful", 'Success')
return redirect('/dashboard')
else:
flash("Incorrect Credentials", 'error')
flash("Incorrect Credentials", 'Error')
return render_template('auth/login.html')



@auth_app.route('/find',methods = DEFUALT_SUBMISSION_METHODS,endpoint='find')
def find_from_account_number():
if 'user_id' in session :
flash("You are already logged in", 'Login')
return redirect('/dashboard')

if request.method == 'POST':
print("account number",request.form['account_number'])

user_id = is_account_exsists(request.form['account_number'],connector)
if user_id:
if have_a_user_account(user_id,connector):
flash("User already have an account", 'Error')
return redirect('login')
else:
flash("User found ! Please create account for Web Portal", 'Success')
return redirect('register')
else:
flash("Please contact your neaerest branch for more details ", 'No Account Found')
Expand All @@ -57,6 +60,7 @@ def find_from_account_number():
@auth_app.route('/register',methods = DEFUALT_SUBMISSION_METHODS,endpoint='register')
def sigup()->str:
if 'user_id' in session :
flash("You are already logged in", 'Login')
return redirect('/dashboard')

if request.method == 'POST':
Expand All @@ -69,16 +73,11 @@ def sigup()->str:
flash('Username already exists', 'Error')
return redirect(url_for('auth.register'))
else:
print("username",request.form['username'])
print('password',request.form['password'])
print('confirm password',request.form['confirm_password'])
print('account number',request.form['account_number'])
if request.form['confirm_password'] != request.form['password']:
flash('Passwords are mismatch','Error')
return redirect(url_for('auth.register'))
user_id = create_user(request.form['username'],request.form['password'],request.form['account_number'],connector)
session['user_id'] = int(user_id)
print(user_id)
session['user_role'] = get_user_role(int(user_id),connector)
return redirect('/dashboard')

Expand Down Expand Up @@ -129,5 +128,6 @@ def sigup()->str:
@auth_app.route('/logout',methods = DEFAULT_METHODS)
def logout():
session.pop('user_id',None)
flash('You have been logged out', 'Success')
return redirect('/')

File renamed without changes.
File renamed without changes.
Loading

0 comments on commit c07b745

Please sign in to comment.