========================================
VOUCHER SETTINGS - INSTALLATION CHECKLIST
========================================

PRE-INSTALLATION
□ Agent System sudah terinstall
□ Database mikhmon_agents sudah ada
□ Tabel agent_settings sudah ada
□ PHP version 7.0 atau lebih tinggi
□ MySQL 5.6 atau lebih tinggi

========================================
FILE UPLOAD CHECKLIST
========================================

CORE FILES:
□ lib/VoucherGenerator.class.php
□ agent-admin/voucher_settings.php
□ database/voucher_settings_update.sql
□ install_voucher_settings.php

DOCUMENTATION:
□ VOUCHER_SETTINGS_GUIDE.md
□ VOUCHER_SETTINGS_QUICKSTART.md
□ VOUCHER_SETTINGS_SUMMARY.txt
□ VOUCHER_SETTINGS_CHECKLIST.txt (this file)

TESTING:
□ test_voucher_generator.php

MODIFIED FILES (backup dulu!):
□ api/agent_generate_voucher.php
□ include/menu.php
□ index.php

========================================
INSTALLATION STEPS
========================================

STEP 1: BACKUP
□ Backup database
□ Backup file api/agent_generate_voucher.php
□ Backup file include/menu.php
□ Backup file index.php

STEP 2: UPLOAD FILES
□ Upload semua file baru ke server
□ Pastikan permission file 644
□ Pastikan permission folder 755

STEP 3: RUN INSTALLER
□ Akses install_voucher_settings.php di browser
□ Verifikasi "Koneksi database berhasil"
□ Verifikasi "8 settings ditambahkan"
□ Verifikasi "VoucherGenerator.class.php ditemukan"
□ Verifikasi "voucher_settings.php ditemukan"
□ Lihat pesan "Instalasi Selesai"

STEP 4: VERIFY DATABASE
□ Login ke phpMyAdmin/database
□ Cek tabel agent_settings
□ Pastikan ada 8 row dengan prefix 'voucher_'
□ Verifikasi setting_value sesuai default

STEP 5: VERIFY MENU
□ Login ke admin panel MikhMon
□ Buka menu "Agent/Reseller"
□ Pastikan ada menu "Format Voucher"
□ Klik menu tersebut
□ Pastikan halaman terbuka tanpa error

========================================
CONFIGURATION CHECKLIST
========================================

ADMIN PANEL:
□ Akses halaman Format Voucher
□ Form tampil dengan lengkap
□ Preview voucher tampil
□ Ubah setting → preview update real-time
□ Klik "Simpan Pengaturan"
□ Lihat pesan "Pengaturan berhasil disimpan"

SETTINGS TO CONFIGURE:
□ Username & Password (Sama/Berbeda)
□ Tipe Karakter Username
□ Jumlah Digit Username
□ Tipe Karakter Password (jika berbeda)
□ Jumlah Digit Password (jika berbeda)
□ Prefix (Enable/Disable)
□ Prefix Text (jika enabled)
□ Uppercase/Lowercase

========================================
TESTING CHECKLIST
========================================

UNIT TESTING:
□ Akses test_voucher_generator.php
□ Verifikasi "Files loaded successfully"
□ Verifikasi "VoucherGenerator initialized"
□ Test Case 1: Single voucher ✓
□ Test Case 2: Multiple vouchers ✓
□ Test Case 3: Character types ✓
□ Test Case 4: Length validation ✓
□ Test Case 5: Prefix validation ✓
□ Test Case 6: Same username/password ✓
□ Performance test < 1000ms ✓

INTEGRATION TESTING:
□ Login sebagai agent
□ Akses agent dashboard
□ Pilih profile voucher
□ Set quantity
□ Klik "Generate Voucher"
□ Verifikasi voucher ter-generate
□ Cek format username sesuai setting
□ Cek format password sesuai setting
□ Cek prefix (jika enabled)
□ Cek case (uppercase/lowercase)

FUNCTIONAL TESTING:
□ Test dengan username & password sama
□ Test dengan username & password berbeda
□ Test dengan tipe numeric
□ Test dengan tipe alpha
□ Test dengan tipe alphanumeric
□ Test dengan berbagai panjang (4-20)
□ Test dengan prefix enabled
□ Test dengan prefix disabled
□ Test dengan uppercase
□ Test dengan lowercase

EDGE CASES:
□ Generate 1 voucher
□ Generate 100 vouchers
□ Generate dengan panjang minimal (4)
□ Generate dengan panjang maksimal (20)
□ Generate dengan prefix panjang (5 char)
□ Cek tidak ada duplikat username

========================================
VERIFICATION CHECKLIST
========================================

DATABASE:
□ Settings tersimpan di agent_settings
□ Voucher ter-generate tersimpan di agent_vouchers
□ Transaction tercatat di agent_transactions
□ Balance agent terpotong dengan benar

MIKROTIK:
□ User ter-create di MikroTik
□ Username sesuai format
□ Password sesuai format
□ Profile sesuai pilihan
□ Comment ter-set dengan benar

AGENT PANEL:
□ Voucher tampil di "My Vouchers"
□ Transaction tampil di "Transaction History"
□ Balance ter-update
□ Format voucher sesuai setting

========================================
TROUBLESHOOTING CHECKLIST
========================================

IF ERROR DURING INSTALL:
□ Cek koneksi database
□ Cek Agent System sudah install
□ Cek permission file
□ Cek PHP error log
□ Cek MySQL error log

IF MENU NOT SHOWING:
□ Clear browser cache
□ Hard refresh (Ctrl+F5)
□ Cek file include/menu.php
□ Cek file index.php
□ Cek session aktif

IF VOUCHER FORMAT WRONG:
□ Clear browser cache
□ Cek settings di database
□ Cek VoucherGenerator.class.php loaded
□ Run test_voucher_generator.php
□ Cek API response

IF DUPLICATE USERNAME:
□ Tambah panjang karakter
□ Gunakan alphanumeric
□ Enable prefix
□ Cek random_int() function

========================================
POST-INSTALLATION CHECKLIST
========================================

CLEANUP:
□ Hapus install_voucher_settings.php (optional)
□ Hapus test_voucher_generator.php (optional)
□ Backup file dokumentasi
□ Update internal documentation

DOCUMENTATION:
□ Baca VOUCHER_SETTINGS_GUIDE.md
□ Simpan VOUCHER_SETTINGS_QUICKSTART.md
□ Arsip VOUCHER_SETTINGS_SUMMARY.txt
□ Share ke team (jika ada)

TRAINING:
□ Train admin cara setting format
□ Train agent cara generate voucher
□ Dokumentasi SOP
□ Buat video tutorial (optional)

MONITORING:
□ Monitor generate voucher pertama
□ Monitor duplikat username
□ Monitor performance
□ Monitor error log

========================================
MAINTENANCE CHECKLIST
========================================

REGULAR CHECKS:
□ Cek duplikat username (weekly)
□ Cek performance (monthly)
□ Backup database (daily)
□ Update documentation (as needed)

OPTIMIZATION:
□ Review character length
□ Review prefix usage
□ Review performance metrics
□ Optimize if needed

========================================
ROLLBACK PLAN
========================================

IF NEED TO ROLLBACK:
□ Restore backup database
□ Restore backup files
□ Remove voucher settings from agent_settings
□ Remove VoucherGenerator.class.php
□ Remove voucher_settings.php
□ Restore original menu.php
□ Restore original index.php
□ Restore original agent_generate_voucher.php
□ Clear cache
□ Test system

========================================
SUCCESS CRITERIA
========================================

INSTALLATION SUCCESS IF:
✓ All files uploaded
✓ Database updated
✓ Menu showing
✓ Settings page accessible
✓ Preview working
✓ Save working
✓ Generate working
✓ Format correct
✓ No errors
✓ Performance good

========================================
FINAL VERIFICATION
========================================

□ Installation complete
□ Configuration done
□ Testing passed
□ Documentation read
□ Team trained
□ System monitored
□ Backup created
□ Ready for production

========================================
SIGN-OFF
========================================

Installed by: ___________________
Date: ___________________
Verified by: ___________________
Date: ___________________

Notes:
_________________________________
_________________________________
_________________________________

========================================
END OF CHECKLIST
========================================

Status: □ PENDING  □ IN PROGRESS  □ COMPLETED

Completion Date: ___________________

Signature: ___________________
