List Failed And TTL-Expired Pending Payments
Record in-memory payment attempts and list the ones that failed or are still pending after their TTL expires.
A checkout caller records payment attempts. Some attempts fail. Others stay pending until a deadline. An operations caller later needs the payments that still require attention.
For this exercise, assume one query returns transactions whose status is FAILED or PENDING with an expired TTL. For this exercise, assume only PENDING records carry a TTL; FAILED records remain queryable without TTL. For this exercise, assume authorization, capture, refunds, and settlement are out of scope.
For this exercise, assume a checkout caller can record a PENDING payment with a TTL, and a later outcome can mark that same record SUCCEEDED or FAILED while it is still PENDING, including after the TTL has elapsed.
For this exercise, assume the failed-or-expired listing is a read-only snapshot evaluated against a clock at query time; it does not mutate PENDING records into a new status. For this exercise, assume SUCCEEDED payments may be stored but never appear in the failed-or-expired result.
For this exercise, assume one in-memory process owns the records; card-network callbacks, durable persistence, and multi-region replication are out of scope. For this exercise, assume a missing payment id is not found, and a SUCCEEDED or FAILED payment rejects a later outcome instead of changing again.
For this exercise, assume a concrete walkthrough records two payments: one becomes FAILED while still pending and the other stays PENDING until its TTL elapses, after which both appear on the list.
For this exercise, assume a focused follow-up will ask how listing stays correct if it overlaps a terminal update on a PENDING payment whose TTL has already elapsed.
Design the objects, public contracts, and collaborations that support recording attempts and listing failed or TTL-expired pending payments. Do not start from a stock payments-platform class list.