feat(documents): ticket and receipt PDFs, attached and downloadable (#35) #115
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/kws!115
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/35-pdf-documents"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #35.
What
Ticket and receipt PDFs, built on demand with
signintech/gopdf(pure Go, no change to the distroless image), attached to the purchase email and downloadable in the apps.internal/documents: renderer (A4, one page per ticket with QR + code, receipt with line table),Service(the only builder; limiter of 2 per node, 200-ticket cap, 3 s read-only snapshot),pgstorereader,Mailer.GET /v1/me/transactions/{id}/tickets.pdf|receipt.pdf(own sales only, 404 otherwise) andGET /v1/admin/transactions/{id}/tickets.pdf|receipt.pdf(platform scope;admin_portal.tickets.scanORadmin_portal.finance.managethrough the newrbac.Guard.RequireAny). Only completed sales; cancelled/replaced tickets are not printed.notify.Attachment,multipart/mixedin the SMTP sender; ticket sale = tickets + receipt, overstay = receipt only. Over 200 tickets keeps the receipt; over 6 MiB or any non-busy failure sends the text email; busy retries but never on the last attempt (no lost email).Verification
make cover: 91.0 % (minimum 80 %); documents 93.1 %, documents/pgstore 83.6 %, notify 97.6 %, smtpsender 86.7 %.make lint0 issues,make contractok,go test -race -count=1 ./...55 packages ok,scripts/generate-clients.shok.PlatformOnly.Not verified / owner to confirm ([verify] list in ADR 0024)
CleanTextnegative max, no end-to-end Mailer-to-SMTP test, 401/403 from the admin guard lackno-store.🤖 Generated with Claude Code
GET /v1/me/transactions/{id}/tickets.pdf|receipt.pdf (the buyer's own, else 404) and GET /v1/admin/transactions/{id}/tickets.pdf|receipt.pdf (platform scope, admin_portal.tickets.scan or admin_portal.finance.manage, via the new rbac.Guard.RequireAny and documents.StaffOnly). Downloads are attachments with fixed names, no-store and nosniff; ErrTooManyTickets is a 422, ErrBusy a 503 with Retry-After: 1. Four OpenAPI operations (tag Documents) and live calls. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>