-
Notifications
You must be signed in to change notification settings - Fork 134
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
Location: backend/src/invoices/providers/pdf-invoice.provider.ts
Description
Every invoice on ManageHub should be available as a downloadable PDF. This provider accepts an invoice (with its relations loaded) and returns a Buffer containing a formatted PDF document. The buffer is used in two places: as an email attachment (Issue #40) and as the response body for the download endpoint (Issue #39).
Use the pdfkit npm package (npm install pdfkit + npm install --save-dev @types/pdfkit) to generate the PDF programmatically. The document does not need to be elaborate — clean, readable, and professional is sufficient.
Acceptance Criteria
- A
PdfInvoiceProviderclass is created atbackend/src/invoices/providers/pdf-invoice.provider.ts - The provider exposes a
generate(invoice: Invoice): Promise<Buffer>method whereinvoicehasuser,booking, andbooking.workspacerelations loaded - The generated PDF includes the following sections:
- Header — ManageHub logo/name, "TAX INVOICE" title
- Invoice metadata — Invoice number, issue date, payment date
- Bill To — Member's full name and email address
- Service details — Workspace name, plan type, start date, end date, number of seats
- Amount summary — Subtotal, total amount in Naira (₦), status (
PAID) - Footer — "Thank you for your business" or equivalent
- The method returns a
Buffer(not a stream) so it can be attached to emails and sent as an HTTP response -
PdfInvoiceProvideris registered inInvoicesModuleproviders and exported -
pdfkitis added tobackend/package.jsondependencies -
npx tsc --noEmitpasses with no errors
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers