Created
September 13, 2019 05:07
-
-
Save joemocha/45f4fd12ab25884015a21e15eab5a56f to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const orderStateMachine = Machine({ | |
id: 'state', | |
initial: 'CREATED', | |
states: { | |
CREATED: { | |
on: { | |
AUTHORIZE: 'AUTHORIZED', | |
PAYMENT_FAIL: 'PAYMENT_FAILED', | |
}, | |
}, | |
AUTHORIZED: { | |
on: { | |
FULFILL: 'FULFILLED', | |
CANCEL: 'CANCELLED', | |
}, | |
}, | |
FULFILLED: { | |
on: { | |
PICK_UP: 'PICKED_UP', | |
FULL_REFUND: 'FULLY_REFUNDED', | |
NOT_PICKED_UP: 'NOT_PICKED_UP', | |
}, | |
}, | |
PICKED_UP: { | |
on: { | |
TIP: 'COMPLETED', | |
CANCEL: 'CANCELLED', | |
PARTIAL_REFUND: 'PARTIAL_REFUNDED', | |
}, | |
}, | |
COMPLETED: { | |
on: { | |
FULL_REFUND: 'FULLY_REFUNDED', | |
PARTIAL_REFUND: 'PARTIAL_REFUNDED', | |
}, | |
}, | |
CANCELLED: { | |
on: { | |
FULL_REFUND: 'FULLY_REFUNDED', | |
PARTIAL_REFUND: 'PARTIAL_REFUNDED', | |
}, | |
}, | |
FULLY_REFUNDED: { | |
type: 'final', | |
}, | |
PAYMENT_FAILED: { | |
type: 'final', | |
}, | |
PARTIAL_REFUNDED: { | |
on: { | |
TIP: 'COMPLETED', | |
FULL_REFUND: 'FULLY_REFUNDED', | |
}, | |
}, | |
NOT_PICKED_UP: { | |
type: 'final', | |
}, | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment