diff --git a/.version b/.version index 0bc022d..99a3501 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -1.0.7.10 \ No newline at end of file +1.0.9.11 \ No newline at end of file diff --git a/Netina.Api/Controllers/ProductController.cs b/Netina.Api/Controllers/ProductController.cs index c2157d1..3879b4e 100644 --- a/Netina.Api/Controllers/ProductController.cs +++ b/Netina.Api/Controllers/ProductController.cs @@ -36,12 +36,21 @@ public class ProductController : ICarterModule } // GET:Get All Entity - public async Task GetAllAsync([FromQuery] int page, [FromQuery]string? productName, [FromQuery] QuerySortBy? sortBy, [FromQuery] Guid? categoryId, [FromQuery] bool? specialOffer, [FromQuery] Guid[]? brandIds , [FromQuery]double? minPrice , [FromQuery] double? maxPrice, [FromQuery]bool? isActive, IMediator mediator, CancellationToken cancellationToken) - => TypedResults.Ok(await mediator.Send(new GetProductsQuery(Page: page, SpecialOffer: specialOffer, SortBy: sortBy ?? 0 ,ProductName: productName, CategoryId: categoryId ?? default , BrandIds: brandIds , MinPrice: minPrice ?? -1 , MaxPrice:maxPrice ?? 0,IsActive:isActive),cancellationToken)); + public async Task GetAllAsync([FromQuery] int page, + [FromQuery] string? productName, + [FromQuery] QuerySortBy? sortBy, + [FromQuery] Guid? categoryId, + [FromQuery] bool? specialOffer, + [FromQuery] Guid[]? brandIds, + [FromQuery] double? minPrice, + [FromQuery] double? maxPrice, + [FromQuery] bool? isActive, + IMediator mediator, CancellationToken cancellationToken) + => TypedResults.Ok(await mediator.Send(new GetProductsQuery(Page: page, SpecialOffer: specialOffer, SortBy: sortBy ?? 0, ProductName: productName, CategoryId: categoryId ?? default, BrandIds: brandIds, MinPrice: minPrice ?? -1, MaxPrice: maxPrice ?? 0, IsActive: isActive), cancellationToken)); // GET:Get An Entity By Id - public async Task GetAsync(Guid id, IMediator mediator,CancellationToken cancellationToken) - => TypedResults.Ok(await mediator.Send(new GetProductQuery(id),cancellationToken)); + public async Task GetAsync(Guid id, IMediator mediator, CancellationToken cancellationToken) + => TypedResults.Ok(await mediator.Send(new GetProductQuery(id), cancellationToken)); // POST:Create Entity public async Task Post([FromBody] CreateProductCommand request, IMediator mediator, @@ -53,7 +62,7 @@ public class ProductController : ICarterModule CancellationToken cancellationToken) => TypedResults.Ok(await mediator.Send(request, cancellationToken)); - public async Task ChangeDisplayedAsync(Guid productId, [FromQuery]bool beDisplayed, [FromServices] IMediator mediator, CancellationToken cancellationToken) + public async Task ChangeDisplayedAsync(Guid productId, [FromQuery] bool beDisplayed, [FromServices] IMediator mediator, CancellationToken cancellationToken) => TypedResults.Ok(await mediator.Send(new ChangeProductDisplayedCommand(productId, beDisplayed), cancellationToken)); // DELETE:Delete Entity diff --git a/Netina.Api/Netina.Api.csproj b/Netina.Api/Netina.Api.csproj index cc32a8a..d84a3e8 100644 --- a/Netina.Api/Netina.Api.csproj +++ b/Netina.Api/Netina.Api.csproj @@ -6,8 +6,8 @@ enable true Linux - 1.0.7.10 - 1.0.7.10 + 1.0.9.11 + 1.0.9.11 diff --git a/Netina.Api/Program.cs b/Netina.Api/Program.cs index 76f3385..3539a43 100644 --- a/Netina.Api/Program.cs +++ b/Netina.Api/Program.cs @@ -41,7 +41,6 @@ builder.Services.AddMarten(configuration,builder.Environment); builder.Services.AddCarter(); -Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("NjU5MUAzMTM5MmUzMTJlMzBmYlFPZXRJVThMS20zaFlBdjdKMnlKeGJRQng4b0lURDZ1Rk40akFHbnVrPQ=="); builder.Host.ConfigureContainer(builder => diff --git a/Netina.Core/CoreConfig.cs b/Netina.Core/CoreConfig.cs index 627b896..0c06675 100644 --- a/Netina.Core/CoreConfig.cs +++ b/Netina.Core/CoreConfig.cs @@ -8,6 +8,7 @@ public static class CoreConfig public static async Task CoreInit(this IApplicationBuilder app) { + Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("NjA1NkAzMjM2MkUzMTJFMzliSzVTQlJKN0NLVzNVOFVKSlErcVEzYW9PSkZ2dUhicHliVjkrMncxdHpRPQ=="); var scopeFactory = app.ApplicationServices.GetRequiredService(); using (var scope = scopeFactory.CreateScope()) { diff --git a/Netina.Core/EntityServices/OrderHandlers/CalculateOrderCommandHandler.cs b/Netina.Core/EntityServices/OrderHandlers/CalculateOrderCommandHandler.cs index a6b124c..b610617 100644 --- a/Netina.Core/EntityServices/OrderHandlers/CalculateOrderCommandHandler.cs +++ b/Netina.Core/EntityServices/OrderHandlers/CalculateOrderCommandHandler.cs @@ -1,10 +1,14 @@ namespace Netina.Core.EntityServices.OrderHandlers; -public class CalculateOrderCommandHandler(IRepositoryWrapper repositoryWrapper, IMediator mediator) : IRequestHandler +public class CalculateOrderCommandHandler(IRepositoryWrapper repositoryWrapper, IMediator mediator,ISettingService settingService) : IRequestHandler { public async Task Handle(CalculateOrderCommand request, CancellationToken cancellationToken) { + var setting = await settingService.GetSettingAsync("ShopSetting", cancellationToken); + double taxesFee = 9; + if (setting is ShopSetting shopSetting) + taxesFee = shopSetting.TaxesFee; var order = await mediator.Send(new GetOrderQuery(request.OrderId), cancellationToken); if (order.OrderStatus != OrderStatus.OrderBag) throw new AppException("Order is not in bag status and cant be calculate", ApiResultStatusCode.BadRequest); @@ -22,7 +26,7 @@ public class CalculateOrderCommandHandler(IRepositoryWrapper repositoryWrapper, if (!order.DiscountCode.IsNullOrEmpty()) discountCodePrice += await mediator.Send(new CalculateOrderDiscountCommand(order.DiscountCode, order),cancellationToken); - var taxesPrice = (((totalProductPrice - (discountCodePrice + productDiscountPrice)) + totalPackingPrice + servicePrice) / 100) * 10; + var taxesPrice = (((totalProductPrice - (discountCodePrice + productDiscountPrice)) + totalPackingPrice + servicePrice) / 100) * taxesFee; order.SetTotalPrice(totalProductPrice, totalPackingPrice, servicePrice, deliveryPrice, productDiscountPrice, discountCodePrice, taxesPrice); diff --git a/Netina.Core/Netina.Core.csproj b/Netina.Core/Netina.Core.csproj index f9710f9..4a9947b 100644 --- a/Netina.Core/Netina.Core.csproj +++ b/Netina.Core/Netina.Core.csproj @@ -14,7 +14,7 @@ - +