Class InvoiceService

java.lang.Object
springboot.bg.harisauto.invoice.service.InvoiceService

@Service public class InvoiceService extends Object
InvoiceService.java - Generation, retrieval, and PDF rendering of invoices.
Author:
Kristian Popov
  • Constructor Details

  • Method Details

    • generate

      @Transactional public Invoice generate(User user, Vehicle vehicle, List<CarService> services, LocalDateTime serviceDate, String paymentMethod, InvoiceStatus status, String paymentReference, UUID bookingId)
      Generate and persist an invoice for a completed booking.
    • listForUser

      public List<Invoice> listForUser(UUID userId)
      Returns all invoices for the given user, newest first.
    • getForUser

      public Invoice getForUser(UUID invoiceId, UUID userId)
      Look up an invoice by id and verify the requester owns it. Throws AccessDeniedException if the invoice belongs to a different user.
    • renderPdf

      public byte[] renderPdf(Invoice invoice)
      Render the invoice as a PDF byte stream.