# DeactivateCustomerAccount

## Permission Scope

partner

## Overview

Deactivates an active customer account without changing the global BusinessPartner.

## Business Rules

- Account must exist
- Only active accounts may be deactivated
- Inactive accounts remain available for historical reference but not for new transactions

## Process Flow

```mermaid
flowchart TD
    A[Receive request] --> B{Account exists?}
    B -->|No| C[Return not found]
    B -->|Yes| D{status=ACTIVE?}
    D -->|No| E[Return invalid transition]
    D -->|Yes| F[Save account with status=INACTIVE]
```

## External Dependencies

- None

## Error Scenarios

- **CUSTOMER_ACCOUNT_NOT_FOUND**: Account does not exist
- **INVALID_STATE_TRANSITION**: Requested state transition is not allowed from the current status

## Test Cases

- deactivates an active customer account
- returns error when account not found
- returns error when account is already inactive
