private void CheckMultipleCoupons(PromotionFilterContext filterContext, IList <string> couponCodes, PromotionData includedPromotion, List <UniqueCoupon> uniqueCoupons) { foreach (var couponCode in uniqueCoupons) { // Check if the code its assigned to the user and that has not been used if (couponCodes.Contains(couponCode.Code, GetCodeEqualityComparer()) && couponCode.UsedRedemptions < couponCode.MaxRedemptions) { filterContext.AddCouponCode(includedPromotion.ContentGuid, couponCode.Code); return; } } filterContext.ExcludePromotion(includedPromotion, FulfillmentStatus.CouponCodeRequired, filterContext.RequestedStatuses.HasFlag(RequestFulfillmentStatus.NotFulfilled)); }
private void CheckSingleCoupon(PromotionFilterContext filterContext, IEnumerable <string> couponCodes, string couponCode, PromotionData includedPromotion) { if (couponCodes.Contains(couponCode, GetCodeEqualityComparer())) { filterContext.AddCouponCode(includedPromotion.ContentGuid, couponCode); } else { filterContext.ExcludePromotion( includedPromotion, FulfillmentStatus.CouponCodeRequired, filterContext.RequestedStatuses.HasFlag(RequestFulfillmentStatus.NotFulfilled)); } }