-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-order.workflow.json
More file actions
72 lines (65 loc) · 1.79 KB
/
Copy pathexample-order.workflow.json
File metadata and controls
72 lines (65 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
"dsl": "abacus.workflow/1.0",
"name": "example-order-dsl",
"version": "1.0.0",
"description": "The shipped example, authored as a document instead of C#.",
"context": {
"type": "object",
"required": ["orderId", "amount"],
"properties": {
"orderId": { "type": "string", "minLength": 1 },
"amount": { "type": "number", "minimum": 0 },
"currency": { "type": "string", "default": "GBP" }
}
},
"start": "price",
"output": ["settle"],
"nodes": [
{
"id": "price",
"kind": "transform",
"description": "Applies VAT and carries the order forward.",
"set": {
"orderId": "$ctx.orderId",
"net": "$ctx.amount",
"vat": "$ctx.amount * 0.2",
"total": "$ctx.amount * 1.2",
"currency": "coalesce($ctx.currency, 'GBP')"
},
"notify": {
"name": "priced",
"payload": { "order": "$.orderId", "total": "$.total" }
}
},
{
"id": "settle",
"kind": "transform",
"description": "Settles the order. Large ones need a human first.",
"set": {
"orderId": "$.orderId",
"total": "$.total",
"status": "'settled'"
},
"gate": {
"mode": "conditional",
"when": "$.total > 25000",
"reason": "LargeSettlement",
"requireApprovers": 1,
"expiresAfter": "PT8H",
"onExpiry": { "action": "deadStop" }
}
}
],
"edges": [
{ "from": "price", "to": "settle" }
],
"notifications": {
"level": "standard",
"stream": true
},
"onFailure": [
{ "match": { "exception": "ApiCallFailureException", "status": "5xx" }, "disposition": "retry" },
{ "match": { "exception": "WorkflowValidationException" }, "disposition": "deadStop" }
],
"limits": { "maxAttempts": 3 }
}