How allaingaye/paypilot-shield works
PayPilot Shield lets an owner manage suppliers, invoices, policy and approvals, then ask a read-only AI agent to request payment. The backend pipeline checks invoice and supplier data, applies signed policy and fraud checks, and either blocks, requests approval, or verifies and sends a payout; audit events support replay. The UI also exposes payments, invoices, suppliers, policy signing and replay. Relationships among pipeline stages are based on the README’s documented flow; sampled excerpts show pipeline responsibilities and webhook refresh, but not every internal call.
Main entry points: pipeline.py Payment pipeline · main.py API application · App.tsx Web application · api.ts Session and API client
Components 25
Owner interface
- Web application
frontend/src/App.tsx - Agent chat
frontend/src/pages/AgentChat.tsx - Policy signing
frontend/src/pages/Policy.tsx - Approval review
frontend/src/pages/Approvals.tsx - Operations views
frontend/src/pages/Payments.tsx - Audit replay
frontend/src/pages/Replay.tsx - Session and API client
frontend/src/lib/api.ts
Backend API
- API application
backend/app/main.py - Authentication
backend/app/routers/auth.py - Agent tools
backend/app/services/agent.py - Invoice and supplier API
backend/app/routers/invoices.py - Mandate API
backend/app/routers/mandates.py - Approval API
backend/app/routers/approvals.py - Transaction API
backend/app/routers/transactions.py - PayPal webhook
backend/app/routers/webhooks.py
Trust and payment
- Payment pipeline
backend/app/services/pipeline.py - Truth checks
backend/app/services/truth_check.py - Policy decision
backend/app/services/decision.py - Pre-payout verifier
backend/app/services/verifier.py - Signed mandate
backend/app/services/mandate.py
Data and integrations
- Audit events
backend/app/services/audit.py - Business records
backend/app/models.py - PayPal Payouts
backend/app/services/paypal_client.py
Other components
- Owner
- PayPal service
Connections 30
- Owner → Web application: uses
- Web application → Agent chat: routes to
frontend/src/App.tsx - Web application → Policy signing: routes to
frontend/src/App.tsx - Web application → Approval review: routes to
frontend/src/App.tsx - Web application → Operations views: routes to
frontend/src/App.tsx - Web application → Audit replay: routes to
frontend/src/App.tsx - Agent chat → Session and API client: requests API
frontend/src/pages/AgentChat.tsx - Policy signing → Session and API client: requests API
frontend/src/pages/Policy.tsx - Approval review → Session and API client: requests API
- Operations views → Session and API client: requests API
frontend/src/pages/Payments.tsx - Audit replay → Session and API client: requests API
- Session and API client → API application: calls
frontend/src/lib/api.ts - API application → Authentication: routes to
backend/app/main.py - API application → Invoice and supplier API: routes to
backend/app/main.py - API application → Mandate API: routes to
backend/app/main.py - API application → Approval API: routes to
backend/app/main.py - API application → Transaction API: routes to
backend/app/main.py - API application → PayPal webhook: routes to
backend/app/main.py - Agent tools → Payment pipeline: submits request
backend/app/services/agent.py - Payment pipeline → Business records: reads and writes
backend/app/services/pipeline.py - Payment pipeline → Truth checks: checks invoice
backend/app/services/pipeline.py - Payment pipeline → Policy decision: evaluates policy
backend/app/services/pipeline.py - Payment pipeline → Signed mandate: loads signed rules
backend/app/services/pipeline.py - Payment pipeline → Pre-payout verifier: rechecks before payout
backend/app/services/pipeline.py - Payment pipeline → Audit events: records steps
backend/app/services/pipeline.py - Payment pipeline → PayPal Payouts: sends payout
backend/app/services/pipeline.py - Mandate API → Signed mandate: manages mandate
backend/app/routers/mandates.py - PayPal webhook → PayPal Payouts: verifies event
backend/app/routers/webhooks.py - PayPal webhook → Payment pipeline: refreshes transaction
backend/app/routers/webhooks.py - PayPal service → PayPal webhook: sends events
backend/app/routers/webhooks.py