Nobody has started this yet — be first.
Business impact
There is currently no way to see, via the API, whether a payment has a pending timeout scheduled, what state it's for, or when it's due. The only way to answer "is this payment about to auto-expire, and when?" is to query the payment_timeouts table directly. This is genuinely useful observability for exactly the kind of question ("why did this payment expire when it did?") that comes up during an incident.
Problem
The route (GET /v1/payments/{id}/timeouts), handler, response DTO, and a PendingTimeout model type all already exist -- only the actual SQL query in Store.ListTimeouts is missing (a panicking stub).
Current behavior
GET /v1/payments/{id}/timeouts returns 500 with a panic logged: Store.ListTimeouts not implemented.
Expected behavior
GET /v1/payments/{id}/timeouts should return every payment_timeouts row for that payment (across all statuses -- pending, claimed, fired, invalidated -- most recent first), so an operator or support tool can see the full timeout history for a payment without touching the database.
Steps to reproduce
go run ./cmd/paystate curl -s localhost:8080/v1/payments/<id>/timeouts
Why this matters
This mirrors Store.Events (the audit-trail query) almost exactly -- same shape, different table. It's a genuinely useful piece of observability for exactly the kind of question ("why did this payment expire when it did?") that comes up during an incident.
Suggested approach
Look at Store.Events right below where Store.ListTimeouts is defined in internal/payment/store.go for the pattern: a pool.Query against payment_timeouts WHERE payment_id = $1 ORDER BY ..., then loop rows.Next() and Scan into a PendingTimeout (declared in internal/payment/models.go) per row. The columns you need are already named consistently: id, state, version, deadline_at, timeout_event, status.
Acceptance criteria
Verification
TEST_DATABASE_URL=postgresql://... go test ./tickets/tests/... -run TestTicket13 -v
Hints (0/2)
Try it without hints first — the reading is the exercise.
Working on this ticket
Work on a branch named for the ticket — that's what you'll submit.
Branch off your fork
Sign in to create it automatically, or do it yourself:
$git checkout -b feat/payment-timeouts-endpointFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin feat/payment-timeouts-endpointSubmit it below
Paste your fork URL and the branch name, with a short write-up of the root cause.
Questions
Ask about anything unclear in the ticket — the maintainer and anyone who has solved it can answer. Please don't post full solutions.
Sign in to ask a question or reply.
Sign indocker composepaystate/paystate/go.modreplace reliable => ../reliabledocker compose up --buildpaystate/context: ..docker-compose.ymlCREATED_TIMEOUTAUTHORIZED_TIMEOUTWork the tickets in tickets/docs/ (ticket-01 through ticket-25); each names one Go test in tickets/tests/:
TEST_DATABASE_URL=postgresql://... go test ./tickets/tests/... -run TestTicket01 -v # a single ticket
TEST_DATABASE_URL=postgresql://... ./tickets/run_tickets.sh # all 25, clean pass/fail summary
Tickets that don't touch Postgres (02, 03, 04, 05, 06, 14, 15, 24) run fine without TEST_DATABASE_URL set; the rest report FAIL with a "TEST_DATABASE_URL not set" message if it's missing. make test-race runs the full go test -race -p 1 ./... suite the same way.
Level 2
Implement a feature
Extend the system within its own patterns.