Milestones configuration
For milestones to be calculated for an order, orchestration must take the delivery promise into account, to do so, orders must be orchestrated using a ruleset chaining instead of a ruleset.
- 1 Vocabulary
- 2 Milestones depend on delivery promise configuration
- 3 When are milestones recalculated ?
- 4 Using milestones
- 5 Configuration example
- 5.1 Workflow
- 5.2 Store App
- 5.3 Stock Locations
Vocabulary
Milestone: it represents a specific step in the order execution and the corresponding time when it should be executed. For example: fraud check validation on the 05/05 at 10:00, start of preparation on the 05/05 at 12:00, carrier pick-up on the 05/05 at 16:00…
Cutoff: it is a consistent group of the different milestones to execute an order. For example: (fraud check validation: 05/05 10:00 ; preparation start: 05/05 12:00 ; carrier pick-up: 05/05 16:00)
Cutoffs set: all the cutoffs that allow a delivery on time (eventually taking into account the tolerance) for a given delivery route (for a given carrier-service).
In the example below, for a promised delivery date on the 08/05, there are 2 cutoffs sets:
1 for UPS-standard with 2 cutoffs possible
1 for DHL-express with 3 cutoffs possible
Carrier-service | Fraud check validation | Start preparation | Carrier pick-up | Delivery |
---|---|---|---|---|
UPS-standard | 05/05 10:00 | 05/05 12:00 | 05/05 16:00 | 07/05 10:00-18:00 |
| 06/05 10:00 | 06/05 12:00 | 06/05 16:00 | 08/05 10:00-18:00 |
DHL-express | 05/05 12:00 | 05/05 14:00 | 05/05 18:00 | 06/05 08:00-13:00 |
| 06/05 12:00 | 06/05 14:00 | 06/05 18:00 | 07/05 08:00-13:00 |
| 07/05 12:00 | 07/05 14:00 | 07/05 18:00 | 08/05 08:00-13:00 |
Milestones depend on delivery promise configuration
Milestones are calculated based on delivery configuration operations.
Operations taken into account are always_at_start
, before_shipping
and from_destination
. Operations of type after_shipping
are not taken into account, as when received, the current delivery promise eta end is the milestone of interest.
Milestones are precalculated and stored in Endpoint Delivery Promises under the object cutoffs.
Milestone names are auto-generated and match delivery configuration’s operation names.
Delivery configuration’s operations duration depends on operations set in the stock locations. If an operation is not set in the stock location, a duration of 0 seconds will be considered for it.
Endpoint Delivery Promise (EDP) Cutoff Example
{
"_id" : ObjectId("618225724bbd51a42c47ce10"),
"cutoffs" : {
"prep_time_sfs" : 1636030800,
"carrier_pickup" : 1636030800,
"without_always_at_start" : 1636027200,
"purchase_cutoff" : 1636027200
},
"delivery_method" : "STD",
"delivery_route_id" : "GB_GB_DPD_Standard",
"eta_end" : 1636232400,
"eta_start" : 1636117201,
"expired" : false,
"pickup_day" : 1635984000,
"sales_channel_id" : "web",
"version" : 0,
"endpoint_ids" : [
"190",
"157"
],
"public_id" : "5279a9cc-3c6b-11ec-bf59-02420a0001f3",
"unavailable_endpoint_ids" : []
} |
When are milestones recalculated ?
All this scenarios impact the current delivery promise of the order.
Reservation change.
eta_end
in the reservation changes or the reservation changes from one stock key to another.When a line item group gets claimed if
set_milestone
is set in the graph worfklow.
The currenteta_end
will be the one determined by the orchestration. The tolerance set in the ruleset chaining impacts the currenteta_end
.When an item is put or removed from a parcel. The current
eta_end
that's calculated is the one for the parcel as a whole.When the
recompute_cutoffs_sets
notification is sent by aset_milestone_alert
action.
Using milestones
To exploit milestones during order's treatment, milestones must be used in the workflow. This allows to set milestones - considered that it has been reached - and set alerts if not reached in time.
Minimum configuration requirements
To exploit milestones, the site must comply with the following :
Delivery promise in configured and a valid response can be recovered for delivery methods sent during order creation.
You should be able to recover a valid delivery promise response in the Delivery promise test page when sending a request containing : a basket that with all items in the order, an order price equal to the one sent for the order (order.pricing_details.price
), sales channel equal to the one sent for the order and delivery method equal to the one sent in the order.Orders are orchestrated using a ruleset chaining which enforces respect of delivery promise.
The orders workflow sets milestones for line item groups.
If your site complies with the above, milestones should be present for the order when recovering order delivery promises details this can be recovered by API through GET /orders/:id/delivery_promise/details
If you want to exploit milestones in the Store App the site must also :
Have a valid configuration in the Store App for displaying milestones in pages where they need to be displayed.
Activate milestones display at the stock location at which milestones should be displayed.
Workflow
All information regarding workflow actions can be found at Orders & workflows
set_milestone : set the achieved milestone. If empty,
without_always_at_start
milestone is set (generally de case when initiating milestones in the graph).
For theset_milestone
action to work, the line item group must have stock location ID assigned. As a result, when placing aset_milestone
in the workflow it must be placed after assign origin actions.To make use of milestones, they must be stored for the order at each of its line_item_groups claimed transition. To do so, the action
set_milestone
has to be set in the claim transition of theline_item_groups
, if any..When recomputing, solutions with non-achieved milestones dates in the future (greater than now) will be considered as valid options. Those with dates in the past, will not be considered.
set_milestone_alert : Schedule alerts to be triggered at milestones cutoffs (plus a delay)
Notifications can be scheduled to be triggerd at the time of milestones cutoffs (plus a certain delay). When triggered, a validity check will be performed to ensure the specified milestone has not yet been reached/acheived. If already reached, notifications won't be triggered.
The time at which the notification will be triggered is the milestone cutoff of the first milestone stored in
order_delivery_promises
. Cutoffs are sorted based on the sort criteria configured for the site.
A special notification named
recompute_cutoffs_sets
can be called to recompute the cutoffs for each milestone.
Notifications
Notifications can be triggered thanks to set_milestone_alert
order workflow action.
Its also possible to intercept internal delivery promise notifications sent when a milestone is reached. Milestones notifications are sent through an internal rabbit queue (order_dp:lig_milestone_reached
). To listen to messages, the site needs to have a notification configured as follows :
lig_milestone_reached:
media:
rabbit:
- order_dp:lig_milestone_reached
time_type: duration
time_value: 0s
Notification message example
Sorting cutoff sets
Multiple cutoff sets are calculated and consist of all the possible delivery options that can serve the order on time (promised delivery date + tolerance allowed by the orchestration ruleset chaining). See Vocabulary
Sorting criteria are defined to select the best options. The sorting is done in two steps:
among the cutoffs: sort all the cutoffs a given delivery route (so, for the same cost)
among the cutoffs sets: sort the best cutoffs of each delivery route.
This configuration is set on the configuration of the site (file or API):
+
means ascending sorting (0, 1, 2, 3) — the smallest number or the earliest date will be selected
-
means descending sorting (3, 2, 1, 0) — the biggest number or the latest date will be selected
use_sort_orders
set to true
In this case, the cutoffs of a given delivery route will be sorted using the default_sort_criteria
for cutoffs
. After that, only the first cutoff of each delivery route will be considered. Then, the cutoff sets will be sorted following the sort option defined on the delivery configurations, in the Delivery screen in the backoffice.
use_sort_orders
set to false
In this case, the cutoffs of a given delivery route will be sorted using the sort_criteria
for cutoffs
. After that, only the first cutoff of each delivery route will be considered. Then, the cutoff sets will be sorted following the sort option defined on sort_criteria
for cutoffs_sets
.
Display the milestones on the store app
Select the pages and milestones to display
In the store app config, you need to add a delivery_promise key, with the list of pages where to display the milestones.
Pages supported: pack
, bag
, reserve
, pack_scan
, bag_scan
The warning indicates the period of time, in seconds, before the milestone, during which the remaining time will be showed as a warning, in orange. Before, the milestone is shown with no warning, and after it is shown in alert, in red.
Pack page specific extra configuration
Turn on the display of milestone on the stock location
Your stock location must have a configuration to indicate that the milestones can be displayed.
You must configure this on the stock location (endpoint), by API (it is currently not available in the backoffice):
Configuration example
Workflow
Store App
Stock Locations