# ActivatePurchasePaymentTerm

## Permission Scope

purchasePricing

## Overview

ActivatePurchasePaymentTerm re-enables a previously deactivated payment term so it can default onto new purchase orders and supplier bills again.

## Business Rules

- Target payment term must exist
- Activating an already active payment term returns success without changing state
- The term's schedule definition must still be internally valid at activation time

## Process Flow

```mermaid
flowchart TD
    A[Receive activate request] --> B{Payment term exists?}
    B -->|No| C[Return PAYMENT_TERM_NOT_FOUND]
    B -->|Yes| D{Already active?}
    D -->|Yes| E[Return success with no-op]
    D -->|No| F[Set status to ACTIVE]
    F --> G[Return activated term]
```

## External Dependencies

- None

## Error Scenarios

- **PAYMENT_TERM_NOT_FOUND**: Referenced purchase payment term does not exist
- **INVALID_TERM_CONFIGURATION**: Term definition is no longer valid for activation

## Test Cases

- activates an inactive payment term
- returns success when the payment term is already active
- returns error when payment term does not exist
- returns error when the payment term schedule is invalid at activation time
