Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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.
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 points of stock. If an operation is not set in the point of stock, 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" : []
}

To exploit milestones during orders treatment, milestones must configured in the worklflow. This allows to set milestones - considered that it has been reached - and set alerts if not reached in time.

Workflow

All information regarding workflow actions can be found at Orders & workflows

  1. set_milestone : Initiate milestones for line item groups

    1. 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 the line_item_groups.

  2. set_milestone_alert : Schedule alerts to be triggered at milestones cutoffs (plus a delay)

    1. 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.

      A special notification named "recompute_cutoffs_sets" can be called to recompute the cutoffs for each milestones.

    placed:
      transitions:
        claimed: # De placed à claimed (VI)
          conditions:
          actions_after:
          - type: set_milestone
          - type: set_milestone_alert
            parameters:
              milestone: packed
              notifications:
              - name: send_mail
                delay: -300
                params:
                  to: "tbaudon@onestock-retail.com"
    claimed:
      transitions:
        packed: # De claimed à packed (VI)
          conditions:
          actions_after:
          - type: set_milestone
            parameters:
              milestone : preparation #name depends on DP config
    packed:
      transitions:
        dispatched: # De packed à dispatched (VI)
          conditions:
          actions_after:
          - type: set_milestone
            parameters:
              milestone : carrier_pickup

Recovering milestones' information (not sure where to place it)

Milestone information can be retrieved by calling the OMSv2 route GET v2/orders/:order_id/delivery_promise/details

type DPDetails []DPDetailsForIndexes // List of DPDetails by index ranges

type IndexRanges struct {
  from int
  to int
}
type DPDetailsForIndexes struct {
  index_ranges     IndexRanges              
  endpoint_id      string                           
  milestones       map[string]IndexRanges 
  notification_key string                           
  cutoffs_sets     CutoffsSets // cutoffs sets from best to worst (depending of the context)
}

type CutoffsSets []CutoffsSet
type Carrier struct {
  name string
  option name
}
type CutoffsSet struct { // each index of milestones_cutoffs and eta_ends correspond to one possible scenario
  carrier             *Carrier
  milestones_cutoffs  map[string][]*int64 // for each milestone, the list of cutoffs
  eta_ends            []*int64            // the list of eta ends
}

  • No labels