...
┌─────────────────────────────────────────────────────────────────┐
│ EG Flow Complete Data Flow │
└─────────────────────────────────────────────────────────────────┘
External System EG Flow System (Azure)
(Utility Billing)
│
│ 1. Generate monthly
│ invoice batch (XML)
│
├──────────────────────────────────────────>
│ POST /batches ┌──────────────┐
│ (GASEL/XELLENT/ZYNERGY XML) │ Core API │
│ │ Service │
│ │ │
│ │ • Auth check │
│ │ • Validate │
│ │ • Store blob │
│ └──────┬───────┘
│ │
│ 2. Return Batch ID │
│<────────────────────────────────────────────┤
│ {batchId, status: "uploaded"} │
│ │
│ 3. Start Processing │
├──────────────────────────────────────────> │
│ POST /batches/{id}/start │
│ │
│ ┌──────▼───────┐
│ │ Blob │
│ │ Storage │
│ │ │
│ │ {org}-batches│
│ │ /2025/11/21/ │
│ └──────┬───────┘
│ │
│ 4. 202 Accepted (queued) │
│<────────────────────────────────────────────┤
│ │
│ ┌──────▼────────┐
│ │ Storage │
│ │ Queues │
│ │ │
│ │ • batch-upload│
│ │ • batch-items │
│ │ • email │
│ │ • postal-bulk │
│ └───────┬───────┘
│ │
│ ┌───────────────┼──────────────┐
│ │ │ │
│ ┌──────▼─────┐ ┌─────▼──────┐┌──────▼─────┐ ┌─────▼──────┐┌──────▼─────┐
│ │ Parser │ │ Document │ │ Email │
│ │ Service │ │ Generator │ │ Service │
│ │ │ │ │ │ │
│ │ • Detect │ │ • Render │ │ • SendGrid │
│ │ • Validate │ │ • PDF gen │ │ • Retry │
│ │ • Parse │ │ • Store │ │ • Fallback │
│ │ • Transform│ │ │ │ │
│ └──────┬─────┘ └─────┬──────┘ └─────┬──────┘
│ │ │ │
│ Creates 157 Creates PDFs Sends emails
│ JSON files & queues │
│ (5000/32) delivery │
│ │ │ │
│ ▼ ▼ ▼
│ ┌──────────────────────────────────────┐
│ │ Blob Storage │
│ │ │
│ │ {org}-invoices-2025/11/21/ │
│ │ ├── {id}.json (canonical data) │
│ │ ├── {id}.html (rendered) │
│ │ └── {id}.pdf (final invoice) │
│ └──────────────────────────────────────┘
│ │
│ 5. Poll Status │
│ GET /batches/{id} │
├───────────────────────────────────────────> │
│ │
│ 6. Status Response │
│<─────────────────────────────────────────────┤
│ {status: "processing", │
│ processedItems: 3200/5000} │
│ │
│ 7. Status: Completed │
│<─────────────────────────────────────────────┤
│ {status: "completed", │
│ successfulItems: 4950, │
│ failedItems: 50} │
│ │
│ ┌───────▼──────┐
│ │ Postal │
│ │ Service │
│ │ │
│ │ • Collect │
│ │ • Create ZIP │
│ │ • 21G SFTP │
│ └───────┬──────┘
│ │
End Customer │
│ │
│ 8a. Receive Email │
│<─────────────────────────────────────────────┤
│ (PDF attachment) │
│ │
│ 8b. Receive Postal │
│<─────────────────────────────────────────────┤
│ (via 21G print partner) │
...