Files
go-cart-actor/pkg/order/flows/place-and-pay.json
T
2026-07-01 10:40:28 +02:00

37 lines
1.2 KiB
JSON

{
"name": "place-and-pay",
"description": "Place an order and take payment in one transaction. Authorization is compensated (voided + order cancelled) if capture fails. Sends order confirmation and payment receipt emails when a customer email is present.",
"steps": [
{
"name": "place",
"action": "place_order",
"hooks": {
"after": [
{ "type": "log", "params": { "message": "order placed" } },
{ "type": "send_email", "when": "has_customer_email", "params": { "template": "order-confirmation" } }
]
}
},
{
"name": "authorize",
"action": "authorize_payment",
"compensate": { "action": "void_payment" },
"hooks": {
"after": [{ "type": "log", "params": { "message": "payment authorized" } }],
"onError": [{ "type": "log", "params": { "message": "authorization failed" } }]
}
},
{
"name": "capture",
"action": "capture_payment",
"hooks": {
"after": [
{ "type": "log", "params": { "message": "payment captured" } },
{ "type": "send_email", "when": "has_customer_email", "params": { "template": "payment-receipt" } },
{ "type": "emit_order_created" }
]
}
}
]
}