Skip to content

Instantly share code, notes, and snippets.

@awto
Last active June 6, 2018 11:26
Show Gist options
  • Save awto/d34e003a2cce5723eb1c190ddc4ea9c3 to your computer and use it in GitHub Desktop.
Save awto/d34e003a2cce5723eb1c190ddc4ea9c3 to your computer and use it in GitHub Desktop.
workflow sample
function order(customer, item) {
begin();
customer.balance -= item.price;
item.vendor.balance += item.price;
if (customer.balance < 0)
throw new NegativeBalance();
scheduleShipment(customer, item)
commit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment