# openAccountReceivables

## Overview

BFF (backend-for-frontend) resolver — a read endpoint shaped for the receipt-create screen rather than a plain module command. Given an optional `customerAccountId`, it returns the open (settleable) due-schedule lines of POSTED customer INVOICEs: for each line, `openAmount = due amount − effective settled`, and only lines whose open amount is still positive are returned. Non-POSTED documents and CREDIT_MEMOs are excluded.

Each item identifies the account with `customerAccountId` and returns its required name as `customerAccountName`.

The effective settled amount is the single source of truth shared with [postIncomingPayment](./postIncomingPayment.md)'s over-settlement check: over settlements whose parent `IncomingPayment` is effective (POSTED or REVERSED), an original row adds its `settledAmount` and a reversing row (`reversalOfSettlementId` set) subtracts it, so a reversed payment's original and reversing rows net to zero. Computing the open balance here — instead of in the frontend — is what keeps the settlement list and the post-time validation from drifting.

## Modules Commands Used

- (none) — read-only aggregation over `AccountReceivableDocument` / `AccountReceivableDueScheduleLine` / `AccountReceivableSettlement` / `IncomingPayment` / `CustomerAccount`; it issues no module command.

## Exception Handling

| Error Code | Description |
| --- | --- |
| INSUFFICIENT_PERMISSION | The caller does not have permission to perform this operation |
