Skip to content

ripcord20/DataGate-Bill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DATAGATE - Sistem Manajemen ISP Terintegrasi

GitHub stars GitHub forks GitHub issues GitHub license

πŸ“‹ Deskripsi Aplikasi

Gembok Bill adalah sistem manajemen ISP terintegrasi yang menggabungkan WhatsApp Gateway dengan portal admin web untuk mengelola layanan internet secara komprehensif. Aplikasi ini dirancang khusus untuk ISP (Internet Service Provider) yang membutuhkan solusi all-in-one untuk manajemen pelanggan, billing, monitoring, dan notifikasi.

🎯 Fitur Utama

  • πŸ”§ WhatsApp Bot Gateway - Interface perintah via WhatsApp
  • 🌐 Web Portal Admin - Dashboard admin yang lengkap
  • πŸ’³ Sistem Billing Terintegrasi - Manajemen tagihan dan pembayaran
  • πŸ’³ Payment Gateway - Integrasi Midtrans, Xendit, Tripay
  • πŸ“Š GenieACS Management - Monitoring dan manajemen perangkat ONU/ONT
  • πŸ› οΈ Mikrotik Management - Manajemen PPPoE dan Hotspot
  • πŸ“± Portal Pelanggan - Self-service untuk pelanggan
  • πŸ“ˆ Monitoring Real-time - PPPoE, RX Power, dan sistem
  • πŸ”” Notifikasi Otomatis - WhatsApp notifications
  • πŸ“‹ Trouble Ticket System - Manajemen gangguan

πŸš€ Instalasi

Persyaratan Sistem

  • Node.js v18+ (direkomendasikan v20+)
  • npm atau yarn
  • GenieACS API access
  • Mikrotik API access
  • WhatsApp number untuk bot
  • Database SQLite (built-in)

1. Clone Repository

# Install git jika belum ada
apt install git curl -y

sudo apt update
sudo apt install git

# Clone repository
git clone https://github.com/ripcord20/DataGate-Bill.git
cd DataGate-Bill

2. Install Dependencies

# Install semua dependencies
npm install

jika ada masalah dengan npm install npm warn deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. npm warn deprecated [email protected]: This package is no longer supported. npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported npm warn deprecated [email protected]: This package is deprecated. Use require('node:util').isDeepStrictEqual instead. npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported npm warn deprecated [email protected]: This package is no longer supported. npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported npm warn deprecated [email protected]: This package is no longer supported. npm warn deprecated [email protected]: This package is no longer supported. npm warn deprecated [email protected]: Use your platform's native DOMException instead npm warn deprecated [email protected]: node-routeros has been discontinued

added 548 packages, and audited 549 packages in 51s

81 packages are looking for funding run npm fund for details

3 high severity vulnerabilities

To address all issues (including breaking changes) run : npm audit fix --force

3. Konfigurasi Settings

run : nano setting.json

Edit file settings.json dengan pengaturan yang sesuai:

