# Manage Wallet Command

The `manage_wallet` management command allows administrators to add or deduct points from a user's wallet directly via the command line. It supports various transaction types, remarks, and extra data handling.

## Usage

```bash
python manage.py manage_wallet [options] user_id amount operation
```

## Arguments

*   `user_id` (int): User ID (primary key) or Telegram User ID.
*   `amount` (str): Amount to add or deduct. Supports decimal values (e.g., '100.50').
*   `operation` (str): The operation to perform.
    *   `add`, `credit`: Add points to the wallet.
    *   `deduct`, `debit`: Deduct points from the wallet.

## Options

*   `--transaction-type`, `--trans-type`: Specify the transaction type.
    *   Can be an integer constant (e.g., `1006`).
    *   Can be a name in kebab-case (e.g., `wallet-topup`).
    *   Can be a name in UPPER_SNAKE_CASE (e.g., `WALLET_TOPUP`).
    *   Defaults to `WALLET_DEPOSIT` (1000) for additions and `WALLET_WITHDRAW` (1003) for deductions.
*   `--remarks`: Add a description or remarks for the transaction.
*   `--initiator-id`: ID of the user performing the transaction. Defaults to `-100` (System).
*   `--allow-negative`: Allow the wallet balance to drop below zero (only applicable for `deduct` operations).
*   `--point-type`: The type of point to operate on. Defaults to `credit_balance`.
*   `--extra-data`: JSON string containing additional data (e.g., `'{"reason": "manual adjustment"}'`).
*   `--dry-run`: Simulate the transaction without applying any changes.

## Examples

### Add Points
Add 100 points to user with ID 12345:
```bash
python manage.py manage_wallet 12345 100 add --remarks "Bonus reward"
```

### Deduct Points with Custom Transaction Type
Deduct 50 points from user 67890 using the `wallet-payment` transaction type:
```bash
python manage.py manage_wallet 67890 50 deduct --transaction-type wallet-payment
```

### Dry Run
Check what would happen if you added 500 points to user 11111:
```bash
python manage.py manage_wallet 11111 500 add --dry-run
```

### Deduct with Negative Balance Allowed
Deduct 200 points, allowing the balance to go negative if insufficient funds:
```bash
python manage.py manage_wallet 12345 200 deduct --allow-negative
```
