## Decide several provider customers to clarify at once (tenant:trade:msp:write)

`POST /api/trade/v1/msp/customers/decide`

Module: Trade · operationId: `decideMspCustomers` · Tag: MSP billing · Auth: access token (`Authorization: Bearer <accessToken>`)

Applies one decision to every named provider customer: `accept` takes masterdata's suggestion over, `assign`
maps every customer to the one existing address given (`addressId`, required for it). Each customer is saved
on its own and becomes a manual mapping; the answer names the customers the decision could not apply to with
a `code`: `no_suggestion` or `failed`. No masterdata address is created.

### Request body

`application/json` (required)

- `action` (string, required): (one of `accept`, `assign`)
- `customers` (array of object, required)
  - `provider` (string, required): (max length 32)
  - `sourceCustomer` (string, required): (max length 200)
- `addressId` (string (uuid)): The address of `assign`.
- `addressName` (string): (max length 300)
- `adrNr` (string): (max length 64)
- `customerNumber` (string): (max length 64)

Example:

```json
{
  "action": "accept",
  "customers": [
    {
      "provider": "sophos",
      "sourceCustomer": "6f1e2d3c-4b5a-4968-8776-a5b4c3d2e1f0"
    },
    {
      "provider": "mailstore",
      "sourceCustomer": "k10004"
    }
  ]
}
```

### Responses

- **200** How many customers were decided, and the refused ones. (`application/json`)
- **400** Error (`application/json`)
- **401** No valid session or bearer token (no body).
- **403** Missing permission, no active tenant in the token, or a missing CSRF token on a cookie write. (`application/json`)

Fields of the 200 answer:

- `done` (integer)
- `refused` (array of object)
  - `code` (string): (one of `no_suggestion`, `failed`)
  - `error` (string)
  - `provider` (string)
  - `sourceCustomer` (string)

Example 200 answer:

```json
{
  "done": 1,
  "refused": [
    {
      "code": "no_suggestion",
      "error": "Für diesen Kunden gibt es keinen Vorschlag.",
      "provider": "mailstore",
      "sourceCustomer": "k10004"
    }
  ]
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/trade/v1/msp/customers/decide' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"action":"accept","customers":[{"provider":"sophos","sourceCustomer":"6f1e2d3c-4b5a-4968-8776-a5b4c3d2e1f0"},{"provider":"mailstore","sourceCustomer":"k10004"}]}'
```
