public static ShippingMethod ToWebModel(this VirtoCommerceCartModuleWebModelShippingMethod shippingMethod)
        {
            var shippingMethodModel = new ShippingMethod();

            shippingMethodModel.InjectFrom(shippingMethod);

            var currency = new Currency(EnumUtility.SafeParse(shippingMethod.Currency, CurrencyCodes.USD));

            if (shippingMethod.Discounts != null)
            {
                shippingMethodModel.Discounts = shippingMethod.Discounts.Select(d => d.ToWebModel()).ToList();
            }

            shippingMethodModel.Price = new Money(shippingMethod.Price ?? 0, currency.Code);

            return(shippingMethodModel);
        }
        public static ShippingMethod ToWebModel(this VirtoCommerceCartModuleWebModelShippingMethod shippingMethod, IEnumerable <Currency> availCurrencies, Language language)
        {
            var shippingMethodModel = new ShippingMethod();

            shippingMethodModel.InjectFrom(shippingMethod);

            var currency = availCurrencies.FirstOrDefault(x => x.Equals(shippingMethod.Currency)) ?? new Currency(language, shippingMethod.Currency);

            if (shippingMethod.Discounts != null)
            {
                shippingMethodModel.Discounts = shippingMethod.Discounts.Select(d => d.ToWebModel(availCurrencies, language)).ToList();
            }

            shippingMethodModel.Price = new Money(shippingMethod.Price ?? 0, currency);

            return(shippingMethodModel);
        }