private static IReadOnlyList <PaymentShippingOption> CreateShippingOptions(ShoppingCart shoppingCart) { List <PaymentShippingOption> paymentShippingOptions = new List <PaymentShippingOption>(); ShippingType selectedShippingType = shoppingCart.ShippingType; IReadOnlyDictionary <ShippingType, ShoppingCartCostsSummary> cartShippingOptions = shoppingCart.CalculateShippingOptions(); ShoppingCartCostsSummary costsOfSelectedShipping = cartShippingOptions[selectedShippingType]; foreach (var kvp in cartShippingOptions) { ShippingType shippingType = kvp.Key; ShoppingCartCostsSummary costs = kvp.Value; PaymentShippingOption shippingOption = new PaymentShippingOption( label: ShippingTypeStringUtilities.CreateShippingOptionTitle(shippingType, costs, costsOfSelectedShipping), selected: (shippingType == selectedShippingType), tag: shippingType.ToString(), amount: CreateCurrencyAmount(costs.Shipping)); paymentShippingOptions.Add(shippingOption); } return(paymentShippingOptions); }
/// <summary> /// Get the Name for the Enum Value /// </summary> /// <param name="shippingType">The ShippingType Value</param> /// <returns></returns> public static string GetSerializedName(ShippingType shippingType) { FieldInfo fi = t.GetField(shippingType.ToString()); return(EnumSerilizedNameAttribute.GetValue(fi)); }
/// <summary> /// Get the Shipping Comany Name for an Enum Value /// </summary> /// <param name="shippingType">The ShippingType Value</param> /// <returns></returns> public static string GetShippingCompany(ShippingType shippingType) { FieldInfo fi = t.GetField(shippingType.ToString()); return TypeDictionaryEntryAttribute.GetValue(fi, "shipping-company"); }
/// <summary> /// Get the Shipping Comany Name for an Enum Value /// </summary> /// <param name="shippingType">The ShippingType Value</param> /// <returns></returns> public static string GetShippingCompany(ShippingType shippingType) { FieldInfo fi = t.GetField(shippingType.ToString()); return(TypeDictionaryEntryAttribute.GetValue(fi, "shipping-company")); }
/// <summary> /// Get the Name for the Enum Value /// </summary> /// <param name="shippingType">The ShippingType Value</param> /// <returns></returns> public static string GetSerializedName(ShippingType shippingType) { FieldInfo fi = t.GetField(shippingType.ToString()); return EnumSerilizedNameAttribute.GetValue(fi); }