# README

<!-- This section should contain the following subsections in order: -->
<!-- 1. ## Overview (required) -->
<!-- 2. ## Key Features (required) -->
<!-- 3. ## Module Scope (required) -->
<!-- 4. ## Module Dependencies (required) -->

## Overview

The account-payable module owns payable-side operational accounting documents.
It captures vendor invoices and credit memos as AP documents before
they are posted to financial accounting. The module keeps payable document
lifecycle, commercial AP lines, and AP-owned posting distributions together.
Posted AP documents are immutable; corrections are represented by separate AP
correction documents that can reference the corrected document, line, and
distribution.

`accounting-event` remains the handoff point for downstream accounting. When an
AP document is posted, account-payable emits an accounting event with source
document references back to the AP document.

## Key Features

- Account payable document lifecycle from draft through registration, posting, and cancellation
- Commercial AP document lines with weak source document references
- Line-level price, quantity, and amount corrections through separate correction documents
- AP distribution lines that describe the accounting event emitted at posting
- Posting workflow that emits source-referenced accounting events

## Module Scope

### In Scope

- Vendor and payable-side document headers for invoices and credit memos
- AP document line capture and AP-owned posting distributions
- AP correction documents for posted AP documents, with optional line and distribution correction links
- Registration and posting readiness validation
- Posting into accounting events through source document references
- Full invoice offsets through posted credit memo correction documents

### Out of Scope

- General ledger ownership, accounting periods, and journal lifecycle
- Chart of accounts and account governance, owned by `coa-management`
- Purchase order processing, goods receipt matching, and procurement workflows
- Payment execution rails, bank connectivity, and cash management
- External accounting system delivery such as QBO Bill synchronization

### Scope Decision Rationale

AP documents are payable operational documents, not GL master records. Keeping
them in a separate module avoids overloading financial-accounting with vendor
bill lifecycle while still allowing AP posting to create immutable GL facts in
financial-accounting.

The boundary also leaves room for accounting output integrations. A future QBO
integration can translate AP document intent into a QBO Bill without forcing the
AP document itself to become a generic journal-entry interface.

## Module Dependencies

- `business-partner` - Payable counterparty references
- `coa-management` - Posting account references on AP distribution lines
- `accounting-event` - Accounting event handoff for posted AP documents
- `organization` - Company scope for AP documents
- `primitives` - Currency references for AP documents
