Exemple #1
0
 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));
 }
Exemple #2
0
 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));
     }
 }