public PromotionElement getPromotionElement(int promotionId) { PromotionElement promotionElement = null; _mPromotionElementList.TryGetValue(promotionId, out promotionElement); return(promotionElement); }
public PromotionCollection GetPromotionCollectionMock() { PromotionCollection promotionCollection = new PromotionCollection(); PromotionElement pe = new PromotionElement { FreeSKUList = new FreeSKUCollection { new FreeSKU { Quantity = 1, SKU = "376P" } }, AmountMax = -1, AmountMaxInclude = -1, AmountMin = -1, AmountMinInclude = -1, Code = "00014", CustCategoryTypeList = new List <string>(), SelectableSKUList = new FreeSKUCollection { new FreeSKU { Quantity = 1, SKU = "1447" } }, StartDate = Convert.ToDateTime("2016-02-01 00:00:00").ToString(CultureInfo.InvariantCulture), EndDate = Convert.ToDateTime("2016-02-28 11:59:59 PM").ToString(CultureInfo.InvariantCulture), excludedExpID = new List <string>(), VolumeMax = -1, VolumeMaxInclude = -1, VolumeMin = -1, VolumeMinInclude = 200, CurrentConfiguration = { }, CustCategoryType = "", CustType = "", LockAllAttributesExcept = { }, LockItem = false, LockAttributes = { }, LockElements = { }, PromotionType = PromotionType.Volume, NumOfMonth = 1, MaxFreight = -1, OnlineOrderOnly = false, FreeSKUListForSelectableSku = new FreeSKUCollection(), FreeSKUListForVolume = new FreeSKUCollection(), ForPC = false, CustTypeList = new List <string> { "DS,PC,FM,SR" }, DSStoreProvince = new List <string>(), DeliveryTypeList = new List <string>() }; promotionCollection.Add(pe); return(promotionCollection); }
private bool LoadPromotionElement(SecurityElement element, out PromotionElement itemElement) { itemElement = new PromotionElement(); string attribute = element.Attribute("Promotion_ID"); if (attribute != null) { itemElement.Promotion_ID = StrParser.ParseDecInt(attribute, -1); } attribute = element.Attribute("LineDay_Begin"); if (attribute != null) { itemElement.LineDay_Begin = StrParser.ParseDecInt(attribute, -1); } attribute = element.Attribute("LineDay_End"); if (attribute != null) { itemElement.LineDay_End = StrParser.ParseDecInt(attribute, -1); } attribute = element.Attribute("Reward"); if (attribute != null) { itemElement.Reward = StrParser.ParseStr(attribute, ""); } attribute = element.Attribute("Free_Chest"); if (attribute != null) { itemElement.Free_Chest = StrParser.ParseDecInt(attribute, -1); } attribute = element.Attribute("Original_Price"); if (attribute != null) { itemElement.Original_Price = StrParser.ParseDecInt(attribute, -1); } attribute = element.Attribute("Discount_Price"); if (attribute != null) { itemElement.Discount_Price = StrParser.ParseDecInt(attribute, -1); } return(true); }
private void setupCart() { MyHLShoppingCart _cart = new MyHLShoppingCart { CurrentItems = new ShoppingCartItemList(), CartItems = new ShoppingCartItemList(), CountryCode = "CN", DeliveryInfo = new MyHerbalife3.Ordering.Providers.Shipping.ShippingInfo(), DistributorID = "test123", RuleResults = new List <ShoppingCartRuleResult> { }, Totals = new HL.Order.ValueObjects.OrderTotals(), ShoppingCartItems = new List <Shared.Providers.DistributorShoppingCartItem>(), }; OrderTotals_V02 totals = new OrderTotals_V02 { AmountDue = 500, ChargeList = new HL.Order.ValueObjects.ChargeList { new HL.Order.ValueObjects.Charge_V01 { ChargeType = HL.Order.ValueObjects.ChargeTypes.FREIGHT, Amount = 25, DiscountedAmount = 1 } }, DiscountAmount = 1, ItemsTotal = 500, OrderFreight = new OrderFreight { ActualFreight = 1, Packages = new List <Package> { new Package { Packagetype = "C", Unit = 1, Volume = 0.0078045M } }, } }; _cart.CartItems.Add(new ShoppingCartItem_V01() { SKU = "1316", ID = 1, Quantity = 2 }); _cart.CurrentItems.Add(new ShoppingCartItem_V01() { SKU = "1316", ID = 1, Quantity = 2 }); _cart.RuleResults.Add(new ShoppingCartRuleResult { RuleName = "ETO Rules" }); _cart.DeliveryInfo = new MyHerbalife3.Ordering.Providers.Shipping.ShippingInfo { FreightCode = "22", AddressType = "EXP", WarehouseCode = "3019", Option = HL.Common.ValueObjects.DeliveryOptionType.Shipping }; _cart.Totals = totals; _cart.DeliveryInfo = new MyHerbalife3.Ordering.Providers.Shipping.ShippingInfo { Address = new HL.Shipping.ValueObjects.ShippingAddress_V01 { Address = new HL.Common.ValueObjects.Address_V01 { StateProvinceTerritory = "广西壮族自治区", City = "梧州市", Country = "CN", CountyDistrict = "蝶山区", PostalCode = "111111" } }, AddressType = "EXP" }; cart = _cart; var onePromo = new PromotionElement { AmountMinInclude = 500, PromotionType = HL.Order.ValueObjects.China.PromotionType.Freight, StartDate = DateTime.Now.ToString("MM-dd-yyyy"), EndDate = DateTime.Now.ToString("MM-dd-yyyy"), excludedExpID = new List <string> { "10,30" }, CustTypeList = new List <string> { "PC,CS" }, CustCategoryTypeList = new List <string> { "PC" }, Code = "DecPCPromo" }; promotionSet.Add(onePromo); // Session sessionInfo = new SessionInfo { ShippingAddresses = new List <HL.Shipping.ValueObjects.ShippingAddress_V02>() { new HL.Shipping.ValueObjects.ShippingAddress_V02 { Address = new HL.Common.ValueObjects.Address_V01 { City = "南宁市", StateProvinceTerritory = "广西壮族自治区", CountyDistrict = "青秀区", Country = "CN" } } } }; //DistributorProfile distributorProfile = new DistributorOrderingProfile { CNAPFStatus = 2, CNCustCategoryType = "PC", CNCustType = "PC", IsPC = true, Id = "test123", CNStoreProvince = "广西壮族自治区" }; }
public void ProcessOtherMarchPromotionPC_Test() { var Promotion = new PromotionElement { StartDate = "01-01-2016", EndDate = "01-31-2016", PromotionType = ServiceProvider.OrderChinaSvc.PromotionType.Other, HasIncrementaldegree = true, AmountMinInclude = 2000, CustTypeList = new List <string> { "PC", "CS" }, FreeSKUList = new FreeSKUCollection { new FreeSKU { Quantity = 1, SKU = "560P" } }, }; Promotion.Code = "00017"; var Cart = MyHLShoppingCartGenerator.GetBasicShoppingCart("CN1632369 ", "zh-CN", "20", "3019", new ShippingAddress_V02()); Cart.CartItems = new ShoppingCartItemList { ShoppingCartItemHelper.GetCartItem(1, 1, "1316"), ShoppingCartItemHelper.GetCartItem(2, 1, "1317"), }; var Order = new Order_V01(); Order.DistributorID = "CN1632369"; var order1 = new OnlineOrderItem() { Quantity = 10, SKU = "1316", Description = "", RetailPrice = 0, IsPromo = false, }; Order.OrderItems = new OrderItems { order1 }; Order.Shipment = new ShippingInfo_V01 { Address = new ServiceProvider.OrderSvc.Address() { City = "眉山市", Country = "cn" }, ShippingMethodID = "22", WarehouseCode = "3019" }; Order.CountryOfProcessing = "CN"; var ordertotal = new OrderTotals_V02(); GetQuotes(Order, ordertotal, false, out ordertotal); var promorule = new MyHerbalife3.Ordering.Rules.Promotional.zh_CN.PromotionalRules(); Cart.Totals = ordertotal; FreeSKUCollection skuCollection = promorule.CheckPcPromo(Promotion, Cart); Assert.AreEqual(skuCollection[0].Quantity, 2); }
public void ProcessVolumePromotionDSNovPromo_Test() { var promoelement = new PromotionElement { StartDate = "11-01-2015", EndDate = "11-30-2015", PromotionType = MyHerbalife3.Ordering.ServiceProvider.OrderChinaSvc.PromotionType.Volume, HasIncrementaldegree = true, VolumeMinInclude = 200, CustTypeList = new List <string> { "DS", "FM", "SC", "SP", "SQ" }, FreeSKUList = new FreeSKUCollection { new FreeSKU { Quantity = 1, SKU = "1443" }, new FreeSKU { Quantity = 1, SKU = "K365" }, }, SelectableSKUList = new FreeSKUCollection { new FreeSKU { Quantity = 1, SKU = "1316" }, new FreeSKU { Quantity = 1, SKU = "1318" }, }, FreeSKUListForVolume = new FreeSKUCollection { new FreeSKU { Quantity = 1, SKU = "1443" }, }, FreeSKUListForSelectableSku = new FreeSKUCollection { new FreeSKU { Quantity = 1, SKU = "K365" }, }, }; promoelement.Code = "DSNovPromo"; var cart = MyHLShoppingCartGenerator.GetBasicShoppingCart("CN640521", "zh-CN", "20", "3019", new ShippingAddress_V02()); cart.CartItems = new ShoppingCartItemList { ShoppingCartItemHelper.GetCartItem(1, 1, "1316"), ShoppingCartItemHelper.GetCartItem(2, 1, "1442"), ShoppingCartItemHelper.GetCartItem(3, 1, "1318") }; var order = new Order_V01(); order.DistributorID = "CN640521"; var orderitem1 = new OnlineOrderItem() { Quantity = 10, SKU = "1316", Description = "", RetailPrice = 0, IsPromo = false, }; var orderitem2 = new OnlineOrderItem() { Quantity = 1, SKU = "1442", Description = "", RetailPrice = 0, IsPromo = false, }; var orderitem3 = new OnlineOrderItem() { Quantity = 1, SKU = "1318", Description = "", RetailPrice = 0, IsPromo = false, }; order.OrderItems = new OrderItems { orderitem1, orderitem2, orderitem3 }; order.Shipment = new ShippingInfo_V01 { Address = new MyHerbalife3.Ordering.ServiceProvider.OrderSvc.Address { City = "眉山市", Country = "cn" }, ShippingMethodID = "22", WarehouseCode = "3019" }; order.CountryOfProcessing = "CN"; var ordertotal = new MyHerbalife3.Ordering.ServiceProvider.OrderSvc.OrderTotals_V02(); GetQuotes(order, ordertotal, false, out ordertotal); var promorule = new MyHerbalife3.Ordering.Rules.Promotional.zh_CN.PromotionalRules(); cart.Totals = ordertotal; FreeSKUCollection skuCollection = promorule.CheckDsNovPromo(promoelement, cart); Assert.AreEqual(skuCollection[0].Quantity, 3); }