Close a day cycle
Closes the calling salesperson's open day cycle with the closing cash, end odometer reading, location and remarks. Fails if the day is already closed or the end odometer is lower than the start; the vehicle's odometer is updated and a cash-drawer close is logged.
How to use it
- Get the open dayCycleId with Get the active day cycle, signed in as the salesperson who started it.
- Send the counted closingCash, endOdometerKm (not below the start reading), GPS position and optional remarks.
- The day becomes CLOSED and cannot be closed again; the vehicle odometer is updated, a cash drawer close is logged and ops managers are notified.
- Stock left on the van is moved back to the default warehouse automatically; if that fails, a VAN_RETURN_TRANSFER_FAILED inventory exception is raised.
BearerAuthAuthorizationBearer <JWT>dayCycleId*stringID of the caller's open day cycle, from Get the active day cycle. Only the salesperson who started it can close it.
uuidapplication/json- body
closingCash*numberCash counted at the end of the day, in the merchant's currency. Required.
endOdometerKm*integerOdometer reading at day close, in kilometres. Required, positive, and not lower than the start reading.
int32gpsLat*numberLatitude where the day was closed, in decimal degrees. Required.
doublegpsLon*numberLongitude where the day was closed, in decimal degrees. Required.
doublegpsAccuracyMeters?|Accuracy of the GPS fix in metres. Optional.
int32remarks?|Optional closing notes from the salesperson.
OK
*/*- response
status*stringOutcome of the call: SUCCESS when the request worked, ERROR when it did not.
message*stringShort human-readable message describing the result, for logs or display; do not parse it.
data?The day cycle as it now stands, or null from Get the active day cycle when no day is open.
curl -X POST 'https://beta.iotoms.com/api/v1/ops/day-cycles/497f6eca-6276-4993-bfeb-53cbbbba6f08/close' \ -H 'Content-Type: application/json' \ -d '{ "closingCash": 0, "endOdometerKm": 0, "gpsLat": 0.1, "gpsLon": 0.1}'{ "status": "string", "message": "string", "data": { "dayCycleId": "bbed7a30-80be-4ccf-810d-a33c370a67d1", "businessDate": "2019-08-24", "status": "OPEN", "startedAt": "2019-08-24T14:15:22Z", "closedAt": "2019-08-24T14:15:22Z", "vehicleLabel": "string", "vehicleId": "c406adf4-e700-4483-ad7a-e7447a2941cb", "vehicleType": "VAN", "openingCash": 0, "closingCash": 0, "startOdometerKm": 0, "endOdometerKm": 0, "coveragePercent": 0, "totalStores": 0, "visitedStores": 0 }}