Welcome to the Virtual Bank project! This web application and API were created to provide developers with a platform for simulating banking transactions. Whether you're testing e-commerce websites or exploring payment integrations, our project allows you to experiment without using real bank APIs. Built on Django, it offers a range of functionalities tailored for transaction simulation. if you want to delve deeper into the details of this project, feel free to visit this blog post authored by Adeniji Olajide.
- Website
- Author: Adeniji Olajide
- Project Blog Article
To set up the Virtual Bank project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/virtual-bank.git cd virtual-bank
-
Run the installation script:
chmod +x install.sh ./install.sh
-
Create a .env file in the root directory and add the following environment variables:
# .env file DB_USER=your_db_username DB_PASSWORD=your_db_password
-
Configure your database:
- Default Configuration (PostgreSQL):
- Configure your PostgreSQL database by creating a user with the provided credentials (DB_USER and DB_PASSWORD). If you need help setting up PostgreSQL, you can refer to the official documentation.
- Other Databases:
- For different databases, refer to the Django documentation on database setup.
- Default Configuration (PostgreSQL):
-
Run migrations
- API
cd api/ python3 manage.py makemigrations python3 manage.py migrate
- Clients
cd clients/ python3 manage.py makemigrations python3 manage.py migrate
-
Start the development server:
- API
cd api/ python manage.py runserver
- clients
cd clients/ python manage.py runserver
Access the application in your browser at http://localhost:8000/.
To start the development server:
-
API:
-
Navigate to the API directory:
cd api/ python manage.py runserver
Create User:
curl -X POST http://localhost:8000/api/users/create/ -H 'Content-Type: application/json;' -d '{ "username": "max_miller", "password": "maxm1234", "first_name": "Max", "last_name": "Miller", "email": "max.miller@example.com", "address": "606 Oakwood Dr", "city": "Mountainview", "state": "CO", "country": "USA", "date_of_birth": "1998-01-22", "phone_number": "+199999999999", }'
Generate Authorization Key:
cd helper python3 authorizationkey.py # Output: username:password # Input: max_miller:maxm1234 # Output Authorization Key: bWF4X21pbGxlcjptYXhtMTIzNA==
Create Account:
curl -X POST http://localhost:8000/api/accounts/create/ -H 'Content-Type: application/json; Authorization: Basic bWF4X21pbGxlcjptYXhtMTIzNA==' -d '{ "name": "Biznumd", "account_type": "CURRENT", "balance": 7500, "currency": "USD" }'
-
-
Clients:
- Navigate to the Clients directory:
cd clients/ python3 manage.py runserver
- Navigate to the Clients directory:
Once the servers are running, access the application in your browser at http://localhost:8000/.
Additionally, the application is accessible on the official website - Virtual Bank.
The Virtual Bank API provides several endpoints for handling transactions.
- Endpoint:
/api/users/
- Description: Retrieves a list of users.
- Method: GET, POST
- Authorization: Basic base64(username:password)
- Body:
{ "username": "your_username", "password": "your_password", "first_name": "your_first_name", "last_name": "your_last_name", "email": "your_email", "address": "your_address", "city": "your_city", "state": "your_state", "country": "your_country", "date_of_birth": "your_date_of_birth", "phone_number": "your_phone_number" }
- Endpoint:
/api/users/<int:pk>/
- Description: Retrieves details of a specific user.
- Method: GET, PUT, DELETE
- Authorization: Basic base64(username:password)
- Endpoint:
/api/users/create/
- Description: Creates a new user.
- Method: POST
- Authorization: None (No authentication required)
- Body:
{ "username": "your_username", "password": "your_password", "first_name": "your_first_name", "last_name": "your_last_name", "email": "your_email", "address": "your_address", "city": "your_city", "state": "your_state", "country": "your_country", "date_of_birth": "your_date_of_birth", "phone_number": "your_phone_number" }
- Endpoint:
/api/users/update/
- Description: Updates user information.
- Method: PUT
- Authorization: Basic base64(username:password)
- Endpoint:
/api/users/info/
- Description: Retrieves user information.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/users/lists/
- Description: Retrieves a list of users.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/accounts/
- Description: Retrieves a list of accounts.
- Method: GET, POST
- Authorization: Basic base64(username:password)
- Body:
{ "name": "account_name", "account_type": "[CURRENT, SAVINGS]", "balance": "Initial Balance", "currency": "[USD, EUR, GBP, NGN]" }
- Endpoint:
/api/accounts/<int:pk>/
- Description: Retrieves details of a specific account.
- Method: GET, PUT, DELETE
- Authorization: Basic base64(username:password)
- Endpoint:
/api/accounts/lists/
- Description: Retrieves accounts associated with current users.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/accounts/create/
- Description: Creates a new account.
- Method: POST
- Authorization: Basic base64(username:password)
- Body:
{ "name": "account_name", "account_type": "[CURRENT, SAVINGS]", "balance": "Initial Balance", "currency": "[USD, EUR, GBP, NGN]" }
- Endpoint:
/api/accounts/details/<int:number>/
- Description: Retrieves details of a specific account.
- Method: GET, PUT, DELETE
- Authorization: Basic base64(username:password)
- Endpoint:
/api/debit_cards/
- Description: Retrieves a list of debit cards.
- Method: GET, POST
- Authorization: Basic base64(username:password)
- Endpoint:
/api/debit_cards/<int:pk>/
- Description: Retrieves details of a specific debit card.
- Method: GET, PUT, DELETE
- Authorization: Basic base64(username:password)
- Endpoint:
/api/debit_cards/lists/
- Description: Retrieves debit cards associated with current users.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/debit_cards_transactions/
- Description: Retrieves transactions related to debit cards.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/debit_cards_transactions/<int:pk>
- Description: Retrieves details of a specific debit card transaction.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/debit_cards/lists/
- Description: Retrieves debit cards associated with current users.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/debit_cards/details/<int:number>/
- Description: Retrieves details of a specific debit card.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/debit_cards_transactions/lists/
- Description: Retrieves transactions related to debit cards.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/debit_cards_transactions/details/<uuid:identifier>/
- Description: Retrieves details of a specific debit card transaction.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/debit_cards/payment/
- Description: Processes payment for debit cards.
- Method: POST
- Authorization: Basic base64(username:password)
- Body:
{ "account_number": "your_account_number", "card_number": "debit_card_number", "expiry_date": "debit_card_expiry_date (e.g month/year)", "cvv": "debit_card_cvv", "amount": "transaction_amount" }
- Endpoint:
/api/deposits/
- Description: Retrieves a list of deposits.
- Method: GET, POST
- Authorization: Basic base64(username:password)
- Endpoint:
/api/deposits/<int:pk>/
- Description: Retrieves details of a specific deposit.
- Method: GET, PUT, DELETE
- Authorization: Basic base64(username:password)
- Endpoint:
/api/deposits/create/
- Description: Creates a new deposit.
- Method: POST
- Authorization: Basic base64(username:password)
- Body:
{ "account_number": "your_account_number", "amount": "transaction_amount", }
- Endpoint:
/api/deposits/lists/
- Description: Retrieves deposits associated with current users.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/deposits/details/<uuid:identifier>/
- Description: Retrieves details of a specific user deposit.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/merchants/
- Description: Retrieves a list of merchants.
- Method: GET, POST
- Authorization: Basic base64(username:password)
- Body:
- Endpoint:
/api/merchants/<int:pk>/
- Description: Retrieves details of a specific merchant.
- Method: GET, PUT, DELETE
- Authorization: Basic base64(username:password)
- Endpoint:
/api/merchants/create/
- Description: Creates a new merchant.
- Method: POST
- Authorization: Basic base64(username:password)
- Body:
{
"account_number": "your_account_number",
"description": "Delicious Italian cuisine with a cozy atmosphere.",
"category": "Restaurant",
"payment_methods_accepted": "[CREDIT_CARD, DEPOSIT, TRANSFER]",
"business_hours": {
"Monday": "9:00 AM - 10:00 PM",
"Tuesday": "9:00 AM - 10:00 PM",
"Wednesday": "9:00 AM - 10:00 PM",
"Thursday": "9:00 AM - 10:00 PM",
"Friday": "9:00 AM - 11:00 PM",
"Saturday": "10:00 AM - 11:00 PM",
"Sunday": "Closed"
},
"website_url": "https://example-restaurant.com"
}
- Endpoint:
/api/merchants/details/
- Description: Retrieves details of a merchant.
- Method: GET, PUT, DELETE
- Authorization: Basic base64(username:password)
- Endpoint:
/api/notifications/
- Description: Retrieves a list of notifications.
- Method: GET, POST
- Authorization: Basic base64(username:password)
- Endpoint:
/api/notifications/<int:pk>/
- Description: Retrieves details of a specific notification.
- Method: GET, PUT, DELETE
- Authorization: Basic base64(username:password)
- Endpoint:
/api/notifications/lists/
- Description: Retrieves notifications associated with current users.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/notifications/details/<int:notification_number>/
- Description: Retrieves details of a specific user notification.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/transactions/
- Description: Retrieves a list of transactions.
- Method: GET, POST
- Authorization: Basic base64(username:password)
- Endpoint:
/api/transactions/<int:pk>/
- Description: Retrieves details of a specific transaction.
- Method: GET, PUT, DELETE
- Authorization: Basic base64(username:password)
- Endpoint:
/api/transactions/history/
- Description: Retrieves transaction history.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/transactions/history/<uuid:identifier>/
- Description: Retrieves details of a specific user transaction.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/transfers/
- Description: Retrieves a list of transfers.
- Method: GET, POST
- Authorization: Basic base64(username:password)
- Endpoint:
/api/transfers/<int:pk>/
- Description: Retrieves details of a specific transfer.
- Method: GET, PUT, DELETE
- Authorization: Basic base64(username:password)
- Endpoint:
/api/transfers/create/
- Description: Creates a new transfer.
- Method: POST
- Authorization: Basic base64(username:password)
- Body:
{
"account_number": "your account number",
"transaction_partner_account_number": "recipient's account number",
"amount": "transaction_amount"
}
- Endpoint:
/api/transfers/lists/
- Description: Retrieves transfers associated with current users.
- Method: GET
- Authorization: Basic base64(username:password)
- Endpoint:
/api/transfers/details/<uuid:identifier>/
- Description: Retrieves details of a specific user transfer.
- Method: GET
- Authorization: Basic base64(username:password)
Contributions are welcome! Follow these steps to contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature/new-feature
- Make your changes and commit them:
git commit -m 'Add new feature'
. - Push to the branch:
git push origin feature/new-feature
. - Submit a pull request.
Explore other related projects that offer real-world payment solutions:
- Stripe API: The official Stripe API. A widely-used payment gateway for handling real transactions securely.
- PayPal Developer: PayPal's official checkout SDK for integrating PayPal payments into your applications.
These projects provide robust and secure payment solutions that go beyond dummy data, suitable for real-world applications and e-commerce platforms.
Please Note: This README is a work in progress. It may undergo changes or become more comprehensive over time as the project evolves.
The Virtual Bank project is licensed under the MIT License, ensuring open-source availability and contributions from the community.
For any inquiries or support, please contact Adeniji Olajide at adenijiolajid01@gmail.com.