# DeactivatePartnerBankAccount

## Permission Scope

partnerDetail

## Overview

deactivatePartnerBankAccount sets a bank account's `active` flag to `false`. The bank account remains readable for existing usages and historical records but cannot be assigned to a newly created CustomerAccount or SupplierAccount.

## Business Rules

- Bank account must exist
- Bank account must currently be active
- Deactivation never removes the bank account or its existing usage references

## Process Flow

```mermaid
flowchart TD
    A[Receive bank account ID] --> B{Bank account exists and is active?}
    B -->|No| C[Return domain error]
    B -->|Yes| D[Set active to false]
    D --> E[Save BusinessPartner aggregate]
```

## External Dependencies

- None

## Error Scenarios

- **BANK_ACCOUNT_NOT_FOUND**: Specified bank account ID does not exist
- **INVALID_STATE_TRANSITION**: Requested state transition is not allowed from the current status

## Test Cases

- deactivates a bank account without removing it
- returns an error when the bank account does not exist
