/// <summary> /// Creates a list up to 12 DistributorShoppingCartItems with the parameters given /// </summary> /// <param name="locale">Locale</param> /// <param name="skus">Array of skus to be taken</param> /// <param name="lines">Number of lines to be added</param> /// <param name="qty">Quantity for each line</param> /// <returns>List of DistributorShoppingCartItem</returns> public static List <DistributorShoppingCartItem> GetDistributorShoppingCartItemList(string locale, List <string> skus, int lines, int qty) { var distributorShoppingCartItemList = new List <DistributorShoppingCartItem>(); var linesToAdd = (skus.Count < lines) ? skus.Count : lines; for (int i = 0; i < linesToAdd; i++) { distributorShoppingCartItemList.Add(ShoppingCartItemHelper.GetCatalogItems(1, qty, skus[i], locale)); } return(distributorShoppingCartItemList); }
internal static MyHLShoppingCart GetBasicShoppingCart(string distributorId, string locale, string freightCode, string wareHouseCode, ShippingAddress_V02 shiptoaddress) { if (string.IsNullOrEmpty(locale)) { locale = "en-US"; } var shoppingCart = new MyHLShoppingCart { Locale = locale, ShoppingCartItems = new List <DistributorShoppingCartItem> { ShoppingCartItemHelper.GetShoppingCartItem(1, 1, "1231"), ShoppingCartItemHelper.GetShoppingCartItem(2, 1, "0138"), ShoppingCartItemHelper.GetShoppingCartItem(3, 1, "0139") }, CartItems = new ShoppingCartItemList { ShoppingCartItemHelper.GetCartItem(1, 1, "1231"), ShoppingCartItemHelper.GetCartItem(2, 1, "0138"), ShoppingCartItemHelper.GetCartItem(3, 1, "0139") }, DistributorID = string.IsNullOrEmpty(distributorId) ? "webtest1" : distributorId, FreightCode = freightCode, DeliveryInfo = new ShippingInfo { FreightCode = freightCode, WarehouseCode = wareHouseCode, Option = ServiceProvider.ShippingSvc.DeliveryOptionType.Shipping, Address = shiptoaddress }, CountryCode = locale.Substring(3) }; shoppingCart.Totals = new OrderTotals_V01() { AmountDue = 1000M, BalanceAmount = 900M, DiscountPercentage = 50M, VolumePoints = 1000 }; return(shoppingCart); }
public void NumberOfSkuSubjectToFraudCheckTest() { MyHLShoppingCart cart = MyHLShoppingCartGenerator.GetBasicShoppingCart("STAFF", "en-US", "FED", "03", ShoppingCartItemHelper.GetDistributorShoppingCartItemList(new List <string> { "1455", "8612", "2674" }), ServiceProvider.CatalogSvc.OrderCategoryType.RSO); MyHLConfiguration conf = createMyHLConfiguration(100, new List <DistributorLevelType> { DistributorLevelType._DS }, true, false, 10, new List <string> { "F1P" }, 2, false, new List <string>(), 100, new List <string>()); // var result = FraudControlProvider.IsSubjectToFraudCheck("en-US", cart, "DS", DateTime.Now.AddYears(-1), conf); Assert.AreEqual(true, result); }