feat: add cash rounding, POS test suite, and fix test harness port cleanup
- Add Swedish rounding (nearest nickel) for cash payments at locations with cash_rounding enabled - Add rounding_adjustment column to transactions, cash_rounding to locations - Add POS schema to database plugin for relational query support - Complete/void routes now return full transaction with line items via getById - Test harness killPort falls back to fuser when lsof unavailable (fixes stale process bug) - Add 35-test POS API suite covering discounts, drawer, transactions, tax, rounding, e2e flow - Add unit tests for tax service and POS Zod schemas Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -78,13 +78,15 @@ export const transactionRoutes: FastifyPluginAsync = async (app) => {
|
||||
if (!parsed.success) {
|
||||
return reply.status(400).send({ error: { message: 'Validation failed', details: parsed.error.flatten(), statusCode: 400 } })
|
||||
}
|
||||
const txn = await TransactionService.complete(app.db, id, parsed.data)
|
||||
await TransactionService.complete(app.db, id, parsed.data)
|
||||
const txn = await TransactionService.getById(app.db, id)
|
||||
return reply.send(txn)
|
||||
})
|
||||
|
||||
app.post('/transactions/:id/void', { preHandler: [app.authenticate, app.requirePermission('pos.admin')] }, async (request, reply) => {
|
||||
const { id } = request.params as { id: string }
|
||||
const txn = await TransactionService.void(app.db, id, request.user.id)
|
||||
await TransactionService.void(app.db, id, request.user.id)
|
||||
const txn = await TransactionService.getById(app.db, id)
|
||||
return reply.send(txn)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user