Skip to main content
The LedgerEntry model represents a financial transaction in a group’s ledger. It tracks both expenses and settlements, recording who paid whom and for what amount.

Data Class Definition

LedgerEntry.kt
Source: LedgerEntry.kt

LedgerEntryType Enum

Source: LedgerEntry.kt
  • EXPENSE: Represents a shared expense that was split among group members
  • SETTLEMENT: Represents a direct payment from one user to another to settle debts

Fields

String
required
Unique identifier for the ledger entry
LedgerEntryType
required
Type of transaction: EXPENSE or SETTLEMENT
String
required
Description of the transaction (e.g., “Grocery Store”, “Payment to Sarah”)
Long
required
Transaction amount in cents
String
required
ID of the group this ledger entry belongs to
String
required
User ID of the person who made the payment
String
required
Human-readable date label (e.g., “Today”, “Yesterday”, “Mar 1”)
String
default:"\"\""
For settlements, the user ID of the person receiving the payment. Empty for expenses.
String
default:"\"\""
For expenses, the method used to split the cost (e.g., “EQUAL”, “PERCENTAGE”). Empty for settlements.
String
default:"\"\""
Name of the group (denormalized for display purposes)
String
default:"\"\""
Display name of the user who paid (denormalized for display purposes)
String
default:"\"\""
Display name of the user who received payment in a settlement (denormalized for display purposes)
Boolean
default:"false"
Whether the current user made this payment

Usage Examples

Expense Ledger Entry

Settlement Ledger Entry

ActivityItem

A simplified model for displaying activity feed items:
ActivityItem.kt
Source: [ActivityItem.kt:6] The ActivityItem model is a simpler representation used in activity feeds, while LedgerEntry contains more detailed transaction information.

Relationships

  • Group: Each ledger entry belongs to a Group via groupId
  • User: The paidByUserId and toUserId fields reference UserProfile IDs
  • Expense: Expense-type ledger entries are derived from Expense or GroupExpense records

Use Cases

Transaction History

Ledger entries provide a complete audit trail of all financial transactions within a group:
  • Who paid for what expenses
  • Who settled debts with whom
  • When transactions occurred

Balance Calculation

Ledger entries are used to calculate member balances:
  • Expenses increase what others owe the payer
  • Settlements reduce outstanding debts between members

Activity Feed

The denormalized fields (groupName, paidByName, toName) allow ledger entries to be displayed in activity feeds without additional database lookups.