public async Task CanPrepareEstimateShippingModel() { var model = await _shoppingCartModelFactory.PrepareEstimateShippingModelAsync(await _shoppingCartService.GetShoppingCartAsync(await _workContext.GetCurrentCustomerAsync())); model.AvailableCountries.Any().Should().BeTrue(); model.AvailableStates.Any().Should().BeTrue(); model.Enabled.Should().BeTrue(); model.ZipPostalCode.Should().Be("10021"); model.CountryId.Should().BeNull(); model.StateProvinceId.Should().BeNull(); }
public async Task <IViewComponentResult> InvokeAsync(bool?prepareAndDisplayOrderReviewData) { if (!_shippingSettings.EstimateShippingCartPageEnabled) { return(Content(string.Empty)); } var cart = await _shoppingCartService.GetShoppingCartAsync(await _workContext.GetCurrentCustomerAsync(), ShoppingCartType.ShoppingCart, (await _storeContext.GetCurrentStoreAsync()).Id); var model = await _shoppingCartModelFactory.PrepareEstimateShippingModelAsync(cart); if (!model.Enabled) { return(Content(string.Empty)); } return(View(model)); }