# ListSalesCreditNotesByInvoice

## Overview

ListSalesCreditNotesByInvoice lists all credit notes issued against one invoice for dispute handling and downstream AR reconciliation.

## Business Rules

- Sales-invoice identifier is required.
- Returned credit notes may include draft and issued states unless a status filter narrows the result.

## Process Flow

```mermaid
flowchart TD
    A[Receive invoice id] --> B[Query credit notes by invoice]
    B --> C[Apply optional status filter]
    C --> D[Return credit-note history]
```

## External Dependencies

- None

## Error Scenarios

- **SALES_INVOICE_ID_REQUIRED**: Sales-invoice id is required.

## Test Cases

- lists credit notes under an invoice
- filters credit notes by status when provided
- throws when invoice id is missing
