Billing Module Integration Test";
// Test 1: Check navigation.xml
echo "
1. Navigation Configuration
";
$nav_file = "modules/billing/navigation.xml";
if (file_exists($nav_file)) {
echo "✓ navigation.xml found
";
$xml = simplexml_load_file($nav_file);
echo "";
foreach ($xml->page as $page) {
echo "- Page: ".$page['key']." → ".$page['file']." (access: ".$page['access'].")
";
}
echo "
";
} else {
echo "✗ navigation.xml NOT FOUND
";
}
// Test 2: Check page files
echo "2. Page Files
";
$pages = array(
'create_servers.php' => 'Server provisioning script',
'my_orders_panel.php' => 'User order list',
'admin_orders.php' => 'Admin order management'
);
foreach ((array)$pages as $file => $desc) {
$path = "modules/billing/".$file;
if (file_exists($path)) {
echo "✓ $file - $desc
";
} else {
echo "✗ $file - MISSING
";
}
}
// Test 3: Check database tables
echo "3. Database Tables
";
$tables = array(
'billing_orders' => 'Order records',
'billing_services' => 'Available services',
'billing_invoices' => 'Payment records'
);
foreach ((array)$tables as $table => $desc) {
$result = $db->query("SHOW TABLES LIKE 'OGP_DB_PREFIX".$table."'");
if ($result && $db->num_rows($result) > 0) {
echo "✓ $table - $desc
";
} else {
echo "✗ $table - NOT FOUND
";
}
}
// Test 4: Order status counts
echo "4. Order Statistics
";
$stats = $db->resultQuery("SELECT status, COUNT(*) as count FROM OGP_DB_PREFIXbilling_orders GROUP BY status");
if (!empty($stats)) {
echo "";
echo "| Status | Count |
";
foreach ((array)$stats as $stat) {
echo "| ".$stat['status']." | ".$stat['count']." |
";
}
echo "
";
} else {
echo "No orders in database yet
";
}
// Test 5: Check user access
echo "5. User Access
";
$user_id = $_SESSION['user_id'];
$isAdmin = $db->isAdmin($user_id);
echo "Logged in as: ".$_SESSION['users_login']."
";
echo "User ID: ".$user_id."
";
echo "Group: ".$_SESSION['users_group']."
";
echo "Admin: ".($isAdmin ? 'Yes' : 'No')."
";
// Test 6: Page access URLs
echo "6. Test Page Access
";
echo "";
// Test 7: Sample paid order check
echo "7. Paid Orders Ready for Provisioning
";
if ($isAdmin) {
$paid_orders = $db->resultQuery("SELECT COUNT(*) as count FROM OGP_DB_PREFIXbilling_orders WHERE status='paid'");
} else {
$paid_orders = $db->resultQuery("SELECT COUNT(*) as count FROM OGP_DB_PREFIXbilling_orders WHERE status='paid' AND user_id=".$db->realEscapeSingle($user_id));
}
if (!empty($paid_orders)) {
$count = $paid_orders[0]['count'];
if ($count > 0) {
echo "✓ $count paid order(s) ready for provisioning
";
echo "View Orders
";
} else {
echo "No paid orders awaiting provisioning
";
}
}
// Test 8: Module loading mechanism
echo "8. Module Loading Test
";
echo "If you can see this page, the module loading mechanism is working correctly!
";
echo "✓ Navigation system functional
";
echo "✓ exec_ogp_module() called successfully
";
// Summary
echo "Integration Status Summary
";
echo "";
echo "
✓ Billing Module Panel Integration Complete
";
echo "
All components are in place. The billing module can now:
";
echo "
";
echo "- Display user orders via
home.php?m=billing&p=my_orders ";
echo "- Provision servers via
home.php?m=billing&p=provision_servers ";
if ($isAdmin) {
echo "- Admin management via
home.php?m=billing&p=admin_orders ";
}
echo "
";
echo "
";
}
?>