Repository navigation
feat(refunds): add configurable manager policy - #1529
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
ⓘ Your Qodo trial ends soon. Ask your workspace admin to set up billing to keep reviews running after the trial. Manage billing |
PR Summary by QodoConfigure manager refund approvals and remove the owner age cutoff
AI Description
Diagram
High-Level Assessment
Files changed (44)
|
Code Review by Qodo
1. Some managers can edit controls but not save
|
b347260 to
257bd57
Compare
Add owner-controlled refund_manager_enabled and refund_manager_window settings (30m, 1h, 2h, 4h, same_business_day; default 1h) via /api/settings/refunds, remove the post-business-day 409 cutoff for Owner Staff Approval PIN refunds, and expose Refund Policy controls in POS Workflow settings and RefundModal.
…ne in RefundModal.submit"}
Keep POS refund policy controls disabled until hydrated and ignore stale GET responses after local edits, gate refund policy controls on owner role plus settings.manage, and treat failed /settings/refunds reads in RefundModal as load errors while refreshing the policy alongside approvers before submission.
257bd57 to
4c5d81b
Compare
Fixes #1519
Intent
For the refunding for an order, we have a hard limit of one hour if it is anyone other than the owner. Make that a configurable option in the settings (30 minutes, 1 hour, 2 hours, 4 hours, or same business day; default 1 hour), with an owner-controlled enable/disable toggle for manager approval. For the owner level, remove the 1-day / same-business-day hard limit so the owner can refund any eligible paid order backdated (Staff Approval PIN still required). Cashiers may initiate when granted permission and always require eligible Manager/Owner approval.
What Changed
refund_manager_enabled(defaulttrue) andrefund_manager_window(30m,1h,2h,4h, orsame_business_day; default1h) settings exposed viaGET/PUT /api/settings/refundsand the POS Settings tab, restricting modifications to theownerrole.checkIsLateRefundandvalidateRefundPreconditionsinmain/services/refund.tsso manager Staff Approval PINs are accepted only when manager approval is enabled and the order is within both the configured window and its anchor business day, while removing the same-business-day expiration cutoff so owners can approve refunds on eligible paid orders from any past business day.RefundModaland locale translations across all 32 supported languages to load the active refund policy and business day settings, filter eligible approvers dynamically by window/day cutoff, and refresh policy state before submission.Risk Assessment
✅ Low: The configurable manager refund approval window, owner toggle, and removal of the owner-level same-business-day refund cutoff are cleanly enforced in the backend and frontend with comprehensive behavioral test coverage.
Testing
Ran the targeted refund and translation suites (
npm run test:refund-completed-orderswith 50/50 assertions passing,npm run test:refundswith 83/83 and 40/40 assertions passing, andnpm run test:translationsacross all 32 locales) and stood up an isolated FloCafe server and SQLite database driven end-to-end via headless Chromium with Playwright to exercise all five user-intent scenarios and adversarial guards, capturing seven UI screenshots and structured API/DB verification evidence.Evidence: Live Playwright + API + SQLite verification results across all 5 refund policy scenarios
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ No issues found.
🔧 **Test** - 1 issue found ✅
✅ No issues found.
npm run test:refund-completed-ordersnpm run test:refundsnpm run test:translationsnode tests/run-electron-node-test.cjs /tmp/run-live-refund-scenarios.cjs(live Playwright Chromium browser + FloCafe Express/SQLite server verification across all 5 scenarios)✅ **Document** - passed
✅ No issues found.
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.