Skip to content

Receipt Settings

Location: dg_smart_pos_api/modules/ReceiptSettings (the directory name has no space; an earlier version of this stub pointed at modules/Receipt Settings, which does not exist, and has been corrected here). Owns four related but distinct things: per-store receipt display settings (footer text, toggles, logo, width), the actual Receipt records generated per sale (with reprint and public share links), tenant-wide document template variant settings, and reusable warranty text lines assignable to specific printable document types.

Loaded as a tenant route module (ReceiptSettings is in ModulesServiceProvider::TENANT_ROUTE_MODULES).

  • Receipt - a generated receipt file: links to its source polymorphically (receiptable), an is_original flag distinguishing the first print from its copies(), a receiptVersion, an R2-hosted PDF/HTML path, and a share_token/share_expires_at pair for the public share link.
  • ReceiptSetting - per-store footer text, display-option toggles, and receipt width.
  • ReceiptVersion - a versioned template/layout a store is on.
  • DocumentTemplateVariant - tenant-wide (single row per tenant database, not per store) template variant choices.
  • DocumentWarrantyAssignment / DocumentWarrantyLine - reusable short warranty text blocks (DocumentWarrantyLine), assignable in order to one of a fixed set of document keys (DocumentWarrantyAssignment): receipt, receipt_a4, delivery, invoice_delivery, quotation, invoice (DocumentWarrantyService::DOCUMENT_KEYS).

ReceiptSettingsController::show/update read and write footer text, display-option toggles and receipt width for a store, merged with store header info by ReceiptSettingService. uploadLogo/deleteLogo handle the store logo as a base64 upload (UploadLogoRequest).

Receipt records, reprint, and public share

Section titled “Receipt records, reprint, and public share”

ReceiptController::index lists only is_original = true receipts for a store (a reprint creates a copy row, never a new original). show loads copies and receiptVersion and calls ReceiptService::ensureFileAvailable before returning, since a retention job prunes the R2 file over time and ensureFileAvailable regenerates it on demand rather than dead-ending the link. reprint always reprints from the original ($receipt->is_original ? $receipt : $receipt->originalReceipt) and creates a new copy. ReceiptShareController::show is the public (no auth:sanctum) counterpart: looks a receipt up by share_token, returns 410 if share_expires_at has passed, regenerates the file the same way, and redirects to the R2 PDF URL.

Document template variants and warranty lines

Section titled “Document template variants and warranty lines”

DocumentTemplateVariantsController::show/update read and write a single tenant-wide settings row. DocumentWarrantyLineController is full CRUD on reusable warranty text lines, plus showByDocument/syncAssignments to read and replace the ordered set of lines assigned to one document key.

All under auth:sanctum, prefix v1/stores/{store}, registered via modules/ReceiptSettings/Routes/receipt_settings.php (required once from routes/tenant.php), except the public share route which has no prefix and no auth middleware:

Method Path Controller method
GET receipt-settings ReceiptSettingsController::show
PUT receipt-settings ReceiptSettingsController::update
POST receipt-settings/logo ReceiptSettingsController::uploadLogo
DELETE receipt-settings/logo ReceiptSettingsController::deleteLogo
GET receipts ReceiptController::index
GET receipts/{receipt} ReceiptController::show
POST receipts/{receipt}/reprint ReceiptController::reprint
GET document-template-variants DocumentTemplateVariantsController::show
PUT document-template-variants DocumentTemplateVariantsController::update
GET document-warranty-lines/by-document/{documentKey} DocumentWarrantyLineController::showByDocument
PUT document-warranty-lines/by-document/{documentKey}/sync DocumentWarrantyLineController::syncAssignments
GET document-warranty-lines DocumentWarrantyLineController::index
POST document-warranty-lines DocumentWarrantyLineController::store
PUT document-warranty-lines/{line} DocumentWarrantyLineController::update
DELETE document-warranty-lines/{line} DocumentWarrantyLineController::destroy
GET receipts/share/{token} (public, no auth, no {store} prefix) ReceiptShareController::show