public async Task MakeOrder(CoffeeService coffee, User user, string text, SlackResponse response) { var canceled = await coffee.CancelOrderAsync(user.Id, DateTime.Now, DateTime.MinValue); var order = await coffee.MakeOrderAsync(user.Id, text, DateTime.Now, canceled); var deposit = await coffee.GetDepositAsync(user.Id); response.Ephemeral($"{order.Price}원, 현재 잔액 {deposit}원"); if (canceled != null && canceled.IsPicked && order.Price != canceled.Price) { response.Ephemeral($"추첨된 메뉴와 가격이 다릅니다. 추출러에게 바뀐 메뉴를 확실히 알려주세요."); } response.InChannel($"{user.Name} 님이 {order.MenuId}{(canceled != null ? "로 변경" : "를 주문")} 하였습니다."); }
public async Task MakeReservationForAfternoon(CoffeeService coffee, User user, string text, SlackResponse response) { var at = DateTime.Now.Noon(); if (DateTime.Now > at) { throw new BadRequestException("오전에만 사용 가능한 메뉴입니다."); } var canceled = await coffee.CancelOrderAsync(user.Id, at, at); var order = await coffee.MakeOrderAsync(user.Id, text, at); var deposit = await coffee.GetDepositAsync(user.Id); response .Ephemeral($"{order.Price}원, 현재 잔액 {deposit}원") .InChannel($"{user.Name} 님이 오후 커피를 {order.MenuId}로 {(canceled != null ? "변경" : "예약")} 하였습니다."); }
public async Task GetDeposit(CoffeeService coffee, User user, string text, SlackResponse response) { var deposit = await coffee.GetDepositAsync(user.Id); response.Ephemeral($"현재 잔액은 {deposit}원 입니다."); }