Skip to content

fix(cash): non-blocking shift carry-over, day-close open-shift guard, and custom Cash drawer math - #1318

Merged
khaira777 merged 2 commits into
FreeOpenSourcePOS:mainfrom
sattelweb:fix/makepos-cash-close-phase1
Oct 23, 2026
Merged

khaira777 merged 2 commits into
FreeOpenSourcePOS:mainfrom
sattelweb:fix/makepos-cash-close-phase1

Conversation

@sattelweb

@sattelweb sattelweb commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • True Shift Handover (non-blocking carry-over): GET /api/cash-sessions/current/close-preview returns unpaid_in_shift (count, bill_count, pending_cents, and up to 5 sample orders) with would_block_close: false. POST /api/cash-sessions/:id/close closes cleanly (200) even when open or partially paid orders exist from the shift window; those orders remain open and carry over to the next shift while sessionExpectedCash reconciles only cash payment lines physically collected during the shift. ShiftCloseModal displays an informational carry-over notice banner ([data-testid="shift-close-unpaid-warning"], role="status") without disabling the close button.
  • Day-close open-shift guard: openSessionBlockingDayClose blocks POST /api/cash-closures with 409 open_shift_blocks_day_close (and surfaces blockingOpenShift on GET /api/reports/x-report and [data-testid="day-close-open-shift-blocker"] in CashCloseModal) whenever any shift opened on or before the target business_date is still open, including multi-day stale shifts from prior business dates.
  • Custom 'Cash' payment method & partial line-time drawer math: cashDrawerSalesAndRefunds resolves custom 'Cash' payment methods via payment_methods (lower(trim(name)) = 'cash') and attributes cash payment lines by per-line timestamp with index-friendly bills date bounds.
  • Translations & docs: Added complete translations across all 24 locale files in frontend/src/lib/i18n/messages/*.json and updated docs/reference/api.md.

Test plan

  • npm run test:cash-closures (370/370 passed, including custom 'Cash', cross-midnight partial payment lines, and multi-day stale shift 2026-06-14 -> 2026-06-15 day-close guard)
  • npm run test:cash-sessions (208/208 passed, including non-blocking shift close carry-over preview and same-day open-shift day-close guard)
  • npm run i18n:check (all 24 locales verified)
  • npm run docs:check
  • npm run lint & npm run lint:budget
  • npm run build & npm run build:frontend
  • Playwright E2E e2e/cash-close-phase1-ui.spec.ts (2/2 passed)

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 4537a4f and 911769c.

📒 Files selected for processing: 38
  • docs/reference/api.md
  • frontend/e2e/cash-close-phase1-ui.spec.ts
  • frontend/e2e/cashier-status-bar.spec.ts
  • frontend/src/components/dashboard/CashCloseModal.tsx
  • frontend/src/components/dashboard/ShiftCloseModal.tsx
  • frontend/src/hooks/useCashClose.ts
  • frontend/src/hooks/useCashSession.ts
  • frontend/src/lib/i18n/messages/ar.json
  • frontend/src/lib/i18n/messages/bn.json
  • frontend/src/lib/i18n/messages/de.json
  • frontend/src/lib/i18n/messages/en.json
  • frontend/src/lib/i18n/messages/es.json
  • frontend/src/lib/i18n/messages/fa.json
  • frontend/src/lib/i18n/messages/fil.json
  • frontend/src/lib/i18n/messages/fr.json
  • frontend/src/lib/i18n/messages/hi.json
  • frontend/src/lib/i18n/messages/id.json
  • frontend/src/lib/i18n/messages/it.json
  • frontend/src/lib/i18n/messages/ja.json
  • frontend/src/lib/i18n/messages/ko.json
  • frontend/src/lib/i18n/messages/ne.json
  • frontend/src/lib/i18n/messages/nl.json
  • frontend/src/lib/i18n/messages/pt.json
  • frontend/src/lib/i18n/messages/ru.json
  • frontend/src/lib/i18n/messages/sq.json
  • frontend/src/lib/i18n/messages/th.json
  • frontend/src/lib/i18n/messages/tr.json
  • frontend/src/lib/i18n/messages/ur.json
  • frontend/src/lib/i18n/messages/vi.json
  • frontend/src/lib/i18n/messages/zh-tw.json
  • frontend/src/lib/i18n/messages/zh.json
  • main/lib/operation-failure.ts
  • main/routes/cash-closures.ts
  • main/routes/cash-sessions.ts
  • main/routes/reports.ts
  • main/services/cash-day-close-guards.ts
  • tests/cash-closures.test.ts
  • tests/cash-sessions.test.ts
  • 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

Comment @coderabbitai help to get the list of available commands.

@khaira777
khaira777 force-pushed the fix/makepos-cash-close-phase1 branch from 7a73021 to c41ebb1 Compare October 23, 2026 02:48
@khaira777 khaira777 changed the title fix(cash): phase-1 day/shift closes and custom Cash day expected cash fix(cash): non-blocking shift carry-over, day-close open-shift guard, and custom Cash drawer math Oct 23, 2026
@khaira777
khaira777 force-pushed the fix/makepos-cash-close-phase1 branch from c41ebb1 to 56aedab Compare October 23, 2026 02:55
@khaira777
khaira777 force-pushed the fix/makepos-cash-close-phase1 branch from 56aedab to 88e9213 Compare October 23, 2026 03:27
@khaira777

Copy link
Copy Markdown
Contributor

@greptileai review this at apex

@khaira777
khaira777 enabled auto-merge (squash) October 23, 2026 04:11
@khaira777
khaira777 merged commit a2d24c5 into FreeOpenSourcePOS:main Oct 23, 2026
19 checks passed
@sattelweb
sattelweb deleted the fix/makepos-cash-close-phase1 branch October 23, 2026 04:18
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.

2 participants