public virtual Response <IList <ShippingMethodModel> > GetShippingMethods(ShoppingCartModel shoppingCartModel, string storeName = "", AddressModel addressModel = null) { var customer = this.customerService.GetCustomerByGuid(shoppingCartModel.CustomerGuid); if (customer == null) { return(new Response <IList <ShippingMethodModel> > { Success = false, Message = "Cannot find customer by guid" }); } if (customer.ShoppingCartItems == null) { return(new Response <IList <ShippingMethodModel> > { Success = false, Message = "Shopping curt items is null" }); } var store = this.storeService.GetAllStores() .FirstOrDefault(s => s.Name.Equals(storeName, StringComparison.CurrentCultureIgnoreCase)); var address = addressModel != null ? addressModel.MapToAddress() : customer.ShippingAddress; var optionResponse = this.shippingService.GetShippingOptions(customer.ShoppingCartItems.ToList(), address, string.Empty, store == null ? 0 : store.Id); var result = new List <ShippingMethodModel>(0); if (optionResponse.Success) { foreach (var shippingOption in optionResponse.ShippingOptions) { result.Add(new ShippingMethodModel { Name = shippingOption.Name, Description = shippingOption.Description, SystemName = shippingOption.ShippingRateComputationMethodSystemName }); } } return(new Response <IList <ShippingMethodModel> > { Success = true, Result = result }); }