# DeactivateSalesPaymentTerm

## Permission Scope

salesPricing

## Overview

DeactivateSalesPaymentTerm removes an active SalesPaymentTerm from future operational use while preserving historical references.

## Business Rules

- Only ACTIVE SalesPaymentTerm records may be deactivated.
- Historical references to the SalesPaymentTerm must remain valid after deactivation.

## Process Flow

```mermaid
flowchart TD
    A[Receive deactivate request] --> B[Load SalesPaymentTerm]
    B --> C{Status is ACTIVE?}
    C -->|No| D[Return INVALID_SALESPAYMENTTERM_STATUS]
    C -->|Yes| E[Set status to INACTIVE]
    E --> F[Return deactivated SalesPaymentTerm]
```

## External Dependencies

- None

## Error Scenarios

- **SALESPAYMENTTERM_NOT_FOUND**: Referenced SalesPaymentTerm does not exist
- **INVALID_SALESPAYMENTTERM_STATUS**: SalesPaymentTerm status does not allow this operation

## Test Cases

- deactivates an active SalesPaymentTerm
- throws when SalesPaymentTerm is not active
