# PAMNETSOLUTIONS ISP Billing

Lightweight ISP billing for Hotspot / PPPoE with MikroTik sync, M-Pesa & Airtel payments, SMS/WhatsApp, reports, and cron.

## Requirements

- PHP 8.1+ (pdo_mysql, curl, openssl)
- MySQL 5.7+ / MariaDB 10.3+
- Apache with `mod_rewrite` (or nginx equivalent)
- Network access from server → MikroTik API port `8728`

## Install

1. Point the web root to `isp-billing/public` (or open `.../isp-billing/public/`).
2. Edit `config/config.php` with your DB credentials.
3. Create an empty MySQL database named `isp_billing` (or match config).
4. Open `/install` in the browser and run the installer.
5. Login: **admin** / **admin123** — change this immediately.

### Apache example

```apache
DocumentRoot "C:/TV Hotspot/isp-billing/public"
<Directory "C:/TV Hotspot/isp-billing/public">
    AllowOverride All
    Require all granted
</Directory>
```

## Feature map

| Feature | Where |
|--------|--------|
| Admin login / bad password / logout | Login page |
| Dashboard stats | Dashboard |
| Customers CRUD + search | Customers |
| Packages CRUD + assign | Packages |
| Manual / M-Pesa / Airtel + history + receipt | Payments |
| PPPoE/Hotspot sync, enable/disable, disconnect | PPPoE / Hotspot |
| Add router, test API, sync users | Routers |
| Test SMS/WhatsApp, reminders | SMS / WhatsApp |
| Revenue / customer / payment reports | Reports |
| Company, M-Pesa, SMS, cron secret, backup/restore | Settings |
| Expire users, reminders, router check | `cron.php` |

## Cron

```bash
php "C:\TV Hotspot\isp-billing\cron.php"
```

Or HTTP (set secret in Settings):

```
https://your-host/cron.php?key=YOUR_CRON_SECRET
```

Suggested schedule: every 5–15 minutes.

## Notes

- Customer passwords are **service credentials** (synced to MikroTik), stored as entered.
- M-Pesa needs Safaricom Daraja credentials and a public callback URL.
- Airtel is wired as a collect stub — plug in live Collection API when ready.
- You also have a full AllxSys/PHPNuxBill stack under `net-backup` if you need the larger production platform.
