feat: add purchaseTickets() for MPP-powered ticket purchases#3
feat: add purchaseTickets() for MPP-powered ticket purchases#3
Conversation
Adds purchaseTickets() method to TixBitClient that POSTs to /api/purchase. Returns a PurchasePaymentRequired (402 challenge), PurchaseResult (success), or PurchaseError. Agent runtimes with mppx/client handle 402 automatically. New types: PurchaseParams, PurchasePaymentRequired, PurchaseResult, PurchaseError
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f8a42b1f6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| try { | ||
| const res = await fetch(url, { | ||
| method: "POST", |
There was a problem hiding this comment.
Return structured errors when purchase fetch fails
purchaseTickets advertises a discriminated union return (success / payment_required / error), but await fetch(...) can still reject on timeout aborts or network failures, which throws out of the method instead of returning status: "error". In practice, transient network issues will bypass the documented result.status flow and force consumers into unexpected exception handling paths.
Useful? React with 👍 / 👎.
Adds purchaseTickets() for MPP-powered ticket purchases. See commit message for details.