Class ReceiptController

java.lang.Object
com.ntu.fdae.group1.bto.controllers.booking.ReceiptController

public class ReceiptController extends Object
Controller responsible for managing receipt generation operations in the BTO Management System.

This controller acts as an intermediary between the UI layer and the receipt service, handling operations related to generating booking receipts. It performs basic validation on inputs before delegating the business logic to the receipt service.

The ReceiptController follows the MVC architecture pattern by: 1. Receiving receipt generation requests from the UI 2. Validating inputs before processing 3. Delegating business logic to the receipt service 4. Handling exceptions appropriately 5. Returning the generated receipt information to the UI

  • Constructor Details

    • ReceiptController

      public ReceiptController(IReceiptService receiptService)
      Constructs a new ReceiptController with the specified receipt service.
      Parameters:
      receiptService - The receipt service to use for receipt generation operations
  • Method Details

    • getBookingReceiptInfo

      public BookingReceiptInfo getBookingReceiptInfo(HDBOfficer officer, Booking booking) throws DataAccessException
      Retrieves the consolidated information needed to generate a booking receipt. Performs basic validation and delegates the main logic to the ReceiptService.

      This method validates that both the officer and booking objects are valid and complete before requesting receipt generation from the service layer. It also handles any exceptions that may occur during the process.

      Parameters:
      officer - The HDB Officer performing the action (used for authorization/context if needed by service).
      booking - The Booking object for which to generate the receipt info.
      Returns:
      A BookingReceiptInfo object containing all necessary details.
      Throws:
      DataAccessException - if there's an error retrieving related data (e.g., Applicant or Project details).
      NullPointerException - if officer or booking is null.
      IllegalArgumentException - if the booking object seems invalid (optional stricter check).