Skip to content

feat: printable daily sales summary with localized receipt - #236

Open
pagcoinbr wants to merge 1 commit into
lnbits:mainfrom
pagcoinbr:feat/daily-summary-print
Open

feat: printable daily sales summary with localized receipt#236
pagcoinbr wants to merge 1 commit into
lnbits:mainfrom
pagcoinbr:feat/daily-summary-print

Conversation

@pagcoinbr

Copy link
Copy Markdown

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

  • New endpoints GET/POST /api/v1/tposs/{id}/summary[/print].
    • GET returns the computed summary (JSON + rendered print_text).
    • POST .../print emits a receipt_print websocket event so a wrapper/companion print app can drive an ESC/POS printer. The plain browser 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 — no separate language toggle.
  • 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.

Notes

The POST .../print path is designed for kiosk/terminal setups where a companion app listens on the TPoS websocket and forwards receipt_print events to a physical printer. On a normal browser the summary is available via GET and printed with the browser print dialog, so the feature degrades gracefully without any wrapper.

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.
@talvasconcelos
talvasconcelos self-requested a review July 22, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant