2.2 KiB
Phase 2D: supplier invoices
All routes are under /api/v1 and require a bearer token. Read routes require procurement.read; writes require procurement.manage. All records are scoped to the signed-in organization.
| Method | Route | Purpose |
|---|---|---|
| GET | /purchase-orders/:orderId/invoices |
Page through invoices for an order, including void records |
| POST | /purchase-orders/:orderId/invoices |
Record an invoice matched to QC-accepted goods |
| GET | /supplier-invoices/:id |
Read an invoice and its lines |
| POST | /supplier-invoices/:id/void |
Void an invoice with a reason |
Create with {"invoiceNumber":"INV-001","invoiceDate":"2026-09-28","taxAmount":"18.00","shippingAmount":"5.00","lines":[{"purchaseOrderLineId":"<uuid>","quantity":"1.000"}]}. Shipping defaults to 0.00; tax must be provided explicitly. Invoice numbers are normalized to uppercase and remain reserved for the supplier even after voiding. Quantity uses exactly three decimal places and money uses exactly two.
The list accepts limit (default 25, maximum 100) and offset (default 0) query parameters.
An invoice must refer to one issued purchase order. Each line uses the order's unit price; total merchandise, tax, and shipping charges are added with exact decimal arithmetic. Cumulative active invoice quantity cannot exceed QC-accepted receipt quantity. A voided invoice releases its billed quantity, but its original record and number remain in the audit trail. The database also enforces scoped foreign keys, line and header totals, invoice price matching, accepted-quantity limits, and immutability.
Tax and shipping amounts are transcribed from the supplier document. The backend does not calculate tax rules or approve price variances in this phase. Supplier payments, payment status, and document attachments remain future work. No payment should be initiated solely from a recorded invoice until those controls exist.