Class ReceiptService
java.lang.Object
com.ntu.fdae.group1.bto.services.booking.ReceiptService
- All Implemented Interfaces:
IReceiptService
Service for generating booking receipts in the BTO Management System.
This service is responsible for assembling booking receipt information by: - Retrieving applicant details from the user repository - Retrieving project details from the project repository - Combining booking, applicant, and project information into a receipt
The service follows the Service Layer pattern, encapsulating business logic related to receipt generation and providing a clean API for controllers.
-
Constructor Summary
ConstructorsConstructorDescriptionReceiptService
(IUserRepository userRepo, IProjectRepository projRepo) Constructs a ReceiptService with required repositories. -
Method Summary
Modifier and TypeMethodDescriptiongenerateBookingReceipt
(Booking booking) Gathers necessary information (Applicant, Project) related to the given Booking and constructs a BookingReceiptInfo DTO.
-
Constructor Details
-
ReceiptService
Constructs a ReceiptService with required repositories.- Parameters:
userRepo
- Repository for accessing user dataprojRepo
- Repository for accessing project data- Throws:
NullPointerException
- if either repository is null
-
-
Method Details
-
generateBookingReceipt
Gathers necessary information (Applicant, Project) related to the given Booking and constructs a BookingReceiptInfo DTO.- Specified by:
generateBookingReceipt
in interfaceIReceiptService
- Parameters:
booking
- The core Booking object containing IDs for related entities.- Returns:
- A populated BookingReceiptInfo DTO.
- Throws:
DataAccessException
- If required User or Project data associated with the Booking cannot be found.NullPointerException
- If the input booking is null.IllegalArgumentException
- If the booking object is missing required IDs.
-