Add retry-safe fake payment API#26
Open
qjly421 wants to merge 1 commit into
Open
Conversation
The template API only exposed a health check and starter thing routes, so this adds a small fake payment lifecycle that can simulate sending, listing, reading, completing, and canceling bounty payments without introducing new infrastructure. The implementation keeps state in the existing zod/zustand database and uses idempotency keys so callers can safely retry send requests without duplicating records. Constraint: Use the existing Winterspec, zod, and Zustand patterns without new dependencies Rejected: Only add a single send route | too little behavior to verify realistic payment flows Rejected: Persist payments outside the in-memory store | unnecessary for this template API Confidence: high Scope-risk: narrow Directive: Keep this API fake/in-memory unless the project explicitly adds a durable database layer Tested: bunx biome check README.md lib/db/schema.ts lib/db/db-client.ts lib/payments/schemas.ts routes/payments tests/routes/payments/payments.test.ts Tested: bunx tsc --noEmit Tested: bun test Tested: bun run build Tested: git diff --check Not-tested: Real external payment provider integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
send,list,get,complete, andcancelidempotency_keybody values andIdempotency-Keyheaders so send retries do not duplicate payments/claim #1
Verification
bunx biome check README.md lib/db/schema.ts lib/db/db-client.ts lib/payments/schemas.ts routes/payments tests/routes/payments/payments.test.tsbunx tsc --noEmitbun testbun run buildgit diff --checkNotes
This is a fake in-memory payment flow for the template API; it does not integrate with a real payment provider.