37 lines
1.2 KiB
JSON
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_order_email_consent", "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_order_email_consent", "params": { "template": "payment-receipt" } },
|
|
{ "type": "emit_order_created" }
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|