Skip to main content

Device Invoices

:::info Status Implemented. Source: fastapi-backend/api/v1/endpoints/device_invoices.py. :::

Sales invoicing for sold device hardware (transmitters, stream players) — Super Admin only. An invoice bills to exactly one of a mosque (for transmitters) or a member (for stream players) — enforced by a database constraint (device_invoices_bill_to_xor). Line items resolve through the unified device registry, not the legacy mosque_devices table, and snapshot each device's serial and kind so an invoice survives the device later being decommissioned.

Lifecycle

Totals (subtotal, discount, tax, total) are computed server-side, never trusted from the client.

API

MethodPathPurpose
GET/api/v1/device-invoicesList invoices
POST/api/v1/device-invoicesCreate a draft invoice
GET/api/v1/device-invoices/{id}Invoice detail
PATCH/api/v1/device-invoices/{id}Edit a draft
POST/api/v1/device-invoices/{id}/issuedraft → issued, assigns invoice number
POST/api/v1/device-invoices/{id}/mark-paidissued → paid
POST/api/v1/device-invoices/{id}/canceldraft/issued → cancelled
DELETE/api/v1/device-invoices/{id}Remove an invoice
GET/api/v1/device-invoices/{id}/printPrintable invoice
GET/PUT/api/v1/device-invoices/auto-draft-settingsAuto-draft configuration

Full request/response schemas: API Reference.