public async Task <bool> ShopperHasPurchasedProduct(string shopperId, string productId) { bool hasPurchased = false; try { VtexOrderList vtexOrderList = await _productReviewRepository.ListOrders($"q={shopperId}"); var orderIds = vtexOrderList.List.Select(o => o.OrderId); foreach (string orderId in orderIds) { VtexOrder vtexOrder = await _productReviewRepository.GetOrderInformation(orderId); var productIds = vtexOrder.Items.Select(i => i.ProductId); hasPurchased = productIds.Contains(productId); if (hasPurchased) { break; } } } catch (Exception ex) { _context.Vtex.Logger.Error("ShopperHasPurchasedProduct", null, "Request Error", ex); } return(hasPurchased); }