iotoms Docs

Recalculate a draft settlement run

POST
/api/v1/commission/settlements/{id}/recalculate

Rebuilds every line of a draft settlement from the sales, receipts and returns as they stand now. Only works on draft runs; approved runs are frozen.

How to use it

  1. Get the run ID from List commission settlement runs; the run must still be DRAFT.
  2. Call it after late sales, receipts, returns or plan changes; every line is rebuilt from current data.
  3. The response is the refreshed run; approved runs are rejected and never change.

Authorization

BearerAuth
headerAuthorizationBearer <JWT>

Path Parameters

id*string

ID of the record (UUID).

Formatuuid

Header Parameters

X-TenantID*string

Your merchant's tenant code — the value typed in the Domain field on the iotoms login screen. See Concepts.

Response Body

OK

*/*
  1. response
status*string

Outcome of the request: SUCCESS when it worked; errors return an error status with the reason in message.

message*string

Short human-readable message describing the outcome.

data?

The settlement run with every person's commission line.

Example Request
curl -X POST 'https://beta.iotoms.com/api/v1/commission/settlements/497f6eca-6276-4993-bfeb-53cbbbba6f08/recalculate' \  -H 'X-TenantID: your-tenant-code'
Example Response
{  "status": "string",  "message": "string",  "data": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "periodFrom": "2019-08-24",    "periodTo": "2019-08-24",    "status": "DRAFT",    "totalCommission": 0,    "totalPaid": 0,    "notes": "string",    "lines": [      {        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "userRef": "string",        "planId": "b3f60ba2-c1fd-4b3a-a23d-8e876e0ef75d",        "planName": "string",        "rateStructure": "FLAT",        "rateBp": 0,        "collectedBase": 0,        "returnsBase": 0,        "netBase": 0,        "commissionAmount": 0,        "paidAmount": 0,        "status": "DRAFT",        "uncollectedCredit": 0,        "sources": [          {            "sourceType": "SALE_COLLECTION",            "documentId": "4704590c-004e-410d-adf7-acb7ca0a7052",            "documentDate": "2019-08-24",            "documentRef": "string",            "grossAmount": 0,            "baseAmount": 0          }        ]      }    ],    "createdAt": "2019-08-24T14:15:22Z",    "createdBy": "string",    "approvedAt": "2019-08-24T14:15:22Z",    "approvedBy": "string"  }}