Skip to content

Sub-Domain Blueprint: Finance AP/AR

Domain: Finance (Ledger, Budget, AP, AR) Logical Sub-Domain: AP/AR (Cash Flow) Physical Packages: @sd/mod-finance/payables, @sd/mod-finance/receivables Related Documents: Data Definition Context: This document defines the Invoices (Inflow) and Bills (Outflow) workflows. Status: Stable (v2.5)

1. Mandate

The AP/AR Sub-Domain manages Cash Flow. It converts Operational Activity (POs) and Community Obligations (Dues) into Financial Artifacts (Bill, Invoice). It triggers Ledger Postings automatically upon generation and payment.

2. Capabilities

Capability Description Component
Invoicing Generating bills for Owners (Dues, Fines). ReceivablesService.createInvoice
Bill Processing Reviewing and Paying Vendor Bills. PayablesService.approveBill
Payment Matching Reconciling Bank Transfers to Invoices. recordPayment
Dunning Tracking Overdue Invoices. getOverdueInvoices

3. Process Models

A. Paying a Vendor (AP)

Happy Path: Payment Run.

sequenceDiagram
    participant Admin
    participant AP as PayablesService
    participant GL as LedgerService
    participant DB as Firestore

    Admin->>AP: approveBill("bill_123")
    AP->>GL: postEntry(Dr Expense, Cr AP)

    Admin->>AP: payBill("bill_123", method="Check")
    AP->>GL: postEntry(Dr AP, Cr Cash)
    AP->>DB: updateBill(status="paid")

B. Receiving Dues (AR)

Happy Path: Owner pays HOA.

sequenceDiagram
    participant Owner
    participant AR as ReceivablesService
    participant GL as LedgerService

    Owner->>AR: payInvoice("inv_456")
    AR->>GL: postEntry(Dr Cash, Cr AR)
    AR->>DB: updateInvoice(status="paid")

4. State Machines

Invoice Status

stateDiagram-v2
    [*] --> Draft
    Draft --> Sent: Emailed
    Sent --> Paid: Settled
    Sent --> Overdue: Late
    Overdue --> BadDebt: Write-off

5. Interface Definitions

PayablesService

  • createBill(bill): Promise<Bill>
  • payBill(id, amount): Promise<Payment>

ReceivablesService

  • createInvoice(inv): Promise<Invoice>
  • recordPayment(id, amount): Promise<Payment>

6. Changelog

Date Author Description Reference
2026-01-24 Antigravity Initial creation Implementation Plan