예제 #1
0
        public static Response CheckOut(List <DetailedCart> Cart, string paymentId, int userId)
        {
            if (paymentId == "" || paymentId.All(char.IsDigit) != true)
            {
                return(new Response(false, "Payment ID cannot be empty or non numeric"));
            }

            int _paymentId = Int32.Parse(paymentId);

            if (PaymentTypeHandler.GetPaymentType(_paymentId) == null)
            {
                return(new Response(false, "Wrong Payment Type ID"));
            }

            if (Cart == null)
            {
                return(new Response(false, "Cart Cannot be empty"));
            }

            TransactionHandler.CheckOut(Cart, _paymentId, userId);
            return(new Response(true, "Cart successfully checked out"));
        }