Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
Hi @habet-alex, thank you for working on this! Adding card terminal transaction numbers to payment settlement and reports is a useful addition for cashier reconciliation. CC @itsbkm for maintainer review and scope decision. I completed a technical review of the changes across the backend, frontend, translations, and test suites. Storing Before this PR can be merged, there are two functional bugs and a scope question for 1. Functional Bug:
|
7c4d333 to
026a6d2
Compare
|
Rebased onto
|
|
@greptileai review this at apex |
[Medium impact] The PR appears safe to merge; no new actionable issues were found.
|
026a6d2 to
352d811
Compare
|
@greptileai review this at apex |
352d811 to
0054aad
Compare
|
@greptileai review this at apex |
2 similar comments
|
@greptileai review this at apex |
|
@greptileai review this at apex |
0054aad to
ada9de2
Compare
|
@greptileai review this at apex |
ada9de2 to
2dc2e62
Compare
|
Fixed in
|
|
@greptileai review this at apex |
2dc2e62 to
8c766ac
Compare
|
@greptileai review this at apex |
8c766ac to
64fc7ad
Compare
|
@greptileai review this at apex |
64fc7ad to
6052c8e
Compare
|
@greptileai review this at apex |
6052c8e to
3c682d1
Compare
|
@greptileai review this at apex |
3c682d1 to
9cc5698
Compare
|
@greptileai review this at apex |
9cc5698 to
9db261b
Compare
Related work
Issue / Discussion: Contributor feature PR (#1233)
Summary
Adds an optional store setting (
card_transaction_id_required, defaultfalse) under Settings -> Payment methods that requires cashiers to enter the card terminal's transaction reference number when settling a built-incardpayment line, and extends the Daily Sales Export (GET /api/reports/daily-sales/export) with aPaymentsworksheet in XLSX and apart=paymentsCSV download so card terminal transaction numbers can be reconciled against batch settlement reports.main/routes/settings.ts,main/routes/bills.ts,main/lib/operation-failure.ts): Registerscard_transaction_id_requiredinOPTIONAL_SETTING_DEFAULTS('false') andALLOWED_WILDCARD_KEYSwith boolean validation. When enabled, built-incardpayment lines without a non-empty trimmedtransaction_idare rejected with HTTP400anddisplay_code: 'card_transaction_id_required', whiletransaction_idvalues exceeding 256 characters continue to fail withdisplay_code: 'payment_input_invalid'. Custom payment methods are unaffected.PaymentModal.tsx,PrepaidCheckoutModal.tsx,pos/page.tsx,OrderDetailPanel.tsx): Displays a transaction number input on active built-incardrows whencard_transaction_id_requiredis enabled (or revealed by acard_transaction_id_requiredrejection), forwards trimmedtransaction_idvalues in both post-order bill settlement and prepaid counter checkout, preservestransaction_idacross stored prepaid attempt retries, and displays recorded payment transaction references inOrderDetailPanel.main/services/daily-sales-export.ts,main/services/daily-sales-export-files.ts,main/routes/reports.ts,dashboard/page.tsx): Addspaymentsledger rows (bill_number,order_number, store-localpayment_time, resolvedmethod,amount, and verbatimtransaction_id) tobuildDailySalesExportDataset, appends aPaymentssheet to the XLSX workbook, addspart=paymentsto CSV export, and updates the dashboard CSV export action to download all three CSV parts (summary,items,payments).frontend/src/lib/i18n/messages/*.json): Adds localized strings for the setting toggle, hint, input label, and validation message across all 24 supported locales.Scope
cardpayment lines are gated bycard_transaction_id_required; custom payment methods and non-card tenders (cash,upi,wallet) are unaffected.card_transaction_id_requiredis persisted insettings, andtransaction_idis already stored inbills.payment_detailsJSON andpayment_transaction_refs).Verification
Commands run:
node tests/run-electron-node-test.cjs tests/card-transaction-id.test.tsnode tests/run-electron-node-test.cjs tests/daily-sales-export.test.tsnode tests/run-electron-node-test.cjs tests/issue-788-order-attempt-storage.test.tsnpm run test:script-coveragenpm run i18n:checknpm run test:translationsnpm run docs:checknode scripts/ci/check-changed-format.cjs --base origin/mainnpm run lintnpm run buildnpm run build:frontendResults:
tests/card-transaction-id.test.ts: 30/30 passed (including missing, empty"", whitespace" ", and> 256-chartransaction_idvalidation, custom method exemption, verbatim ledger storage, and cross-bill409reuse rejection).tests/daily-sales-export.test.ts: 76/76 passed (XLSXSummary+Items+Paymentssheets, store-localpayment_time, leading-zero preservation ontransaction_id,part=paymentsCSV export, and empty-day header-only sheets).tests/issue-788-order-attempt-storage.test.ts: passed (card_transaction_id_requiredclassified as expected payment rejection).npm run test:script-coverage: 256 reachable scripts, 314 test files covered.npm run i18n:check&npm run test:translations: all 24 locales (3,200 leaf keys each) passed parity and ICU checks.npm run docs:check,check-changed-format.cjs,npm run lint,npm run build, andnpm run build:frontend: all passed with 0 errors.Compatibility & data safety
settingstable (card_transaction_id_required, defaulting to'false') and existingbills.payment_details/payment_transaction_refscolumns.card_transaction_id_required = 'false', preserving existing card checkout behavior unless enabled.Paymentsworksheet in XLSX and a third CSV download (daily-sales-YYYY-MM-DD-payments.csv).Cross-cutting surfaces
PaymentMethodsSettings,PaymentModal,PrepaidCheckoutModal,OrderDetailPanel,DashboardPage,POSPage,SupportPage)GET/PUT /api/settings/card_transaction_id_required,POST /api/bills/:id/payments,GET /api/reports/daily-sales/export)settingskey andbills.payment_detailsJSON ledger)'false'preserves existing behavior)part=paymentsCSV export withtoCsvRowformula neutralization)<Ltr>wrapper used fortransaction_idinOrderDetailPanel)payment_timeformatted in configured store timezone viastoreLocalTimestamp)Developer documentation
docs/architecture/order-lifecycle.md,docs/reference/api.md, anddocs/reference/daily-sales-export.mdContributor checklist