nim-dagger/codex/purchasing/states/pending.nim

15 lines
423 B
Nim

import ../statemachine
import ./errorhandling
import ./submitted
type PurchasePending* = ref object of ErrorHandlingState
method `$`*(state: PurchasePending): string =
"pending"
method run*(state: PurchasePending, machine: Machine): Future[?State] {.async.} =
let purchase = Purchase(machine)
let request = !purchase.request
await purchase.market.requestStorage(request)
return some State(PurchaseSubmitted())