Payed Documentation
Payed Controller Documentation
File: /controllers/payedController.php
Purpose: Simple view controller for payment status display pages
Last Updated: December 20, 2024
Total Functions: 0 (View-only controller)
Lines of Code: ~66
---
๐ Overview
The Payed Controller is a minimal view controller that serves static payment status pages. It does not contain business logic or data processing functions, instead focusing solely on displaying payment-related views through Smarty templates.
Primary Functions
- โ Display "payed" (paid) status page
- โ Display "notpayed" (unpaid) status page
- โ Display error page
- โ Basic authentication integration
- โ Template rendering via Smarty
Related Controllers
- โข clientPayedDeptController.php - Payment processing
- โข clientPayedDeptReportController.php - Payment reporting
- โข paymentMethodsController.php - Payment methods management
---
๐๏ธ Database Tables
Primary Tables (Indirect Access via Templates)
| Table Name | Purpose | Key Columns |
|---|---|---|
| **programsettings** | System configuration | programsettingsid, settingkey, settingvalue |
- โข This controller does not directly interact with database tables
- โข Database access occurs through included templates and authentication system
- โข Program settings may be referenced by included templates
---
๐ Key Functions
1. Default Action - Payed Status Display
Location: Lines 44-49
Purpose: Display paid status confirmation page
Function Signature:
if ($do == "payed" || empty($do)) {
include_once("../public/authentication.php");
$smarty->display("payedview/payed.html");
}
Process Flow:
1. Check authentication status
2. Load authentication system
3. Display payed confirmation template
---
2. Not Payed Action - Unpaid Status Display
Location: Lines 50-55
Purpose: Display unpaid status notification page
Function Signature:
elseif ($do == "notpayed") {
include_once("../public/authentication.php");
$smarty->display("payedview/notpayed.html");
}
Process Flow:
1. Check authentication status
2. Load authentication system
3. Display unpaid notification template
---
3. Error Action - Error Display
Location: Lines 56-60
Purpose: Display error page for payment-related issues
Function Signature:
elseif ($do == "error") {
$smarty->display("error.html");
}
Process Flow:
1. Display generic error template
2. No authentication required for error display
---
๐ Workflows
Workflow 1: Payment Status Display
---
๐ URL Routes & Actions
| URL Parameter | Template Displayed | Authentication Required | Description | |
|---|---|---|---|---|
| `do=payed` or empty | `payedview/payed.html` | Yes | Payment successful confirmation | |
| `do=notpayed` | `payedview/notpayed.html` | Yes | Payment pending notification | |
| `do=error` | `error.html` | No | Error message display |
- โข
/controllers/payedController.php- Shows paid status (default) - โข
/controllers/payedController.php?do=payed- Shows paid status - โข
/controllers/payedController.php?do=notpayed- Shows unpaid status - โข
/controllers/payedController.php?do=error- Shows error page
---
๐งฎ Calculation Methods
No calculations performed - This controller is purely for view presentation.
---
๐ Security & Permissions
Authentication Requirements
// Required for payment status pages
include_once("../public/authentication.php");
Security Features:
- โข Authentication required for payed/notpayed views
- โข Error pages accessible without authentication
- โข Uses standard ERP authentication system
- โข No direct user input processing (minimal attack surface)
Input Validation
- โข Only accepts predefined
$_GET['do']values - โข No user data processing or SQL operations
- โข Minimal security risk due to static nature
---
๐ Performance Considerations
Optimization Strengths
1. Minimal Processing: No database operations or complex logic
2. Fast Loading: Simple template rendering only
3. Low Memory Usage: No data arrays or complex objects
4. Cacheable: Static content can be easily cached
Performance Characteristics
- โข Load Time: <50ms (template rendering only)
- โข Memory Usage: Minimal (authentication + templates)
- โข Database Queries: 0 direct queries
- โข File I/O: Template files only
---
๐ Common Issues & Troubleshooting
1. Template Not Found
Issue: "Template not found" error for payment views
Cause: Missing template files in /templates/payedview/ directory
Fix:
# Check template existence
ls -la /templates/payedview/
# Should contain: payed.html, notpayed.html
2. Authentication Failure
Issue: Redirected to login instead of payment status
Cause: Session expired or authentication.php issues
Debug:
// Add before authentication include
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
echo "Session ID: " . session_id();
echo "User ID: " . $_SESSION['userid'];
3. Footer Not Displaying
Issue: Page cuts off without footer
Cause: Error in template rendering or includes
Fix:
// Verify template path
if (file_exists("../templates/footer.html")) {
echo "Footer template exists";
} else {
echo "Footer template missing";
}
---
๐งช Testing Scenarios
Test Case 1: Payment Success Flow
1. Navigate to /controllers/payedController.php
2. Verify authentication prompt if not logged in
3. Confirm payed.html template displays correctly
4. Check footer renders properly
Test Case 2: Payment Pending Flow
1. Navigate to /controllers/payedController.php?do=notpayed
2. Verify authentication prompt if not logged in
3. Confirm notpayed.html template displays correctly
4. Check for proper messaging and styling
Test Case 3: Error Handling
1. Navigate to /controllers/payedController.php?do=error
2. Verify NO authentication prompt (direct access)
3. Confirm error.html template displays
4. Check error styling and messaging
Test Case 4: Invalid Parameter
1. Navigate to /controllers/payedController.php?do=invalid
2. Should default to payed.html template
3. Verify authentication still required
---
๐ Related Documentation
- โข CLAUDE.md - PHP 8.2 migration guide
- โข clientPayedDeptController.md - Payment processing
- โข paymentMethodsController.md - Payment methods
- โข Authentication System Documentation - Login/session management
- โข Smarty Templates Guide - Template system reference
---
Documented By: AI Assistant
Review Status: โ Complete
Next Review: When template changes occur