feat: Add payment API for fake Algora#4
Open
buildingvibes wants to merge 1 commit intotscircuit:mainfrom
Open
Conversation
Implements a complete payment API for simulating bounty payments. The API includes: **Features:** - Create payments with recipient, amount, and optional bounty metadata - List payments with optional filters (recipient, status) - Get payment by ID - Complete/mark payments as successful **Database Schema:** - Added `Payment` model with fields: payment_id, recipient, amount, currency, status, bounty_id, issue_number, repository, timestamps - Payment status: pending, completed, failed **API Endpoints:** - POST /payments/create - Create a new payment - GET /payments/list - List all payments with optional filters - GET /payments/get - Get a specific payment by ID - POST /payments/complete - Mark a payment as completed **Testing:** - Comprehensive test coverage for all endpoints - Tests verify creation, listing, filtering, and completion workflows - All 7 tests passing /claim tscircuit#1
0af86c8 to
026623b
Compare
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
Implements a complete payment API for simulating bounty payments in fake Algora. This provides a mock payment system for testing bounty payment workflows.
Fixes #1
Features
Payment Management:
Database Schema:
Paymentmodel with fields:payment_id: Unique identifier (auto-generated)recipient: User receiving the paymentamount: Payment amount (positive number)currency: Currency code (default: USD)status: pending | completed | failedbounty_id: Optional bounty identifierissue_number: Optional GitHub issue numberrepository: Optional repository namecreated_at: Timestamp of creationcompleted_at: Timestamp of completionAPI Endpoints
POST /payments/create
Create a new payment.
Request:
{ "recipient": "user123", "amount": 100, "currency": "USD", "bounty_id": "bounty_456", "issue_number": 123, "repository": "tscircuit/test-repo" }Response:
{ "payment": { "payment_id": "pay_0", "recipient": "user123", "amount": 100, "currency": "USD", "status": "pending", "bounty_id": "bounty_456", "issue_number": 123, "repository": "tscircuit/test-repo", "created_at": "2026-02-09T18:00:00.000Z" } }GET /payments/list
List all payments with optional filters.
Query Parameters:
recipient(optional): Filter by recipientstatus(optional): Filter by status (pending, completed, failed)Response:
{ "payments": [ ... ] }GET /payments/get
Get a specific payment by ID.
Query Parameters:
payment_id(required): Payment IDResponse:
{ "payment": { ... } }POST /payments/complete
Mark a payment as completed.
Request:
{ "payment_id": "pay_0" }Response:
{ "ok": true }Testing
Comprehensive test coverage for all endpoints:
Test Results:
Implementation Details
/claim #1