Beispiel #1
0
        public async virtual Task <ShippingMethodTypesViewModel> GetShippingMethodTypesAsync(GetShippingMethodsParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }

            var shippingMethods = await GetFulfillmentMethods(param).ConfigureAwait(false);

            if (shippingMethods == null)
            {
                return(null);
            }

            var shippingMethodTypeViewModels = shippingMethods
                                               .Select(sm => CartViewModelFactory.GetShippingMethodViewModel(sm, param.CultureInfo))
                                               .Where(FilterShippingMethodView)
                                               .GroupBy(sm => sm.FulfillmentMethodType)
                                               .Select(type => CartViewModelFactory.GetShippingMethodTypeViewModel(type.Key, type.ToList(), param.CultureInfo))
                                               .OrderBy(OrderShippingMethodTypeView)
                                               .ToList();

            return(new ShippingMethodTypesViewModel
            {
                ShippingMethodTypes = shippingMethodTypeViewModels
            });
        }