This is an ATM implementation (ATM is the client, bank is the server), using multiple connection types (web-services, RPC, MOM etc)
Note: Instead of the card (which originally contains all the needed info about the customer, except the pin number) I used a username, in order to identify customers.
pip install -r requirements.txt
You also need to install Erlang and RabbitMQ (Tested in 3.8.1 version). These are need in order to establish client-server connection with pika lib.
Inside folder customer_create_delete, there are:
(i) create_customer.py for customer creation
(ii) delete_customer.py for customer removal
Usage:
(i) python create_customer.py
(ii) python delete_customer.py
When you enter the info asked (username, pin, full name) a customer will be created in MongoDB (Atlas) database. After creation, you may perform operations on ATM (for the created customer).
To start the server from command line/prompt:
python bank_server_main.py
To start PyQt5 client from command line/prompt:
python atm_client_ui.py
To start the server from command line/prompt:
python bank_server_main.py
To start PyQt5 client from command line/prompt:
python atm_client_ui.py
To start the server from command line/prompt:
python bank_server_rpc.py
To start PyQt5 client from command line/prompt:
python atm_client_ui.py
To start the server from command line/prompt:
python bank_server_main.py
To start PyQt5 client from command line/prompt:
python atm_client_ui.py
To start the server from command line/prompt:
python bank_api.py
To start PyQt5 client from command line/prompt:
python atm_client_ui.py
To start the server from command line/prompt:
python bank_server_main.py
To start PyQt5 client from command line/prompt:
python atm_client_ui.py
To start the server from command line/prompt:
python bank_server_main.py
To start PyQt5 client from command line/prompt:
python atm_client_ui.py
To start the server from command line/prompt:
python bank_server.py
To start PyQt5 client from command line/prompt:
python atm_client_ui.py
All clients have the same UI (written in PyQt5). What changes among the clients is the bank_client.py
file, whose class (BankClient
class) is always called inside the establish_connection()
function (atm_client_ui.py
):
def establish_connection(self):
try:
client = BankClient(action=self.action, username=self.username,
pin=self.pin, amount=self.amount, new_pin=self.new_pin) # creates a BankClient object
response_txt = client.make_request() # make_request function is standard for all kinds of connection.
except Exception as e:
print(e)
self.create_response_screen(response_txt)
I used MongoDB as the server's database (NoSQL) and more specifically, I used MongoDB Atlas, a database-as-a-service platform.
In every server directory, there is a config file (.ini), which contains among others the connection string of the database.
Database's (bank_db) Collections:
You may wanna check PyMongo's Documentation (lib I use to connect with the MongoDB) to understand how the connection between the server and the database (which is in cloud) is established.
client = pymongo.MongoClient(client_string) # MongoDB Client created, client_string is the connection string inside the ini file
db = self.client.get_database(database_name) # Get a Database with the given name (database_name)
An operation example:
db.customer.find_one({'username': <username>}) # from collection customer of db, find one document where field "username" equals to <username>