Prevent negative item orders (#392)

* Pulling changes over from previous branch

* Adding exception and guard clause
This commit is contained in:
Eric Fleming
2020-06-12 21:06:23 -04:00
committed by GitHub
parent 0af21d22f5
commit 248b8ed632
10 changed files with 133 additions and 46 deletions

View File

@@ -33,6 +33,7 @@ namespace Microsoft.eShopWeb.ApplicationCore.Services
var basket = await _basketRepository.FirstOrDefaultAsync(basketSpec);
Guard.Against.NullBasket(basketId, basket);
Guard.Against.EmptyBasketOnCheckout(basket.Items);
var catalogItemsSpecification = new CatalogItemsSpecification(basket.Items.Select(item => item.CatalogItemId).ToArray());
var catalogItems = await _itemRepository.ListAsync(catalogItemsSpecification);