feat(exit): forgiven exit — open the exit barrier with no payment (barrier:create)
Build & push images / images (push) Successful in 3m23s
Build & push images / images (push) Successful in 3m23s
The owner (or any role the owner grants barrier:create) lets a car out for free.
Exit side only. Every use is signed, attributed, photographed and on the operator's
Z-report; the shift's cash/card/drawer are untouched by construction.
- shared: resource 'barrier' + permission 'barrier:create'; reason codes
exit.forgiven / exit.forgiven.noSession; LedgerPayload.forgoneMinor.
- pay-station: forgive() signs a $0 payment carrying the quoted fee as forgoneMinor
(no tender), refuses a ticket with module charge lines (a wash is not forgiven).
- exit-flow: reopenBarrier(..., { forgiven }) bypasses the walk-back check and stamps
the forgiven reason on the anomaly + vehicle_exit; forgiveExitNoSession() for a car
with no ticket (anomaly under forgiven:<id> + exit snapshot + pulse). Relay driving
shared in #pulseExit.
- route POST /api/barrier/forgive { identity?, note? }: barrier:create + open shift;
the reason is optional (an empty note is signed as '(no reason given)').
- shift-service: forgoneTotalMinor + forgoneCount on the report/summary/signed
shift_z_report (only when > 0), print line 'Dalje të falura (N)'.
- web: 'Forgive & open' in the pay/exit modal for an open transient that owes money;
'Forgive & open exit' on the booth header for the no-ticket case; forgone line on
the X-report, close confirm and history; en/sq. Prints nothing.
- tests: exit-flow, pay-station, shift-service, HTTP route (403 without the
permission, 409 no shift, empty note accepted, ledger sequence, report figures).
- wiki: decisions/forgiven-exit.md (decision + as-built), booth-exit-flow, shift,
index, log.
This commit is contained in:
@@ -32,6 +32,7 @@ export const RESOURCES = [
|
||||
"recyclebin", // soft-deleted master data: view / restore / purge
|
||||
"backup", // encrypted DB backups: configure target + trigger a manual run
|
||||
"carwash", // Car Wash module: orders/queue (read), intake (create), done/pay/void (update)
|
||||
"barrier", // the EXIT barrier opened with NO payment (forgiven exit) — see wiki/decisions/forgiven-exit.md
|
||||
] as const;
|
||||
export type Resource = (typeof RESOURCES)[number];
|
||||
|
||||
@@ -94,6 +95,12 @@ export const PERMISSIONS: readonly Permission[] = [
|
||||
// `drawer:create`; see ModuleManifest.tillGuards). Settings (categories, services,
|
||||
// price matrix, sponsorship program) ride site:update.
|
||||
"carwash:read", "carwash:create", "carwash:update", "carwash:cash",
|
||||
// Forgiven exit (wiki/decisions/forgiven-exit.md): open the EXIT barrier for a car with
|
||||
// no payment — a ticketed transient (its fee is signed as a $0 payment carrying the
|
||||
// forgone amount) or a car with no session at all. Admin by default; the owner grants
|
||||
// it to a role deliberately. Every use is signed, attributed, photographed and on the
|
||||
// operator's Z-report. Never the entry side.
|
||||
"barrier:create",
|
||||
] as const;
|
||||
|
||||
/** The protected built-in role: non-deletable, non-editable, always = ALL
|
||||
@@ -329,6 +336,11 @@ export interface LedgerPayload {
|
||||
readonly grossMinor?: number;
|
||||
readonly discountMinor?: number;
|
||||
readonly validationIds?: string[];
|
||||
/** payment: a FORGIVEN exit (wiki/decisions/forgiven-exit.md). `amountMinor` is 0 —
|
||||
* nothing was tendered, so cash/card/drawer are untouched — and `forgoneMinor` is the
|
||||
* fee the car owed and the operator waived. Reported as its own Z-report line, never
|
||||
* folded into the merchant-validation `discountMinor`. */
|
||||
readonly forgoneMinor?: number;
|
||||
/** payment: the per-validation receipt lines as settled (label + amount taken off) —
|
||||
* stamped so the printed receipt reproduces without re-deriving the fold. */
|
||||
readonly validationLines?: { programId: string; label: string; mode: string; discountMinor: number }[];
|
||||
@@ -463,6 +475,11 @@ export const REASON_CODES = [
|
||||
"exit.freeGrace",
|
||||
// manual / human-intervention barrier open
|
||||
"exit.manualOpen",
|
||||
// forgiven exit: the owner/operator (barrier:create) lets a car out with no money.
|
||||
// With a ticket → a $0 payment carries the forgone fee; no session → anomaly only.
|
||||
// See wiki/decisions/forgiven-exit.md.
|
||||
"exit.forgiven",
|
||||
"exit.forgiven.noSession",
|
||||
// plate reconciliation: the exiting car's plate is already OPEN under a DIFFERENT
|
||||
// ticket (possible ticket-swap fraud). Suspected = flagged; Override = operator
|
||||
// consciously released it. See wiki/concepts/plate-reconciliation.md.
|
||||
@@ -512,6 +529,8 @@ export const REASON_EN: Record<ReasonCode, string> = {
|
||||
"exit.open.failed": "exit recorded, but the barrier did not open — open manually",
|
||||
"exit.freeGrace": "free entry-grace (no charge)",
|
||||
"exit.manualOpen": "manual barrier open (human intervention)",
|
||||
"exit.forgiven": "forgiven exit by {operator} — fee of {forgone} {currency} waived: {note}",
|
||||
"exit.forgiven.noSession": "forgiven exit by {operator} — no ticket / no session: {note}",
|
||||
"exit.plateSwapSuspected": "possible ticket swap — plate {plate} is already inside under ticket {otherIdentity}",
|
||||
"exit.plateSwapOverride": "operator {operator} released a suspected ticket-swap exit (plate {plate}, also open under {otherIdentity})",
|
||||
"sub.refused.notFound": "subscription refused — not found",
|
||||
|
||||
Reference in New Issue
Block a user