TC-001: Fuel Adjustment Factor (FAF) Test Cases
Feature: Fuel Adjustment Factor (FAF)
Reference: ADR-001-Fuel-Adjustment-Factor.md
Implementation: Commits 2f4ca69b through d0e482bb
Last Updated: April 10, 2026
Table of Contents
- Configuration Tests (Admin)
- Admin Order Creation Tests
- Web Order Tests (Customer)
- Change-Over Order Tests
- Order Edit Tests
- Invoice Tests
- Xero Integration Tests
- Edge Cases & Regression Tests
- Regression Checklist
1. Configuration Tests (Admin)
TC-001: Enable FAF - Percentage Type
Priority: High
Component: Admin Bin Hire Configuration
Preconditions:
- Logged in as admin with
bin-hires-updatepermission - Supplier has Partner record
- Navigate to
/admin/skip-bin/{type_id}/{supplier_id}/{area_id}
Test Steps:
- Locate FAF configuration card (right after "Bin Hire" title)
- Check "Enable FAF" toggle
- Select "Percentage (%)" from FAF Type dropdown
- Enter value
5.5in FAF Value field - Verify input shows
%prefix - Click "Save FAF Setting" button
- Wait for SweetAlert2 success notification
- Refresh page
Expected Results:
- Toggle remains checked after refresh
- Type dropdown shows "Percentage (%)"
- Value field displays
5.5 - Database:
partners.has_faf = true,faf_type = 'percentage',faf_value = 5.5
TC-002: Enable FAF - Fixed Amount Type
Priority: High
Component: Admin Bin Hire Configuration
Test Steps:
- Check "Enable FAF" toggle
- Select "Fixed Amount ($)" from FAF Type dropdown
- Verify input switches to
$prefix - Enter value
25.00in FAF Value field - Click "Save FAF Setting" button
- Wait for success notification
- Refresh page
Expected Results:
- Input prefix shows
$ - Database:
partners.faf_type = 'fixed',faf_value = 25.00
TC-003: Disable FAF
Priority: High
Component: Admin Bin Hire Configuration
Test Steps:
- Ensure FAF is currently enabled
- Uncheck "Enable FAF" toggle
- Click "Save FAF Setting" button
- Refresh page
Expected Results:
- Toggle remains unchecked after refresh
- Database:
partners.has_faf = false - Type and value fields may be null/empty
TC-004: FAF Value Validation - Negative Number
Priority: Medium
Component: Admin Bin Hire Configuration
Test Steps:
- Enable FAF toggle
- Enter
-10in FAF Value field - Click "Save FAF Setting"
Expected Results:
- Validation error displayed: "FAF value cannot be negative"
- Database not updated
- Save button returns to enabled state
TC-005: FAF Value Validation - Non-Numeric Input
Priority: Medium
Component: Admin Bin Hire Configuration
Test Steps:
- Enable FAF toggle
- Enter "abc" in FAF Value field
- Click "Save FAF Setting"
Expected Results:
- HTML5 number validation prevents submission OR
- Server validation returns error: "FAF value must be a number"
TC-006: FAF Type Prefix Switching
Priority: Low
Component: Admin Bin Hire Configuration (JavaScript)
Test Steps:
- Select "Percentage (%)" type
- Verify prefix shows
% - Change type to "Fixed Amount ($)"
- Verify prefix switches to
$ - Change back to "Percentage (%)"
- Verify prefix switches back to
%
Expected Results:
- Prefix updates immediately on type change (no page reload)
- jQuery event handler working correctly
TC-007: AJAX Save Button State
Priority: Low
Component: Admin Bin Hire Configuration (JavaScript)
Test Steps:
- Click "Save FAF Setting"
- Immediately observe button state during request
- Wait for response
Expected Results:
- Button disabled during request
- Button shows spinner icon:
<i class="fas fa-spinner fa-spin"></i> - Button text changes to "Saving..."
- Button re-enables after response (success or error)
- Button returns to original state with save icon
2. Admin Order Creation Tests
TC-008: Create Non-Rental Order with FAF (Percentage)
Priority: High
Component: Admin Order Creation
Preconditions:
- FAF enabled on Partner: type=percentage, value=10%
- Navigate to
/admin/skip-bin-orders/create - Select waste type with base price $500
Test Steps:
- Fill order details (non-rental)
- Verify FAF section displays calculated amount: $50.00
- Verify FAF is shown as "Fuel Adjustment Factor (10%)"
- Verify FAF is read-only (no input fields)
- Complete order creation
- Check database
order_detailstable
Expected Results:
- FAF display shows: $50.00 (10% of $500)
- No edit controls for FAF
- Database:
faf_applied_type='percentage',faf_applied_rate=10,faf_total_amount=50.00 - Order total includes FAF
TC-009: Create Non-Rental Order with FAF (Fixed)
Priority: High
Component: Admin Order Creation
Preconditions:
- FAF enabled on Partner: type=fixed, value=$30
- Navigate to
/admin/skip-bin-orders/create
Test Steps:
- Fill order details (non-rental)
- Verify FAF section displays calculated amount: $30.00
- Verify FAF is shown as "Fuel Adjustment Factor"
- Complete order creation
- Check database
Expected Results:
- FAF display shows: $30.00 (fixed amount)
- Database:
faf_applied_type='fixed',faf_applied_rate=30,faf_total_amount=30.00 - Order total includes $30 FAF regardless of base price
TC-010: Create Rental Order - FAF Should Not Apply
Priority: High
Component: Admin Order Creation
Preconditions:
- FAF enabled on Partner (any type)
- Navigate to
/admin/skip-bin-orders/create
Test Steps:
- Fill order details
- Set "Is Rental" = true
- Verify FAF section behavior
- Complete order creation
- Check database
Expected Results:
- FAF section hidden or shows $0.00
- Database:
faf_total_amount = 0.00(or null) - No FAF snapshot fields populated
- Order total does NOT include FAF
TC-011: Create Order with FAF Disabled
Priority: High
Component: Admin Order Creation
Preconditions:
- FAF disabled on Partner (
has_faf = false)
Test Steps:
- Create non-rental order
- Verify FAF section
- Check database after creation
Expected Results:
- No FAF displayed in order creation UI
- Database:
faf_total_amount = 0.00or null fields - Order total is base price only
TC-012: FAF Calculation Accuracy - Rounding
Priority: Medium
Component: Admin Order Creation
Preconditions:
- FAF enabled: type=percentage, value=7.25%
- Base price: $333.33
Test Steps:
- Create non-rental order with base price $333.33
- Calculate expected FAF: $333.33 × 0.0725 = $24.166425
- Verify displayed FAF amount
- Verify database stored value
Expected Results:
- Displayed FAF: $24.17 (rounded to 2 decimal places)
- Database:
faf_total_amount = 24.17 round($value, 2)used consistently
3. Web Order Tests (Customer)
TC-013: Web Order Step 2 - Quote with FAF
Priority: High
Component: Web Order Flow - Waste Selection
Preconditions:
- FAF enabled: percentage 10%
- Navigate to
/jr-trash/order/skipbin/quote
Test Steps:
- Select waste type with base price $400
- Select bin size
- Review price display
Expected Results:
- Price displayed includes FAF: $440.00
- Info message shown: "Includes Fuel Adjustment Factor (10%)"
- FAF breakdown visible or accessible
TC-014: Web Order Step 3 - Quote Detail with FAF Breakdown
Priority: High
Component: Web Order Flow - Quote Detail
Preconditions:
- FAF enabled: fixed $25
- Navigate to
/jr-trash/order/skipbin/quote-detail
Test Steps:
- Review quote detail page
- Locate price breakdown section
Expected Results:
- Base price shown separately
- FAF shown as line item: $25.00
- Total includes FAF
- Clear breakdown of all charges
TC-015: Web Order Step 4 - Customer Form FAF Display
Priority: High
Component: Web Order Flow - Customer Details
Preconditions:
- FAF enabled: percentage 5%
- Navigate to
/jr-trash/order/customer-form-skipbin - Price with extra: $600
Test Steps:
- Review order summary on customer form
- Locate FAF line item
Expected Results:
- FAF displayed as separate line item: $30.00 (5% of $600)
- Display text: "Fuel Adjustment Factor (5%)"
- Total includes FAF
- Price excludes FAF on individual items (shown separately)
TC-016: Web Order Step 5 - FAF Persistence on Submission
Priority: High
Component: Web Order Flow - Order Submission
Preconditions:
- FAF enabled: fixed $35
- Customer form completed
Test Steps:
- Submit order
- Check database
order_detailsfor new order
Expected Results:
faf_applied_type = 'fixed'faf_applied_rate = 35faf_total_amount = 35.00- Order total in database includes FAF
TC-017: Web Order Step 6 - Payment Page FAF Display
Priority: High
Component: Web Order Flow - Payment
Preconditions:
- FAF enabled
- Order submitted, at payment step
Test Steps:
- View payment page
- Review invoice breakdown
Expected Results:
- FAF shown as separate line item
- Total payment amount includes FAF
- Clear breakdown before payment confirmation
4. Change-Over Order Tests
TC-018: Create Change-Over (Non-Rental) with FAF
Priority: High
Component: Admin Change-Over Orders
Preconditions:
- FAF enabled on Partner: percentage 8%
- Existing non-rental order (original)
- Navigate to
/admin/change-over/edit/{order_id}
Test Steps:
- Verify FAF config loaded from Partner (not original order)
- Select new bin size with different price
- Verify FAF recalculates: 8% of new base price
- Complete change-over creation
- Check new order in database
Expected Results:
- FAF calculated from current Partner config (not inherited)
- FAF amount updated for new bin price
- New order has fresh FAF snapshot
- Admin cannot modify FAF (view-only)
TC-019: Create Change-Over (Rental) - FAF Excluded
Priority: High
Component: Admin Change-Over Orders
Preconditions:
- FAF enabled on Partner
- Existing order (original)
Test Steps:
- Create change-over order
- Set "Is Rental" = true
- Verify FAF behavior
- Complete creation
Expected Results:
- FAF section hidden or disabled
- No FAF calculated for rental change-over
- Database shows no FAF snapshot
TC-020: Change-Over FAF Rate Change Scenario
Priority: Medium
Component: Admin Change-Over Orders
Preconditions:
- Original order created with FAF 10% ($50)
- Partner FAF config changed to 15%
- Creating change-over from original order
Test Steps:
- Navigate to change-over page
- Verify FAF calculation uses new 15% rate
- Complete change-over
Expected Results:
- FAF calculated at 15% (current config), not 10% (original order)
- New order reflects updated FAF rate
- Demonstrates FAF is NOT inherited from original order
5. Order Edit Tests
TC-021: Edit Order - FAF Snapshot View-Only
Priority: High
Component: Admin Order Edit
Preconditions:
- Existing non-rental order with FAF applied
- Navigate to
/admin/skip-bin-orders/{id}/edit
Test Steps:
- View order edit page
- Locate FAF section in order summary
- Attempt to locate FAF edit controls
Expected Results:
- FAF displayed as read-only text (e.g., "Fuel Adjustment Factor (10%): $50.00")
- No input fields for FAF type, rate, or amount
- No toggle/switch to enable/disable FAF
- FAF snapshot from order creation shown
- Modifying other order fields does not affect FAF
TC-022: Edit Order - Verify FAF Not Modifiable
Priority: Medium
Component: Admin Order Edit
Test Steps:
- Inspect HTML source for FAF section
- Search for
<input>tags related to FAF - Verify no form fields with names:
faf_type,faf_rate,faf_amount
Expected Results:
- No form inputs for FAF fields
- Only display elements (spans, divs) present
- FAF data not included in form submission
6. Invoice Tests
TC-023: First Invoice (v1) - FAF Line Item
Priority: High
Component: PDF Invoice Generation
Preconditions:
- Order with FAF: $500 base + $50 FAF (10%)
- Invoice version: v1 (document/invoice)
Test Steps:
- Generate first invoice
- Open PDF:
resources/views/document/invoice/first-invoice.blade.php - Review line items
Expected Results:
- FAF appears as separate line item
- Description: "Fuel Adjustment Factor (10%)"
- Amount: $50.00
- Quantity: 1
- Line total: $50.00
- Invoice total includes FAF
TC-024: First Invoice (v2) - FAF Line Item
Priority: High
Component: PDF Invoice Generation
Preconditions:
- Order with FAF
- Invoice version: v2 (document/new-invoice)
Test Steps:
- Generate first invoice (v2)
- Review PDF output
Expected Results:
- FAF shown as separate line item
- Layout consistent with v1
- Totals include FAF
TC-025: Part/Subsequent Invoice - FAF Display
Priority: High
Component: PDF Invoice Generation
Preconditions:
- Order with multiple invoices
- First invoice already generated with FAF
- Generating part invoice (invoice_number > 1)
Test Steps:
- Generate part invoice
- Review line items
Expected Results:
- DECISION NEEDED: FAF should only appear on first invoice
- Part invoice may or may not show FAF (depends on implementation)
- Verify consistent with ADR-001-F
TC-026: Web Invoice View - FAF Display
Priority: High
Component: Frontend Invoice Display
Preconditions:
- Order with FAF
- Navigate to
/invoice/{token}/show
Test Steps:
- View invoice on web page
- Review line items table
Expected Results:
- FAF shown as separate line item
- Clear description with percentage if applicable
- Total includes FAF
- Layout matches PDF invoice
TC-027: Email Invoice - First Invoice with FAF
Priority: High
Component: Email Templates
Preconditions:
- Order with FAF
- First invoice email triggered
Test Steps:
- Check email:
resources/views/mails/invoice/first-invoice-to-customer.blade.php - Review included details:
resources/views/mails/invoice/details-skip-bin.blade.php
Expected Results:
- FAF summary included in email body
- Amount clearly stated
- Description includes percentage if applicable
TC-028: Email Invoice - Part Invoice with FAF
Priority: Medium
Component: Email Templates
Preconditions:
- Order with FAF
- Part invoice email triggered
Test Steps:
- Check email:
resources/views/mails/invoice/part-invoice-to-customer.blade.php - Review FAF display
Expected Results:
- FAF handling consistent with PDF part invoices
TC-029: Invoice Total Accuracy
Priority: High
Component: All Invoice Types
Preconditions:
- Multiple test orders with different FAF configurations
Test Steps:
- Generate invoices for each order
- Calculate expected totals manually
- Compare with invoice totals
Expected Results:
- Subtotal = Base Price + FAF + Other Charges
- GST calculated correctly on total including FAF
- Grand Total = Subtotal + GST (if applicable)
- No rounding errors
TC-030: Invoice Regeneration - FAF Idempotency
Priority: Medium
Component: Invoice Management
Preconditions:
- Order with FAF
- Invoice already generated once
Test Steps:
- Regenerate same invoice (simulate correction/update)
- Check database
order_invoice_extrastable - Count FAF line items for this invoice
Expected Results:
- Only ONE FAF line item exists (idempotent)
- No duplicate FAF entries
FuelAdjustmentRepository::addFAFToInvoice()uses updateOrCreate pattern
7. Xero Integration Tests
TC-031: Xero Sync - FAF Line Item Present
Priority: High
Component: Xero Integration
Preconditions:
- Order with FAF: $500 base + $50 FAF
- Xero integration enabled
- Invoice ready to sync
Test Steps:
- Trigger Xero sync for invoice
- Review
InvoiceManagement::xeroItemNonRental()output - Check line items array
Expected Results:
- Two line items in Xero payload:
- Main service: Description, UnitAmount=$500, AccountCode=$itemXero
- FAF: Description="Fuel Adjustment Factor (10%)", UnitAmount=$50.00, AccountCode=$itemXero
TC-032: Xero Sync - Same AccountCode for FAF
Priority: High
Component: Xero Integration
Test Steps:
- Sync invoice to Xero
- Verify AccountCode values
Expected Results:
- FAF line uses SAME AccountCode as main service line
- No separate
xero_faf_account_codefield used - Consistent with CEO requirement
TC-033: Xero Sync - Rental Order Exclusion
Priority: High
Component: Xero Integration
Preconditions:
- Rental order with FAF enabled in Partner config
- Xero sync triggered
Test Steps:
- Sync rental order invoice to Xero
- Review line items
Expected Results:
- NO FAF line item in Xero payload
- Only main service line present
- Rental orders excluded from FAF in Xero sync
8. Edge Cases & Regression Tests
TC-034: Zero FAF Value
Priority: Medium
Component: All Order Types
Preconditions:
- FAF enabled: fixed $0.00
Test Steps:
- Create non-rental order
- Check FAF display and database
Expected Results:
- FAF may show $0.00 or be hidden
- Database:
faf_total_amount = 0.00 - No FAF line item on invoice (if amount is 0)
- Order total unchanged
TC-035: Very Large FAF Value
Priority: Low
Component: Calculation Logic
Preconditions:
- FAF enabled: fixed $999,999.99
Test Steps:
- Create order
- Verify calculation and display
Expected Results:
- Large FAF handled without overflow
- Database DECIMAL(10,2) accommodates value
- Display formatted correctly
TC-036: Decimal Precision - 2 Decimal Places
Priority: High
Component: Calculation & Storage
Preconditions:
- Various FAF calculations that produce many decimal places
Test Steps:
- Test case 1: $100 × 3.333% = $3.333 → $3.33
- Test case 2: $199.99 × 7.5% = $14.99925 → $15.00
- Verify all stored and displayed values
Expected Results:
- All values rounded to exactly 2 decimal places
round($value, 2)used consistently- No floating point precision issues visible to users
TC-037: FAF Rate Change After Order Creation
Priority: Medium
Component: Order Snapshot
Preconditions:
- Create order with FAF 10% (snapshot saved)
- Change Partner FAF config to 15%
- View original order and generate invoice
Test Steps:
- Verify original order unchanged
- Generate invoice for original order
- Create new order
Expected Results:
- Original order: FAF still 10% (snapshot preserved)
- Original invoice: FAF at 10%
- New order: FAF at 15% (new config)
- Demonstrates immutability of FAF snapshots
TC-038: Multi-Order Invoice with Mixed FAF
Priority: Medium
Component: Invoice Management
Preconditions:
- Multiple orders in single invoice
- Some orders with FAF, some without
Test Steps:
- Create invoice with multiple orders
- Review line items
Expected Results:
- Each order's FAF shown separately (if applicable)
- Correct totals for each order
- FAF only on non-rental orders
TC-039: Coupon/Discount with FAF
Priority: Medium
Component: Order Calculation
Preconditions:
- FAF enabled: 10%
- Coupon available: $50 off
- Base price: $500
Test Steps:
- Apply coupon during order
- Calculate expected totals
Expected Results:
- FAF calculated on pre-discount or post-discount base? VERIFY
- Document expected behavior:
- If FAF on base: $500 × 10% = $50 FAF
- If FAF after discount: ($500 - $50) × 10% = $45 FAF
- Behavior should be consistent and documented
TC-040: Extra Services with FAF
Priority: Medium
Component: Order Calculation
Preconditions:
- Order with extra services (e.g., lock, lights)
- FAF enabled: 10%
- Base bin price: $400
- Extra services: $50
Test Steps:
- Create order with extra services
- Review FAF calculation
Expected Results:
- FAF calculated on base bin price only: $400 × 10% = $40
- OR FAF on total including extras? VERIFY
- Document expected behavior
TC-041: Change FAF Type (Percentage → Fixed)
Priority: Low
Component: Configuration
Preconditions:
- FAF enabled: percentage 10%
- Existing orders with FAF snapshots
Test Steps:
- Change FAF type to fixed $25
- Create new order
- View existing orders
Expected Results:
- New orders use fixed $25
- Existing orders unchanged (snapshot preserved)
- No retroactive changes to historical orders
TC-042: Database Migration Rollback
Priority: Low
Component: Database
Test Steps:
- Run rollback on FAF migrations:
php artisan migrate:rollback --path=database/migrations/2026_04_09_041400_add_faf_columns_to_partners_table.phpphp artisan migrate:rollback --path=database/migrations/2026_04_09_041401_add_faf_columns_to_order_details_table.php
- Verify columns removed
- Re-run migrations
- Verify columns restored
Expected Results:
- Rollback removes FAF columns cleanly
- Re-migration restores columns
- No data loss in other tables
TC-043: FAF with GST Calculation
Priority: High
Component: Tax Calculation
Preconditions:
- GST enabled (e.g., 10%)
- FAF enabled: fixed $50
- Base price: $500
Test Steps:
- Create order
- Generate invoice
- Calculate expected GST
Expected Results:
- Subtotal = $500 + $50 = $550
- GST = $550 × 10% = $55 (if GST applies to FAF)
- Grand Total = $605
- OR GST may be calculated differently - VERIFY implementation
9. Regression Checklist
Core Functionality
- TC-R01: Existing orders without FAF continue to work
- TC-R02: Existing invoices generate correctly
- TC-R03: Xero sync works for orders without FAF
- TC-R04: Pricing calculations unaffected for orders without FAF
- TC-R05: Rental orders continue to exclude FAF
- TC-R06: Admin permissions (
bin-hires-update) still enforced - TC-R07: Order totals calculate correctly in all scenarios
- TC-R08: Invoice totals accurate before and after FAF feature
UI/UX
- TC-R09: Bin Hire page loads without JavaScript errors
- TC-R10: SweetAlert2 notifications display correctly
- TC-R11: Vue components on order pages render properly
- TC-R12: Invoice PDFs generate without layout issues
- TC-R13: Email templates render correctly
Data Integrity
- TC-R14: No NULL constraint violations on new columns
- TC-R15: Default values applied correctly (
faf_total_amountdefaults to 0.00) - TC-R16: Foreign key relationships preserved
- TC-R17: Existing data migration handled gracefully (if applicable)
Test Data Setup
Required Test Partners
| Partner | has_faf | faf_type | faf_value | Purpose |
|---|---|---|---|---|
| Test-Partner-1 | false | null | null | No FAF baseline |
| Test-Partner-2 | true | percentage | 10.00 | Percentage FAF |
| Test-Partner-3 | true | fixed | 25.00 | Fixed FAF |
| Test-Partner-4 | true | percentage | 5.555 | Rounding test |
Required Test Orders
| Order | is_rental | Partner | Expected FAF |
|---|---|---|---|
| Test-Order-1 | false | Test-Partner-2 | 10% of base |
| Test-Order-2 | true | Test-Partner-2 | $0 |
| Test-Order-3 | false | Test-Partner-3 | $25 fixed |
| Test-Order-4 | false | Test-Partner-1 | $0 |
Appendix: Related Files
Controllers
app/Http/Controllers/Admin/GeneralWasteBinHireController.php- FAF configapp/Http/Controllers/Admin/OrderSkipBinController.php- Admin order creationapp/Http/Controllers/OrderController.php- Web ordersapp/Http/Controllers/Admin/ChangeOverController.php- Change-over orders
Repositories
app/Repositories/FuelAdjustmentRepository.php- FAF business logicapp/Repositories/InvoiceManagement.php- Invoice generation
Models
app/Partner.php- FAF configurationapp/OrderDetail.php- FAF snapshotapp/OrderInvoiceExtra.php- Invoice line items
Views
resources/views/admin/bin-hire/index.blade.php- FAF config UIresources/views/orders/skipbin_quote.blade.php- Web order step 2resources/views/orders/skipbin_quote_detail.blade.php- Web order step 3resources/views/orders/customer-form-skipbin.blade.php- Web order step 4resources/views/document/invoice/first-invoice.blade.php- PDF v1resources/views/document/new-invoice/first-invoice.blade.php- PDF v2resources/views/frontend/invoice/index.blade.php- Web invoice
Vue Components
resources/js/components/AdminNewSkipBinOrder.vue- Admin order creationresources/js/components/AdminEditOrder.vue- Admin order editresources/js/components/AdminChangeOver.vue- Change-over ordersresources/js/store/NewSkipBinOrder.js- Order state management