Financial Management Entities
1. Overview
Financial entities manage the complete financial lifecycle including orders, payments, general ledger accounting, and financial reconciliation. These entities support both event registration payments and membership fees.
Package: za.co.idealogic.event.domain
Repository: event-database
Total Entities: 7
2. Order Management
2.1. Order
Represents a customer order for event registrations, memberships, products, or services.
Key Relationships:
-
Many-to-one with Organisation
-
Many-to-one with User (customer)
-
One-to-many with OrderLineItem
-
Many-to-one with PaymentProcessor
-
One-to-many with GlTransaction
Attributes:
-
Order number (unique identifier)
-
Order date
-
Order status (pending, paid, cancelled, refunded, partially_refunded)
-
Total amount
-
Currency
-
Payment status
-
Payment method
-
Transaction reference
-
Customer information
Order Statuses:
-
Pending - Order created, awaiting payment
-
Paid - Payment received and confirmed
-
Cancelled - Order cancelled before payment
-
Refunded - Full refund processed
-
Partially Refunded - Partial refund processed
-
Failed - Payment failed
2.2. OrderLineItem
Individual items within an order (event entries, membership fees, products, add-ons).
Key Relationships:
-
Many-to-one with Order
-
References Product (optional)
-
References EventParticipant (for event entries)
-
References MembershipPeriod (for membership fees)
Attributes:
-
Line item description
-
Quantity
-
Unit price
-
Discount amount
-
Tax amount
-
Total amount
-
Item type (event_entry, membership, product, fee, discount)
-
Related entity reference
Line Item Types:
-
Event Entry - Registration for an event/race
-
Membership Fee - Membership payment
-
Product - Physical or digital product
-
Processing Fee - Transaction fees
-
Discount - Discount applied (negative amount)
-
Add-on - Optional extras (timing chip, t-shirt, etc.)
2.3. Product
Catalog of products and services that can be sold.
Attributes:
-
Product name
-
Description
-
SKU/product code
-
Price
-
Currency
-
Tax category
-
Active/inactive status
-
Stock tracking (optional)
Product Types:
-
Event merchandise (t-shirts, medals)
-
Timing chips
-
Race photos/videos
-
Training programs
-
Equipment rental
-
Insurance products
-
Donations
3. Payment Processing
3.1. PaymentProcessor
Configuration for payment gateway integrations.
Key Relationships:
-
Many-to-one with Organisation
-
One-to-many with Order
Attributes:
-
Processor name (PayFast, Stripe, PayPal, etc.)
-
Processor type
-
API credentials (encrypted)
-
Merchant ID
-
Configuration settings (JSON)
-
Active/inactive status
-
Supported currencies
-
Supported payment methods
Supported Processors:
-
PayFast (South African payment gateway)
-
Stripe (International)
-
PayPal
-
Manual payments (bank transfer, cash)
-
Organization-specific integrations
4. General Ledger
The general ledger entities provide double-entry accounting for financial tracking and reporting.
4.1. GlAccount
Chart of accounts defining the general ledger account structure.
Attributes:
-
Account number
-
Account name
-
Account type (asset, liability, equity, revenue, expense)
-
Parent account (for hierarchical structure)
-
Active/inactive status
-
Currency
Standard Account Types:
-
Revenue - Event fees, membership fees, product sales
-
Liability - Deferred revenue, refunds payable
-
Asset - Cash, accounts receivable, payment processor balance
-
Expense - Transaction fees, refunds issued
-
Equity - Organisation capital
Example Accounts:
4000 - Revenue
4100 - Event Registration Revenue
4200 - Membership Fee Revenue
4300 - Product Sales Revenue
4400 - Sponsorship Revenue
5000 - Expenses
5100 - Payment Processing Fees
5200 - Refunds
5300 - Event Costs
1000 - Assets
1100 - PayFast Balance
1200 - Stripe Balance
1300 - Bank Account
4.2. GlRecord
Individual general ledger entries (debits and credits).
Key Relationships:
-
Many-to-one with GlTransaction
-
Many-to-one with GlAccount
Attributes:
-
Debit amount
-
Credit amount
-
Record date
-
Description
-
Reference number
Accounting Rules:
-
Every transaction has at least two GlRecords
-
Total debits must equal total credits
-
Each record affects one GlAccount
4.3. GlTransaction
A complete financial transaction consisting of multiple GlRecords (double-entry).
Key Relationships:
-
One-to-many with GlRecord
-
Many-to-one with Order (optional - for order-related transactions)
-
Many-to-one with Organisation
Attributes:
-
Transaction date
-
Transaction type
-
Description
-
Status (draft, posted, voided)
-
Posted by (user)
-
Posted date
Transaction Types:
-
Payment Received - Customer payment
-
Refund Issued - Refund to customer
-
Fee Expense - Payment processor fees
-
Bank Transfer - Funds movement
-
Adjustment - Manual corrections
-
Closing - Period close entries
5. Reconciliation
5.1. Recon
Reconciliation records for matching payments, bank statements, and general ledger entries.
Attributes:
-
Reconciliation type (bank, payment processor, order)
-
Reconciliation date
-
Period start/end dates
-
Status (in_progress, completed, discrepancies)
-
Reconciled amount
-
Discrepancy amount
-
Notes
Reconciliation Types:
-
Bank Reconciliation - Match bank statements to GL
-
Payment Processor Reconciliation - Match processor reports to orders
-
Order Reconciliation - Verify order totals match GL
-
Period Close - Month/year-end reconciliation
Use Cases:
-
Daily payment processor reconciliation
-
Monthly bank reconciliation
-
Dispute investigation
-
Financial audit support
-
Variance analysis
6. Entity Relationships
Organisation
|
+----> PaymentProcessor
|
+----> Order -------- 1:N --------> OrderLineItem
| | |
| | +---> Product
| | +---> EventParticipant
| | +---> MembershipPeriod
| |
| +--------> GlTransaction
| |
| | 1:N
| |
+----> GlAccount <----- GlRecord
7. Example Transactions
7.1. Example 1: Event Registration Payment
Order #12345
Customer: John Doe
Date: 2025-01-15
Status: Paid
Total: R500.00
OrderLineItems:
- Marathon Entry: R450.00
- Timing Chip: R50.00
GlTransaction for Payment:
Type: Payment Received
Date: 2025-01-15
GlRecords:
Debit: Account 1100 (PayFast Balance) - R485.00
Debit: Account 5100 (Processing Fees) - R15.00
Credit: Account 4100 (Event Revenue) - R500.00
7.2. Example 2: Membership Fee Payment
Order #12346
Customer: Jane Smith
Date: 2025-01-16
Status: Paid
Total: R300.00
OrderLineItems:
- Annual Membership: R300.00
GlTransaction for Payment:
Type: Payment Received
Date: 2025-01-16
GlRecords:
Debit: Account 1100 (PayFast Balance) - R291.00
Debit: Account 5100 (Processing Fees) - R9.00
Credit: Account 4200 (Membership Revenue) - R300.00
8. Common Workflows
8.1. Order Creation & Payment Workflow
-
User adds items to cart (create Order with status=pending)
-
Add OrderLineItems for each item
-
Calculate totals (items + fees - discounts)
-
User selects PaymentProcessor
-
Redirect to payment gateway
-
Payment processor callback updates Order status
-
Create GlTransaction and GlRecords
-
Update EventParticipant or MembershipPeriod status
-
Send confirmation email with receipt
8.2. Refund Processing Workflow
-
Refund request initiated
-
Validate refund eligibility
-
Calculate refund amount (full or partial)
-
Update Order status (refunded or partially_refunded)
-
Process refund through PaymentProcessor
-
Create GlTransaction for refund
-
Update related entities (EventParticipant, MembershipPeriod)
-
Send refund confirmation
8.3. Daily Reconciliation Workflow
-
Export transaction report from PaymentProcessor
-
Create Recon record
-
Match processor transactions to Orders
-
Match Orders to GlTransactions
-
Identify discrepancies
-
Investigate and resolve discrepancies
-
Create adjustment GlTransactions if needed
-
Mark Recon as completed
-
Generate reconciliation report
9. Multi-Tenancy Considerations
-
Each Organisation has its own:
-
Chart of accounts (GlAccounts)
-
Payment processor configurations
-
Order numbering sequence
-
Financial reporting
-
-
System administrators can:
-
Define standard chart of accounts templates
-
Configure global Products
-
Monitor cross-organisation transactions
-
-
Financial data is strictly organisation-scoped:
-
No cross-organisation financial queries
-
Each org maintains separate books
-
Independent reconciliation processes
-
10. Integration Points
10.1. Payment Gateway Integration
-
Order → PaymentProcessor → External Gateway
-
Webhook/callback handling for payment status
-
Refund API integration
-
Transaction status synchronization
11. Entity Summary
| Entity | Primary Purpose | Key Features |
|---|---|---|
Order |
Customer order/purchase |
Status tracking, totals |
OrderLineItem |
Order details |
Links to entities, pricing |
Product |
Product catalog |
Pricing, SKU, inventory |
PaymentProcessor |
Gateway configuration |
Multiple processors, encrypted credentials |
GlAccount |
Chart of accounts |
Hierarchical structure, account types |
GlRecord |
Ledger entries |
Debits/credits, double-entry |
GlTransaction |
Transaction container |
Multiple records, balanced entries |
Recon |
Reconciliation tracking |
Period-based, variance tracking |
12. Reporting Capabilities
The financial entities support various reports:
-
Revenue Reports - By event, membership, product, period
-
Payment Processor Reports - By processor, reconciliation status
-
General Ledger Reports - Trial balance, income statement, balance sheet
-
Reconciliation Reports - Daily, monthly, variance analysis
-
Audit Reports - Transaction history, user actions
-
Tax Reports - VAT/sales tax reporting