Skip to content

Instantly share code, notes, and snippets.

@zacharysyoung
Last active June 2, 2021 19:15
Show Gist options
  • Save zacharysyoung/4ba39f7ff7f33903e248d45df97ac7e5 to your computer and use it in GitHub Desktop.
Save zacharysyoung/4ba39f7ff7f33903e248d45df97ac7e5 to your computer and use it in GitHub Desktop.
Funding/Check states
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
id: 'Funding - Checks',
initial: 'verifying',
states: {
incomplete: {
on: { VERIFY: 'verifying' }
},
verifying: {
on: {
VERIFY_INCOMPLETE: 'incomplete',
VERIFY_COMPLETE: 'ready for billDotCom'
}
},
'ready for billDotCom': { on: { HANDOFF: 'pending' } },
pending: { on: { SCHEDULE: 'scheduled' } },
scheduled: { on: { ISSUE: 'issued' } },
issued: { on: { SEND: 'sent' } },
sent: {
on: {
CLEAR: 'cleared',
RETURN: 'returned',
TIMEOUT: 'uncashed',
CANCEL: 'cancelled',
VOID: 'voided'
}
},
cleared: { type: 'final' },
returned: { on: { RESEND: 'sent' } },
uncashed: { on: { CANCEL: 'cancelled' } },
cancelled: { on: { VOID: 'voided' } },
voided: { type: 'final' },
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment