### Manual Installation and Running Dino-Bill Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Steps for manual installation including cloning the repository, installing dependencies, and starting the server. Access the web installer via your browser after starting. ```bash git clone https://github.com/ittosolution-png/Dino-Bill.git cd Dino-Bill npm install node server.js # Buka browser: http://ip-server:3999 → Web Installer akan muncul otomatis ``` -------------------------------- ### Setup Database via Web Installer API Source: https://context7.com/ittosolution-png/dino-bill/llms.txt API endpoint to set up the database, create the 'users' table, and generate the .env file. The server automatically restarts after a successful setup. ```bash curl -X POST http://localhost:3999/install/setup \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "dbHost=localhost&dbUser=root&dbPass=rahasia123&dbName=dinobill" # Respons sukses → halaman installer step 'success' di-render # Server akan restart → semua rute normal aktif ``` -------------------------------- ### Setup Database via Web Installer Source: https://context7.com/ittosolution-png/dino-bill/llms.txt This endpoint is called by the web installer to set up the database, create the users table, and generate the .env file. After a successful setup, the server automatically restarts. ```APIDOC ## POST /install/setup — Setup Database via Web Installer ### Description Endpoint ini dipanggil oleh form web installer untuk membuat database, tabel `users`, dan menghasilkan file `.env`. Setelah sukses, server restart otomatis dalam 3 detik. ### Method POST ### Endpoint /install/setup ### Parameters #### Request Body - **dbHost** (string) - Required - Database host - **dbUser** (string) - Required - Database username - **dbPass** (string) - Required - Database password - **dbName** (string) - Required - Database name ### Request Example ```bash curl -X POST http://localhost:3999/install/setup \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "dbHost=localhost&dbUser=root&dbPass=rahasia123&dbName=dinobill" ``` ### Response #### Success Response (200) - Renders the 'success' step of the installer. - Server restarts, activating all normal routes. ``` -------------------------------- ### Example .env File Configuration Source: https://context7.com/ittosolution-png/dino-bill/llms.txt An example of the .env file generated by the installer, showing database connection details and application settings. This file is crucial for configuring the Dino-Bill instance. ```env DB_HOST=localhost DB_PORT=3306 DB_NAME=dinobill DB_USER=root DB_PASS=rahasia123 APP_PORT=3999 APP_NAME=Dino-Bill NODE_ENV=production SESSION_SECRET=abc123xyz ``` -------------------------------- ### Run Dino-Bill application Source: https://github.com/ittosolution-png/dino-bill/blob/main/README.md Start the Dino-Bill application server. Access the web installer via your browser. ```bash node server.js ``` -------------------------------- ### Install Node.js dependencies Source: https://github.com/ittosolution-png/dino-bill/blob/main/README.md Install project dependencies using npm after cloning the repository. ```bash npm install ``` -------------------------------- ### Install Dino-Bill with a single command Source: https://github.com/ittosolution-png/dino-bill/blob/main/README.md Run this command in your Ubuntu terminal to quickly install Dino-Bill. ```bash curl -sSL https://raw.githubusercontent.com/ittosolution-png/Dino-Bill/main/install.sh | bash ``` -------------------------------- ### Clone Dino-Bill repository Source: https://github.com/ittosolution-png/dino-bill/blob/main/README.md Clone the Dino-Bill repository to your local machine to begin manual installation. ```bash git clone https://github.com/ittosolution-png/Dino-Bill.git cd Dino-Bill ``` -------------------------------- ### Get System Resource Info - MikroTik Helper Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Retrieves system resource information from the MikroTik router, such as board name, firmware version, CPU load, and uptime. ```javascript const mikrotik = require('./helpers/mikrotik'); const router = { ip_address: '192.168.1.1', username: 'admin', password: 'password123', port: 8728 }; // Info sumber daya sistem const sys = await mikrotik.getSystemResource(router); ``` -------------------------------- ### Get All PPPoE Secrets - MikroTik Helper Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Fetches all configured PPPoE secrets from the MikroTik router, including their status (enabled/disabled) and profile. ```javascript const mikrotik = require('./helpers/mikrotik'); const router = { ip_address: '192.168.1.1', username: 'admin', password: 'password123', port: 8728 }; // Ambil semua PPPoE secrets const secrets = await mikrotik.getPPPoESecrets(router); ``` -------------------------------- ### System Update Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Endpoint to trigger an automatic update from GitHub, including pulling the latest code, installing dependencies, and restarting the server. ```APIDOC ## Update System ### Description Initiates an automatic system update by pulling the latest code from the main branch of the GitHub repository, running `npm install`, and restarting the server. ### Method POST ### Endpoint `/api/system/update` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the update process was initiated successfully. - **message** (string) - A message confirming the update and server restart (e.g., "Aplikasi berhasil diperbarui. Server akan restart dalam 3 detik."). ### Request Example ```bash curl -X POST http://localhost:3999/api/system/update -b cookies.txt ``` ``` -------------------------------- ### Portal Get WiFi Info Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Retrieves the current WiFi SSID and password from GenieACS. ```APIDOC ## GET /portal/wifi ### Description Fetches the current WiFi network name (SSID) and password associated with the customer's account. ### Method GET ### Endpoint /portal/wifi ### Response #### Success Response (200) - **success** (boolean) - Indicates if the WiFi information was retrieved successfully. - **ssid** (string) - The current WiFi SSID. - **password** (string) - The current WiFi password. #### Response Example ```json { "success": true, "ssid": "Rumah-Budi", "password": "wifi12345" } ``` ``` -------------------------------- ### Get Active PPPoE Connections - MikroTik Helper Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Retrieves a list of all currently active PPPoE connections on the MikroTik router. ```javascript const mikrotik = require('./helpers/mikrotik'); const router = { ip_address: '192.168.1.1', username: 'admin', password: 'password123', port: 8728 }; // Ambil semua koneksi PPPoE aktif const active = await mikrotik.getActiveConnections(router); ``` -------------------------------- ### Portal Get Tickets Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Retrieves a list of support tickets associated with the customer's account. ```APIDOC ## GET /portal/tickets ### Description Fetches a history of support tickets submitted by the customer. ### Method GET ### Endpoint /portal/tickets ### Response #### Success Response (200) - **success** (boolean) - Indicates if the tickets were retrieved successfully. - **tickets** (array) - A list of support tickets. - **id** (integer) - The unique ID of the ticket. - **title** (string) - The title of the ticket. - **status** (string) - The current status of the ticket (e.g., 'open'). #### Response Example ```json { "success": true, "tickets": [{ "id": 3, "title": "Internet Lambat", "status": "open" }] } ``` ``` -------------------------------- ### Tripay Helper Get Payment Channels Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Helper function to retrieve available payment channels from Tripay. ```APIDOC ## Tripay Helper: getPaymentChannels ### Description Fetches a list of all available payment channels supported by Tripay. ### Parameters - **pool** (object) - Required - Database connection pool. ### Response #### Success Response - **success** (boolean) - Indicates if the payment channels were retrieved successfully. - **data** (array) - A list of available payment channels. - **name** (string) - The display name of the payment channel. - **code** (string) - The internal code for the payment channel. - **icon_url** (string) - URL for the icon representing the payment channel. #### Response Example ```json { "success": true, "data": [{ "name": "QRIS", "code": "QRIS", "icon_url": "..." }, ...] } ``` ``` -------------------------------- ### Pembaruan Otomatis Sistem dari GitHub Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Endpoint ini digunakan untuk menarik pembaruan terbaru dari repositori GitHub, menginstal dependensi, dan me-restart server secara otomatis. Pastikan Anda memiliki otentikasi yang benar untuk mengakses repositori. ```bash curl -X POST http://localhost:3999/api/system/update \ -b cookies.txt # { "success": true, "message": "Aplikasi berhasil diperbarui. Server akan restart dalam 3 detik." } ``` -------------------------------- ### Kelola Pengaturan WiFi via Portal Pelanggan Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Ambil dan update SSID serta password WiFi melalui portal pelanggan. Perubahan dikirim ke ONT via GenieACS. ```bash # Ambil info WiFi dari GenieACS curl -b portal_cookies.txt http://localhost:3999/portal/wifi # { "success": true, "ssid": "Rumah-Budi", "password": "wifi12345" } # Update SSID dan password WiFi (dikirim ke ONT via GenieACS) curl -X POST http://localhost:3999/portal/wifi \ -b portal_cookies.txt \ -H "Content-Type: application/json" \ -d '{ "ssid": "RumahBudi-Baru", "password": "newpassword123" }' # { "success": true, "message": "Pengaturan WiFi sedang dikirim ke ONT. WiFi akan segera berubah." } ``` -------------------------------- ### Get Ticket Details Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Retrieves detailed information about a specific support ticket using its ID. ```APIDOC ## GET /tickets/api/{id} ### Description Fetches the details of a specific support ticket identified by its unique ID. ### Method GET ### Endpoint `/tickets/api/{id}` ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the ticket to retrieve. ### Response Example (Success) ```json { "success": true, "data": { "id": 3, "title": "Connection Lost", "priority": "high", "customer_name": "Budi Santoso" } } ``` ``` -------------------------------- ### Buat Transaksi Pembayaran via Portal Pelanggan Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Membuat transaksi pembayaran menggunakan metode yang didukung Tripay (QRIS, VA, E-Wallet) dari portal pelanggan. Mengembalikan detail checkout URL atau QR Code. ```bash # Buat transaksi pembayaran Tripay (QRIS/VA/E-Wallet) curl -X POST http://localhost:3999/portal/pay/17 \ -b portal_cookies.txt \ -H "Content-Type: application/json" \ -d '{ "method": "QRIS" }' # { # "success": true, # "data": { # "reference": "TRX12345", # "checkout_url": "https://tripay.co.id/checkout/TRX12345", # "qr_url": "https://tripay.co.id/qr/TRX12345", # "amount": 150000, # "expired_time": 1748000000 # } # } ``` -------------------------------- ### Login ke Portal Pelanggan Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Endpoint untuk login ke portal pelanggan menggunakan username PPPoE atau nomor telepon dan password. Cookie akan disimpan untuk sesi berikutnya. ```bash # Login portal pelanggan curl -X POST http://localhost:3999/portal/login \ -c portal_cookies.txt \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "username=budi.pppoe&password=1234" # Redirect ke /portal (dashboard) ``` -------------------------------- ### Buat Transaksi Pembayaran via Tripay Helper Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Menggunakan helper `tripay.js` untuk membuat transaksi pembayaran. Mendukung berbagai metode pembayaran dan memerlukan detail pelanggan serta URL callback. ```javascript const tripay = require('./helpers/tripay'); // Buat transaksi (dipanggil dari portal pelanggan atau billing) const result = await tripay.createTransaction(pool, { method: 'QRIS', // atau 'BRIVA', 'MYBVA', 'OVO', dll. merchantRef: 'INV-17-1748000000000', amount: 150000, customerName: 'Budi Santoso', customerPhone: '08123456789', customerEmail: 'budi@email.com', callbackUrl: 'https://myisp.com/api/tripay/callback', returnUrl: 'https://myisp.com/portal' }); // { // success: true, // data: { reference: 'TRX12345', checkout_url: '...', qr_url: '...', amount: 150000 } // } ``` -------------------------------- ### Kelola OLT dan ONU via API Source: https://context7.com/ittosolution-png/dino-bill/llms.txt API untuk sinkronisasi OLT, reboot ONU, dan cek sinyal ONU real-time. Gunakan cURL untuk berinteraksi dengan endpoint API. ```bash # Sinkronisasi semua OLT aktif ke database via API curl -X POST http://localhost:3999/olt/api/sync \ -b cookies.txt # { # "success": true, # "message": "Sinkronisasi selesai. Berhasil: 2/2 OLT. Total 128 ONU ditemukan." # } # Reboot satu ONU via Web OLT curl -X POST http://localhost:3999/olt/api/reboot \ -b cookies.txt \ -H "Content-Type: application/json" \ -d '{ "olt_id": 1, "index": "1.5" }' # { "success": true, "message": "Perintah reboot berhasil dikirim ke ONU 1.5" } # Cek sinyal ONU real-time (digunakan Portal Teknisi) curl "http://localhost:3999/technician/api/onu-info?olt_id=1&index=1.5" \ -b cookies.txt # { "success": true, "rx_power": "-21.40", "status": "Up" } ``` -------------------------------- ### Kelola Tiket Gangguan via Portal Pelanggan Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Membuat laporan gangguan baru dan melihat riwayat tiket pelanggan. Laporan akan diproses oleh tim terkait. ```bash # Buat tiket gangguan dari portal curl -X POST http://localhost:3999/portal/ticket \ -b portal_cookies.txt \ -H "Content-Type: application/json" \ -d '{ "title": "Internet Lambat", "description": "Kecepatan sangat lambat sejak pagi ini" }' # { "success": true, "message": "Laporan berhasil dikirim, tim kami akan segera memprosesnya." } # Lihat riwayat tiket pelanggan curl -b portal_cookies.txt http://localhost:3999/portal/tickets # { "success": true, "tickets": [{ "id": 3, "title": "Internet Lambat", "status": "open" }] } ``` -------------------------------- ### Create Customer Support Ticket Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Creates a new customer support ticket with a specified priority (normal/high) and description. Requires authentication via cookies. ```bash curl -X POST http://localhost:3999/tickets/api/create \ -b cookies.txt \ -H "Content-Type: application/json" \ -d '{ "customer_id": 5, "title": "Koneksi Terputus", "description": "Internet mati total sejak pukul 08.00", "priority": "high" }' ``` -------------------------------- ### Ubah Password Akun Portal Pelanggan Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Mengganti password akun portal pelanggan. Membutuhkan password saat ini dan password baru. ```bash # Ganti password portal curl -X POST http://localhost:3999/portal/change-password \ -b portal_cookies.txt \ -H "Content-Type: application/json" \ -d '{ "current_password": "1234", "new_password": "passwordBaru99" }' # { "success": true, "message": "Password berhasil diperbarui" } ``` -------------------------------- ### Add New Customer Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Creates a new customer record. If 'router_id' and 'pppoe_username' are provided, a PPPoE secret is automatically added to the specified MikroTik router. ```bash curl -X POST http://localhost:3999/customers \ -b cookies.txt \ -H "Content-Type: application/json" \ -d '{ "name": "Budi Santoso", "phone": "08123456789", "address": "Jl. Merdeka No.10", "package_id": 2, "router_id": 1, "pppoe_username": "budi.pppoe", "pppoe_password": "budi1234", "isolation_date": 20, "billing_method": "fixed", "lat": "-7.250445", "lng": "112.768845" }' # { "success": true, "message": "Customer berhasil ditambahkan" } # → PPPoE secret otomatis ditambahkan ke MikroTik router ID 1 ``` -------------------------------- ### Add New User Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Adds a new user to the system with a specified role (admin, technician, sales). Requires authentication via cookies. ```bash curl -X POST http://localhost:3999/settings/api/users \ -b cookies.txt \ -H "Content-Type: application/json" \ -d '{ "username": "teknisi01", "password": "password123", "role": "technician" }' ``` -------------------------------- ### Save System Settings Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Saves various system configurations, including those for WhatsApp, Telegram, Tripay, and more. ```APIDOC ## POST /settings/api/save ### Description Saves a comprehensive set of system configurations. This endpoint allows for updating settings related to company information, notification providers, payment gateways, and more. ### Method POST ### Endpoint `/settings/api/save` ### Headers - `Content-Type`: `application/json` ### Request Body - `company_name` (string) - Optional - The name of the company. - `company_phone` (string) - Optional - The company's phone number. - `auto_billing_enabled` (string) - Optional - Enables automatic billing (e.g., '1'). - `auto_isolate_enabled` (string) - Optional - Enables automatic customer isolation (e.g., '1'). - `auto_generate_day` (string) - Optional - The day of the month for auto-generating invoices. - `reminder_days_before` (string) - Optional - Number of days before the due date to send reminders. - `wa_provider` (string) - Optional - WhatsApp provider ('local' or external API). - `wa_delay` (string) - Optional - Delay in seconds for WhatsApp messages. - `wa_limit` (string) - Optional - Limit for WhatsApp messages. - `wa_admin` (string) - Optional - Admin phone number for WhatsApp. - `telegram_bot_token` (string) - Optional - Telegram bot token. - `telegram_chat_id` (string) - Optional - Telegram chat ID. - `tripay_api_key` (string) - Optional - Tripay API key. - `tripay_private_key` (string) - Optional - Tripay private key. - `tripay_merchant_code` (string) - Optional - Tripay merchant code. - `tripay_mode` (string) - Optional - Tripay mode ('sandbox' or 'production'). - `payment_gateway` (string) - Optional - The selected payment gateway. - `acs_url` (string) - Optional - URL for the ACS (Auto Configuration Server). - `acs_user` (string) - Optional - Username for ACS. - `acs_pass` (string) - Optional - Password for ACS. - `msg_invoice_created` (string) - Optional - Custom message template for invoice creation. ### Request Example ```json { "company_name": "Dino-Net ISP", "auto_billing_enabled": "1", "wa_provider": "local", "tripay_api_key": "DEV-xxxx" } ``` ### Response Example (Success) ```json { "success": true, "message": "Settings saved successfully" } ``` ``` -------------------------------- ### Create Manual Invoice - Billing API Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Use this endpoint to manually create an invoice for a specific customer. Ensure the customer ID, amount, due date, and description are provided. ```bash curl -X POST http://localhost:3999/billing/api/create \ -b cookies.txt \ -H "Content-Type: application/json" \ -d '{ "customer_id": 5, "amount": 150000, "due_date": "2025-06-20", "description": "Tagihan Juni 2025" }' ``` -------------------------------- ### Add Hotspot User - MikroTik Helper Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Adds a new user to the MikroTik Hotspot system, specifying username, password, and profile. ```javascript const mikrotik = require('./helpers/mikrotik'); const router = { ip_address: '192.168.1.1', username: 'admin', password: 'password123', port: 8728 }; // Tambah user Hotspot const hs = await mikrotik.addHotspotUser(router, 'voucher001', 'pass001', '1Hour'); ``` -------------------------------- ### Baca Data ONU dari OLT Hioso via SNMP Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Gunakan kelas HiosoOLT untuk membaca daftar ONU dan data real-time dari OLT Hioso/C-Data. Mendukung auto-deteksi profil OID. ```javascript const HiosoOLT = require('./helpers/olt'); // Inisialisasi koneksi ke OLT const olt = new HiosoOLT('192.168.10.1', 'public', 161); // Ambil daftar semua ONU (auto-detect profil) const { onus, detectedProfile } = await olt.getOnuList(); // detectedProfile: 'HIOSO_GPON' // onus: [ // { index: '1.1', name: 'budi.pppoe', sn: 'ABCD1234', status: 'Up', tx_power: '-3.50', rx_power: '-21.40' }, // { index: '1.2', name: 'siti.pppoe', sn: 'EFGH5678', status: 'Down', tx_power: '0.00', rx_power: '0.00' } // ] // Ambil data real-time satu ONU berdasarkan index const data = await olt.getOnuData('1.1', 'HIOSO_GPON'); // { status: 'Up', tx_power: '-3.50', rx_power: '-21.40' } ``` -------------------------------- ### Logika Generate Invoice Bulanan Otomatis Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Contoh logika JavaScript yang dipanggil oleh CRON scheduler untuk menghasilkan invoice bulanan bagi pelanggan aktif. Kode ini memastikan invoice hanya dibuat jika belum ada untuk bulan dan tahun berjalan, serta mengirimkan notifikasi. ```javascript // Contoh logika auto-generate invoice bulanan (dipanggil CRON tanggal 1) // Hanya generate jika belum ada invoice bulan ini untuk pelanggan tersebut const [customers] = await pool.query( `SELECT c.*, p.price as package_price FROM customers c LEFT JOIN packages p ON c.package_id = p.id WHERE c.status = 'active' AND (c.billing_method IS NULL OR c.billing_method = 'fixed')` ); for (const c of customers) { const [[exists]] = await pool.query( 'SELECT id FROM invoices WHERE customer_id=? AND MONTH(due_date)=? AND YEAR(due_date)=?', [c.id, bulan, tahun] ); if (!exists) { const dueDate = `${tahun}-${bulan}-${c.isolation_date || 20}`; await pool.query( 'INSERT INTO invoices (customer_id, package_id, amount, due_date, status) VALUES (?,?,?,?,?)', [c.id, c.package_id, c.package_price, dueDate, 'unpaid'] ); await notifyInvoiceCreated(pool, c, c.package_price, dueDate); // Asumsikan fungsi ini ada await new Promise(r => setTimeout(r, waDelay)); // Jeda antar WA } } ``` -------------------------------- ### Create Ticket Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Creates a new customer support ticket with specified details including priority and description. ```APIDOC ## POST /tickets/api/create ### Description Creates a new support ticket for a customer. Tickets can be assigned a priority level and include a title and detailed description. ### Method POST ### Endpoint `/tickets/api/create` ### Headers - `Content-Type`: `application/json` ### Request Body - `customer_id` (integer) - Required - The ID of the customer. - `title` (string) - Required - The title of the ticket. - `description` (string) - Required - A detailed description of the issue. - `priority` (string) - Required - The priority of the ticket (`normal` or `high`). ### Request Example ```json { "customer_id": 5, "title": "Connection Lost", "description": "Internet has been down since 8 AM.", "priority": "high" } ``` ### Response Example (Success) ```json { "success": true, "message": "Ticket created successfully" } ``` ``` -------------------------------- ### Dapatkan Channel Pembayaran Tripay Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Mengambil daftar channel pembayaran yang tersedia dari Tripay menggunakan helper `tripay.js`. Berguna untuk menampilkan opsi pembayaran kepada pengguna. ```javascript // Ambil channel pembayaran yang tersedia const channels = await tripay.getPaymentChannels(pool); // { success: true, data: [{ name: 'QRIS', code: 'QRIS', icon_url: '...' }, ...] } ``` -------------------------------- ### Impor Pelanggan Massal via CSV Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Impor data pelanggan secara massal menggunakan `curl` dengan mengirimkan data CSV dalam format JSON. Pastikan format CSV sesuai dengan kolom yang diharapkan sistem. ```bash # Impor pelanggan dari CSV curl -X POST http://localhost:3999/import/customers \ -b cookies.txt \ -H "Content-Type: application/json" \ -d '{ "csv_data": "ID,Nama,Telepon,Alamat,Paket,Harga,PPPoE,Metode,Tgl Isolir,Status,Tgl Daftar\n,Siti Rahayu,08198765432,Jl. Pahlawan 5,,,,fixed,20,active," }' # { "success": true, "message": "Import selesai: 1 berhasil, 0 dilewati" } ``` -------------------------------- ### Ekspor Data Pelanggan dan Invoice ke CSV Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Gunakan perintah `curl` untuk mengekspor data pelanggan atau invoice dari sistem ke format CSV. File CSV yang dihasilkan kompatibel dengan Excel dan menyertakan BOM UTF-8. ```bash # Ekspor semua pelanggan ke CSV curl -b cookies.txt http://localhost:3999/export/customers \ -o pelanggan-2025-06-01.csv # CSV dengan kolom: ID,Nama,Telepon,Alamat,Paket,Harga,PPPoE,Metode,Tgl Isolir,Status,Tgl Daftar ``` ```bash # Ekspor semua invoice ke CSV curl -b cookies.txt http://localhost:3999/export/invoices \ -o invoice-2025-06-01.csv # CSV dengan kolom: ID,Pelanggan,PPPoE,Nominal,Status,Jatuh Tempo,Tanggal Bayar,Dibuat ``` -------------------------------- ### Save System Settings Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Saves various system configurations, including company details, notification provider settings (WhatsApp, Telegram), payment gateway (Tripay), ACS integration, and custom notification messages. All settings are stored in the 'settings' table as key-value pairs. ```bash curl -X POST http://localhost:3999/settings/api/save \ -b cookies.txt \ -H "Content-Type: application/json" \ -d '{ "company_name": "Dino-Net ISP", "company_phone": "08001234567", "auto_billing_enabled": "1", "auto_isolate_enabled": "1", "auto_generate_day": "1", "reminder_days_before": "3", "wa_provider": "local", "wa_delay": "5", "wa_limit": "50", "wa_admin": "08123456789", "telegram_bot_token": "123456789:ABCDEFabcdef", "telegram_chat_id": "-1001234567890", "tripay_api_key": "DEV-xxxx", "tripay_private_key": "xxxx", "tripay_merchant_code": "Txxxx", "tripay_mode": "sandbox", "payment_gateway": "tripay", "acs_url": "http://192.168.1.100:7557", "acs_user": "admin", "acs_pass": "admin", "msg_invoice_created": "📄 *Tagihan Baru*\n\nYth. {name},\nTagihan: Rp {amount}\nJatuh Tempo: {due_date}\n\n{company}" }' ``` -------------------------------- ### Add User Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Adds a new user to the system with a specified role (admin, technician, sales). ```APIDOC ## POST /settings/api/users ### Description Adds a new user to the system, assigning them a specific role such as administrator, technician, or sales. ### Method POST ### Endpoint `/settings/api/users` ### Headers - `Content-Type`: `application/json` ### Request Body - `username` (string) - Required - The username for the new user. - `password` (string) - Required - The password for the new user. - `role` (string) - Required - The role of the user (`admin`, `technician`, or `sales`). ### Request Example ```json { "username": "technician01", "password": "password123", "role": "technician" } ``` ### Response Example (Success) ```json { "success": true, "message": "User added successfully" } ``` ``` -------------------------------- ### Portal Login Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Logs a customer into the portal using PPPoE username or phone number. ```APIDOC ## POST /portal/login ### Description Authenticates a customer to access the customer portal. ### Method POST ### Endpoint /portal/login ### Parameters #### Request Body - **username** (string) - Required - The customer's PPPoE username or phone number. - **password** (string) - Required - The customer's password. ### Request Example ```bash curl -X POST http://localhost:3999/portal/login \ -c portal_cookies.txt \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "username=budi.pppoe&password=1234" ``` ### Response #### Success Response (Redirect) Redirects to the portal dashboard upon successful login. #### Response Example Redirect to /portal (dashboard) ``` -------------------------------- ### Check Local WhatsApp Connection Status Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Retrieves the connection status of the local WhatsApp provider. Returns 'READY' if connected, or 'DISCONNECTED' with a QR code if re-authentication is needed. ```bash curl -b cookies.txt http://localhost:3999/settings/whatsapp-status ``` -------------------------------- ### Portal Create Payment Transaction Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Initiates a payment transaction through Tripay for a specific invoice. ```APIDOC ## POST /portal/pay/{invoice_id} ### Description Creates a new payment transaction for a given invoice using various payment methods supported by Tripay. ### Method POST ### Endpoint /portal/pay/{invoice_id} ### Parameters #### Path Parameters - **invoice_id** (integer) - Required - The ID of the invoice to pay. #### Request Body - **method** (string) - Required - The payment method to use (e.g., 'QRIS', 'VA', 'E-Wallet'). ### Request Example ```bash curl -X POST http://localhost:3999/portal/pay/17 \ -b portal_cookies.txt \ -H "Content-Type: application/json" \ -d '{ "method": "QRIS" }' ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the transaction creation was successful. - **data** (object) - Contains transaction details. - **reference** (string) - The unique transaction reference ID. - **checkout_url** (string) - URL for completing the payment. - **qr_url** (string) - URL for the QR code if applicable. - **amount** (integer) - The amount to be paid. - **expired_time** (integer) - The expiration timestamp for the transaction. #### Response Example ```json { "success": true, "data": { "reference": "TRX12345", "checkout_url": "https://tripay.co.id/checkout/TRX12345", "qr_url": "https://tripay.co.id/qr/TRX12345", "amount": 150000, "expired_time": 1748000000 } } ``` ``` -------------------------------- ### Login API for Users Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Authenticates Admin, Technician, and Sales users using username and password. Session is managed by express-session, and redirection depends on the user's role. ```bash curl -X POST http://localhost:3999/login \ -H "Content-Type: application/x-www-form-urlencoded" \ -c cookies.txt \ -d "username=admin&password=admin" # Redirect ke / jika admin # Redirect ke /technician jika teknisi # Redirect ke /sales jika sales ``` -------------------------------- ### Authenticate Admin, Technician, and Sales Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Log in using username and password. The session is stored using express-session. The user's role determines the redirection target: admin to '/', technician to '/technician', and sales to '/sales'. ```APIDOC ## POST /login — Autentikasi Admin, Teknisi, dan Sales ### Description Login dengan username/password. Sesi disimpan dengan `express-session`. Role menentukan redirect tujuan: `admin` → `/`, `technician` → `/technician`, `sales` → `/sales`. ### Method POST ### Endpoint /login ### Parameters #### Request Body - **username** (string) - Required - User's username - **password** (string) - Required - User's password ### Request Example ```bash curl -X POST http://localhost:3999/login \ -H "Content-Type: application/x-www-form-urlencoded" \ -c cookies.txt \ -d "username=admin&password=admin" ``` ### Response #### Success Response (200) - Redirects to the appropriate dashboard based on user role. ``` -------------------------------- ### Retrieve Ticket Details Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Fetches the details of a specific support ticket by its ID. Requires authentication via cookies. ```bash curl -b cookies.txt http://localhost:3999/tickets/api/3 ``` -------------------------------- ### Portal Create Ticket Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Creates a new support ticket for a customer-reported issue. ```APIDOC ## POST /portal/ticket ### Description Allows customers to submit a new support ticket regarding an issue. ### Method POST ### Endpoint /portal/ticket ### Parameters #### Request Body - **title** (string) - Required - The title of the support ticket. - **description** (string) - Required - A detailed description of the issue. ### Request Example ```bash curl -X POST http://localhost:3999/portal/ticket \ -b portal_cookies.txt \ -H "Content-Type: application/json" \ -d '{ "title": "Internet Lambat", "description": "Kecepatan sangat lambat sejak pagi ini" }' ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the ticket was created successfully. - **message** (string) - A confirmation message that the report has been sent. #### Response Example ```json { "success": true, "message": "Laporan berhasil dikirim, tim kami akan segera memprosesnya." } ``` ``` -------------------------------- ### MikroTik Helper Functions Source: https://context7.com/ittosolution-png/dino-bill/llms.txt JavaScript functions to interact with MikroTik RouterOS via API for managing PPPoE secrets, active connections, Hotspot users, and system information. ```APIDOC ## mikrotik.checkStatus(router) ### Description Checks the status of the MikroTik router. ### Parameters - **router** (object) - Required - An object containing router connection details (`ip_address`, `username`, `password`, `port`). ### Response - **success** (boolean) - Indicates if the status check was successful. - **identity** (string) - The identity name of the router. ### Example ```javascript const status = await mikrotik.checkStatus(router); // { success: true, identity: 'Router-Utama' } ``` ``` ```APIDOC ## mikrotik.addPPPoESecret(router, username, password, profile) ### Description Adds a new PPPoE secret to the MikroTik router. ### Parameters - **router** (object) - Required - Router connection details. - **username** (string) - Required - The username for the PPPoE secret. - **password** (string) - Required - The password for the PPPoE secret. - **profile** (string) - Optional - The profile to assign to the PPPoE secret. ### Response - **success** (boolean) - Indicates if the operation was successful. - **data** (array) - Details of the added secret. ### Example ```javascript const add = await mikrotik.addPPPoESecret(router, 'budi.pppoe', 'budi1234', '10Mbps'); // { success: true, data: [...] } ``` ``` ```APIDOC ## mikrotik.disablePPPoESecret(router, username) ### Description Disables a PPPoE secret, effectively isolating the user. This also disconnects any active session for the user. ### Parameters - **router** (object) - Required - Router connection details. - **username** (string) - Required - The username of the PPPoE secret to disable. ### Response - **success** (boolean) - Indicates if the operation was successful. - **data** (boolean) - True if the secret was disabled. ### Example ```javascript const disable = await mikrotik.disablePPPoESecret(router, 'budi.pppoe'); // { success: true, data: true } ``` ``` ```APIDOC ## mikrotik.enablePPPoESecret(router, username) ### Description Enables a previously disabled PPPoE secret, removing isolation. ### Parameters - **router** (object) - Required - Router connection details. - **username** (string) - Required - The username of the PPPoE secret to enable. ### Response - **success** (boolean) - Indicates if the operation was successful. - **data** (array) - Details of the enabled secret. ### Example ```javascript const enable = await mikrotik.enablePPPoESecret(router, 'budi.pppoe'); // { success: true, data: [...] } ``` ``` ```APIDOC ## mikrotik.getActiveConnections(router) ### Description Retrieves a list of all currently active PPPoE connections on the router. ### Parameters - **router** (object) - Required - Router connection details. ### Response - **success** (boolean) - Indicates if the operation was successful. - **data** (array) - An array of active connection objects, each containing `name`, `address`, `uptime`, and `callerid`. ### Example ```javascript const active = await mikrotik.getActiveConnections(router); // { success: true, data: [{ name: 'budi.pppoe', address: '10.0.0.5', uptime: '2d3h', callerid: '' }] } ``` ``` ```APIDOC ## mikrotik.getPPPoESecrets(router) ### Description Retrieves all PPPoE secrets configured on the router. ### Parameters - **router** (object) - Required - Router connection details. ### Response - **success** (boolean) - Indicates if the operation was successful. - **data** (array) - An array of PPPoE secret objects, each containing `name`, `profile`, and `disabled` status. ### Example ```javascript const secrets = await mikrotik.getPPPoESecrets(router); // { success: true, data: [{ name: 'budi.pppoe', profile: '10Mbps', disabled: false }] } ``` ``` ```APIDOC ## mikrotik.getSystemResource(router) ### Description Fetches system resource information from the MikroTik router. ### Parameters - **router** (object) - Required - Router connection details. ### Response - **success** (boolean) - Indicates if the operation was successful. - **data** (object) - An object containing system resource details like `boardName`, `version`, `cpuLoad`, and `uptime`. ### Example ```javascript const sys = await mikrotik.getSystemResource(router); // { success: true, data: { boardName: 'RB750Gr3', version: '7.14.2', cpuLoad: '15', uptime: '10d2h' } } ``` ``` ```APIDOC ## mikrotik.addHotspotUser(router, username, password, profile) ### Description Adds a new user to the MikroTik Hotspot service. ### Parameters - **router** (object) - Required - Router connection details. - **username** (string) - Required - The username for the Hotspot user. - **password** (string) - Required - The password for the Hotspot user. - **profile** (string) - Optional - The profile to assign to the Hotspot user. ### Response - **success** (boolean) - Indicates if the operation was successful. - **data** (array) - Details of the added Hotspot user. ### Example ```javascript const hs = await mikrotik.addHotspotUser(router, 'voucher001', 'pass001', '1Hour'); // { success: true, data: [...] } ``` ``` -------------------------------- ### Enable PPPoE Secret - MikroTik Helper Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Re-enables a previously disabled PPPoE secret, allowing the user to reconnect. ```javascript const mikrotik = require('./helpers/mikrotik'); const router = { ip_address: '192.168.1.1', username: 'admin', password: 'password123', port: 8728 }; // Aktifkan kembali PPPoE (buka isolasi) const enable = await mikrotik.enablePPPoESecret(router, 'budi.pppoe'); ``` -------------------------------- ### Send WA Reminders - Billing API Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Send WhatsApp reminders to all customers with unpaid invoices. The reminders are sent with a delay. ```bash curl -X POST http://localhost:3999/billing/api/send-reminders \ -b cookies.txt ``` -------------------------------- ### Isolate Customer Internet Access Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Manually isolates a customer, cutting off their internet access and sending a WhatsApp notification. This action requires the customer's ID. ```bash curl -X POST http://localhost:3999/customers/5/isolate \ -b cookies.txt # { "success": true, "message": "Customer berhasil di-isolate" } ``` -------------------------------- ### Generate Bulk Invoices - Billing API Source: https://context7.com/ittosolution-png/dino-bill/llms.txt This endpoint generates invoices for all active customers for the current month. It handles sending out WA notifications with a delay. ```bash curl -X POST http://localhost:3999/billing/api/generate-bulk \ -b cookies.txt ``` -------------------------------- ### Run Manual Auto-Isolate - Billing API Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Manually trigger the auto-isolation process for all overdue customers. This will isolate them and send WA notifications. ```bash curl -X POST http://localhost:3999/billing/api/run-isolir \ -b cookies.txt ``` -------------------------------- ### Remove Customer Internet Isolation Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Re-enables internet access for an isolated customer. This action requires the customer's ID. ```bash curl -X POST http://localhost:3999/customers/5/unisolate \ -b cookies.txt # { "success": true, "message": "Customer berhasil di-unisolate" } ``` -------------------------------- ### Handle Tripay Webhook Callback Source: https://context7.com/ittosolution-png/dino-bill/llms.txt Endpoint to receive automated payment notifications from Tripay. It verifies the signature and updates invoice status, triggering actions like activating MikroTik services. Handles automatic billing adjustments for payments made late in the month. ```bash curl -X POST http://localhost:3999/api/tripay/callback \ -H "Content-Type: application/json" \ -H "x-callback-signature: " \ -d '{ "merchant_ref": "INV-17-1748000000000", "status": "PAID", "amount": 150000 }' ```