@open-mercato/core 0.6.2-develop.3400.2.d948268f50 → 0.6.2-develop.3406.1.2b403f40da
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/generated/entities/workflow_definition/index.js +2 -0
- package/dist/generated/entities/workflow_definition/index.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +1 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/sales/workflows.js +180 -0
- package/dist/modules/sales/workflows.js.map +7 -0
- package/dist/modules/workflows/api/definitions/[id]/customize/route.js +172 -0
- package/dist/modules/workflows/api/definitions/[id]/customize/route.js.map +7 -0
- package/dist/modules/workflows/api/definitions/[id]/reset-to-code/route.js +205 -0
- package/dist/modules/workflows/api/definitions/[id]/reset-to-code/route.js.map +7 -0
- package/dist/modules/workflows/api/definitions/[id]/route.js +91 -2
- package/dist/modules/workflows/api/definitions/[id]/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/route.js +32 -9
- package/dist/modules/workflows/api/definitions/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/serialize.js +36 -1
- package/dist/modules/workflows/api/definitions/serialize.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/[id]/page.js +161 -52
- package/dist/modules/workflows/backend/definitions/[id]/page.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/page.js +37 -34
- package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js +134 -41
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js.map +2 -2
- package/dist/modules/workflows/cli.js +19 -121
- package/dist/modules/workflows/cli.js.map +2 -2
- package/dist/modules/workflows/components/formConfig.js +1 -1
- package/dist/modules/workflows/components/formConfig.js.map +2 -2
- package/dist/modules/workflows/data/entities.js +3 -0
- package/dist/modules/workflows/data/entities.js.map +2 -2
- package/dist/modules/workflows/data/validators.js +2 -2
- package/dist/modules/workflows/data/validators.js.map +2 -2
- package/dist/modules/workflows/events.js +2 -0
- package/dist/modules/workflows/events.js.map +2 -2
- package/dist/modules/workflows/examples/guard-rules-example.json +6 -6
- package/dist/modules/workflows/examples/order-approval-guard-rules.json +2 -2
- package/dist/modules/workflows/frontend/checkout-demo/page.js +4 -4
- package/dist/modules/workflows/frontend/checkout-demo/page.js.map +2 -2
- package/dist/modules/workflows/lib/code-registry.js +40 -0
- package/dist/modules/workflows/lib/code-registry.js.map +7 -0
- package/dist/modules/workflows/lib/find-definition.js +58 -0
- package/dist/modules/workflows/lib/find-definition.js.map +7 -0
- package/dist/modules/workflows/lib/seeds.js +0 -3
- package/dist/modules/workflows/lib/seeds.js.map +2 -2
- package/dist/modules/workflows/lib/start-validator.js +1 -20
- package/dist/modules/workflows/lib/start-validator.js.map +2 -2
- package/dist/modules/workflows/lib/workflow-executor.js +1 -19
- package/dist/modules/workflows/lib/workflow-executor.js.map +2 -2
- package/dist/modules/workflows/migrations/Migration20260414120000.js +13 -0
- package/dist/modules/workflows/migrations/Migration20260414120000.js.map +7 -0
- package/dist/modules/workflows/migrations/Migration20260428102318.js +32 -0
- package/dist/modules/workflows/migrations/Migration20260428102318.js.map +7 -0
- package/dist/modules/workflows/widgets/injection/order-approval/widget.client.js +1 -1
- package/dist/modules/workflows/widgets/injection/order-approval/widget.client.js.map +1 -1
- package/dist/modules/workflows/workflows.js +260 -0
- package/dist/modules/workflows/workflows.js.map +7 -0
- package/generated/entities/workflow_definition/index.ts +1 -0
- package/generated/entity-fields-registry.ts +1 -0
- package/package.json +7 -7
- package/src/modules/sales/workflows.ts +184 -0
- package/src/modules/workflows/api/definitions/[id]/customize/route.ts +197 -0
- package/src/modules/workflows/api/definitions/[id]/reset-to-code/route.ts +252 -0
- package/src/modules/workflows/api/definitions/[id]/route.ts +108 -4
- package/src/modules/workflows/api/definitions/route.ts +54 -10
- package/src/modules/workflows/api/definitions/serialize.ts +42 -0
- package/src/modules/workflows/backend/definitions/[id]/page.tsx +135 -11
- package/src/modules/workflows/backend/definitions/page.tsx +45 -33
- package/src/modules/workflows/backend/definitions/visual-editor/page.tsx +222 -97
- package/src/modules/workflows/cli.ts +32 -155
- package/src/modules/workflows/components/formConfig.tsx +2 -2
- package/src/modules/workflows/data/entities.ts +4 -1
- package/src/modules/workflows/data/validators.ts +4 -3
- package/src/modules/workflows/events.ts +2 -0
- package/src/modules/workflows/examples/guard-rules-example.json +6 -6
- package/src/modules/workflows/examples/order-approval-guard-rules.json +2 -2
- package/src/modules/workflows/frontend/checkout-demo/page.tsx +4 -4
- package/src/modules/workflows/i18n/de.json +16 -0
- package/src/modules/workflows/i18n/en.json +16 -0
- package/src/modules/workflows/i18n/es.json +16 -0
- package/src/modules/workflows/i18n/pl.json +16 -0
- package/src/modules/workflows/lib/code-registry.ts +65 -0
- package/src/modules/workflows/lib/find-definition.ts +100 -0
- package/src/modules/workflows/lib/seeds.ts +4 -3
- package/src/modules/workflows/lib/start-validator.ts +2 -35
- package/src/modules/workflows/lib/workflow-executor.ts +2 -39
- package/src/modules/workflows/migrations/.snapshot-open-mercato.json +10 -0
- package/src/modules/workflows/migrations/Migration20260414120000.ts +13 -0
- package/src/modules/workflows/migrations/Migration20260428102318.ts +57 -0
- package/src/modules/workflows/widgets/injection/order-approval/widget.client.tsx +1 -1
- package/src/modules/workflows/workflows.ts +278 -0
- package/dist/modules/workflows/examples/checkout-demo-definition.json +0 -486
- package/dist/modules/workflows/examples/order-approval-definition.json +0 -257
- package/dist/modules/workflows/examples/simple-approval-definition.json +0 -134
- package/src/modules/workflows/examples/checkout-demo-definition.json +0 -486
- package/src/modules/workflows/examples/order-approval-definition.json +0 -257
- package/src/modules/workflows/examples/simple-approval-definition.json +0 -134
|
@@ -1,486 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"workflowId": "checkout_simple_v1",
|
|
3
|
-
"workflowName": "Checkout with Payment Webhook",
|
|
4
|
-
"description": "Realistic checkout workflow with signal-based payment confirmation: validate cart, initiate payment, wait for webhook, send confirmation",
|
|
5
|
-
"version": 1,
|
|
6
|
-
"enabled": true,
|
|
7
|
-
"metadata": {
|
|
8
|
-
"category": "E-commerce",
|
|
9
|
-
"tags": ["checkout", "demo", "payments", "signals", "webhooks"],
|
|
10
|
-
"icon": "ShoppingCart"
|
|
11
|
-
},
|
|
12
|
-
"definition": {
|
|
13
|
-
"steps": [
|
|
14
|
-
{
|
|
15
|
-
"stepId": "start",
|
|
16
|
-
"stepName": "Start",
|
|
17
|
-
"stepType": "START",
|
|
18
|
-
"description": "Checkout process initiated",
|
|
19
|
-
"preConditions": [
|
|
20
|
-
{
|
|
21
|
-
"ruleId": "workflow_checkout_cart_not_empty",
|
|
22
|
-
"required": true,
|
|
23
|
-
"validationMessage": {
|
|
24
|
-
"en": "Your shopping cart is empty. Please add items before starting checkout.",
|
|
25
|
-
"pl": "Twój koszyk jest pusty. Dodaj produkty przed rozpoczęciem zakupu."
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"stepId": "cart_validation",
|
|
32
|
-
"stepName": "Cart Validation",
|
|
33
|
-
"stepType": "AUTOMATED",
|
|
34
|
-
"description": "Validate cart has items and inventory is available",
|
|
35
|
-
"timeout": "PT10S"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"stepId": "customer_info",
|
|
39
|
-
"stepName": "Customer Information",
|
|
40
|
-
"stepType": "USER_TASK",
|
|
41
|
-
"description": "Collect customer shipping and contact information",
|
|
42
|
-
"userTaskConfig": {
|
|
43
|
-
"formSchema": {
|
|
44
|
-
"type": "object",
|
|
45
|
-
"properties": {
|
|
46
|
-
"fullName": {
|
|
47
|
-
"type": "string",
|
|
48
|
-
"title": "Full Name",
|
|
49
|
-
"description": "Customer's full legal name"
|
|
50
|
-
},
|
|
51
|
-
"email": {
|
|
52
|
-
"type": "string",
|
|
53
|
-
"format": "email",
|
|
54
|
-
"title": "Email Address",
|
|
55
|
-
"description": "Email for order confirmation"
|
|
56
|
-
},
|
|
57
|
-
"phone": {
|
|
58
|
-
"type": "string",
|
|
59
|
-
"title": "Phone Number",
|
|
60
|
-
"description": "Contact number for delivery"
|
|
61
|
-
},
|
|
62
|
-
"comment": {
|
|
63
|
-
"type": "string",
|
|
64
|
-
"title": "Order Comment",
|
|
65
|
-
"maxLength": 500,
|
|
66
|
-
"description": "Special instructions or notes for this order"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"required": ["fullName", "email"]
|
|
70
|
-
},
|
|
71
|
-
"slaDuration": "PT24H"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"stepId": "payment_initiation",
|
|
76
|
-
"stepName": "Initiate Payment",
|
|
77
|
-
"stepType": "AUTOMATED",
|
|
78
|
-
"description": "Send payment request to payment provider",
|
|
79
|
-
"timeout": "PT10S"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"stepId": "wait_payment_confirmation",
|
|
83
|
-
"stepName": "Wait for Payment Confirmation",
|
|
84
|
-
"stepType": "WAIT_FOR_SIGNAL",
|
|
85
|
-
"description": "Waiting for payment provider webhook confirmation",
|
|
86
|
-
"signalConfig": {
|
|
87
|
-
"signalName": "payment_confirmed",
|
|
88
|
-
"timeout": "PT5M"
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"stepId": "order_confirmation",
|
|
93
|
-
"stepName": "Order Confirmation",
|
|
94
|
-
"stepType": "AUTOMATED",
|
|
95
|
-
"description": "Create order record and send confirmation",
|
|
96
|
-
"timeout": "PT15S"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"stepId": "end",
|
|
100
|
-
"stepName": "Complete",
|
|
101
|
-
"stepType": "END",
|
|
102
|
-
"description": "Checkout completed successfully"
|
|
103
|
-
}
|
|
104
|
-
],
|
|
105
|
-
"transitions": [
|
|
106
|
-
{
|
|
107
|
-
"transitionId": "start_to_cart",
|
|
108
|
-
"transitionName": "Initialize Checkout",
|
|
109
|
-
"fromStepId": "start",
|
|
110
|
-
"toStepId": "cart_validation",
|
|
111
|
-
"trigger": "auto",
|
|
112
|
-
"priority": 100,
|
|
113
|
-
"activities": [
|
|
114
|
-
{
|
|
115
|
-
"activityId": "log_checkout_start",
|
|
116
|
-
"activityName": "Log Checkout Start",
|
|
117
|
-
"activityType": "EMIT_EVENT",
|
|
118
|
-
"config": {
|
|
119
|
-
"eventName": "checkout.started",
|
|
120
|
-
"payload": {
|
|
121
|
-
"customerId": "{{context.customerId}}",
|
|
122
|
-
"cartId": "{{context.cartId}}",
|
|
123
|
-
"currency": "{{context.currency}}",
|
|
124
|
-
"timestamp": "{{now}}"
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
"async": false
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
"transitionId": "cart_to_customer_info",
|
|
133
|
-
"transitionName": "Collect Customer Information",
|
|
134
|
-
"fromStepId": "cart_validation",
|
|
135
|
-
"toStepId": "customer_info",
|
|
136
|
-
"trigger": "auto",
|
|
137
|
-
"priority": 100,
|
|
138
|
-
"preConditions": [
|
|
139
|
-
{
|
|
140
|
-
"ruleId": "workflow_checkout_cart_not_empty",
|
|
141
|
-
"required": true
|
|
142
|
-
}
|
|
143
|
-
],
|
|
144
|
-
"activities": [
|
|
145
|
-
{
|
|
146
|
-
"activityId": "validate_cart_items",
|
|
147
|
-
"activityName": "Validate Cart Items",
|
|
148
|
-
"activityType": "EMIT_EVENT",
|
|
149
|
-
"config": {
|
|
150
|
-
"eventName": "checkout.cart_validation_started",
|
|
151
|
-
"payload": {
|
|
152
|
-
"customerId": "{{context.customerId}}",
|
|
153
|
-
"cartId": "{{context.cartId}}",
|
|
154
|
-
"currency": "{{context.currency}}",
|
|
155
|
-
"cart": {
|
|
156
|
-
"id": "{{context.cartId}}",
|
|
157
|
-
"currency": "{{context.currency}}",
|
|
158
|
-
"subtotal": 100.00,
|
|
159
|
-
"tax": 8.50,
|
|
160
|
-
"shipping": 12.00,
|
|
161
|
-
"total": 120.50,
|
|
162
|
-
"itemCount": 2,
|
|
163
|
-
"items": [
|
|
164
|
-
{
|
|
165
|
-
"kind": "product",
|
|
166
|
-
"name": "Demo Product 1",
|
|
167
|
-
"quantity": 1,
|
|
168
|
-
"currencyCode": "{{context.currency}}",
|
|
169
|
-
"unitPriceGross": 50.00,
|
|
170
|
-
"totalGrossAmount": 50.00
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
"kind": "product",
|
|
174
|
-
"name": "Demo Product 2",
|
|
175
|
-
"quantity": 2,
|
|
176
|
-
"currencyCode": "{{context.currency}}",
|
|
177
|
-
"unitPriceGross": 25.00,
|
|
178
|
-
"totalGrossAmount": 50.00
|
|
179
|
-
}
|
|
180
|
-
]
|
|
181
|
-
},
|
|
182
|
-
"customer": {
|
|
183
|
-
"id": "{{context.customerId}}"
|
|
184
|
-
},
|
|
185
|
-
"payment": {
|
|
186
|
-
"id": "demo-payment-001",
|
|
187
|
-
"methodId": "demo-payment-method"
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
"async": false
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
"activityId": "reserve_inventory",
|
|
195
|
-
"activityName": "Reserve Inventory",
|
|
196
|
-
"activityType": "CALL_WEBHOOK",
|
|
197
|
-
"config": {
|
|
198
|
-
"url": "{{env.INVENTORY_SERVICE_URL}}/api/inventory/reserve",
|
|
199
|
-
"method": "POST",
|
|
200
|
-
"headers": {
|
|
201
|
-
"Authorization": "Bearer {{env.SERVICE_TOKEN}}",
|
|
202
|
-
"Content-Type": "application/json"
|
|
203
|
-
},
|
|
204
|
-
"body": {
|
|
205
|
-
"cartId": "{{context.cart.id}}",
|
|
206
|
-
"items": "{{context.cart.items}}",
|
|
207
|
-
"expiresIn": "PT10M"
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
"timeout": "PT10S",
|
|
211
|
-
"async": false,
|
|
212
|
-
"retryPolicy": {
|
|
213
|
-
"maxAttempts": 1,
|
|
214
|
-
"initialIntervalMs": 2000,
|
|
215
|
-
"backoffCoefficient": 2,
|
|
216
|
-
"maxIntervalMs": 10000
|
|
217
|
-
},
|
|
218
|
-
"compensationActivity": {
|
|
219
|
-
"activityId": "release_reservation_compensation",
|
|
220
|
-
"activityName": "Release Inventory Reservation (Compensation)",
|
|
221
|
-
"activityType": "CALL_WEBHOOK",
|
|
222
|
-
"config": {
|
|
223
|
-
"url": "{{env.INVENTORY_SERVICE_URL}}/api/inventory/release",
|
|
224
|
-
"method": "POST",
|
|
225
|
-
"headers": {
|
|
226
|
-
"Authorization": "Bearer {{env.SERVICE_TOKEN}}",
|
|
227
|
-
"Content-Type": "application/json"
|
|
228
|
-
},
|
|
229
|
-
"body": {
|
|
230
|
-
"reservationId": "{{activity.reserve_inventory.reservationId}}",
|
|
231
|
-
"reason": "payment_failed"
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
"timeout": "PT10S"
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
"activityId": "emit_cart_validated",
|
|
239
|
-
"activityName": "Emit Cart Validated Event",
|
|
240
|
-
"activityType": "EMIT_EVENT",
|
|
241
|
-
"config": {
|
|
242
|
-
"eventName": "checkout.cart_validated",
|
|
243
|
-
"payload": {
|
|
244
|
-
"cartId": "{{context.cart.id}}",
|
|
245
|
-
"total": "{{context.cart.total}}",
|
|
246
|
-
"itemCount": "{{context.cart.itemCount}}"
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
"async": false
|
|
250
|
-
}
|
|
251
|
-
]
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
"transitionId": "customer_info_to_payment",
|
|
255
|
-
"transitionName": "Initiate Payment",
|
|
256
|
-
"fromStepId": "customer_info",
|
|
257
|
-
"toStepId": "payment_initiation",
|
|
258
|
-
"trigger": "auto",
|
|
259
|
-
"priority": 100,
|
|
260
|
-
"activities": [
|
|
261
|
-
{
|
|
262
|
-
"activityId": "charge_payment",
|
|
263
|
-
"activityName": "Charge Payment Method",
|
|
264
|
-
"activityType": "CALL_WEBHOOK",
|
|
265
|
-
"config": {
|
|
266
|
-
"url": "{{env.PAYMENT_SERVICE_URL}}/api/payments/charge",
|
|
267
|
-
"method": "POST",
|
|
268
|
-
"headers": {
|
|
269
|
-
"Authorization": "Bearer {{env.SERVICE_TOKEN}}",
|
|
270
|
-
"Content-Type": "application/json",
|
|
271
|
-
"Idempotency-Key": "{{workflow.instanceId}}"
|
|
272
|
-
},
|
|
273
|
-
"body": {
|
|
274
|
-
"amount": "{{context.cart.total}}",
|
|
275
|
-
"currency": "{{context.cart.currency}}",
|
|
276
|
-
"paymentMethodId": "{{context.payment.methodId}}",
|
|
277
|
-
"customerId": "{{context.customer.id}}",
|
|
278
|
-
"metadata": {
|
|
279
|
-
"cartId": "{{context.cart.id}}",
|
|
280
|
-
"workflowInstanceId": "{{workflow.instanceId}}"
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
"timeout": "PT30S",
|
|
285
|
-
"async": false,
|
|
286
|
-
"retryPolicy": {
|
|
287
|
-
"maxAttempts": 1,
|
|
288
|
-
"initialIntervalMs": 3000,
|
|
289
|
-
"backoffCoefficient": 2,
|
|
290
|
-
"maxIntervalMs": 15000
|
|
291
|
-
},
|
|
292
|
-
"compensationActivity": {
|
|
293
|
-
"activityId": "refund_payment",
|
|
294
|
-
"activityName": "Refund Payment (Compensation)",
|
|
295
|
-
"activityType": "CALL_WEBHOOK",
|
|
296
|
-
"config": {
|
|
297
|
-
"url": "{{env.PAYMENT_SERVICE_URL}}/api/payments/refund",
|
|
298
|
-
"method": "POST",
|
|
299
|
-
"headers": {
|
|
300
|
-
"Authorization": "Bearer {{env.SERVICE_TOKEN}}",
|
|
301
|
-
"Content-Type": "application/json",
|
|
302
|
-
"Idempotency-Key": "{{workflow.instanceId}}-refund"
|
|
303
|
-
},
|
|
304
|
-
"body": {
|
|
305
|
-
"transactionId": "{{activity.charge_payment.transactionId}}",
|
|
306
|
-
"amount": "{{context.cart.total}}",
|
|
307
|
-
"reason": "order_failed",
|
|
308
|
-
"metadata": {
|
|
309
|
-
"workflowInstanceId": "{{workflow.instanceId}}"
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
|
-
"timeout": "PT30S"
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
"activityId": "log_payment_initiated",
|
|
318
|
-
"activityName": "Log Payment Initiated",
|
|
319
|
-
"activityType": "EMIT_EVENT",
|
|
320
|
-
"config": {
|
|
321
|
-
"eventName": "checkout.payment_initiated",
|
|
322
|
-
"payload": {
|
|
323
|
-
"cartId": "{{context.cart.id}}",
|
|
324
|
-
"paymentId": "{{context.payment.id}}",
|
|
325
|
-
"amount": "{{context.cart.total}}",
|
|
326
|
-
"transactionId": "{{activity.charge_payment.transactionId}}"
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
"async": false
|
|
330
|
-
}
|
|
331
|
-
]
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
"transitionId": "payment_to_wait_confirmation",
|
|
335
|
-
"transitionName": "Wait for Confirmation",
|
|
336
|
-
"fromStepId": "payment_initiation",
|
|
337
|
-
"toStepId": "wait_payment_confirmation",
|
|
338
|
-
"trigger": "auto",
|
|
339
|
-
"priority": 100
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
"transitionId": "confirmation_to_order",
|
|
343
|
-
"transitionName": "Payment Confirmed",
|
|
344
|
-
"fromStepId": "wait_payment_confirmation",
|
|
345
|
-
"toStepId": "order_confirmation",
|
|
346
|
-
"trigger": "auto",
|
|
347
|
-
"priority": 100,
|
|
348
|
-
"activities": [
|
|
349
|
-
{
|
|
350
|
-
"activityId": "update_payment_status",
|
|
351
|
-
"activityName": "Update Payment Status",
|
|
352
|
-
"activityType": "EMIT_EVENT",
|
|
353
|
-
"config": {
|
|
354
|
-
"eventName": "checkout.payment_status_updated",
|
|
355
|
-
"payload": {
|
|
356
|
-
"paymentId": "{{context.payment.id}}",
|
|
357
|
-
"status": "completed",
|
|
358
|
-
"transactionId": "{{activity.charge_payment.transactionId}}",
|
|
359
|
-
"completedAt": "{{now}}"
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
"timeout": "PT5S",
|
|
363
|
-
"async": false
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
"activityId": "emit_payment_success",
|
|
367
|
-
"activityName": "Emit Payment Success Event",
|
|
368
|
-
"activityType": "EMIT_EVENT",
|
|
369
|
-
"config": {
|
|
370
|
-
"eventName": "checkout.payment_completed",
|
|
371
|
-
"payload": {
|
|
372
|
-
"cartId": "{{context.cart.id}}",
|
|
373
|
-
"paymentId": "{{context.payment.id}}",
|
|
374
|
-
"transactionId": "{{context.payment.transactionId}}",
|
|
375
|
-
"amount": "{{context.cart.total}}"
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
"async": false
|
|
379
|
-
}
|
|
380
|
-
]
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
"transitionId": "confirmation_to_end",
|
|
384
|
-
"transitionName": "Finalize Order",
|
|
385
|
-
"fromStepId": "order_confirmation",
|
|
386
|
-
"toStepId": "end",
|
|
387
|
-
"trigger": "auto",
|
|
388
|
-
"priority": 100,
|
|
389
|
-
"activities": [
|
|
390
|
-
{
|
|
391
|
-
"activityId": "create_order",
|
|
392
|
-
"activityName": "Create Order Record",
|
|
393
|
-
"activityType": "CALL_API",
|
|
394
|
-
"config": {
|
|
395
|
-
"endpoint": "/api/sales/orders",
|
|
396
|
-
"method": "POST",
|
|
397
|
-
"body": {
|
|
398
|
-
"customerEntityId": "{{context.customer.id}}",
|
|
399
|
-
"currencyCode": "{{context.cart.currency}}",
|
|
400
|
-
"placedAt": "{{now}}",
|
|
401
|
-
"grandTotalGrossAmount": "{{context.cart.total}}",
|
|
402
|
-
"subtotalGrossAmount": "{{context.cart.subtotal}}",
|
|
403
|
-
"taxTotalAmount": "{{context.cart.tax}}",
|
|
404
|
-
"shippingGrossAmount": "{{context.cart.shipping}}",
|
|
405
|
-
"lineItemCount": "{{context.cart.itemCount}}",
|
|
406
|
-
"comments": "{{context.comment}}",
|
|
407
|
-
"metadata": {
|
|
408
|
-
"cartId": "{{context.cart.id}}",
|
|
409
|
-
"paymentId": "{{context.payment.id}}",
|
|
410
|
-
"workflowInstanceId": "{{workflow.instanceId}}",
|
|
411
|
-
"workflowId": "{{workflow.workflowId}}",
|
|
412
|
-
"tenantId": "{{workflow.tenantId}}",
|
|
413
|
-
"source": "workflow_checkout"
|
|
414
|
-
}
|
|
415
|
-
},
|
|
416
|
-
"validateTenantMatch": true
|
|
417
|
-
},
|
|
418
|
-
"timeout": "PT10S",
|
|
419
|
-
"async": false,
|
|
420
|
-
"retryPolicy": {
|
|
421
|
-
"maxAttempts": 3,
|
|
422
|
-
"initialIntervalMs": 2000,
|
|
423
|
-
"backoffCoefficient": 2,
|
|
424
|
-
"maxIntervalMs": 10000
|
|
425
|
-
},
|
|
426
|
-
"compensationActivity": {
|
|
427
|
-
"activityId": "cancel_order",
|
|
428
|
-
"activityName": "Cancel Order (Compensation)",
|
|
429
|
-
"activityType": "CALL_API",
|
|
430
|
-
"config": {
|
|
431
|
-
"endpoint": "/api/sales/orders/{{activity.create_order.body.id}}",
|
|
432
|
-
"method": "DELETE"
|
|
433
|
-
},
|
|
434
|
-
"timeout": "PT10S"
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
"activityId": "send_confirmation_email",
|
|
439
|
-
"activityName": "Send Order Confirmation Email",
|
|
440
|
-
"activityType": "SEND_EMAIL",
|
|
441
|
-
"config": {
|
|
442
|
-
"to": "{{context.customer.email}}",
|
|
443
|
-
"subject": "Order Confirmation - Order #{{context.create_order_result.body.number}}",
|
|
444
|
-
"template": "order_confirmation",
|
|
445
|
-
"data": {
|
|
446
|
-
"customerName": "{{context.customer.name}}",
|
|
447
|
-
"orderNumber": "{{context.create_order_result.body.number}}",
|
|
448
|
-
"orderDate": "{{now}}",
|
|
449
|
-
"items": "{{context.cart.items}}",
|
|
450
|
-
"subtotal": "{{context.cart.subtotal}}",
|
|
451
|
-
"tax": "{{context.cart.tax}}",
|
|
452
|
-
"shipping": "{{context.cart.shipping}}",
|
|
453
|
-
"total": "{{context.cart.total}}",
|
|
454
|
-
"comment": "{{context.comment}}"
|
|
455
|
-
}
|
|
456
|
-
},
|
|
457
|
-
"timeout": "PT15S",
|
|
458
|
-
"async": true,
|
|
459
|
-
"retryPolicy": {
|
|
460
|
-
"maxAttempts": 3,
|
|
461
|
-
"initialIntervalMs": 2000,
|
|
462
|
-
"backoffCoefficient": 2,
|
|
463
|
-
"maxIntervalMs": 20000
|
|
464
|
-
}
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
"activityId": "emit_order_completed",
|
|
468
|
-
"activityName": "Emit Order Completed Event",
|
|
469
|
-
"activityType": "EMIT_EVENT",
|
|
470
|
-
"config": {
|
|
471
|
-
"eventName": "checkout.completed",
|
|
472
|
-
"payload": {
|
|
473
|
-
"orderId": "{{context.create_order_result.body.id}}",
|
|
474
|
-
"orderNumber": "{{context.create_order_result.body.number}}",
|
|
475
|
-
"customerId": "{{context.customer.id}}",
|
|
476
|
-
"total": "{{context.cart.total}}",
|
|
477
|
-
"timestamp": "{{now}}"
|
|
478
|
-
}
|
|
479
|
-
},
|
|
480
|
-
"async": false
|
|
481
|
-
}
|
|
482
|
-
]
|
|
483
|
-
}
|
|
484
|
-
]
|
|
485
|
-
}
|
|
486
|
-
}
|