Beispiel #1
0
        public async Task CancelOrder(CoffeeService coffee, User user, string text, SlackResponse response)
        {
            var canceled = await coffee.CancelOrderAsync(user.Id, DateTime.Now, DateTime.MinValue);

            response.Ephemeral(canceled != null ? "취소하였습니다." : "예약이 없습니다.");
            if (canceled != null)
            {
                response.InChannel($"{user.Name} 님이 주문을 취소하였습니다.");
            }
        }
Beispiel #2
0
        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 ? "로 변경" : "를 주문")} 하였습니다.");
        }
Beispiel #3
0
        public async Task CancelAfternoonReservationOrder(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);

            response.Ephemeral(canceled != null ? "취소하였습니다." : "예약이 없습니다.");
            if (canceled != null)
            {
                response.InChannel($"{user.Name} 님이 오후 커피를 취소하였습니다.");
            }
        }
Beispiel #4
0
        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 ? "변경" : "예약")} 하였습니다.");
        }