Skip to content

v1.29.0 — Settlement Workflow Closure

Choose a tag to compare

@B2JK-Industry B2JK-Industry released this 01 Apr 13:29
· 71 commits to main since this release

Settlement Workflow Closure

Turns payment settlement from a foundation-level service into an operator-ready workflow.

What's New

Persistence

  • Settlement requests stored in SQLite — survive agent restart
  • Automatic load-on-init, persist-on-every-state-change

Operator Workflow

  • POST /api/operator/settlements/{id}/approve — approve topup
  • POST /api/operator/settlements/{id}/deny — deny payment
  • POST /api/operator/settlements/{id}/execute — topup + auto-retry original call
  • GET /api/operator/settlements?status=pending — list with filter

Approved Retry Loop

  • Successful wallet topup automatically retries the original API call
  • Original request context preserved through the entire workflow
  • Retry result included in execute response

Gateway Auto-Detection

  • HTTP 402 responses automatically create settlement requests
  • Operator sees pending settlements immediately in API, dashboard, and Telegram

Dashboard UI

  • Settlements section with Approve / Deny / Execute buttons
  • Real-time refresh after actions
  • Status badges (pending → approved → executed)

Reporting

  • settlement_attention items appear in operator inbox for pending settlements

Stats

  • 1617 tests pass, 4 skipped
  • 9 new tests for settlement persistence, retry loop, API actions
  • 11 files modified

Exit Criteria Met (from NEXT_BACKLOG.md)

  • ✅ Settlement requests survive restart
  • ✅ Operators can list/approve/deny from API and dashboard
  • ✅ Payment-required failures move through approved retry path
  • ✅ Reporting shows pending settlement attention

Full Changelog

See CHANGELOG.md for detailed breakdown.