Charging Session Management
The Sessions module (Charging Sessions) mirrors the real-time status of charges and maintains the historical record (System of Record). We use Firestore coupled with a BullMQ bus to ensure fault tolerance.
Session Lifecycle
- CREATED: Initial record created.
- AUTHORIZED: Payment validated (RemoteStart dispatched).
- CHARGING: Hardware confirmed the start.
- STOPPING: RemoteStop dispatched.
- COMPLETED: Transaction completed with financial capture.
- ERROR: Hardware or bank failure. Automatic refunds triggered.
Query Sessions
Returns a paginated list with the session history of the authenticated company.
GET /charging-session
Automatic Failure Handling (Self-Healing)
- Auto-Stop due to Balance Limit: If the dynamic cost exceeds the pre-authorized amount, the transaction ends automatically.
- Refund due to Hardware Failure: If the charger reports an anomaly (CHARGER_FAULT), the API consolidates the consumption and refunds the remainder.