# GetSalesOrder

## Overview

GetSalesOrder retrieves one sales order by identifier, returning header, line, customer, channel, payment-term, and progress details needed by sales, fulfillment, and billing workflows.

## Business Rules

- Lookup by id performs an exact sales-order match.
- Returned payload includes line-level shipped, invoiced, and remaining quantities.
- The query may return any lifecycle status, including CANCELLED or CLOSED.

## Process Flow

```mermaid
flowchart TD
    A[Receive sales-order id] --> B[Query SalesOrder and SalesOrderLine]
    B --> C{Found?}
    C -->|No| D[Return null]
    C -->|Yes| E[Assemble order with progress details]
    E --> F[Return sales order]
```

## External Dependencies

- None

## Error Scenarios

- **NONE**: Returns null when no matching sales order exists.

## Test Cases

- returns sales order when found by id
- returns line-level shipped and invoiced progress
- returns null when sales order is not found
