feat: implement provider fee config, data export, load balancing, and advanced reporting - #339
Open
naallahmagaji31-tech wants to merge 1 commit into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 historyPOST /api/fees/proposalsto propose,POST /api/fees/proposals/:id/reviewto approve or rejectPOST /api/fees/simulatepreviews the impact of proposed parameters against a set of sample amounts before activationGET /api/fees/analyticsreturns P&L-style breakdown by provider and transaction type with a daily trendPOST /api/fees/displayreturns a structured fee object for embedding in transaction/checkout API responses20260730_create_provider_fee_configs.sqlIssue #202 — Data Export
DataExportService— CSV, JSON, and HTML-based PDF export with streaming for large datasetsGET /api/exports/transactions?format=pdf— produces a printable HTML document (renderable by headless browser)POST /api/exports/scheduled— daily, weekly, or monthly jobs with email delivery flagGET /api/exports/templates— built-in templates (monthly summary, failed transactions, PDF history, GDPR package)GET /api/exports/gdpr— full user data package (transactions, profile, KYC, audit logs) as a downloadable JSON file20260730_create_data_exports.sqlIssue #203 — Provider Load Balancing
ProviderLoadBalancerservice — pluggable routing strategies across MTN, Airtel, and Orangeround_robin(default),least_connections,weighted,randommaxConcurrentRequests,weight, andisEnabledflagsPUT /api/providers/load-balancer/config) and manual health overrides (POST /api/providers/load-balancer/health/:name)20260730_create_provider_load_balancer.sqlIssue #205 — Advanced Reporting
AdvancedReportingService— typed report generation engine with Redis cachingGET /api/reports/pnl— revenue, volume, effective fee rate, daily breakdownGET /api/reports/settlement— per-provider settled/pending/failed amounts with settlement rateGET /api/reports/kyc-compliance— approval rates by verification level with daily submission trendPOST /api/reports/custom— specify metrics (count,sum_amount,sum_fees,avg_amount),groupByfields, and filters; returns JSON or CSVPOST /api/reports/scheduled— daily/weekly/monthly with email distribution and recipient listPOST /api/reports/archivewith configurable retention;GET /api/reports/archivefor retrieval20260730_create_advanced_reports.sqlCloses #200
Closes #202
Closes #203
Closes #205