---
# System prepended metadata

title: Deposit promo flow breakdown

---

# Deposit promo flow breakdown

## Add a user to existing promo code

1. Operator add a user to promo code doc via PB admin
-> update_promo API in account engine
-> update promo doc

-> sync user doc so user has the new promo code


```
{
    "id": "TIEREDPROMO3",
    "UserGroup": {
        "MultiUseGroup": [],
        "SingleUseGroup": [
            "222957",
            "123456"
        ]
    },
    "BonusTiers": [
        {
            "MinDeposit": 90,
            "MaxDeposit": null,
            "BonusAmount": 45
        }
    ],
    "BonusPercentage": 0,
    "MinDeposit": 80,
    "BonusLimit": 200,
    "ExpiryOffsetInDays": 7,
    "TbsPromoId": "1",
    "IsActive": true,
    // new fields
    "changedUsers": ["123456"]
}
```

change feed:
 when get the document, look at `changedUsers` field
 based on the document, update the user doc to
 - include new promo code
 - exclude new promo code

```
{
  id: "123456",
  promotions: [{
    code: "TIEREDPROMO3",
    type: "SingleUse",
    isUsed: true | false,
  }]
}
```

2. When user goes to deposit page
get user doc based on ID and filter out signle use and used ones

3. When bonus is allocated
update user doc