feat: printable daily sales summary with localized receipt - #236
feat: printable daily sales summary with localized receipt#236pagcoinbr wants to merge 1 commit into
Conversation
Add a "Print daily summary" action to the last-payments dialog that
totals a day of sales (count, sats, and per-fiat-currency amounts) and
prints a formatted receipt.
- New endpoints GET/POST /api/v1/tposs/{id}/summary[/print]; the POST
variant emits a receipt_print websocket event so a wrapper/companion
print app can drive an ESC/POS printer, while the plain page falls
back to window.print().
- render_summary_text() with English and Portuguese (pt-BR) templates,
locale-normalized so LNbits UI locales (en-US, pt-BR, pt_br, ...) map
correctly and unknown languages fall back to English.
- The button label and the printed receipt both follow the LNbits UI
language the operator has selected.
- Add a paid_at settlement timestamp (migration m025, backfilled from
updated_at) so summaries range on when a sale settled, not when the
invoice was created.
- Unit tests for render_summary_text.
|
Friendly ping on this one 🙂 The Also happy to rebase on top of #235 whenever it lands: it moves the print/receipt endpoints into |
the goal is to merge the refactor PR first, after review/test. TPoS is at a feature freeze until that one gets in as it changes code quite a bit! So, yes, maybe it's a smart move to apply your PR on top of #235 ! |
What
Adds a Print daily summary action to the last-payments dialog. It totals a day of sales — count, total sats, and per-fiat-currency amounts — and prints a formatted receipt.
How
GET/POST /api/v1/tposs/{id}/summary[/print].GETreturns the computed summary (JSON + renderedprint_text).POST .../printemits areceipt_printwebsocket event so a wrapper/companion print app can drive an ESC/POS printer. The plain browser page falls back towindow.print().render_summary_text()with English and Portuguese (pt-BR) templates, locale-normalized so LNbits UI locales (en-US,pt-BR,pt_br, …) map correctly and unknown languages fall back to English.paid_atsettlement timestamp (migrationm025, backfilled fromupdated_at) so summaries range on when a sale settled, not when the invoice was created.render_summary_text.Notes
The
POST .../printpath is designed for kiosk/terminal setups where a companion app listens on the TPoS websocket and forwardsreceipt_printevents to a physical printer. On a normal browser the summary is available viaGETand printed with the browser print dialog, so the feature degrades gracefully without any wrapper.