order sagas
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "place-and-pay",
|
||||
"description": "Place an order and take payment in one transaction. Authorization is compensated (voided + order cancelled) if capture fails.",
|
||||
"steps": [
|
||||
{
|
||||
"name": "place",
|
||||
"action": "place_order",
|
||||
"hooks": {
|
||||
"after": [{ "type": "log", "params": { "message": "order placed" } }]
|
||||
}
|
||||
},
|
||||
{
|
||||
"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" } }]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user