Add documentation headers across system modules

This commit is contained in:
Jissin Mathew
2026-05-22 13:21:51 +05:30
parent a3ad4d2e00
commit f1d146a37c
3 changed files with 104 additions and 2 deletions
@@ -121,6 +121,15 @@ void Controller::removeComboPackage(const std::string& comboPackageID)
{
}
/*
Function: getInvoicesByUser
Description: Retrieves all invoices associated with the currently authenticated user.
Converts them into a read-only map before returning.
Parameters:
- None
Returns:
- util::Map<std::string, const Invoice*> containing the users invoices
*/
util::Map<std::string, const Invoice*> Controller::getInvoicesByUser()
{
User* currentUser = m_authenticationManagementService.getAuthenticatedUser();
@@ -134,6 +143,15 @@ util::Map<std::string, const Invoice*> Controller::getInvoicesByUser()
return userInvoicesReadOnly;
}
/*
Function: completePayment
Description: Completes payment for a specific invoice using the given payment mode.
Parameters:
- invoiceID: std::string, ID of the invoice to be paid
- paymentMode: util::PaymentMode, mode of payment (e.g., ONLINE, OFFLINE)
Returns:
- void
*/
void Controller::completePayment(const std::string& invoiceID, util::PaymentMode paymentMode)
{
m_paymentManagementService.completePayment(invoiceID, paymentMode);
@@ -154,5 +172,4 @@ void Controller::configureNotifications(const std::string& userID, bool paymentN
void Controller::runSystemChecks()
{
}
}
@@ -9,6 +9,15 @@
#include "JobCard.h"
#include "Enums.h"
/*
Function: createInventoryItemsMap (static helper)
Description: Builds a map of inventory items required for a given service and adds them to the bookings inventory map.
Parameters:
- completeInventoryItemMapOfBooking: util::Map<std::string, InventoryItem*>&, map to store inventory items for the booking
- currentService: const Service*, pointer to the current service
Returns:
- void
*/
static void createInventoryItemsMap(util::Map<std::string, InventoryItem*>& completeInventoryItemMapOfBooking, const Service* currentService)
{
auto& currentRequiredInventoryItems = currentService->getRequiredInventoryItems();
@@ -19,6 +28,18 @@ static void createInventoryItemsMap(util::Map<std::string, InventoryItem*>& comp
}
}
/*
Function: generateInvoice
Description: Generates an invoice for a completed service booking.
Validates that all job cards are completed, calculates labor and parts cost, applies discount,
and stores the invoice in the datastore.
Parameters:
- booking: ServiceBooking*, pointer to the service booking
Returns:
- void
Throws:
- std::runtime_error if booking is null or job cards are incomplete
*/
void PaymentManagementService::generateInvoice(ServiceBooking* booking)
{
if (!booking)
@@ -56,6 +77,14 @@ void PaymentManagementService::generateInvoice(ServiceBooking* booking)
currentInvoices.insert(invoice->getId(), invoice);
}
/*
Function: getInvoices
Description: Retrieves all invoices associated with a specific customer.
Parameters:
- customerID: std::string, ID of the customer
Returns:
- util::Map<std::string, Invoice*> containing the customers invoices
*/
util::Map<std::string, Invoice*> PaymentManagementService::getInvoices(const std::string& customerID)
{
util::Map<std::string, Invoice*>& currentInvoices = m_dataStore.getInvoices();
@@ -71,6 +100,18 @@ util::Map<std::string, Invoice*> PaymentManagementService::getInvoices(const std
return currentUserInvoices;
}
/*
Function: completePayment
Description: Completes payment for a specific invoice. Updates payment method, date, and status,
then sends a notification to the customer.
Parameters:
- invoiceID: std::string, ID of the invoice
- paymentMode: util::PaymentMode, mode of payment (e.g., ONLINE, OFFLINE)
Returns:
- void
Throws:
- std::runtime_error if the invoice ID is invalid
*/
void PaymentManagementService::completePayment(const std::string& invoiceID, util::PaymentMode paymentMode)
{
auto& currentInvoices = m_dataStore.getInvoices();
@@ -64,6 +64,14 @@ void CustomerMenu::viewServiceHistory()
{
}
/*
Function: selectInvoiceFromUserForPayment (static helper)
Description: Lists all pending invoices for the customer and allows selection by index.
Parameters:
- currentInvoices: util::Map<std::string, const Invoice*>&, map of customer invoices
Returns:
- std::string: ID of the selected invoice, or empty string if none selected
*/
static std::string selectInvoiceFromUserForPayment(const util::Map<std::string, const Invoice*>& currentInvoices)
{
int currentIndex = 1, choice;
@@ -118,6 +126,14 @@ static std::string selectInvoiceFromUserForPayment(const util::Map<std::string,
}
}
/*
Function: selectPaymentMode (static helper)
Description: Allows the customer to select a payment mode (ONLINE or OFFLINE).
Parameters:
- None
Returns:
- util::PaymentMode: Selected payment mode
*/
static util::PaymentMode selectPaymentMode()
{
int choice;
@@ -140,6 +156,15 @@ static util::PaymentMode selectPaymentMode()
}
}
/*
Function: completePayments
Description: Allows the customer to complete pending payments for invoices.
Validates invoice selection and payment mode before completing payment.
Parameters:
- None
Returns:
- void
*/
void CustomerMenu::completePayments()
{
util::clear();
@@ -155,6 +180,17 @@ void CustomerMenu::completePayments()
std::cout << "Payment completed successfully.\n";
}
/*
Function: displayInvoices (static helper)
Description: Displays detailed information for all invoices associated with the customer,
including booking details, technician, discount, total amount, payment status, and items used.
Parameters:
- currentUserInvoices: util::Map<std::string, const Invoice*>, customers invoices
Returns:
- void
Throws:
- std::runtime_error if a null invoice is encountered
*/
static void displayInvoices(util::Map<std::string, const Invoice*> currentUserInvoices)
{
if (currentUserInvoices.getSize() == 0)
@@ -206,6 +242,14 @@ static void displayInvoices(util::Map<std::string, const Invoice*> currentUserIn
}
}
/*
Function: viewInvoices
Description: Displays invoices associated with the customer by calling displayInvoices.
Parameters:
- None
Returns:
- void
*/
void CustomerMenu::viewInvoices()
{
util::clear();