Benfex ISP Billing System
A comprehensive solution for Internet Service Providers to manage customers, subscriptions, billing, and payments
Benfex ISP Billing System
A comprehensive ISP management solution that streamlines customer management, billing cycles, payment processing, and bandwidth monitoring for internet service providers.
Project Overview
The Benfex ISP Billing System is a comprehensive solution designed to help Internet Service Providers manage their customers, track usage, automate billing cycles, and process payments efficiently. The system includes an administrative dashboard for ISP operators and a customer portal for subscribers.
As the sole developer on this project, I was responsible for the entire development lifecycle, from requirement gathering and system design to implementation, testing, and deployment.
Key Features
Customer Management
Comprehensive customer database with profile management, service history, and communication logs.
Automated Billing
Automated invoice generation, flexible billing cycles, and customizable service plans.
Payment Processing
Integration with multiple payment gateways including M-Pesa and Paystack for seamless transactions.
Bandwidth Monitoring
Real-time bandwidth usage tracking and data consumption reports per customer.
Analytics Dashboard
Comprehensive reporting with visual representations of business metrics and performance indicators.
Security Features
Role-based access control, encrypted data storage, and secure API endpoints.
Technology Stack
PHP
JavaScript
CSS/Bootstrap
MySQL
REST API
VPS Hosting
Payment APIs
JWT Auth
AJAX
Push Notifications
The technology stack was carefully selected to ensure scalability, security, and ease of maintenance. The backend uses PHP with a custom MVC architecture, while the frontend leverages Bootstrap and JavaScript for a responsive and interactive user experience. MySQL was chosen for data persistence due to its reliability and performance with relational data.
System Architecture
The system follows a multi-tier architecture with clear separation between the client, application, data, and external service layers. This design ensures modularity, security, and scalability.
Development Process
This project followed an Agile development methodology with iterative development cycles. I started with extensive requirements gathering from potential ISP clients to understand their workflow and pain points. The development process included:
- Planning & Design: Created detailed wireframes, database schema, and system architecture diagrams.
- Development: Built the system incrementally with regular client feedback, starting with core billing functions.
- Testing: Implemented comprehensive testing including unit tests for critical components and user acceptance testing.
- Deployment: Set up a scalable VPS infrastructure with proper security measures and monitoring tools.
- Maintenance: Established continuous integration pipeline for seamless updates and feature additions.
Key Challenges & Solutions
Complex Billing Logic
Challenge: Implementing flexible billing cycles with support for various service plans, prorated billing, and automatic invoice generation.
Solution: Developed a modular billing engine with configurable rules and templates that could handle different scenarios. Implemented extensive unit tests to ensure accuracy.
Payment Gateway Integration
Challenge: Integrating multiple payment gateways (M-Pesa and Paystack) with different APIs and reconciliation mechanisms.
Solution: Created an abstraction layer with a unified interface for payment processing, allowing easy addition of new payment methods with minimal code changes.
Real-time Bandwidth Monitoring
Challenge: Implementing accurate bandwidth monitoring with minimal performance impact on the network infrastructure.
Solution: Developed a lightweight agent that samples network traffic at regular intervals, with data aggregation happening on separate worker processes to minimize system load.
Scalable Infrastructure
Challenge: Creating a system that could scale from small ISPs with hundreds of customers to larger operations with thousands.
Solution: Implemented a cloud-based architecture with load balancing, database optimization, and caching strategies to ensure performance at scale.
Code Samples
Below are key code snippets that highlight important functionality in the Benfex ISP Billing System:
Payment Gateway Integration
/**
* Payment Gateway Interface
* This interface defines the contract that all payment gateways must implement
*/
interface PaymentGatewayInterface {
public function initialize($amount, $email, $reference);
public function verify($reference);
public function getTransactionStatus($reference);
}
/**
* Payment Gateway Factory
* Creates and returns the appropriate payment gateway instance
*/
class PaymentGatewayFactory {
public static function create($gateway) {
switch(strtolower($gateway)) {
case 'paystack':
return new PaystackGateway(CONFIG['paystack_secret_key']);
case 'mpesa':
return new MPesaGateway(
CONFIG['mpesa_consumer_key'],
CONFIG['mpesa_consumer_secret'],
CONFIG['mpesa_environment']
);
default:
throw new Exception("Unsupported payment gateway: {$gateway}");
}
}
}
/**
* Payment Processing Service
* Handles payment processing logic across different gateways
*/
class PaymentService {
private $gateway;
public function __construct($gatewayName) {
$this->gateway = PaymentGatewayFactory::create($gatewayName);
}
public function processPayment($invoice) {
try {
$reference = 'INV' . $invoice->id . '_' . time();
$response = $this->gateway->initialize(
$invoice->amount,
$invoice->customer->email,
$reference
);
// Log the transaction
$this->logTransaction($invoice->id, $reference, $response);
return $response;
} catch (Exception $e) {
Logger::logError('Payment processing failed: ' . $e->getMessage());
throw new PaymentException("Payment could not be processed: " . $e->getMessage());
}
}
// Other methods...
}
Bandwidth Monitoring Service
/**
* Bandwidth Monitor Service
* Tracks and records client bandwidth usage through router API integration
*/
class BandwidthMonitor {
private $db;
private $routerAPI;
public function __construct(Database $db, RouterAPIInterface $routerAPI) {
$this->db = $db;
$this->routerAPI = $routerAPI;
}
/**
* Collects bandwidth data for all active clients
* Runs as a scheduled task every 15 minutes
*/
public function collectUsageData() {
$activeClients = $this->db->query("
SELECT client_id, username, ip_address
FROM clients
WHERE status = 'active'
")->fetchAll();
foreach ($activeClients as $client) {
try {
$usage = $this->routerAPI->getBandwidthUsage($client['ip_address']);
// Store the collected data
$this->db->execute("
INSERT INTO bandwidth_logs
(client_id, download_bytes, upload_bytes, timestamp)
VALUES (?, ?, ?, NOW())
", [
$client['client_id'],
$usage['download'],
$usage['upload']
]);
// Check if client is approaching their limit
$this->checkUsageThresholds($client['client_id'], $usage);
} catch (Exception $e) {
Logger::logError("Failed to collect bandwidth data for client {$client['client_id']}: " . $e->getMessage());
}
}
}
/**
* Checks if client is approaching their bandwidth limit
* Sends notifications if thresholds are reached
*/
private function checkUsageThresholds($clientId, $currentUsage) {
$plan = $this->db->query("
SELECT c.email, p.monthly_data_cap, p.name as plan_name
FROM clients c
JOIN plans p ON c.plan_id = p.plan_id
WHERE c.client_id = ?
", [$clientId])->fetch();
if (!$plan) return;
$totalUsage = $this->getTotalMonthlyUsage($clientId);
$usagePercentage = ($plan['monthly_data_cap'] > 0)
? ($totalUsage / $plan['monthly_data_cap']) * 100
: 0;
// Send notifications at 80% and 95% thresholds
if ($usagePercentage >= 95) {
NotificationService::send(
$plan['email'],
'Critical Bandwidth Usage Alert',
"You have used {$usagePercentage}% of your monthly data allowance."
);
} elseif ($usagePercentage >= 80 && $usagePercentage < 95) {
NotificationService::send(
$plan['email'],
'Bandwidth Usage Warning',
"You have used {$usagePercentage}% of your monthly data allowance."
);
}
}
// Additional methods...
}
Client-Side Dashboard Data Visualization
/**
* Dashboard Charts Module
* Creates interactive data visualizations for the admin dashboard
*/
const DashboardCharts = (function() {
// Private methods and properties
const _formatCurrency = amount => {
return new Intl.NumberFormat('en-KE', {
style: 'currency',
currency: 'KES'
}).format(amount);
};
const _createRevenueChart = async () => {
try {
const response = await fetch('/api/analytics/revenue?period=6months');
const data = await response.json();
if (!data.success) {
throw new Error(data.message);
}
const ctx = document.getElementById('revenueChart').getContext('2d');
return new Chart(ctx, {
type: 'line',
data: {
labels: data.data.map(item => item.month),
datasets: [{
label: 'Monthly Revenue',
data: data.data.map(item => item.amount),
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 2,
tension: 0.4
}]
},
options: {
responsive: true,
plugins: {
tooltip: {
callbacks: {
label: function(context) {
return _formatCurrency(context.raw);
}
}
}
},
scales: {
y: {
beginAtZero: true,
ticks: {
callback: function(value) {
return _formatCurrency(value);
}
}
}
}
}
});
} catch (error) {
console.error('Failed to load revenue data:', error);
document.getElementById('revenueChartContainer').innerHTML =
`Failed to load revenue data: ${error.message}`;
}
};
// Public API
return {
initialize: function() {
_createRevenueChart();
this.createCustomerGrowthChart();
this.createBandwidthUsageChart();
this.setupRefreshEvents();
},
createCustomerGrowthChart: async function() {
// Implementation similar to _createRevenueChart
},
createBandwidthUsageChart: async function() {
// Implementation for bandwidth usage visualization
},
setupRefreshEvents: function() {
// Set up event listeners for refreshing charts
document.getElementById('refresh-dashboard').addEventListener('click', () => {
this.initialize();
});
// Auto-refresh every 5 minutes
setInterval(() => this.initialize(), 300000);
}
};
})();
// Initialize the dashboard when the DOM is fully loaded
document.addEventListener('DOMContentLoaded', () => {
DashboardCharts.initialize();
});
Outcomes & Results
The Benfex ISP Billing System has been successfully implemented for multiple ISP clients in Kenya, resulting in significant operational improvements and business growth:
The system has been particularly effective for small and medium-sized ISPs who previously relied on manual processes or fragmented solutions. Client feedback has been overwhelmingly positive, with particular praise for the intuitive interface and comprehensive reporting capabilities.
Learnings & Reflections
Developing the Benfex ISP Billing System was a significant learning experience that pushed me to grow as a developer:
Technical Lessons
- Scalable Architecture: I learned how to design systems that can grow with user demand, implementing caching and database optimization techniques.
- API Integration: Gained extensive experience integrating with third-party payment gateways and networking equipment APIs.
- Security Best Practices: Implemented robust authentication, authorization, and data protection measures to safeguard sensitive customer and financial information.
Business & Soft Skills
- Requirements Gathering: Learned to effectively translate client needs into technical specifications through structured interviews and prototyping.
- Project Management: Improved my ability to plan, prioritize features, and deliver iterative improvements while maintaining quality.
- Client Communication: Developed skills in explaining technical concepts to non-technical stakeholders and managing expectations.
Future Improvements
Based on user feedback and market trends, I've identified several areas for future development:
- Integration with additional payment gateways to support more regional payment methods
- Enhanced analytics dashboard with predictive capabilities for bandwidth usage forecasting
- Mobile application for customers to monitor usage and make payments on the go
- API for third-party integrations with other business systems
Relevance to CEMA Software Engineering Role
This project demonstrates several key skills directly applicable to the CEMA Software Engineering Internship position:
- Full-Stack Development: Proficiency in both front-end and back-end technologies, enabling me to contribute to all aspects of CEMA's web applications.
- Server Management: Experience configuring and maintaining VPS infrastructure, similar to what would be needed for CEMA's internal server infrastructure.
- Data Visualization: Skills in creating intuitive dashboards and reports, which would be valuable for CEMA's epidemiological modeling work.
- API Integration: Experience with third-party API integration that would be beneficial for connecting CEMA's systems with external data sources.
- Secure Coding Practices: Strong focus on security, which is essential when working with sensitive health data.
The skills and experience gained from this project align perfectly with CEMA's needs for developing and maintaining web applications for data visualization and analytics in the public health domain.
Upcoming Projects
Innovative network solutions on the horizon
Remote Network Management System
Comprehensive Mikrotik device management platform with real-time monitoring, configuration, and advanced network control capabilities.
Learn MoreKiPay Payment Gateway
A secure and efficient payment processing platform designed to simplify online transactions.
Learn More