Banking_System_Client  1.0.0
Qt-based banking app for user/admin account management, transactions, secure server communication via PostgreSQL/Supabase.
ResponseManager Class Reference

Manages the responses received from the server. More...

#include <ResponseManager.h>

Inheritance diagram for ResponseManager:
Inheritance graph
Collaboration diagram for ResponseManager:
Collaboration graph

Public Types

enum  AvailableRequests {
  Login = 1 , GetAccountnumber , GetBalance , GetTransactionsHistory ,
  MakeTransaction , TransferAmount , GetDatabase , CreateNewUser ,
  DeleteUser , UpdateUser , UserInit , UpdateEmail ,
  UpdatePassword , JsonParseError = -1 , Connection = -2
}
 Defines the types of requests that can be handled. More...
 

Signals

void userloginSuccess (QString email, QString first_name, QString account_number, QString balance)
 Signal emitted when a user login is successful. More...
 
void adminLoginSuccess (QString email, QString first_name)
 Signal emitted when an admin login is successful. More...
 
void ConnectionResponse (bool status)
 Signal emitted for connection response. More...
 
void TransactionsFetched (const QList< QMap< QString, QString >> &transactions)
 Signal emitted when transactions are fetched. More...
 
void DatabaseFetched (const QList< QMap< QString, QString >> &databaseContent)
 Signal emitted when the database content is fetched. More...
 
void BalanceFetched (QString balance)
 Signal emitted when the balance is fetched. More...
 
void SuccessfullRequest (QString message)
 Signal emitted for a successful request. More...
 
void FailedRequest (QString message)
 Signal emitted for a failed request. More...
 

Public Member Functions

bool getResponseStatus (QJsonObject Data)
 Checks the status value in the response. More...
 
QString getResponseMessage (QJsonObject Data)
 Retrieves the message from the response. More...
 
 ResponseManager (QObject *parent=nullptr)
 Constructor for ResponseManager. More...
 
void handleResponse (QJsonObject Data)
 Handles the response received from the server. More...
 

Detailed Description

Manages the responses received from the server.

The ResponseManager class processes server responses and emits signals based on the response type. It handles various response types defined in the AvailableRequests enum and provides feedback through signals to update the application state accordingly.

Member Enumeration Documentation

◆ AvailableRequests

Defines the types of requests that can be handled.

Enumerator
Login 

User login response.

GetAccountnumber 

Response to get account number.

GetBalance 

Response to get account balance.

GetTransactionsHistory 

Response to get transaction history.

MakeTransaction 

Response to make a transaction.

TransferAmount 

Response to transfer an amount (not used for now)

GetDatabase 

Response to get the database.

CreateNewUser 

Response to create a new user.

DeleteUser 

Response to delete a user.

UpdateUser 

Response to update user information.

UserInit 

Response to initialize user.

UpdateEmail 

Response to update user email.

UpdatePassword 

Response to update user password.

JsonParseError 

Indicates a JSON parse error.

Connection 

Indicates a connection response.

Constructor & Destructor Documentation

◆ ResponseManager()

ResponseManager::ResponseManager ( QObject *  parent = nullptr)
explicit

Constructor for ResponseManager.

Parameters
parentThe parent QObject, default is nullptr.

Member Function Documentation

◆ adminLoginSuccess

void ResponseManager::adminLoginSuccess ( QString  email,
QString  first_name 
)
signal

Signal emitted when an admin login is successful.

Parameters
emailAdmin's email.
first_nameAdmin's first name.

Referenced by handleResponse().

Here is the caller graph for this function:

◆ BalanceFetched

void ResponseManager::BalanceFetched ( QString  balance)
signal

Signal emitted when the balance is fetched.

Parameters
balanceUser's balance.

Referenced by UIManager::closeUserWidget(), UIManager::createUserWidget(), and handleResponse().

Here is the caller graph for this function:

◆ ConnectionResponse

void ResponseManager::ConnectionResponse ( bool  status)
signal

Signal emitted for connection response.

Parameters
statusConnection status (true for success, false for failure).

Referenced by handleResponse().

Here is the caller graph for this function:

◆ DatabaseFetched

void ResponseManager::DatabaseFetched ( const QList< QMap< QString, QString >> &  databaseContent)
signal

Signal emitted when the database content is fetched.

Parameters
databaseContentList of database content.

Referenced by UIManager::closeAdminWidget(), UIManager::createAdminWidget(), and handleResponse().

Here is the caller graph for this function:

◆ FailedRequest

void ResponseManager::FailedRequest ( QString  message)
signal

Signal emitted for a failed request.

Parameters
messageFailure message.

Referenced by handleResponse().

Here is the caller graph for this function:

◆ getResponseMessage()

QString ResponseManager::getResponseMessage ( QJsonObject  Data)

Retrieves the message from the response.

Parameters
DataThe QJsonObject representing the response data.
Returns
The message as a QString.

Referenced by handleResponse().

Here is the caller graph for this function:

◆ getResponseStatus()

bool ResponseManager::getResponseStatus ( QJsonObject  Data)

Checks the status value in the response.

Parameters
DataThe QJsonObject representing the response data.
Returns
true if the status value is 1, false otherwise.

Referenced by handleResponse().

Here is the caller graph for this function:

◆ handleResponse()

void ResponseManager::handleResponse ( QJsonObject  Data)

Handles the response received from the server.

Parameters
DataThe QJsonObject representing the response data.
Returns
void

Referenced by UIManager::responseReady().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SuccessfullRequest

void ResponseManager::SuccessfullRequest ( QString  message)
signal

Signal emitted for a successful request.

Parameters
messageSuccess message.

Referenced by handleResponse().

Here is the caller graph for this function:

◆ TransactionsFetched

void ResponseManager::TransactionsFetched ( const QList< QMap< QString, QString >> &  transactions)
signal

Signal emitted when transactions are fetched.

Parameters
transactionsList of transactions.

Referenced by UIManager::closeAdminWidget(), UIManager::closeUserWidget(), UIManager::createAdminWidget(), UIManager::createUserWidget(), and handleResponse().

Here is the caller graph for this function:

◆ userloginSuccess

void ResponseManager::userloginSuccess ( QString  email,
QString  first_name,
QString  account_number,
QString  balance 
)
signal

Signal emitted when a user login is successful.

Parameters
emailUser's email.
first_nameUser's first name.
account_numberUser's account number.
balanceUser's balance.

Referenced by handleResponse().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: