cb3bed4050
<UserStory> PAY002: Complete Payments </UserStory>
<Changes>
1. Integrated Controller with PaymentManagementService to support payment completion workflow.
2. Implemented PaymentManagementService::completePayment with validation for invoice ID, payment mode, and status update.
3. Enhanced CustomerMenu with helper functions to display pending invoices in tabular format and allow index-based selection.
4. Added CustomerMenu::selectPaymentMode to capture payment mode choice (OFFLINE/ONLINE).
5. Updated CustomerMenu::completePayments to handle invoice selection, payment mode input, and trigger payment completion via Controller.
6. Implemented notification logic to send confirmation to customers upon successful payment.
</Changes>
<Test>
Acceptance Criteria:
1. Payment status marked completed.
2. Confirmation message shown.
3. Confirmation notification sent.
Precondition:
1. Customer is logged into the system.
2. At least one pending invoice exists for the customer.
3. Datastore is available for storing invoices and updating payment status.
Steps:
1. Navigate to Customer menu and choose "Complete Payments".
- Verify that the system lists pending invoices with tabular details.
2. Select an invoice by index.
- Verify that the chosen invoice is retrieved correctly.
3. Enter payment mode (OFFLINE/ONLINE).
- Verify that the selected mode is applied to the invoice.
4. Confirm payment completion.
- Verify that the invoice status changes to COMPLETED.
- Verify that a confirmation message is displayed.
- Verify that a notification is sent to the customer.
</Test>
<Review>
Sreeja Reghukumar, please review
</Review>
56 lines
3.0 KiB
C++
56 lines
3.0 KiB
C++
#pragma once
|
|
#include "Map.h"
|
|
#include <string>
|
|
#include "Enums.h"
|
|
#include "PaymentManagementService.h"
|
|
#include "AuthenticationManagementService.h"
|
|
|
|
class Service;
|
|
class ComboPackage;
|
|
class InventoryItem;
|
|
class ServiceBooking;
|
|
class User;
|
|
class JobCard;
|
|
class Invoice;
|
|
class Notification;
|
|
|
|
class Controller
|
|
{
|
|
private:
|
|
AuthenticationManagementService m_authenticationManagementService;
|
|
PaymentManagementService m_paymentManagementService;
|
|
public:
|
|
bool login(const std::string& username, const std::string& password);
|
|
void logout();
|
|
void changePassword(const std::string& newPassword);
|
|
void createCustomer(const std::string& username, const std::string& password, const std::string& email, const std::string& phone);
|
|
const User* getAuthenticatedUser();
|
|
void createTechnician(const std::string& username, const std::string& password, const std::string& email, const std::string& phone);
|
|
void updateUserDetails(const std::string& email, const std::string& phone);
|
|
util::Map<std::string, const Service*> getServices();
|
|
util::Map<std::string, const ComboPackage*> getComboPackages();
|
|
void purchaseService(const util::Vector<std::string>& serviceIDs, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel);
|
|
void purchaseComboPackage(const std::string& comboPackageID, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel);
|
|
util::Map<std::string, const InventoryItem*> getInventoryItems();
|
|
const InventoryItem* getInventoryItem(const std::string& inventoryItemID);
|
|
void addInventoryItem(const std::string& partName, int quantity, double price);
|
|
void removeInventoryItem(const std::string& inventoryItemID);
|
|
util::Map<std::string, const ServiceBooking*> getServiceBookings();
|
|
util::Map<std::string, const ServiceBooking*> getServiceBookingsByUser(const std::string userID);
|
|
util::Map<std::string, const User*> getUsers();
|
|
util::Map<std::string, const User*> getUsers(util::UserType userType);
|
|
void createJobCard(const std::string& bookingID, const std::string& technicianID, const std::string& serviceID);
|
|
void createService(const std::string& name, const util::Vector<std::string>& inventoryItemIDs, double laborCost);
|
|
void removeService(const std::string& serviceID);
|
|
util::Map<std::string, const JobCard*> getJobCardsByUser();
|
|
void completeJob(const std::string& jobID);
|
|
void removeUser(const std::string& userID);
|
|
void createComboPackage(const std::string& name, const util::Vector<std::string>& serviceIDs, double discountPercentage);
|
|
void removeComboPackage(const std::string& comboPackageID);
|
|
util::Map<std::string, const Invoice*> getInvoicesByUser();
|
|
void completePayment(const std::string& invoiceID, util::PaymentMode paymentMode);
|
|
util::Vector<const Notification*> getNotifications();
|
|
void deleteNotification(const std::string& notificationID);
|
|
void configureNotifications(const std::string& userID, bool paymentNotifications, bool serviceNotifications);
|
|
void runSystemChecks();
|
|
}; |