Fluent Commerce Logo
Docs
Sign In

Update Fulfilment Choice status via EVENT API

How-to Guide

Author:

Randy Chan

Changed on:

22 Nov 2024

Key Points

  • An easy step-by-step guide on how to add a new ruleset to update fulfilmentChoice status.
  • This example can be used on the MULTI order type (mixed basket) workflow.

Steps

Step arrow right iconCreate two rulesets in the MULTI ORDER workflow

Add the following rulesets to your multi order workflow:

1{
2    "name": "HoldFulfilmentChoice",
3    "description": "Updates status of fulfilment choice to HOLD",
4    "type": "FULFILMENT_CHOICE",
5    "eventType": "NORMAL",
6    "rules": [
7        {
8            "name": "{{Account_ID}}.core.SetState",
9            "props": {
10                "status": "HOLD"
11            }
12        }
13    ],
14    "triggers": [
15        {
16            "status": "BOOKED"
17        }
18    ],
19    "userActions": [
20    ]
21},
22{
23    "name": "BookFulfilmentChoice",
24    "description": "Updates status of fulfilment choice to BOOKED",
25    "type": "FULFILMENT_CHOICE",
26    "eventType": "NORMAL",
27    "rules": [
28        {
29            "name": "{{Account_ID}}.core.SetState",
30            "props": {
31                "status": "BOOKED"
32            }
33        }
34    ],
35    "triggers": [
36        {
37            "status": "HOLD"
38        }
39    ],
40    "userActions": [
41
42    ]
43},

Language: json

Name: Ruleset HoldFulfilmentChoice and BookFulfilmentChoice

Description:

Ruleset

`HoldFulfilmentChoice`
to change the FulfilmentChoice status from
`BOOKED`
to
`HOLD`
.

Ruleset

`BookFulfilmentChoice`
to change the FulfilmentChoice status from
`HOLD`
to
`BOOKED`
.

Step arrow right iconevent/async

1// change fulfilmentChoice status from BOOKED to HOLD:
2//POST: {{fluentApiHost}}/api/v4.1/event/async
3{
4    "name":"HoldFulfilmentChoice",
5    "entityType":"FULFILMENT_CHOICE",
6    "entityId":"5004998",
7    "entityRef":"fc1_281_988",
8    "retailerId":"5000299"
9}
10
11// change fulfilmentChoice status from HOLD to BOOKED:
12//POST: {{fluentApiHost}}/api/v4.1/event/async
13{
14    "name":"BookFulfilmentChoice",
15    "entityType":"FULFILMENT_CHOICE",
16    "entityId":"5004998",
17    "entityRef":"fc1_281_988",
18    "retailerId":"5000299"
19}

Language: json

Name: Sample event async with payload

Description:

This API call will trigger the associated ruleset within the workflow.