Skip to content

feat: Complete backend implementation for Ledger module#3

Merged
roncodes merged 1 commit intodev-v0.0.1from
feature/backend-implementation
Feb 28, 2026
Merged

feat: Complete backend implementation for Ledger module#3
roncodes merged 1 commit intodev-v0.0.1from
feature/backend-implementation

Conversation

@roncodes
Copy link
Copy Markdown
Member

Overview

This PR implements the complete backend functionality for the Fleetbase Ledger accounting and invoicing module.

What's Included

Database Schema

  • ledger_accounts: Chart of accounts with support for asset, liability, equity, revenue, and expense account types
  • ledger_journals: Double-entry journal entries linking transactions to debit/credit accounts
  • ledger_invoices: Invoice management with customer relationships and order integration
  • ledger_invoice_items: Line items for invoices with tax calculation
  • ledger_wallets: Wallet system for managing entity balances (drivers, vendors, etc.)

Models

  • Full Eloquent models with relationships and traits
  • Proper use of HasUuid, HasPublicId, HasApiModelBehavior
  • Polymorphic relationships using subject_uuid and subject_type (new naming convention)
  • All monetary values stored as integers (cents) for precision

Services

  • LedgerService: Core double-entry bookkeeping logic
  • WalletService: Wallet deposit, withdrawal, and transfer operations
  • InvoiceService: Invoice creation from orders and payment recording

Controllers & Resources

  • AccountController: CRUD operations for chart of accounts
  • InvoiceController: Full invoice lifecycle management
  • WalletController: Wallet management and transactions
  • TransactionController: System-wide transaction viewer
  • API resources for all models

Events & Observers

  • InvoiceCreated and InvoicePaid events
  • InvoiceObserver for lifecycle hooks

Key Features

✅ Double-entry bookkeeping system
✅ System-wide transaction viewing
✅ Wallet functionality for driver/entity payments
✅ Invoice generation from FleetOps orders
✅ Integration with core Transaction model
✅ Proper use of new subject naming convention

Testing

  • All routes configured and ready for testing
  • Service provider properly registers observers and services
  • Follows Fleetbase architecture patterns

Next Steps

  • Frontend implementation (Ember.js components and routes)
  • PDF generation for invoices
  • Email notifications
  • Payment gateway integration

- Add database migrations for accounts, journals, invoices, invoice_items, and wallets
- Implement models with full relationships and traits
- Create LedgerService, WalletService, and InvoiceService for business logic
- Add controllers for accounts, invoices, wallets, and transactions
- Create API resources for all models
- Implement events and observers for invoice lifecycle
- Configure routes and service provider
- Support double-entry bookkeeping with journal entries
- Enable system-wide transaction viewing
- Implement wallet functionality for driver/entity payments
@roncodes roncodes changed the base branch from main to dev-v0.0.1 February 28, 2026 02:39
@roncodes roncodes merged commit b3233ff into dev-v0.0.1 Feb 28, 2026
4 checks passed
@roncodes roncodes deleted the feature/backend-implementation branch February 28, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant