# GetPurchasePaymentTerm

## Overview

GetPurchasePaymentTerm retrieves one purchase payment term and all of its schedule lines by identifier.

## Business Rules

- Lookup key is payment-term id
- Returns payment terms in any status so historical references remain readable
- Response includes all schedule lines needed to compute installments
- Returns null when the payment term does not exist

## Process Flow

```mermaid
flowchart TD
    A[Receive paymentTermId] --> B[Select PurchasePaymentTerm and schedule lines by id]
    B --> C{Term found?}
    C -->|Yes| D[Return payment term with lines]
    C -->|No| E[Return null]
```

## External Dependencies

- None

## Error Scenarios

- **PAYMENT_TERM_NOT_FOUND**: Referenced purchase payment term does not exist

## Test Cases

- returns purchase payment term when found
- returns schedule lines with the term
- returns null when purchase payment term does not exist
