Class InvoiceService
java.lang.Object
springboot.bg.harisauto.invoice.service.InvoiceService
InvoiceService.java - Generation, retrieval, and PDF rendering of invoices.
- Author:
- Kristian Popov
-
Constructor Summary
ConstructorsConstructorDescriptionInvoiceService(InvoiceRepository repository, InvoiceNumberGenerator numberGenerator, org.thymeleaf.TemplateEngine templateEngine) -
Method Summary
Modifier and TypeMethodDescriptiongenerate(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.getForUser(UUID invoiceId, UUID userId) Look up an invoice by id and verify the requester owns it.listForUser(UUID userId) Returns all invoices for the given user, newest first.byte[]Render the invoice as a PDF byte stream.
-
Constructor Details
-
InvoiceService
@Autowired public InvoiceService(InvoiceRepository repository, InvoiceNumberGenerator numberGenerator, org.thymeleaf.TemplateEngine templateEngine)
-
-
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
Returns all invoices for the given user, newest first. -
getForUser
Look up an invoice by id and verify the requester owns it. Throws AccessDeniedException if the invoice belongs to a different user. -
renderPdf
Render the invoice as a PDF byte stream.
-