- tags
- #shop
shop-flows: story¶✎ edit
Each shop flow, run by hand on the sample data (in the Fiddle, nothing is kept). The triggers in Init start the same flows when the data changes for real; a story can't raise those events itself, so it sends the flow's own message.
A new cart: the shop hears who's shopping.
$send shop.cartCreated (id = "cart-3")
$expect payload.text is "New cart from Tom Brady-Lee"
$expect payload.to is "admins"
An order placed: an invoice, stock reserved from the warehouse that has it, and a thank-you. The half-litre press was down to its reorder point, so it's now low.
$send shop.orderPlaced (id = "o-1004")
$expect payload.invoice is "INV-o-1004"
$expect payload.total is 58.0
$expect payload.reserved[0].reserved is true
$expect payload.reserved[0].stock is "low"
Low stock, checked on its own: filters are well stocked.
$send shop.checkStock (id = "st-FI-02W-ott")
$expect payload is "ok"
Abandoned carts: every cart still open after 48 hours is marked abandoned, Omar's from the start of the month among them.
$send shop.abandonedCarts (hours = 48)
$expect "cart-1" in payload
Shipped: the order follows its shipment, and the customer gets the tracking number.
$send shop.shipped (id = "sh-1002")
$expect payload.text is "On its way: order o-1002, Purolator PU-55120-88"
A return approved: a refund for the filters sent back, and the stock goes back.
$send shop.returnApproved (id = "ret-1")
$expect payload.refund is "RF-ret-1"
$expect payload.amount is 8.0
$expect payload.restocked is 1