diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Config/UrlsConfig.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Config/UrlsConfig.cs index c0bb9502e..90fa010cd 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Config/UrlsConfig.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Config/UrlsConfig.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config { @@ -10,12 +7,14 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config public class CatalogOperations { public static string GetItemById(int id) => $"/api/v1/catalog/items/{id}"; + public static string GetItemsById(IEnumerable ids) => $"/api/v1/catalog/items?ids={string.Join(',', ids)}"; } public class BasketOperations { public static string GetItemById(string id) => $"/api/v1/basket/{id}"; + public static string UpdateBasket() => "/api/v1/basket"; } @@ -25,10 +24,15 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config } public string Basket { get; set; } + public string Catalog { get; set; } + public string Orders { get; set; } + public string GrpcBasket { get; set; } + public string GrpcCatalog { get; set; } + public string GrpcOrdering { get; set; } } } diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/HomeController.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/HomeController.cs index 48a71480a..e72e23ca7 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/HomeController.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Controllers/HomeController.cs @@ -1,8 +1,4 @@ using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers { diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs index 3b8298bfe..e975edb23 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs @@ -1,10 +1,11 @@ -namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Filters +using Microsoft.AspNetCore.Authorization; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Filters { - using Microsoft.AspNetCore.Authorization; - using Microsoft.OpenApi.Models; - using Swashbuckle.AspNetCore.SwaggerGen; - using System.Collections.Generic; - using System.Linq; namespace Basket.API.Infrastructure.Filters { diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/AddBasketItemRequest.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/AddBasketItemRequest.cs index f81842c09..d0271d84b 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/AddBasketItemRequest.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/AddBasketItemRequest.cs @@ -1,13 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models +namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models { public class AddBasketItemRequest { public int CatalogItemId { get; set; } + public string BasketId { get; set; } public int Quantity { get; set; } diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/BasketData.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/BasketData.cs index 426b8d2b5..7a43d58e5 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/BasketData.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/BasketData.cs @@ -2,6 +2,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models { + public class BasketData { public string BuyerId { get; set; } @@ -10,7 +11,6 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models public BasketData() { - } public BasketData(string buyerId) @@ -19,15 +19,4 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models } } - public class BasketDataItem - { - public string Id { get; set; } - public int ProductId { get; set; } - public string ProductName { get; set; } - public decimal UnitPrice { get; set; } - public decimal OldUnitPrice { get; set; } - public int Quantity { get; set; } - public string PictureUrl { get; set; } - - } } diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/BasketDataItem.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/BasketDataItem.cs new file mode 100644 index 000000000..3ff91df4f --- /dev/null +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/BasketDataItem.cs @@ -0,0 +1,21 @@ +namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models +{ + + public class BasketDataItem + { + public string Id { get; set; } + + public int ProductId { get; set; } + + public string ProductName { get; set; } + + public decimal UnitPrice { get; set; } + + public decimal OldUnitPrice { get; set; } + + public int Quantity { get; set; } + + public string PictureUrl { get; set; } + } + +} diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs index e63b453a4..44749ff6c 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs @@ -3,23 +3,39 @@ using System.Collections.Generic; namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models { + public class OrderData { public string OrderNumber { get; set; } + public DateTime Date { get; set; } + public string Status { get; set; } + public decimal Total { get; set; } + public string Description { get; set; } + public string City { get; set; } + public string Street { get; set; } + public string State { get; set; } + public string Country { get; set; } + public string ZipCode { get; set; } + public string CardNumber { get; set; } + public string CardHolderName { get; set; } + public bool IsDraft { get; set; } + public DateTime CardExpiration { get; set; } + public string CardExpirationShort { get; set; } + public string CardSecurityNumber { get; set; } public int CardTypeId { get; set; } @@ -28,4 +44,5 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models public List OrderItems { get; } = new List(); } + } diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderItemData.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderItemData.cs index 023cf20e5..b3832fa21 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderItemData.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderItemData.cs @@ -1,12 +1,19 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models { + public class OrderItemData { public int ProductId { get; set; } + public string ProductName { get; set; } + public decimal UnitPrice { get; set; } + public decimal Discount { get; set; } + public int Units { get; set; } + public string PictureUrl { get; set; } } + } diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemData.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemData.cs new file mode 100644 index 000000000..f8ec70d5f --- /dev/null +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemData.cs @@ -0,0 +1,16 @@ +namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models +{ + + public class UpdateBasketItemData + { + public string BasketItemId { get; set; } + + public int NewQty { get; set; } + + public UpdateBasketItemData() + { + NewQty = 0; + } + } + +} diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs index 35b3e76c0..c5a6ccb3e 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs @@ -2,6 +2,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models { + public class UpdateBasketItemsRequest { @@ -15,14 +16,4 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models } } - public class UpdateBasketItemData - { - public string BasketItemId { get; set; } - public int NewQty { get; set; } - - public UpdateBasketItemData() - { - NewQty = 0; - } - } } diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs index b377921be..a1c255551 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs @@ -2,6 +2,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models { + public class UpdateBasketRequest { public string BuyerId { get; set; } @@ -9,10 +10,4 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models public IEnumerable Items { get; set; } } - public class UpdateBasketRequestItemData - { - public string Id { get; set; } // Basket id - public int ProductId { get; set; } // Catalog item id - public int Quantity { get; set; } // Quantity - } } diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequestItemData.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequestItemData.cs new file mode 100644 index 000000000..af28e0157 --- /dev/null +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequestItemData.cs @@ -0,0 +1,13 @@ +namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models +{ + + public class UpdateBasketRequestItemData + { + public string Id { get; set; } // Basket id + + public int ProductId { get; set; } // Catalog item id + + public int Quantity { get; set; } // Quantity + } + +} diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Program.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Program.cs index f536ec19a..2fc86c51f 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Program.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Program.cs @@ -1,10 +1,8 @@ using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.Extensions.Configuration; using Serilog; using System.IO; -using System.Net; namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator { diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs index 609b6cdd9..8bd4c8948 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs @@ -1,14 +1,12 @@ using Grpc.Net.Client; +using GrpcBasket; using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config; using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using System; using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using GrpcBasket; -using Grpc.Core; namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services { diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/CatalogService.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/CatalogService.cs index 2cf160d80..f98b90989 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/CatalogService.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/CatalogService.cs @@ -1,5 +1,4 @@ using CatalogApi; -using Grpc.Net.Client; using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config; using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models; using Microsoft.Extensions.Options; diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/GrpcCallerService.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/GrpcCallerService.cs index fe857c6cc..55f3df3ee 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/GrpcCallerService.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/GrpcCallerService.cs @@ -1,9 +1,8 @@ -using System.Net.Http; -using System.Threading.Tasks; -using System; -using Grpc.Core; -using Serilog; +using Grpc.Core; using Grpc.Net.Client; +using Serilog; +using System; +using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services { diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/OrderingService.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/OrderingService.cs index a48c942de..d34a5338a 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/OrderingService.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/OrderingService.cs @@ -1,4 +1,4 @@ -using Grpc.Net.Client; +using GrpcOrdering; using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config; using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models; using Microsoft.Extensions.Logging; @@ -6,7 +6,6 @@ using Microsoft.Extensions.Options; using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using GrpcOrdering; namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services { diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs index dccccab35..b16530e1b 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs @@ -1,17 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config { + public class UrlsConfig { + public class CatalogOperations { // grpc call under REST must go trough port 80 public static string GetItemById(int id) => $"/api/v1/catalog/items/{id}"; + public static string GetItemById(string ids) => $"/api/v1/catalog/items/ids/{string.Join(',', ids)}"; + // REST call standard must go through port 5000 public static string GetItemsById(IEnumerable ids) => $":5000/api/v1/catalog/items?ids={string.Join(',', ids)}"; } @@ -19,6 +20,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config public class BasketOperations { public static string GetItemById(string id) => $"/api/v1/basket/{id}"; + public static string UpdateBasket() => "/api/v1/basket"; } @@ -28,10 +30,16 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config } public string Basket { get; set; } + public string Catalog { get; set; } + public string Orders { get; set; } + public string GrpcBasket { get; set; } + public string GrpcCatalog { get; set; } + public string GrpcOrdering { get; set; } } + } diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/BasketController.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/BasketController.cs index dd5d4e85c..9471c6e09 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/BasketController.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/BasketController.cs @@ -3,12 +3,9 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; using System; -using System.Collections.Generic; using System.Linq; using System.Net; using System.Threading.Tasks; -using Serilog; -using Newtonsoft.Json; namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers { diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/HomeController.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/HomeController.cs index 58ed48d1a..e742e2bd6 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/HomeController.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/HomeController.cs @@ -1,8 +1,4 @@ using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers { diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/OrderController.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/OrderController.cs index 4b88c45b6..e528b478f 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/OrderController.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Controllers/OrderController.cs @@ -2,9 +2,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services; -using System; -using System.Collections.Generic; -using System.Linq; using System.Net; using System.Threading.Tasks; diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs index 45c191104..c273fd19e 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Filters/AuthorizeCheckOperationFilter.cs @@ -1,11 +1,11 @@ -namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters -{ - using Microsoft.AspNetCore.Authorization; - using Microsoft.OpenApi.Models; - using Swashbuckle.AspNetCore.SwaggerGen; - using System.Collections.Generic; - using System.Linq; +using Microsoft.AspNetCore.Authorization; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; +using System.Collections.Generic; +using System.Linq; +namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters +{ namespace Basket.API.Infrastructure.Filters { public class AuthorizeCheckOperationFilter : IOperationFilter diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/AddBasketItemRequest.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/AddBasketItemRequest.cs index 88aff245f..e9a6492c0 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/AddBasketItemRequest.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/AddBasketItemRequest.cs @@ -1,13 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models +namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models { + public class AddBasketItemRequest { public int CatalogItemId { get; set; } + public string BasketId { get; set; } public int Quantity { get; set; } @@ -17,4 +14,5 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models Quantity = 1; } } + } diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/BasketData.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/BasketData.cs index 507c7cdb7..18e855837 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/BasketData.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/BasketData.cs @@ -2,6 +2,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models { + public class BasketData { public string BuyerId { get; set; } @@ -10,7 +11,6 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models public BasketData() { - } public BasketData(string buyerId) @@ -19,15 +19,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models } } - public class BasketDataItem - { - public string Id { get; set; } - public int ProductId { get; set; } - public string ProductName { get; set; } - public decimal UnitPrice { get; set; } - public decimal OldUnitPrice { get; set; } - public int Quantity { get; set; } - public string PictureUrl { get; set; } - - } } diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/BasketDataItem.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/BasketDataItem.cs new file mode 100644 index 000000000..05fed054e --- /dev/null +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/BasketDataItem.cs @@ -0,0 +1,21 @@ +namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models +{ + + public class BasketDataItem + { + public string Id { get; set; } + + public int ProductId { get; set; } + + public string ProductName { get; set; } + + public decimal UnitPrice { get; set; } + + public decimal OldUnitPrice { get; set; } + + public int Quantity { get; set; } + + public string PictureUrl { get; set; } + } + +} diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/CatalogItem.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/CatalogItem.cs index 43e8e1cd1..68c856970 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/CatalogItem.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/CatalogItem.cs @@ -1,5 +1,6 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models { + public class CatalogItem { public int Id { get; set; } @@ -10,4 +11,5 @@ public string PictureUri { get; set; } } + } diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/OrderData.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/OrderData.cs index e9d5982b9..c4536d697 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/OrderData.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/OrderData.cs @@ -1,27 +1,41 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models { + public class OrderData { public string OrderNumber { get; set; } + public DateTime Date { get; set; } + public string Status { get; set; } + public decimal Total { get; set; } + public string Description { get; set; } + public string City { get; set; } + public string Street { get; set; } + public string State { get; set; } + public string Country { get; set; } + public string ZipCode { get; set; } + public string CardNumber { get; set; } + public string CardHolderName { get; set; } + public bool IsDraft { get; set; } + public DateTime CardExpiration { get; set; } + public string CardExpirationShort { get; set; } + public string CardSecurityNumber { get; set; } public int CardTypeId { get; set; } @@ -30,4 +44,5 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models public List OrderItems { get; } = new List(); } + } diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/OrderItemData.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/OrderItemData.cs index 1a40cb8cb..0c2082fa2 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/OrderItemData.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/OrderItemData.cs @@ -1,17 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models +namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models { + public class OrderItemData { public int ProductId { get; set; } + public string ProductName { get; set; } + public decimal UnitPrice { get; set; } + public decimal Discount { get; set; } + public int Units { get; set; } + public string PictureUrl { get; set; } } + } diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketItemData.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketItemData.cs new file mode 100644 index 000000000..b75784aa2 --- /dev/null +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketItemData.cs @@ -0,0 +1,16 @@ +namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models +{ + + public class UpdateBasketItemData + { + public string BasketItemId { get; set; } + + public int NewQty { get; set; } + + public UpdateBasketItemData() + { + NewQty = 0; + } + } + +} diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs index b41c069bc..3e356dfe1 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs @@ -1,13 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models { + public class UpdateBasketItemsRequest { - public string BasketId { get; set; } public ICollection Updates { get; set; } @@ -18,14 +15,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models } } - public class UpdateBasketItemData - { - public string BasketItemId { get; set; } - public int NewQty { get; set; } - - public UpdateBasketItemData() - { - NewQty = 0; - } - } } diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs index 9beeeade4..070016f70 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs @@ -1,10 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models { + public class UpdateBasketRequest { public string BuyerId { get; set; } @@ -12,10 +10,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models public IEnumerable Items { get; set; } } - public class UpdateBasketRequestItemData - { - public string Id { get; set; } // Basket id - public int ProductId { get; set; } // Catalog item id - public int Quantity { get; set; } // Quantity - } } diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketRequestItemData.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketRequestItemData.cs new file mode 100644 index 000000000..90800374d --- /dev/null +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Models/UpdateBasketRequestItemData.cs @@ -0,0 +1,11 @@ +namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models +{ + public class UpdateBasketRequestItemData + { + public string Id { get; set; } // Basket id + + public int ProductId { get; set; } // Catalog item id + + public int Quantity { get; set; } // Quantity + } +} diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/BasketService.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/BasketService.cs index b289e98d6..7e85132cd 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/BasketService.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/BasketService.cs @@ -1,12 +1,11 @@ -using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config; +using GrpcBasket; +using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config; using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using System.Threading.Tasks; -using Grpc.Net.Client; using System.Linq; -using GrpcBasket; using System.Net.Http; +using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services { diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/CatalogService.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/CatalogService.cs index c10094928..059e1d046 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/CatalogService.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/CatalogService.cs @@ -1,15 +1,13 @@ -using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config; +using CatalogApi; +using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config; using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System.Collections.Generic; +using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using CatalogApi; -using Grpc.Net.Client; -using System; using static CatalogApi.Catalog; -using System.Linq; namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services { diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/GrpcCallerService.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/GrpcCallerService.cs index 43138f987..2039c7c4f 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/GrpcCallerService.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/GrpcCallerService.cs @@ -1,8 +1,8 @@ -using System.Threading.Tasks; -using System; -using Grpc.Core; -using Serilog; +using Grpc.Core; using Grpc.Net.Client; +using Serilog; +using System; +using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services { diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderingService.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderingService.cs index 8075a507c..b460f4864 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderingService.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderingService.cs @@ -1,14 +1,11 @@ -using Grpc.Net.Client; +using GrpcOrdering; using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config; using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using System; using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using GrpcOrdering; -using Grpc.Core; namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services { diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs index f9cd93819..1ea6c0f4f 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs @@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config; using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters.Basket.API.Infrastructure.Filters; using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure;