# ReactivatePartner

## Permission Scope

partner

## Overview

reactivatePartner changes a business partner's `status` from `INACTIVE` to `ACTIVE`, making it eligible to receive new transaction accounts again.

## Business Rules

- Partner must exist in the system
- The BusinessPartner aggregate is loaded with a row lock before its status is changed
- Partner must have `status=INACTIVE`
- After reactivation, new accounts, addresses, and bank details can be added again
- Existing account statuses and resource availability flags are unchanged

## Process Flow

```mermaid
flowchart TD
    A[Receive reactivate request] --> A1[Lock and load BusinessPartner aggregate]
    A1 --> B{Partner exists?}
    B -->|No| C[Return error: not found]
    B -->|Yes| D{status is INACTIVE?}
    D -->|No| E[Return error: invalid state transition]
    D -->|Yes| F[Set status to ACTIVE]
    F --> G[Save aggregate and return partner ID]
```

## External Dependencies

- None

## Error Scenarios

- **PARTNER_NOT_FOUND**: Specified partner ID does not exist
- **INVALID_STATE_TRANSITION**: Requested state transition is not allowed from the current status

## Test Cases

- sets an inactive partner to active
- returns error when partner not found
- returns error when partner is already active
