Repository navigation
fix(billing): expose payment correction eligibility before approval - #1417
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoExpose payment correction eligibility before manager approval
AI Description
Diagram
High-Level Assessment
Files changed (32)
|
Code Review by Qodo
1.
|
408bb22 to
d8f53c0
Compare
d873237 to
c3f5745
Compare
d8f53c0 to
7a325df
Compare
Summary
Addresses release audit finding F-5 for payment method correction UX and safety:
can_correct_payment_methodand reason (shift_closed,day_closed,bill_refunded,bill_not_paid, etc.) directly on bill and order hydration payloads so the frontend can check eligibility before prompting for manager PIN approval.OrderDetailPanelandCorrectPaymentMethodModalto provide clear, disabled-state feedback rather than requesting credentials only to fail after submission.Changes
main/routes/bills.ts: ImplementpaymentMethodCorrectionEligibility(db, bill)returningcorrectableboolean and per-line eligibility. Gracefully handle unconfigured regional settings inresolveBillBusinessDate.main/routes/orders.ts: Wire correction eligibility intobatchHydrateOrders.frontend/src/components/orders/OrderDetailPanel.tsx&CorrectPaymentMethodModal.tsx: Check eligibility before manager override prompt.frontend/src/lib/types.ts: Addpayment_method_correctiontypes.frontend/src/locales/*.json: Add translation keys across all 24 locales.tests/payment-method-correction.test.ts: Add unit assertions for correction eligibility, role gating, and unconfigured regional fallback.Stack
codex/audit-payment-queue)Verification
npm run test:payment-method-correction: Passed (154/154)npm run test:customer-display-feed: Passede2e/orders-master-detail.spec.ts): Passed