Skip to content

Instantly share code, notes, and snippets.

@mrLSD
Forked from lempiy/jsons.md
Last active October 23, 2017 17:25
Show Gist options
  • Select an option

  • Save mrLSD/1912dda84e0f98b96087483fadf4ae70 to your computer and use it in GitHub Desktop.

Select an option

Save mrLSD/1912dda84e0f98b96087483fadf4ae70 to your computer and use it in GitHub Desktop.

EVENTS FROM BID TO BROKER

Event type outcomming event(from bid to broker to all carriers in array)

Event name: offerBid

bid request:

{
  "eventName": "offerBid",
  "eventId": 14,
  "value": {
    "carriers": [
      {
        "id": "5774f0ee-2c4f-42ec-9f35-bda449f558f5",
        "rating": 5.46,
        "status": "online"
      },
      {
        "id": "7f6abd9f-4198-4402-a9b7-0820c9a7cde2",
        "rating": 8.65,
        "status": "online"
      },
      {
        "id": "d05f8729-32b1-4069-bd7e-6f01dcee006f",
        "rating": 3.21,
        "status": "online"
      },
    ],
    "bid": {
	"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
        "chainId": "CS123",
        "sourceTrace": ["storePizzaUS123", "broker1", "rating1", "bidService1"],
	"legs": [
		{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
		{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
	], 
	"routeSeconds": 223,
	"readyForPickupSeconds": 300, 
	"priority": "10"
    }
  },
}

Expected reply:

{
  "status": "ok",
}

Event type outcomming event(from bid to broker to store from source trace)

Event name: approveBid

bid request:

{
  "eventName": "approveBid",
  "eventId": 12,
  "value": {
    "carrier": {
        "id": "5774f0ee-2c4f-42ec-9f35-bda449f558f5",
        "rating": 5.46,
        "status": "online"
    },
    "bid": {
	"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
        "chainId": "CS123",
        "sourceTrace": ["storePizzaUS123", "broker1", "rating1", "bidService1"],
	"legs": [
		{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
		{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
	], 
	"routeSeconds": 223,
	"readyForPickupSeconds": 300, 
	"priority": "10"
    }
  },
}

Expected reply:

{
  "status": "ok",
}

Event type outcomming event(from bid to broker carrier in value)

Event name: passBidToCarrier

bid request:

{
  "eventName": "passBidToCarrier",
  "eventId": 31,
  "value": {
    "carrier": {
        "id": "5774f0ee-2c4f-42ec-9f35-bda449f558f5",
        "rating": 5.46,
        "status": "online"
    },
    "bid": {
	"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
        "chainId": "CS123",
        "sourceTrace": ["storePizzaUS123", "broker1", "rating1", "bidService1"],
	"legs": [
		{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
		{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
	], 
	"routeSeconds": 223,
	"readyForPickupSeconds": 300, 
	"priority": "10"
    }
  },
}

Expected reply:

{
  "status": "ok",
}

Expected reply:

{
  "status": "ok",
}

Event type outcomming event(from bid to broker to ???)

Event name: checkCarrierOnline

bid request:

{
  "eventName": "checkCarrierOnline",
  "eventId": 31,
  "value": {
    "carrier": {
        "id": "5774f0ee-2c4f-42ec-9f35-bda449f558f5",
        "rating": 5.46,
        "status": "online"
    },
    "bid": {
	"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
        "chainId": "CS123",
        "sourceTrace": ["storePizzaUS123", "broker1", "rating1", "bidService1"],
	"legs": [
		{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
		{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
	], 
	"routeSeconds": 223,
	"readyForPickupSeconds": 300, 
	"priority": "10"
    }
  },
}

Expected reply:

{
  "status": "ok",
  "info": "online"
}

or

{
  "status": "ok",
  "info": "offline"
}

Event type outcomming event(from bid to broker to carriers in array)

Event name: offerFinished

bid request:

{
  "eventName": "offerFinished",
  "eventId": 42,
  "value": {
    "carriers": [
      {
        "id": "5774f0ee-2c4f-42ec-9f35-bda449f558f5",
        "rating": 5.46,
        "status": "online"
      },
      {
        "id": "7f6abd9f-4198-4402-a9b7-0820c9a7cde2",
        "rating": 8.65,
        "status": "online"
      },
      {
        "id": "d05f8729-32b1-4069-bd7e-6f01dcee006f",
        "rating": 3.21,
        "status": "online"
      },
    ],
    "description": "Offer stage for bid is finished",
    "bid": {
	"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
        "chainId": "CS123",
        "sourceTrace": ["storePizzaUS123", "broker1", "rating1", "bidService1"],
	"legs": [
		{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
		{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
	], 
	"routeSeconds": 223,
	"readyForPickupSeconds": 300, 
	"priority": "10"
    }
  },
}

Expected reply:

{
  "status": "ok",
}

Event type outcomming event(from bid to broker to store from source trace)

Event name: driverDeclined

bid request:

{
  "eventName": "driverDeclined",
  "eventId": 42,
  "value": {
    "carrier": {
        "id": "5774f0ee-2c4f-42ec-9f35-bda449f558f5",
        "rating": 5.46,
        "status": "online"
    },
    "description": "Bid declined by driver. Looking for other one",
    "bid": {
	"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
        "chainId": "CS123",
        "sourceTrace": ["storePizzaUS123", "broker1", "rating1", "bidService1"],
	"legs": [
		{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
		{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
	], 
	"routeSeconds": 223,
	"readyForPickupSeconds": 300, 
	"priority": "10"
    }
  },
}

Expected reply:

{
  "status": "ok",
}

Event type outcomming event(from bid to broker to carrier fron value)

Event name: storeDeclined

bid request:

{
  "eventName": "storeDeclined",
  "eventId": 42,
  "value": {
    "carrier": {
        "id": "5774f0ee-2c4f-42ec-9f35-bda449f558f5",
        "rating": 5.46,
        "status": "online"
    },
    "description": "Bid declined by store",
    "bid": {
	"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
        "chainId": "CS123",
        "sourceTrace": ["storePizzaUS123", "broker1", "rating1", "bidService1"],
	"legs": [
		{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
		{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
	], 
	"routeSeconds": 223,
	"readyForPickupSeconds": 300, 
	"priority": "10"
    }
  },
}

Expected reply:

{
  "status": "ok",
}

Event type outcomming event(from bid to broker to store from trace)

Event name: driverDeclined

bid request:

{
  "eventName": "driverDeclined",
  "eventId": 42,
  "value": {
    "carrier": {
        "id": "5774f0ee-2c4f-42ec-9f35-bda449f558f5",
        "rating": 5.46,
        "status": "online"
    },
    "description": "Bid declined by driver. Looking for other one",
    "bid": {
	"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
        "chainId": "CS123",
        "sourceTrace": ["storePizzaUS123", "broker1", "rating1", "bidService1"],
	"legs": [
		{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
		{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
	], 
	"routeSeconds": 223,
	"readyForPickupSeconds": 300, 
	"priority": "10"
    }
  },
}

Expected reply:

{
  "status": "ok",
}

Event type outcomming event(from bid to broker to store and driver?)

Event name: done

bid request:

{
  "eventName": "done",
  "eventId": 42,
  "value": {
    "carrier": {
        "id": "5774f0ee-2c4f-42ec-9f35-bda449f558f5",
        "rating": 5.46,
        "status": "online"
    },
    "description": "Bid resolved",
    "bid": {
	"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
        "chainId": "CS123",
        "sourceTrace": ["storePizzaUS123", "broker1", "rating1", "bidService1"],
	"legs": [
		{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
		{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
	], 
	"routeSeconds": 223,
	"readyForPickupSeconds": 300, 
	"priority": "10"
    }
  },
}

Expected reply:

{
  "status": "ok",
}

Event type outcomming event(from bid to broker to carriers in array and store)

Event name: canceled

bid request:

{
  "eventName": "canceled",
  "eventId": 42,
  "value": {
    "carriers": [
      {
        "id": "5774f0ee-2c4f-42ec-9f35-bda449f558f5",
        "rating": 5.46,
        "status": "online"
      },
      {
        "id": "7f6abd9f-4198-4402-a9b7-0820c9a7cde2",
        "rating": 8.65,
        "status": "online"
      },
      {
        "id": "d05f8729-32b1-4069-bd7e-6f01dcee006f",
        "rating": 3.21,
        "status": "online"
      },
    ],
    "description": "Bid canceled by store",
    "bid": {
	"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
        "chainId": "CS123",
        "sourceTrace": ["storePizzaUS123", "broker1", "rating1", "bidService1"],
	"legs": [
		{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
		{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
	], 
	"routeSeconds": 223,
	"readyForPickupSeconds": 300, 
	"priority": "10"
    }
  },
}

Expected reply:

{
  "status": "ok",
}

Event type outcomming event(from bid to broker to carriers and store)

Event name: systemError

bid request:

{
  "eventName": "systemError",
  "eventId": 42,
  "value": {
    "carriers": [
      {
        "id": "5774f0ee-2c4f-42ec-9f35-bda449f558f5",
        "rating": 5.46,
        "status": "online"
      },
      {
        "id": "7f6abd9f-4198-4402-a9b7-0820c9a7cde2",
        "rating": 8.65,
        "status": "online"
      },
      {
        "id": "d05f8729-32b1-4069-bd7e-6f01dcee006f",
        "rating": 3.21,
        "status": "online"
      },
    ],
    "description": "Bid canceled due to system error",
    "bid": {
	"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
        "chainId": "CS123",
        "sourceTrace": ["storePizzaUS123", "broker1", "rating1", "bidService1"],
	"legs": [
		{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
		{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
	], 
	"routeSeconds": 223,
	"readyForPickupSeconds": 300, 
	"priority": "10"
    }
  },
}

Expected reply:

{
  "status": "ok",
}

Event type outcomming event(from bid to broker to carriers in array)

Event name: bidLost

bid request:

{
  "eventName": "bidLost",
  "eventId": 42,
  "value": {
    "carriers": [
      {
        "id": "5774f0ee-2c4f-42ec-9f35-bda449f558f5",
        "rating": 5.46,
        "status": "online"
      },
      {
        "id": "7f6abd9f-4198-4402-a9b7-0820c9a7cde2",
        "rating": 8.65,
        "status": "online"
      },
      {
        "id": "d05f8729-32b1-4069-bd7e-6f01dcee006f",
        "rating": 3.21,
        "status": "online"
      },
    ],
    "description": "Bid lost, looking for new one",
    "bid": {
	"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
        "chainId": "CS123",
        "sourceTrace": ["storePizzaUS123", "broker1", "rating1", "bidService1"],
	"legs": [
		{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
		{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
	], 
	"routeSeconds": 223,
	"readyForPickupSeconds": 300, 
	"priority": "10"
    }
  },
}

Expected reply:

{
  "status": "ok",
}

EVENTS FROM BROKER TO BID

Event type incomming event(from carrier to broker to bid)

Event name: offerReply

Expected request data:

{
  "eventName": "offerReply",
  "eventId": 22,
  "value": {
  	"carrier": {
		"id": "d05f8729-32b1-4069-bd7e-6f01dcee006f",
		"rating": 3.21,
		"status": "online"
	},
	"bid_uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
	"accepted": true
  }
}

Reply:

{
  "eventName": "offerReply",
  "eventId": 123,
  "value": {
    "status": "ok",
    "info": "Offer reply received successfully!"
}

Event type incomming event(from store to broker to bid)

Event name: createBid

Expected request data:

{
  "eventName": "createBid",
  "eventId": 22,
  "value": {
		"uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31",
		"chainId": "CS123",
		"sourceTrace": ["storePizzaUS123", "broker1"],
		"legs": [
			{ "id": "id1", "type": "type1", "lat": 35.0, "lng": 35.0},
			{ "id": "id2", "type": "type2", "lat": 55.0, "lng": 55.0}
		], 
		"routeSeconds": 223,
		"readyForPickupSeconds": 300, 
		"priority": "10"
	}
}

Reply:

{
  "eventName": "createBid",
  "eventId": 53,
  "value": {
    "status": "ok",
    "info": "Bid received successfully!"
}

Event type incomming event(from store or carrier to broker to bid)

Event name: reply

Expected request data:

{
  "eventName": "reply",
  "eventId": 22,
  "value": {
		"status": "ok", //(or failed)
		"bid_uuid": "t84c63dfe-f416-48de-86b1-0e41e186ee31"
	}
}

Reply:

{
  "eventName": "createBid",
  "eventId": 53,
  "value": {
    "status": "ok",
    "info": "Bid received successfully!"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment