# GetGoodsReceipt

## Overview

GetGoodsReceipt retrieves a goods receipt with its receipt lines, receipt date, posting status, and inbound handoff metadata.

## Business Rules

- Lookup key is goods-receipt id
- Returns receipts in any status so draft, cancelled, and posted receipts remain reviewable
- Response includes referenced purchase-order and purchase-order-line links needed for audit and 3-way matching
- Returns null when the goods receipt does not exist

## Process Flow

```mermaid
flowchart TD
    A[Receive goodsReceiptId] --> B[Select GoodsReceipt and receipt lines by id]
    B --> C{Receipt found?}
    C -->|Yes| D[Return goods receipt with lines and handoff metadata]
    C -->|No| E[Return null]
```

## External Dependencies

- None

## Error Scenarios

- **GOODS_RECEIPT_NOT_FOUND**: No goods receipt exists for the given id; caller receives null

## Test Cases

- returns goods receipt when found
- returns receipt lines and handoff metadata with the receipt
- returns null when goods receipt does not exist
