Finance & Payment Settlement
Double-entry allocation cycle, customer invoicing, payment recording, credit notes, refunds, and multi-POS reconciliation.
The Finance module provides ledger-grade billing, customer invoicing, payment recording, and balance reconciliation for sports facilities and multi-entity enterprises. It manages the complete financial cycle from invoice creation through multi-method payment receipt, atomic payment allocation, and credit adjustments.
Financial Infrastructure
Engineered to satisfy enterprise financial audit requirements, multi-currency reporting, and automated tax reconciliation.
Customer Invoicing
Automated and manual invoice generation with line items, tax categories, due dates, and PDF export readiness.
Multi-Channel Payments
Recording payments across online gateways (Stripe, HyperPay), physical POS terminals, bank transfers, and cash.
Atomic Payment Allocation
Deterministic FIFO or manual allocation of payment funds against open invoice balances with real-time status transitions.
Reversals & Refunds
Audited partial or full refunds linked back to original payment transactions with automated balance adjustments.
Credit Notes & Adjustments
Write-offs, promotional credits, and dispute adjustments with required justification audit logs.
Immutable Financial Audit
Tamper-evident financial event stream ensuring full compliance with accounting standards and jurisdictional audits.
Domain Aggregate Root: CustomerInvoice
The CustomerInvoice aggregate manages invoice balance integrity, partial payment allocations, overdue status, and emitted financial events.
public sealed class CustomerInvoice : TenantAggregateRoot
{
public string InvoiceNumber { get; private set; } = string.Empty;
public Guid CustomerPartyId { get; private set; }
public DateTimeOffset IssueDateUtc { get; private set; }
public DateTimeOffset DueDateUtc { get; private set; }
public InvoiceStatus Status { get; private set; }
public decimal TotalAmount { get; private set; }
public decimal PaidAmount { get; private set; }
public decimal BalanceRemaining => TotalAmount - PaidAmount;
public string Currency { get; private set; } = "USD";
public List<CustomerInvoiceLine> Lines { get; private set; } = new();
public Result ApplyPaymentAllocation(decimal allocationAmount)
{
if (allocationAmount <= 0)
return Result.Failure("Allocation amount must be greater than zero.");
if (PaidAmount + allocationAmount > TotalAmount)
return Result.Failure("Allocation exceeds remaining balance.");
PaidAmount += allocationAmount;
if (PaidAmount >= TotalAmount)
Status = InvoiceStatus.Paid;
else
Status = InvoiceStatus.PartiallyPaid;
RaiseDomainEvent(new InvoicePaymentAppliedDomainEvent(Id, TenantId, allocationAmount, BalanceRemaining));
return Result.Success();
}
}Double-Entry Payment Allocation & Reconciliation Cycle
How incoming customer funds are verified, recorded, and allocated against open obligations:
Primary API Endpoints
Key endpoints exposed by FinanceControllers for invoicing, payment capturing, allocation, and reporting.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/v1/finance/customer-invoices | List customer invoices with filtering by status, party, and date | 🔒 Required |
| POST | /api/v1/finance/customer-invoices | Issue a new customer invoice with detailed line items and taxes | 🔒 Required |
| POST | /api/v1/finance/customer-invoices/{id}/adjustments | Post a credit note or manual adjustment to an existing invoice | 🔒 Required |
| GET | /api/v1/finance/payments | Query recorded payments across all transaction channels | 🔒 Required |
| POST | /api/v1/finance/payments/record | Record a new payment transaction from gateway webhook or POS | 🔒 Required |
| POST | /api/v1/finance/payments/{id}/allocate | Allocate available payment funds against one or more open invoices | 🔒 Required |
| POST | /api/v1/finance/payments/{id}/refund | Initiate a partial or full refund for a recorded payment | 🔒 Required |