{
  "admins.0": "628529988665",
  "admin_enabled": "true",
  "admin_username": "admin",
  "admin_password": "admin",
  "genieacs_url": "http://192.168.22.253:7557",
  "genieacs_username": "admin",
  "genieacs_password": "admin",
  "mikrotik_host": "192.168.90.1",
  "mikrotik_port": "7288",
  "mikrotik_user": "admin",
  "mikrotik_password": "admin",
  "main_interface": "sfp+1",
  "pppoe_monitor_enable": "true",
  "technician_numbers.0": "6285784495037",
  "technician_numbers.1": "6285606424075",
  "technician_group_id": "[email protected]",
  "whatsapp_session_path": "./whatsapp-session",
  "whatsapp_keep_alive": "true",
  "whatsapp_restart_on_error": "true",
  "whatsapp_log_level": "silent",
  "pppoe_monitor_interval": "60000",
  "rx_power_warning": "-40",
  "rx_power_critical": "-45",
  "rx_power_notification_enable": "true",
  "rx_power_notification_interval": "300000",
  "company_header": "🏒 DATAGATE 🏒",
  "footer_info": "The Real Fastes Interconnected",
  "customerPortalOtp": "false",
  "otp_length": "4",
  "otp_expiry_minutes": "5",
  "server_port": "3003",
  "server_host": "localhost",
  "pppoe_notifications.enabled": "true",
  "pppoe_notifications.loginNotifications": "true",
  "pppoe_notifications.logoutNotifications": "true",
  "pppoe_notifications.includeOfflineList": "true",
  "pppoe_notifications.maxOfflineListCount": "20",
  "pppoe_notifications.monitorInterval": "60000",
  "secret_key": "alijaya-digital-network",
  "reconnect_interval": "5000",
  "log_level": "info",
  "logo_filename": "logo.png",
  "payment_gateway": {
    "active": "midtrans",
    "midtrans": {
      "enabled": true,
      "production": false,
      "merchant_id": "G123456789",
      "client_key": "SB-Mid-client-123456789",
      "server_key": "SB-Mid-server-123456789"
    },
    "xendit": {
      "enabled": false,
      "production": false,
      "api_key": "xnd_public_development_123456789",
      "callback_token": "xnd_callback_token_123456789"
    },
    "tripay": {
      "enabled": false,
      "production": false,
      "api_key": "DEV-123456789",
      "private_key": "private_key_123456789",
      "merchant_code": "T12345"
    }
  },
  "payment_accounts": {
    "bank_transfer": {
      "bank_name": "Bank BRI",
      "account_number": "1234-5678-9012-3456",
      "account_name": "ALIJAYA DIGITAL NETWORK"
    },
    "cash": {
      "office_address": "Jl. Contoh No. 123, Kota, Provinsi",
      "office_hours": "08:00 - 17:00 WIB"
    }
  }
}

4. Setup Database

# Jalankan script untuk setup database billing
node scripts/add-payment-gateway-tables.js

5. Menjalankan Aplikasi

Development Mode:

npm run dev

Production Mode:

npm start

Dengan PM2:

# Install PM2 jika belum ada
npm install -g pm2

# Start aplikasi
pm2 start app.js --name DataGate-Bill

# Monitor aplikasi
pm2 monit

# View logs
pm2 logs DataGate-Bill

6. Setup WhatsApp Bot

  1. Siapkan 2 nomor WhatsApp:

    • 1 nomor untuk bot (akan scan QR code)
    • 1 nomor untuk admin (untuk mengirim perintah)
  2. Scan QR Code yang muncul di terminal untuk login WhatsApp bot

  3. Test dengan perintah: status atau menu


🌐 Akses Web Portal

  • Portal Pelanggan: http://ipserver:3003
  • Admin Dashboard: http://ipserver:3003/admin/login
  • Login Admin: Username dan password yang dikonfigurasi di settings.json

πŸ’³ Sistem Billing

Fitur Billing

  • πŸ“Š Dashboard Billing - Statistik real-time
  • πŸ‘₯ Manajemen Pelanggan - CRUD pelanggan dengan PPPoE username
  • πŸ“¦ Manajemen Paket - Paket internet dengan harga
  • πŸ“„ Manajemen Invoice - Buat, edit, hapus tagihan
  • πŸ’° Manajemen Pembayaran - Tracking pembayaran
  • πŸ”„ Auto Invoice - Generate tagihan otomatis
  • πŸ’³ Payment Gateway - Integrasi Midtrans, Xendit, Tripay
  • πŸ“± WhatsApp Notifications - Notifikasi tagihan dan pembayaran

Payment Gateway

Aplikasi mendukung 3 payment gateway populer di Indonesia:

  1. Midtrans - Payment gateway terpopuler
  2. Xendit - Payment gateway enterprise
  3. Tripay - Payment gateway lokal

Setup Payment Gateway:

  1. Akses /admin/billing/payment-settings
  2. Pilih gateway yang aktif
  3. Masukkan API keys
  4. Test koneksi
  5. Aktifkan production mode

πŸ”§ WhatsApp Bot Commands

Perintah untuk Pelanggan

  • menu - Menampilkan menu bantuan
  • status - Cek status perangkat
  • refresh - Refresh data perangkat
  • gantiwifi [nama] - Ganti nama WiFi
  • gantipass [password] - Ganti password WiFi
  • info - Informasi layanan
  • speedtest - Test kecepatan internet

Perintah untuk Admin

GenieACS Commands

  • devices - Daftar perangkat
  • cekall - Cek semua perangkat
  • cek [nomor] - Cek status ONU
  • cekstatus [nomor] - Cek status pelanggan
  • admincheck [nomor] - Cek perangkat admin
  • gantissid [nomor] [ssid] - Ubah SSID
  • gantipass [nomor] [pass] - Ubah password
  • reboot [nomor] - Restart ONU
  • factory reset [nomor] - Reset factory
  • refresh - Refresh data perangkat
  • tag [nomor] [tag] - Tambah tag pelanggan
  • untag [nomor] [tag] - Hapus tag
  • tags [nomor] - Lihat tags
  • addtag [device_id] [nomor] - Tambah tag perangkat
  • addppoe_tag [pppoe_id] [nomor] - Tambah tag dengan id pppoe
  • adminssid [nomor] [ssid] - Admin ubah SSID
  • adminrestart [nomor] - Admin restart ONU
  • adminfactory [nomor] - Admin factory reset
  • confirm admin factory reset [nomor] - Konfirmasi factory reset

Mikrotik Commands

  • interfaces - Daftar interface
  • interface [nama] - Detail interface
  • enableif [nama] - Aktifkan interface
  • disableif [nama] - Nonaktifkan interface
  • ipaddress - Alamat IP
  • routes - Tabel routing
  • dhcp - DHCP leases
  • ping [ip] [count] - Test ping
  • logs [topics] [count] - Log Mikrotik
  • firewall [chain] - Status firewall
  • users - Daftar semua user
  • profiles [type] - Daftar profile
  • identity [nama] - Info router
  • clock - Waktu router
  • resource - Info resource
  • reboot - Restart router
  • confirm restart - Konfirmasi restart

Hotspot & PPPoE Management

  • vcr [user] [profile] [nomor] - Buat voucher
  • hotspot - User hotspot aktif
  • pppoe - User PPPoE aktif
  • offline - User PPPoE offline
  • addhotspot [user] [pass] [profile] - Tambah user
  • addpppoe [user] [pass] [profile] [ip] - Tambah PPPoE
  • setprofile [user] [profile] - Ubah profile
  • delhotspot [username] - Hapus user hotspot
  • delpppoe [username] - Hapus user PPPoE
  • addpppoe_tag [user] [nomor] - Tambah tag PPPoE
  • member [username] [profile] [nomor] - Tambah member
  • list - Daftar semua user
  • remove [username] - Hapus user (generic)
  • addadmin [nomor] - Tambah nomor admin
  • removeadmin [nomor] - Hapus nomor admin

Sistem & Admin

  • otp [nomor] - Kirim OTP
  • status - Status sistem
  • logs - Log aplikasi
  • restart - Restart aplikasi
  • debug resource - Debug resource
  • checkgroup - Cek status group
  • setadmin [nomor] - Set nomor admin
  • settechnician [nomor] - Set nomor teknisi
  • setheader [teks] - Set header pesan
  • setfooter [teks] - Set footer pesan
  • setgenieacs [url] [user] [pass] - Set GenieACS
  • setmikrotik [host] [port] [user] [pass] - Set Mikrotik
  • admin - Menu admin
  • help - Bantuan perintah
  • ya/iya/yes - Konfirmasi ya
  • tidak/no/batal - Konfirmasi tidak
  • addwan [interface] - Tambah WAN

WiFi & Layanan

  • info wifi - Info WiFi pelanggan
  • info - Info layanan
  • gantiwifi [ssid] - Ganti nama WiFi
  • gantipass [password] - Ganti password WiFi
  • speedtest - Test kecepatan
  • diagnostic - Diagnostik perangkat
  • history - Riwayat perangkat
  • menu - Menu utama
  • factory reset - Reset factory (pelanggan)
  • confirm factory reset - Konfirmasi factory reset

πŸ› οΈ Troubleshooting

Masalah Group dan Nomor Teknisi

Jika ada error seperti:

Error sending message: Error: item-not-found
warn: Skipping invalid WhatsApp number: 08xxxxxxxx

Solusi:

  1. Jalankan Script Perbaikan Otomatis:

    node scripts/fix-technician-config.js
  2. Cek Status Group:

    • Kirim perintah WhatsApp: checkgroup
    • Akan menampilkan status group dan nomor teknisi
  3. Perbaiki Manual:

    • Buka Admin Settings
    • Update nomor teknisi dengan format: 628xxxxxxxxxx
    • Pastikan group ID berformat: [email protected]
    • Tambahkan bot ke group teknisi

Format Nomor yang Benar

  • βœ… 628xxxxxxxxxx
  • ❌ 08xxxxxxxxxx
  • ❌ +628xxxxxxxxxx

Format Group ID yang Benar

Masalah Payment Gateway

  1. Invalid API Key:

    • Pastikan API key benar dan aktif
    • Cek status akun di dashboard payment gateway
    • Test koneksi di /admin/billing/payment-settings
  2. Webhook Error:

    • Pastikan URL webhook benar
    • Cek firewall dan port
    • Verifikasi signature di webhook handler

πŸ“ Struktur Aplikasi

gembok-bill/
β”œβ”€β”€ app.js                 # File utama aplikasi
β”œβ”€β”€ package.json           # Dependencies dan scripts
β”œβ”€β”€ settings.json          # Konfigurasi aplikasi
β”œβ”€β”€ config/               # Modul konfigurasi
β”‚   β”œβ”€β”€ whatsapp.js       # WhatsApp bot handler
β”‚   β”œβ”€β”€ genieacs.js       # GenieACS API
β”‚   β”œβ”€β”€ mikrotik.js       # Mikrotik API
β”‚   β”œβ”€β”€ billing.js        # Billing system
β”‚   β”œβ”€β”€ paymentGateway.js # Payment gateway manager
β”‚   β”œβ”€β”€ logger.js         # Logging system
β”‚   └── settingsManager.js # Settings management
β”œβ”€β”€ routes/               # Express routes
β”‚   β”œβ”€β”€ adminAuth.js      # Admin authentication
β”‚   β”œβ”€β”€ adminDashboard.js # Dashboard routes
β”‚   β”œβ”€β”€ adminBilling.js   # Billing management
β”‚   β”œβ”€β”€ adminGenieacs.js  # GenieACS management
β”‚   β”œβ”€β”€ adminMikrotik.js  # Mikrotik management
β”‚   β”œβ”€β”€ adminHotspot.js   # Hotspot management
β”‚   β”œβ”€β”€ adminSetting.js   # Settings management
β”‚   β”œβ”€β”€ customerPortal.js # Customer portal
β”‚   β”œβ”€β”€ payment.js        # Payment gateway routes
β”‚   └── troubleReport.js  # Trouble ticket system
β”œβ”€β”€ views/                # EJS templates
β”‚   β”œβ”€β”€ admin/           # Admin views
β”‚   β”‚   β”œβ”€β”€ billing/     # Billing pages
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ customer/        # Customer views
β”‚   └── partials/        # Shared components
β”œβ”€β”€ public/               # Static files
β”‚   β”œβ”€β”€ css/
β”‚   β”œβ”€β”€ js/
β”‚   └── img/
β”œβ”€β”€ data/                 # Database files
β”œβ”€β”€ logs/                 # Log files
β”œβ”€β”€ scripts/              # Utility scripts
└── whatsapp-session/     # WhatsApp session files

🀝 Kontribusi

Untuk berkontribusi pada proyek ini:

  1. Fork repository
  2. Buat branch fitur baru (git checkout -b feature/AmazingFeature)
  3. Commit perubahan (git commit -m 'Add some AmazingFeature')
  4. Push ke branch (git push origin feature/AmazingFeature)
  5. Buat Pull Request

Development Guidelines

  • Gunakan ESLint untuk code formatting
  • Tulis unit tests untuk fitur baru
  • Update dokumentasi untuk perubahan
  • Ikuti conventional commits

πŸ“„ Lisensi

Distributed under the ISC License. See LICENSE for more information.


πŸ†˜ Support


πŸ™ Donasi

Rekening Donasi Untuk Pembangunan Masjid:

  • Bank: BRI
  • No. Rekening: 4206 01 003953 531
  • Atas Nama: WARJAYA
  • Info: 08194215703 ALIJAYA

⚠️ Disclaimer

Jangan lupa untuk mengkonfigurasi file settings.json terlebih dahulu sebelum menjalankan aplikasi!

Aplikasi ini dikembangkan untuk keperluan ISP dan membutuhkan konfigurasi yang tepat untuk berfungsi dengan baik. Pastikan semua kredensial API dan pengaturan sudah benar sebelum deployment ke production.


Made with ❀️ by Ali Jaya

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published