MODUL WHMCS — RuangNotif Payment Gateway
========================================

Kompatibilitas: WHMCS 8.x & 9.x
API: Dokumentasi terbaru RuangNotif (Channel Code custom + GET /api/v1/channels)
SDK: PHP resmi (listChannels, createTransaction, checkStatus)

INSTALASI
---------
1. Salin file/folder berikut ke root instalasi WHMCS:
   - modules/gateways/ruangnotif.php
   - modules/gateways/ruangnotif/   (folder lib + SDK)
   - modules/gateways/callback/ruangnotif.php

2. Admin WHMCS → Setup → Payments → Payment Gateways
   → Activate "RuangNotif (QRIS / VA / E-Wallet)"

3. Isi konfigurasi:
   - API Key       : pk_live_... atau pk_test_...
   - Secret Key    : sk_live_... atau sk_test_...
   - Mode          : auto (disarankan) / production / sandbox
   - Channel Code  : rn_qris_all (atau kode dari dokumentasi API bagian 4)
   - Base URL      : https://ruangnotif.com
   - Debug         : centang saat troubleshooting

4. Di dashboard RuangNotif (Merchant), set URL Webhook:
   https://domain-whmcs-anda.com/modules/gateways/callback/ruangnotif.php

CHANNEL CODE
------------
Parameter method WAJIB Channel Code custom (white-label), BUKAN nama provider.
Contoh: rn_qris_all, rn_bca, rn_ovo, rn_mandiriva
Jika field Channel Code dikosongkan atau masih "qris", modul mengambil channel
pertama yang aktif lewat GET /api/v1/channels.

MODE SANDBOX / PRODUCTION
-------------------------
- Mode "auto": pk_test_ → sandbox, pk_live_ → production
- Saat merchant masih menunggu review admin, WAJIB pakai sandbox
- Transaksi sandbox tidak mengkredit saldo

ALUR
----
1. Pelanggan buka invoice → klik tombol bayar
2. Modul buat transaksi via API (method = Channel Code custom) → redirect payment_url
3. Setelah bayar berhasil, webhook menghubungi callback
4. Callback verifikasi ulang status ke API → invoice bertanda Paid
