2023-07-17 13:39:25 +02:00

20 lines
452 B
Nim

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