-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
- 5.1 Create
rest/errors.go- Define error response structure (code, message, details)
- Error constants (NOT_FOUND, INVALID_INPUT, INTERNAL_ERROR)
- Error response helpers (JSON formatting)
- 5.2 Implement
rest/middleware.go- Request logging middleware (request ID, method, path, duration)
- Error recovery middleware (panic handling)
- CORS middleware (configurable origins)
- Content-Type validation middleware (require application/json for POST/PUT)
- 5.3 Implement
rest/handlers.go- Account handlers- GET /accounts/{id} → AccountService.RetrieveCurrentAccount
- GET /accounts/{id}/balance → AccountService.RetrieveCurrentAccountBalance
- Input validation (ID not empty)
- Error handling (not found, internal errors)
- JSON response formatting
- 5.4 Implement
rest/handlers.go- Transaction handlers- GET /transactions/{id} → TransactionService.RetrievePaymentTransaction
- GET /accounts/{id}/transactions → TransactionService.RetrievePaymentTransactionHistory
- Query parameter parsing (fromDate, toDate, limit, offset)
- Input validation (date range, pagination parameters)
- Error handling and JSON response
- 5.5 Implement
rest/handlers.go- Consent handlers- GET /consents/{id} → ConsentService.RetrieveConsent
- GET /consents/{id}/status → ConsentService.RetrieveConsentStatus
- Input validation and error handling
- JSON response formatting
- 5.6 Implement
rest/server.go- NewRESTServer(services...) function
- Configure http.ServeMux with all routes
- Apply middleware stack
- Health check endpoint (GET /health)
- Export handler for embedding in unified server
- 5.7 Write unit tests for REST handlers
- Test each endpoint with mock domain services
- Test error cases (not found, invalid input)
- Test query parameter parsing
- Test error response formatting
Source: openspec/changes/bootstrap-mvp-foundation/tasks.md
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels