Skip to main content
Version: 1.0.0 Status: 📝 Planned Created: 2026-03-21 Last Updated: 2026-03-21 Constitution Reference: Section 1.3 (Integration Patterns — Pattern 1: Platform Integration Layer, Pattern 2: Event-Based, Pattern 3: API Contracts)

Overview

This document defines the comprehensive integration contract between the FA (Fund Accounting) core and the FW (Forms & Workflow) core. FA uses FW extensively for financial approval workflows, expense forms, purchase order routing, budget approvals, and amount-based decision table routing. Related Specifications:
  • FA-02: Vendor Bills & Journal Entries
  • FA-03: Payments
  • FA-04: Purchase Orders & Procurement
  • FA-08: Budgeting
  • FA-12: Expense Management
  • FA-19: Period Close
  • FA-22: Accounts Payable Automation
  • FA-UX-05: Purchase Order Creation Wizard
  • FA-UX-07: Expense Report Wizard
FW Features Consumed:
  • FW-01/FW-05: Forms (expense reports, purchase requisitions)
  • FW-03: Automation Engine (AP automation, payment processing triggers)
  • FW-15: Form Field Lookups (vendors, GL accounts, funds, cost centers)
  • FW-16: Event-Based Workflow Triggers
  • FW-34: Approval Workflows (multi-level financial approvals)
  • FW-45: Decision Tables (amount-based approval routing)
Existing Integration: FA-UX-05 / FW-03 Integration — PO-specific approval contract (this document supersedes it as the comprehensive guide). Cross-cutting guide: See FW Cross-Core Integration Guide for shared patterns, platform layer imports, and testing requirements.

Integration Pattern

Primary Pattern: Pattern 1 — Platform Integration Layer Secondary Pattern: Pattern 2 — Event-Based Integration Tertiary Pattern: Pattern 3 — API Contracts (for PO approval submission) FA accesses FW capabilities through:
  • @/platform/forms — expense report and purchase requisition forms
  • @/platform/approvals — financial approval chain submission
  • @/platform/events — publishing FA events for FW automation triggers
  • @/platform/data-lookup — vendor, GL account, fund lookups in forms
  • @/platform/calendar — business day calculations for payment deadlines

Event Contracts (FA → FW)

Events published by FA that trigger FW automations and workflows.

FA-12: Expense Management Events

Event: fa_expense_report_submitted

Event: fa_expense_report_submitted Channel: fa_events Publisher: FA (FA-12 Expense Management) Subscribers: FW-34 (approval workflow), PF-10 (notification) Status: ✅ Implemented (registered in KnownEventName)
Purpose
Triggers expense report approval workflow when an employee submits an expense report.
Payload Schema
Consumer Actions

Event: fa_expense_report_approved

Event: fa_expense_report_approved Channel: fa_events Publisher: FA (FA-12 Expense Management) Subscribers: FW-03 (reimbursement automation), PF-10 (notification) Status: ✅ Implemented (registered in KnownEventName)
Purpose
Triggers reimbursement processing when an expense report is fully approved.
Payload Schema

FA-04: Purchase Order Events

Event: fa_purchase_order_created

Event: fa_purchase_order_created Channel: fa_events Publisher: FA (FA-04 / FA-UX-05) Subscribers: FW-34 (PO approval workflow) Status: 📝 Planned (see FA-UX-05-FW-03-INTEGRATION.md for detailed API contract)
Purpose
Triggers PO approval workflow when a purchase order is created via the PO wizard.
Payload Schema
Consumer Actions

FA-02: Vendor Bill & Journal Entry Events

Event: fa_vendor_bill_received

Event: fa_vendor_bill_received Channel: fa_events Publisher: FA (FA-02 / FA-22) Subscribers: FW-34 (bill approval workflow), FW-03 (AP automation) Status: 📝 Planned
Purpose
Triggers bill approval workflow when a vendor bill is received (manually entered or auto-scanned via FA-22).
Payload Schema

Event: fa_journal_entry_pending

Event: fa_journal_entry_pending Channel: fa_events Publisher: FA (FA-02 Journal Entries) Subscribers: FW-34 (JE approval workflow) Status: 📝 Planned
Purpose
Triggers journal entry approval when a JE is submitted for review.
Payload Schema

FA-08: Budget Events

Event: fa_budget_approved

Event: fa_budget_approved Channel: fa_events Publisher: FA (FA-08 Budgeting) Subscribers: FW-03 (budget activation automation), PF-10 (notification) Status: ✅ Implemented (registered in KnownEventName)
Purpose
Triggers budget activation when a budget is approved through the approval chain.
Payload Schema

FA-22: AP Automation Events

Event: fa_bill_scan_completed

Event: fa_bill_scan_completed Channel: fa_events Publisher: FA (FA-22 AP Automation) Subscribers: FW-03 (auto-matching workflow) Status: 📝 Planned (referenced in EVENT_CONTRACTS.md)
Payload Schema

Event: fa_bill_duplicate_flagged

Event: fa_bill_duplicate_flagged Channel: fa_events Publisher: FA (FA-22 AP Automation) Subscribers: FW-03 (duplicate review workflow) Status: 📝 Planned (referenced in EVENT_CONTRACTS.md)
Payload Schema

FA-19: Period Close Events

Event: fa_close_period_started

Event: fa_close_period_started Channel: fa_events Publisher: FA (FA-19 Period Close) Subscribers: FW-03 (close checklist automation) Status: ✅ Implemented (registered in KnownEventName)
Payload Schema

Approval Chain Configurations

Expense Report Approval

Chain ID: fa-expense-report-approval Entity Type: fa_expense_reports Based On: FA-12, FA-UX-07

Purchase Order Approval

Chain ID: fa-purchase-order-approval Entity Type: fa_purchase_orders Based On: FA-04, FA-UX-05 See FA-UX-05-FW-03-INTEGRATION.md for the detailed PO approval API contract.

Journal Entry Approval

Chain ID: fa-journal-entry-approval Entity Type: fa_journal_entries Based On: FA-02

Budget Approval

Chain ID: fa-budget-approval Entity Type: fa_budgets Based On: FA-08

Vendor Bill Approval

Chain ID: fa-vendor-bill-approval Entity Type: fa_vendor_bills Based On: FA-02

Decision Tables

Expense Approval Routing

Table ID: fa-expense-approval-routing Hit Policy: FIRST (first matching rule wins)

PO Approval Levels

Table ID: fa-po-approval-levels Hit Policy: FIRST

Budget Exception Routing

Table ID: fa-budget-exception-routing Hit Policy: FIRST

Form Templates

FA uses these FW form templates:

Planned Form Templates


Workflow Templates


Form Field Lookups

FA exposes these data sources for FW form field lookups (FW-15):

Platform Layer Usage

Hooks FA Components Import


Testing Requirements

Unit Tests

  • FA event payloads match documented schemas
  • Expense routing decision table returns correct chain for each amount tier
  • PO approval decision table handles sole-source and new-vendor escalation
  • Budget exception routing returns correct actions per variance
  • No PII/PHI in event payloads

Integration Tests

  • fa_expense_report_submitted event triggers approval chain in FW
  • fa_purchase_order_created event routes through PO approval (FA-UX-05 contract)
  • Amount-based conditional steps activate/skip correctly
  • Approval completion updates FA entity status (e.g., PO → approved)
  • Rejection updates FA entity status and notifies submitter
  • Form field lookups return correct vendors, GL accounts, funds

E2E Tests

  • Complete expense report flow: form → decision table → approval → reimbursement
  • Complete PO flow: wizard → approval → goods receipt → payment
  • Budget approval flow: submission → multi-level approval → activation
  • Month-end close: period start → checklist tasks → completion

RLS Tests

  • FA events filtered by organization_id
  • Approval requests scoped to submitter’s organization
  • Form submissions isolated per tenant
  • Vendor and GL account lookups filtered by organization

Implementation Status