private ValidateDiscountCodeDTO CheckQuantityValidation(App.Support.Common.Models.PromotionService.DiscountValidations.DiscountValidation discountValidation, CartDTO cartDto, string productCatId)
        {
            switch (discountValidation.Operator)
            {
            case DiscountValidationOperator.MoreThan:
            {
                var productCatName = "";
                var count          = 0L;
                foreach (var cartItem in cartDto.CartItems)
                {
                    if (cartItem.Product.Category.Id != productCatId)
                    {
                        continue;
                    }
                    productCatName = cartItem.Product.Category.Name;
                    count         += cartItem.Quantity;
                }

                if (count < int.Parse(discountValidation.Value))
                {
                    return(new ValidateDiscountCodeDTO()
                        {
                            IsValid = false,
                            Message = $"Product quantity of category {productCatName} less than discount code condition (> {discountValidation.Value})"
                        });
                }

                break;
            }

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(null);
        }
        private string CheckProductCategoryValidation(App.Support.Common.Models.PromotionService.DiscountValidations.DiscountValidation discountValidation)
        {
            switch (discountValidation.Operator)
            {
            case DiscountValidationOperator.Is:
            {
                var productCatId = discountValidation.Value;
                return(productCatId);
            }

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        private ValidateDiscountCodeDTO CheckBillDiscountValidation(App.Support.Common.Models.PromotionService.DiscountValidations.DiscountValidation discountValidation, CartDTO cartDto)
        {
            switch (discountValidation.Operator)
            {
            case DiscountValidationOperator.MoreThan:
            {
                if (cartDto.SubTotalAmount < decimal.Parse(discountValidation.Value))
                {
                    return(new ValidateDiscountCodeDTO()
                        {
                            IsValid = false,
                            Message = "Subtotal amount less than discount code condition"
                        });
                }
                break;
            }

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(null);
        }