/// <summary> /// Maps an <see cref="IOfferResult{TConstraint,TAward}"/> to <see cref="ICouponRedemptionResult"/> /// </summary> /// <param name="attempt"> /// The attempt. /// </param> /// <param name="coupon"> /// The coupon. /// </param> /// <returns> /// The <see cref="ICouponRedemptionResult"/>. /// </returns> public static ICouponRedemptionResult AsCouponRedemptionResult(this Attempt<IOfferResult<ILineItemContainer, ILineItem>> attempt, ICoupon coupon = null) { var result = attempt.Success ? new CouponRedemptionResult(attempt.Result.Award, attempt.Result.Messages) : new CouponRedemptionResult( attempt.Exception, attempt.Result != null ? attempt.Result.Messages : null); result.Coupon = coupon; return result; }
public Incentive(string code, ICoupon coupon, DateTime expiresOn) { this.Code = code; this.Coupon = coupon; this.ExpiresOn = expiresOn; this.MustHaveProducts = new string[0]; }
private List<CouponEntryData> GetTaxonomyList() { //instantiate coupon service field _CouponService = _CouponService == null ? new Coupon(_CouponApi.RequestInformationRef) : _CouponService; // taxonomies Criteria<CouponEntryProperty> taxonomyCriteria = new Criteria<CouponEntryProperty>(); taxonomyCriteria.AddFilter(CouponEntryProperty.CouponId, CriteriaFilterOperator.EqualTo, this.CouponPublishedData.Id); taxonomyCriteria.AddFilter(CouponEntryProperty.IsIncluded, CriteriaFilterOperator.EqualTo, this.Scope == CouponScope.Exclude ? false : true); List<CouponEntryData> taxonomyList = _CouponService.GetTaxonomyList(taxonomyCriteria); return taxonomyList; }
public void Save(ICoupon coupon) { var sqlHelper = DataLayerHelper.CreateSqlHelper(GlobalSettings.DbDSN); sqlHelper.ExecuteNonQuery("update [uWebshopCoupons] set NumberAvailable = @NumberAvailable WHERE DiscountId = @DiscountId and CouponCode = @CouponCode", sqlHelper.CreateParameter("@DiscountId", coupon.DiscountId), sqlHelper.CreateParameter("@CouponCode", coupon.CouponCode), sqlHelper.CreateParameter("@NumberAvailable", coupon.NumberAvailable)); }
/// <summary> /// Serialized and stores the coupon into the <see cref="ExtendedDataCollection"/> /// </summary> /// <param name="extendedData"> /// The extended data. /// </param> /// <param name="coupon"> /// The coupon. /// </param> internal static void SetCouponValue(this ExtendedDataCollection extendedData, ICoupon coupon) { extendedData.SetValue( Core.Constants.ExtendedDataKeys.CouponReward, JsonConvert.SerializeObject(((Coupon)coupon).Settings.ToOfferSettingsDisplay())); }
public ICoupon UpdateCoupon(ICoupon Coupon) { throw new NotImplementedException(); }
public ICoupon CreateCoupon(ICoupon Coupon, int ProductFamilyID) { throw new NotImplementedException(); }