feat(sales): overstay charges for checked-in tickets (#36, overstay slice) #104
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/kws!104
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/36-overstay"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overstay slice of #36 (does not close it: vehicle add-on and ticket top-up (upgrade) remain, as separate PRs).
What
transactions.typegainsoverstay; new immutableparent_transaction_idandgate_id; onetransaction_linesrow per overstayed ticket (ticket_id, quantity 1) tied to a park-entry ticket of the parent sale and to its product by trigger.sales.Overstay.Create(POST /v1/admin/gates/{id}/overstay,admin_portal.tickets.scan,Idempotency-Keyrequired, bodycodes+payment_method): finds the checked-in, overstayed tickets under the ticket-family locks (newcheckin.Service.Overstayed, ADR 0017 Kenya-date rule), prices each overstay day at that day's park-product price in the parent sale's currency, totals throughtotals.Overstay(no promo; no tax or fee on wallet), writes a pending child sale. A master code expands to its overstayed children; one charge per ticket while not cancelled; at most 30 days; a day without a price is a 409no_price; a charge that rounds to zero but is not free is a 422 (same rule as checkout).Completer.Complete, type-aware): an overstay issues no tickets and takes no seats, and checks the tickets out in the same transaction through the newcheckin.Service.CheckOutPaid. Wallet pay, waive and M-Pesa settle all go through it. A cancelled or expired charge leaves the tickets checked in; a late payment isrefund_dueas for any sale. The purchase email job is reused with an overstay subject.idempotency.Handlenow writes a field rejection with its own status (409) instead of always 422 (existing 422 behaviour unchanged);checkin.WriteRefusalbecamecheckin.Refusal;NewCompletertakes the check-out. OpenAPI and live contract tests, ADR 0018, spec, CLAUDE.md "Overstay" section. Plan:docs/superpowers/plans/2026-10-27-overstay.md.Rulings and limits (ADR 0018)
cardis accepted but has no customer route yet, so card charges and charges on guest sales can only be waived. Taking money at the gate waits for the POS (#48).PayWithWalletcan wait up to the 3 s lock wait for a ticket family lock behind a gate scan (retryable 503).Review
Dual pass done. Pass 1: no Must fix (empty-list panic, silent blank error and the pending-charge rule fixed or documented). Pass 2 found a tiny positive total treated as free (the visitor would be checked out unpaid), fixed in
eff6a0bwith a line/product trigger gap and five ADR limits; Pass 1 re-check: Ship.Checks
make cover: 90.0% (minimum 80%).go test -race ./...,make lint,make contractand client generation green (implementer run); database end-to-end tests cover the Review Focus lines, including real-goroutine races.Deploy
Run migration 0022. No new environment variables. The worker must be running (completion emails and expiry). A dev database already migrated to 0022 from an earlier build needs
downthenupormake clean-testdb.🤖 Generated with Claude Code