Purpose

Agents v2 located in restaurants can send events to White Server. White Server can forward events to aggregators using https Post callback. To receive callbacks, the aggregator must have a web server.

In particular, agents can track changes in r_keeper orders.

Supported agent versionv2

Receiving events by the aggregator

To subscribe to events, the aggregator needs to tell the White Server team:

  • Address of its callback recipient server — multiple URLs can be specified
  • List of events to receive.

White Server sends events using Post requests:

  • Body — in the form of a json request
  • Headers — a Signature field has been added here to check the hash code of the body content, verifying the sender.

Event types:

The aggregator receives all events of the specified type for the specified callback from all restaurants to which the aggregator has access under the license.

Body format


JSON

{
   "responseEventCommon":{
      "objectId":number,
      "agentGuid":"guid",
      "eventGuid":"guid",
      "dateTimeServerReceiveEventFromAgent":"string dateTime",
      "eventType":"OrderChanged"
   },
   "response":{
    
   }
}



Response contains the model, its description in particular for Order can be found in a separate article.

Parameter

Type

Mandatory

Description

agentGuidguidyesRestaurant Agent ID
dateTimeServerReceiveEventFromAgentstring dateTimeyesDate and time of receiving the White Server event from the agent. The time of sending the event to the aggregator by callback may differ and be slightly longer
eventGuidguidyesUnique event identifier generated by the agent
eventTypestring enumyes

Event type, options available:

objectIdintyesRestaurant code in the licensing system

Example of an event

Example Headers:
JSON

{
"content-length":"1140",
"signature":"+sMQMDTMoeE82ONz5ZR03ocQ+TSihyCGCW2Immrlwps=",
"content-type":"application/json; charset=utf-8"
}



Example Body:
JSON

{
   "responseEventCommon":{
      "objectId":19999999,
      "agentGuid":"a63d8b95-8ea0-d83c-8db3-eac3692bcbf2",
      "eventGuid":"31ee5577-5e75-4b5c-bad3-b650e5acb16f",
      "dateTimeServerReceiveEventFromAgent":"2020-12-11T11:36:51.7032158+03:00",
      "eventType":"OrderChanged"
   },
   "response":{
      "originalOrderId":"",
      "tableCode":2,
      "orderGuid":"5e964af3-6e1d-4661-4db1-08d897c7079a",
      "createdAt":"2020-12-10T18:33:19",
      "appliedPayments":[
         {
            "amount":120,
            "guid":"{B2C21309-7E24-4486-B04A-2C012A620C01}",
            "payType":"Unknown"
         }
      ],
      "status":{
         "value":"Complited",
         "isBillPrinted":true
      },
      "midServerPiblicId":"",
      "personsQuantity":0,
      "expeditionType":"Delivery",
      "products":[
         {
            "id":"1000016",
            "name":"Porridge",
            "price":"1200000,00",
            "quantity":1,
            "ingredients":[
                 
            ]
         }
      ],
      "price":{
         "total":120,
         "sumToPay":0
      },
      "waiter":"External editing via XML",
      "tableName":"2",
      "extraTableCodes":[
           
      ]
   }
}