public async Task CancelOpenOrder(FoodUser caller) { var order = await storage.GetOrder(); if (order == null || !order.IsOpen) { throw new BadRequestException("There is no valid order to cancel."); } const int minTimeout = 30; if (caller.UniqueId != order.Owner.UniqueId && DateTimeOffset.UtcNow - order.DateCreated < TimeSpan.FromMinutes(minTimeout)) { throw new BadRequestException($"Only order owner can cancel the order during first {minTimeout} minutes."); } await storage.DeleteOrder(); }