context shop.orders

consumes shop.payment as Pay

exports transparent { OrderError }

type OrderError = enum { Rejected }

service place {
  on call(cents: Int) -> Effect[Result[Int, OrderError]] {
    let a <- Pay.authorise(cents)
    match a {
      Ok(n)  => Ok(n)
      Err(_) => Err(Rejected)
    }
  }
}
