Created
June 30, 2021 09:42
-
-
Save Bradleykingz/e9a0dd75e6e94fbe4f9658fd8a27a1ce 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 fetchMachine = Machine({ | |
id: 'fetch', | |
initial: 'incomplete', | |
context: { | |
retries: 0 | |
}, | |
states: { | |
incomplete: { | |
on: { | |
COMPLETE_ORDER: 'pendingPayment' | |
} | |
}, | |
pendingPayment: { | |
on: { | |
COMPLETE_PAYMENT: 'pendingConfirmation', | |
// CANCEL_PAYMENT: 'cancelled', | |
PAY_ON_DELIVERY: 'pendingConfirmation', | |
} | |
}, | |
pendingConfirmation: { | |
on: { | |
CONFIRM_ORDER: 'pendingDispatch', | |
CANCEL_ORDER: 'cancelled' | |
} | |
}, | |
pendingDispatch: { | |
on: { | |
DISPATCH: 'inTransit' | |
} | |
}, | |
inTransit: { | |
on: { | |
COMPLETE_DELVIVERY: 'delivered' | |
} | |
}, | |
cancelled: { | |
type: 'final' | |
}, | |
delivered: { | |
on: { | |
LAUNCH_DISPUTE: 'disputed' | |
} | |
}, | |
disputed: { | |
on: { | |
REFUND_FULLY: 'fullyRefunded', | |
REFUND_PARTIALLY: 'partiallyRefunded', | |
REJECT_DISPUTE: 'disputeRejected' | |
} | |
}, | |
disputeRejected: { | |
type: 'final' | |
}, | |
partiallyRefunded: { | |
type: 'final' | |
}, | |
fullyRefunded: { | |
type: 'final' | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment