예제 #1
0
        public async void OnPaymentStatusUpdate(NewPaymentStatus status)
        {
            if (status.Status == PaymentStatusDTO.Authorizing)
            {
                NotifyClient(status.OrderId, OrderStatus.Pending);
                UpdateOrderStatus(status.OrderId, OrderStatus.Pending);
            }

            if (status.Status != PaymentStatusDTO.Accepted)
            {
                return;
            }

            // Contact restaurant-api with the order-request
            var order = await Get(status.OrderId);

            if (order == null)
            {
                Console.WriteLine($"[PaymentStatusUpdate] Order is null with id: {status.OrderId}");
                return;
            }
            Console.WriteLine($"[Payment Accepted] Proceeding with order..");
            await _publisher.NewOrderRequest(order);

            Console.WriteLine($"New Order request has been issued to restaurantAPI");
        }