Upgrading to the v2 of the rounds

This page will walk you through upgrading your system from the legacy round_added event to new events round_added_v2, round_edited and round_deleted.

With the new version of the multi-round flow on the mobile, the trucker is able to differentiate the loading from the unloading. You can retrieve this new information in the payload of the event:

// Payload of the `round_added_v2` event
	"round_id": 1,
	// 'origin_load' contains the loading information, null if the trucker
	// did not enter anything
	"origin_load": { 
		"category": "bulk",
		"weight": 12300,
		... // rest of the fields of a load
	// 'destination_load' contains the unloading information, null if the
	// trucker did not enter anything
	"destination_load": null

Moreover, the trucker may edit, or delete rounds before the final signature. The events round_edited and round_deleted are emitted accordingly. The round_edited event contains the new information, that means the previous events with the same round_id are obsolete and have not been updated. And the round_deleted contains the load that was deleted.

The payload of both of these events remains the same as round_added_v2, that is:

  • round_id: unique number to identify a round, appears sequential but if a round has been deleted it may create "holes" in the delivery load list.

  • origin_load: object that contains the load information filled by the trucker at the loading. If no information has been filled, the field is null.

  • destination_load: Same as the above origin_load but it contains the information at the unloading.

For empty rounds, both loads are empty.

Backward compatibility

To ease your transition and because the new flow is opt-in, a round_added_v2 is emitted in the old flow. That means, you will receive both events round_added and round_added_v2.

And in the new flow, the legacy events round_added will be emitted at the final signature for each round validated by the trucker.

In the new flow, at the final signature, a legacy round_added will be emitted for each completed round. For example if the trucker created 2 rounds and deleted one of them, a single round_added event will be emitted at the signature. In this scenario, the list of events will be:

  • round_added_v2: First round created

  • round_added_v2: Second round created

  • round_deleted: One of the round has been deleted (use round_id in the payload to know which one)

  • rounds_complete: Signature completed

  • round_added: Legacy event emitted with the load filled by the trucker from the non-deleted round

Last updated