Skip to content

fix(pos): respect Auto-print Bill in prepaid checkout - #1635

Merged
itsbkm merged 3 commits into
mainfrom
fix/prepaid-print-respects-auto-print
Nov 26, 2026
Merged

itsbkm merged 3 commits into
mainfrom
fix/prepaid-print-respects-auto-print

Conversation

@itsbkm

@itsbkm itsbkm commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Related work

Issue / Discussion: Fixes #1615

Summary

Prepaid checkout passed force = true to the receipt print step, which skipped the Auto-print Bill setting. With no thermal printer connected, printing falls back to the system print dialog, so the dialog opened after payment even with Auto-print Bill off. Prepaid checkout now respects the setting.

Scope

The Print button in the checkout modals still prints on demand. The "Enable Printer" toggle is not changed: it defaults to off and no print path appears to read it, so gating printing on it (as suggested in the issue) could stop printing for stores that print today.

Verification

Commands run:

  • npm run build
  • npm run build:frontend
  • npm run lint
  • npx oxfmt --check on both changed files
  • git diff --check
  • Playwright, in frontend/, for pos-prepaid-auto-print, diagnostics-checkout-recovery, prepaid-payment-reconciliation, order-attempt-storage, checkout-discounts-disabled, checkout-viewport-geometry, pos-keyboard-shortcuts and multi-counter-ordering

Results:

  • The new "Auto-print Bill off" test failed before the fix (one print window opened) and passes after it. The "on" test passed both times.
  • 56 Playwright tests passed. They ran against installed Google Chrome through a temporary local config, not Playwright's bundled Chromium.
  • Builds, lint (warnings only) and format check passed.
  • Not run: the full npm run test:e2e:browser suite, npm test, and a check on physical printer hardware.

Compatibility & data safety

  • Database/data impact: None
  • Migration: None
  • User-visible behavior: Prepaid stores no longer get an automatic receipt unless Auto-print Bill is on. The setting is off by default, so stores relying on the forced print need to enable it.
  • Offline/network impact: None

Cross-cutting surfaces

Surface Status
UI affected (prepaid checkout)
API not affected
Persistence not affected
Upgrade path affected (see user-visible behavior)
Web print affected, verified by the new test
Thermal print affected (same setting gate), not verified on hardware
Permissions not affected

Developer documentation

  • No developer documentation change needed

Contributor checklist

  • This is a small isolated fix/doc update OR follows an approved issue/direction.
  • Unrelated cleanups, refactors, and dependency changes were kept out of this PR.
  • Tests were added or updated for any behavior changes.
  • Verification commands were run and documented above.
  • Customer data and upgrade safety were preserved (if touching database/storage).
  • Documentation or translations were updated where relevant.
  • I understand and can explain all submitted changes.

🤖 Generated with Claude Code

Prepaid checkout forced the receipt print, so the system print dialog
opened even with Auto-print Bill off.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Respect Auto-print Bill during prepaid checkout

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Stop prepaid checkout from forcing receipt printing when Auto-print Bill is off.
• Preserve on-demand printing from the checkout modal.
• Add browser-based tests for both Auto-print Bill settings.
Merge Risk 🟢 Low

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • This is one bounded POS checkout outcome: after a prepaid payment completes, the checkout flow optionally prints its receipt.
  • The changed call and the existing print helper are parts of that same end-to-end behavior, not independent capabilities.
Behavioral complexity 🟢 Low 🧩 Straightforward

  • Before, prepaid checkout passed the prepaid condition as force=true, bypassing the preference gate.
  • After, it passes false and reuses the existing autoPrintBill guard.
  • New correctness condition: the prepaid path must honor the configured print preference while still completing payment and order processing.
  • This is a direct rule change using established printing infrastructure, with no new state machine, concurrency protocol, transformation, or compatibility interaction.
Potential damage 🟡 Medium 🩹 Recoverable

  • If this capability regresses, a completed prepaid sale may omit its automatic receipt print.
  • The payment and order remain completed, and the receipt can be reprinted manually through existing POS flows; reverting the code restores the prior forced-print behavior.
  • No persistent payment or order data requires repair.
  • Manual receipt reprint is supported by the POS receipt-printing flow; no automatic recovery worker or external compensation is needed for a missed print.
Assessed commit 0efc1cf
Diagram

graph TD
  P["Prepaid checkout"] --> H["Receipt print helper"] --> G{"Auto-print or force?"} -->|Yes| R["Receipt printer"]
  G -->|No| S["Skip printing"]
  M["Manual Print button"] -->|force| H
Loading
High-Level Assessment

Keep the existing print gate in the shared helper and stop forcing the prepaid call. Checking the setting separately in checkout would duplicate policy; gating all printing on Enable Printer could also change existing manual-print behavior.

Files changed (2) +75 / -2

Bug fix (1) +1 / -2
page.tsxRemove forced receipt printing from prepaid checkout +1/-2

Remove forced receipt printing from prepaid checkout

• Passes false to the shared receipt-print helper after prepaid payment, allowing Auto-print Bill to determine whether a receipt prints. Removes the now-unused prepaid force flag; the separate manual Print action remains forced.

frontend/src/app/(dashboard)/pos/page.tsx

Tests (1) +74 / -0
pos-prepaid-auto-print.spec.tsCover prepaid receipt printing with Auto-print Bill on and off +74/-0

Cover prepaid receipt printing with Auto-print Bill on and off

• Adds Playwright tests that complete prepaid cash checkout under both setting values and count browser print-window attempts. Each test switches the business to prepaid billing and restores its original settings afterward.

frontend/e2e/pos-prepaid-auto-print.spec.ts

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can tweak Display settings with a live preview to see your comment before it ships

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@itsbkm
itsbkm enabled auto-merge (squash) November 26, 2026 20:34
@itsbkm
itsbkm merged commit d9dd941 into main Nov 26, 2026
23 checks passed
@itsbkm
itsbkm deleted the fix/prepaid-print-respects-auto-print branch November 26, 2026 20:41
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.

Print dialog opens after cash payment despite printing being disabled

1 participant