Skip to content

feat: implement provider fee config, data export, load balancing, and advanced reporting - #339

Open
naallahmagaji31-tech wants to merge 1 commit into
Pidoko257:mainfrom
naallahmagaji31-tech:feat/resolve-issues-200-202-203-205
Open

feat: implement provider fee config, data export, load balancing, and advanced reporting#339
naallahmagaji31-tech wants to merge 1 commit into
Pidoko257:mainfrom
naallahmagaji31-tech:feat/resolve-issues-200-202-203-205

Conversation

@naallahmagaji31-tech

Copy link
Copy Markdown

Summary

This PR resolves four issues from the Stellar Wave milestone by implementing new services, routes, and database migrations for each feature area.


Changes

Issue #200 — Provider Fee Configuration

  • ProviderFeeService — provider-specific fee overrides for MTN, Airtel, and Orange with full version history
  • Fee versioning: each configuration gets an immutable version number; activating a new version deactivates the previous one
  • Fee change approval workflow: POST /api/fees/proposals to propose, POST /api/fees/proposals/:id/review to approve or reject
  • Fee simulation: POST /api/fees/simulate previews the impact of proposed parameters against a set of sample amounts before activation
  • Fee analytics: GET /api/fees/analytics returns P&L-style breakdown by provider and transaction type with a daily trend
  • Fee display helper: POST /api/fees/display returns a structured fee object for embedding in transaction/checkout API responses
  • Migration: 20260730_create_provider_fee_configs.sql

Issue #202 — Data Export

  • DataExportService — CSV, JSON, and HTML-based PDF export with streaming for large datasets
  • PDF export: GET /api/exports/transactions?format=pdf — produces a printable HTML document (renderable by headless browser)
  • Scheduled exports: POST /api/exports/scheduled — daily, weekly, or monthly jobs with email delivery flag
  • Export templates: GET /api/exports/templates — built-in templates (monthly summary, failed transactions, PDF history, GDPR package)
  • GDPR-compliant data export: GET /api/exports/gdpr — full user data package (transactions, profile, KYC, audit logs) as a downloadable JSON file
  • Export access logging for full audit trail
  • Migration: 20260730_create_data_exports.sql

Issue #203 — Provider Load Balancing

  • ProviderLoadBalancer service — pluggable routing strategies across MTN, Airtel, and Orange
  • Strategies: round_robin (default), least_connections, weighted, random
  • Health-aware routing: degraded/unhealthy providers are automatically skipped
  • Capacity tracking: per-provider maxConcurrentRequests, weight, and isEnabled flags
  • Sticky sessions: Redis-backed with configurable TTL (default 5 minutes)
  • Per-provider metrics: request counts, failure counts, average response time
  • Admin API for dynamic config changes (PUT /api/providers/load-balancer/config) and manual health overrides (POST /api/providers/load-balancer/health/:name)
  • Migration: 20260730_create_provider_load_balancer.sql

Issue #205 — Advanced Reporting

  • AdvancedReportingService — typed report generation engine with Redis caching
  • P&L report: GET /api/reports/pnl — revenue, volume, effective fee rate, daily breakdown
  • Settlement report: GET /api/reports/settlement — per-provider settled/pending/failed amounts with settlement rate
  • KYC compliance report: GET /api/reports/kyc-compliance — approval rates by verification level with daily submission trend
  • Custom report builder: POST /api/reports/custom — specify metrics (count, sum_amount, sum_fees, avg_amount), groupBy fields, and filters; returns JSON or CSV
  • Scheduled report generation: POST /api/reports/scheduled — daily/weekly/monthly with email distribution and recipient list
  • Report archival: POST /api/reports/archive with configurable retention; GET /api/reports/archive for retrieval
  • Migration: 20260730_create_advanced_reports.sql

Closes #200
Closes #202
Closes #203
Closes #205

…oko257#205

Issue Pidoko257#200 — Provider Fee Configuration:
- Add ProviderFeeService with provider-specific fee configs (MTN, Airtel, Orange)
- Fee versioning: each config has an immutable version number with full history
- Fee change approval workflow: propose → approve/reject → activate
- Fee simulation: preview impact of proposed params against sample amounts
- Fee analytics: breakdown by provider and transaction type with daily trend
- Fee display helper for embedding structured fee info in API responses
- New routes: /api/fees/providers, /simulate, /analytics, /proposals, /display
- Migration: 20260730_create_provider_fee_configs.sql

Issue Pidoko257#202 — Data Export:
- Add DataExportService with CSV, JSON, and HTML-based PDF export
- Streaming export for CSV/JSON; in-memory PDF for up to 500 rows
- Scheduled export jobs: daily, weekly, monthly with email delivery flag
- Export templates: monthly summary, failed transactions, full history PDF, GDPR package
- GDPR-compliant full data export: transactions, profile, KYC, audit logs
- Export access logging for full audit trail
- New routes: /api/exports/transactions, /scheduled, /gdpr, /templates
- Migration: 20260730_create_data_exports.sql

Issue Pidoko257#203 — Provider Load Balancing:
- Add ProviderLoadBalancer service with pluggable routing strategies
- Strategies: round_robin (default), least_connections, weighted, random
- Health-aware routing: skips unhealthy providers automatically
- Provider capacity tracking: maxConcurrentRequests, weight, isEnabled
- Sticky sessions: Redis-backed with configurable TTL
- Per-provider metrics: request counts, failure counts, avg response time
- Admin API for dynamic config changes and manual health overrides
- New routes: /api/providers/load-balancer/config|capacities|metrics|route|health
- Migration: 20260730_create_provider_load_balancer.sql

Issue Pidoko257#205 — Advanced Reporting:
- Add AdvancedReportingService with typed report generation engine
- P&L report: revenue, volume, effective fee rate, daily breakdown
- Settlement report: per-provider settled/pending/failed with settlement rate
- KYC compliance report: approval rates by level with daily submission trend
- Custom report builder: flexible metrics + groupBy + filters + CSV/JSON output
- Scheduled report generation: daily/weekly/monthly with email distribution
- Report archival with configurable retention policies
- Redis caching for generated reports (1-hour TTL)
- New routes: /api/reports/pnl|settlement|kyc-compliance|custom|scheduled|archive
- Migration: 20260730_create_advanced_reports.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Advanced Reporting Implement Provider Load Balancing Implement Data Export Functionality Implement Provider Fee Configuration

1 participant