/// <summary> /// Convert a coupon adjustment into a merchant code. /// </summary> /// <param name="item">The coupon to convert</param> public MerchantCode(AutoGen.CouponAdjustment item) { this.CodeType = MerchantCodeType.Coupon; this.AppliedAmount = item.appliedamount.Value; this.CalculatedAmount = item.calculatedamount.Value; this.Code = item.code; this.Message = item.message; }
/// <summary> /// Obtain the Merchant Codes from the OrderAdjustmentMerchantcodes. /// </summary> /// <param name="merchantcodes">The <seealso cref="AutoGen.OrderAdjustmentMerchantcodes"/></param> /// <returns></returns> public static List <MerchantCode> GetMerchantCodes(AutoGen.OrderAdjustmentMerchantcodes merchantcodes) { List <MerchantCode> retVal = new List <MerchantCode>(); if (merchantcodes == null) { return(retVal); } foreach (object item in merchantcodes.Items) { if (item is AutoGen.CouponAdjustment) { AutoGen.CouponAdjustment adjust = item as AutoGen.CouponAdjustment; retVal.Add(new MerchantCode(adjust)); } if (item is AutoGen.GiftCertificateAdjustment) { AutoGen.GiftCertificateAdjustment adjust = item as AutoGen.GiftCertificateAdjustment; retVal.Add(new MerchantCode(adjust)); } } return(retVal); }