nim-dagger/codex/sales/states/ignored.nim

19 lines
425 B
Nim

import pkg/chronos
import ../statemachine
import ../salesagent
import ./errorhandling
type
SaleIgnored* = ref object of ErrorHandlingState
method `$`*(state: SaleIgnored): string = "SaleIgnored"
method run*(state: SaleIgnored, machine: Machine): Future[?State] {.async.} =
let agent = SalesAgent(machine)
let context = agent.context
if onIgnored =? context.onIgnored:
onIgnored()
await agent.unsubscribe()