update
This commit is contained in:
784
docs/model.ndm2
784
docs/model.ndm2
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,8 @@ using CMSMicroservice.Protobuf.Protos.UserAddress;
|
|||||||
using CMSMicroservice.Protobuf.Protos.UserCarts;
|
using CMSMicroservice.Protobuf.Protos.UserCarts;
|
||||||
using CMSMicroservice.Protobuf.Protos.UserContract;
|
using CMSMicroservice.Protobuf.Protos.UserContract;
|
||||||
using CMSMicroservice.Protobuf.Protos.UserOrder;
|
using CMSMicroservice.Protobuf.Protos.UserOrder;
|
||||||
|
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||||
|
using CMSMicroservice.Protobuf.Protos.UserWalletChangeLog;
|
||||||
using PYMSMicroservice.Protobuf.Protos.Transaction;
|
using PYMSMicroservice.Protobuf.Protos.Transaction;
|
||||||
|
|
||||||
namespace FrontOffice.BFF.Application.Common.Interfaces;
|
namespace FrontOffice.BFF.Application.Common.Interfaces;
|
||||||
@@ -27,6 +29,8 @@ public interface IApplicationContractContext
|
|||||||
UserAddressContract.UserAddressContractClient UserAddress { get; }
|
UserAddressContract.UserAddressContractClient UserAddress { get; }
|
||||||
UserOrderContract.UserOrderContractClient UserOrder { get; }
|
UserOrderContract.UserOrderContractClient UserOrder { get; }
|
||||||
OtpTokenContract.OtpTokenContractClient OtpToken { get; }
|
OtpTokenContract.OtpTokenContractClient OtpToken { get; }
|
||||||
|
UserWalletContract.UserWalletContractClient UserWallet { get; }
|
||||||
|
UserWalletChangeLogContract.UserWalletChangeLogContractClient UserWalletChangeLog { get; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region PYMS
|
#region PYMS
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\FrontOffice.BFF.Domain\FrontOffice.BFF.Domain.csproj" />
|
<ProjectReference Include="..\FrontOffice.BFF.Domain\FrontOffice.BFF.Domain.csproj" />
|
||||||
|
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.UserOrder.Protobuf\FrontOffice.BFF.UserOrder.Protobuf.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,16 +1,28 @@
|
|||||||
|
using CMSMicroservice.Protobuf.Protos.UserOrder;
|
||||||
|
|
||||||
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
||||||
public class SubmitShopBuyOrderCommandHandler : IRequestHandler<SubmitShopBuyOrderCommand, SubmitShopBuyOrderResponseDto>
|
|
||||||
|
public class
|
||||||
|
SubmitShopBuyOrderCommandHandler : IRequestHandler<SubmitShopBuyOrderCommand, SubmitShopBuyOrderResponseDto>
|
||||||
{
|
{
|
||||||
private readonly IApplicationContractContext _context;
|
private readonly IApplicationContractContext _context;
|
||||||
|
private readonly ICurrentUserService _currentUserService;
|
||||||
|
|
||||||
public SubmitShopBuyOrderCommandHandler(IApplicationContractContext context)
|
public SubmitShopBuyOrderCommandHandler(IApplicationContractContext context, ICurrentUserService currentUserService)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
|
_currentUserService = currentUserService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SubmitShopBuyOrderResponseDto> Handle(SubmitShopBuyOrderCommand request, CancellationToken cancellationToken)
|
public async Task<SubmitShopBuyOrderResponseDto> Handle(SubmitShopBuyOrderCommand request,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
//TODO: Implement your business logic
|
var result = await _context.UserOrder.SubmitShopBuyOrderAsync(new SubmitShopBuyOrderRequest()
|
||||||
return new SubmitShopBuyOrderResponseDto();
|
{
|
||||||
|
UserId = _currentUserService.UserId.Value,
|
||||||
|
TotalAmount = request.TotalAmount
|
||||||
|
}, cancellationToken: cancellationToken);
|
||||||
|
return result.Adapt<SubmitShopBuyOrderResponseDto>();
|
||||||
|
// return new SubmitShopBuyOrderResponseDto();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
using FrontOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
|
||||||
|
|
||||||
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
||||||
public class SubmitShopBuyOrderResponseDto
|
public class SubmitShopBuyOrderResponseDto
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,16 +1,26 @@
|
|||||||
|
using CMSMicroservice.Protobuf.Protos.UserWalletChangeLog;
|
||||||
|
|
||||||
namespace FrontOffice.BFF.Application.UserWalletCQ.Queries.GetAllUserWalletChangeLog;
|
namespace FrontOffice.BFF.Application.UserWalletCQ.Queries.GetAllUserWalletChangeLog;
|
||||||
public class GetAllUserWalletChangeLogQueryHandler : IRequestHandler<GetAllUserWalletChangeLogQuery, Unit>
|
public class GetAllUserWalletChangeLogQueryHandler : IRequestHandler<GetAllUserWalletChangeLogQuery, Unit>
|
||||||
{
|
{
|
||||||
private readonly IApplicationContractContext _context;
|
private readonly IApplicationContractContext _context;
|
||||||
|
private readonly ICurrentUserService _currentUserService;
|
||||||
|
|
||||||
public GetAllUserWalletChangeLogQueryHandler(IApplicationContractContext context)
|
public GetAllUserWalletChangeLogQueryHandler(IApplicationContractContext context, ICurrentUserService currentUserService)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
|
_currentUserService = currentUserService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Unit> Handle(GetAllUserWalletChangeLogQuery request, CancellationToken cancellationToken)
|
public async Task<Unit> Handle(GetAllUserWalletChangeLogQuery request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
//TODO: Implement your business logic
|
await _context.UserWalletChangeLog.GetAllUserWalletChangeLogByFilterAsync(new GetAllUserWalletChangeLogByFilterRequest()
|
||||||
|
{
|
||||||
|
Filter = new GetAllUserWalletChangeLogByFilterFilter()
|
||||||
|
{
|
||||||
|
UserId = _currentUserService.UserId.Value
|
||||||
|
}
|
||||||
|
}, cancellationToken: cancellationToken);
|
||||||
return new Unit();
|
return new Unit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,32 @@
|
|||||||
|
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||||
|
|
||||||
namespace FrontOffice.BFF.Application.UserWalletCQ.Queries.GetUserWallet;
|
namespace FrontOffice.BFF.Application.UserWalletCQ.Queries.GetUserWallet;
|
||||||
|
|
||||||
public class GetUserWalletQueryHandler : IRequestHandler<GetUserWalletQuery, GetUserWalletResponseDto>
|
public class GetUserWalletQueryHandler : IRequestHandler<GetUserWalletQuery, GetUserWalletResponseDto>
|
||||||
{
|
{
|
||||||
private readonly IApplicationContractContext _context;
|
private readonly IApplicationContractContext _context;
|
||||||
|
private readonly ICurrentUserService _currentUserService;
|
||||||
|
|
||||||
public GetUserWalletQueryHandler(IApplicationContractContext context)
|
public GetUserWalletQueryHandler(IApplicationContractContext context, ICurrentUserService currentUserService)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
|
_currentUserService = currentUserService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetUserWalletResponseDto> Handle(GetUserWalletQuery request, CancellationToken cancellationToken)
|
public async Task<GetUserWalletResponseDto> Handle(GetUserWalletQuery request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
//TODO: Implement your business logic
|
var userWallet = await _context.UserWallet.GetAllUserWalletByFilterAsync(new GetAllUserWalletByFilterRequest()
|
||||||
return new GetUserWalletResponseDto();
|
{
|
||||||
|
Filter = new GetAllUserWalletByFilterFilter()
|
||||||
|
{
|
||||||
|
UserId = _currentUserService.UserId.Value,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (userWallet.Models.Count == 0)
|
||||||
|
{
|
||||||
|
throw new NotFoundException("UserWallet", _currentUserService.UserId.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return userWallet.Models.FirstOrDefault().Adapt<GetUserWalletResponseDto>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Afrino.PYMSMicroservice.Protobuf" Version="0.0.11" />
|
<PackageReference Include="Afrino.PYMSMicroservice.Protobuf" Version="0.0.11" />
|
||||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.124" />
|
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.127" />
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.33.0" />
|
<PackageReference Include="Google.Protobuf" Version="3.33.0" />
|
||||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
|
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
|
||||||
<PackageReference Include="Grpc.Tools" Version="2.76.0">
|
<PackageReference Include="Grpc.Tools" Version="2.76.0">
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ using CMSMicroservice.Protobuf.Protos.UserAddress;
|
|||||||
using CMSMicroservice.Protobuf.Protos.UserCarts;
|
using CMSMicroservice.Protobuf.Protos.UserCarts;
|
||||||
using CMSMicroservice.Protobuf.Protos.UserContract;
|
using CMSMicroservice.Protobuf.Protos.UserContract;
|
||||||
using CMSMicroservice.Protobuf.Protos.UserOrder;
|
using CMSMicroservice.Protobuf.Protos.UserOrder;
|
||||||
|
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||||
|
using CMSMicroservice.Protobuf.Protos.UserWalletChangeLog;
|
||||||
using FrontOffice.BFF.Application.Common.Interfaces;
|
using FrontOffice.BFF.Application.Common.Interfaces;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using PYMSMicroservice.Protobuf.Protos.Transaction;
|
using PYMSMicroservice.Protobuf.Protos.Transaction;
|
||||||
@@ -54,6 +56,8 @@ public class ApplicationContractContext : IApplicationContractContext
|
|||||||
public UserOrderContract.UserOrderContractClient UserOrder => GetService<UserOrderContract.UserOrderContractClient>();
|
public UserOrderContract.UserOrderContractClient UserOrder => GetService<UserOrderContract.UserOrderContractClient>();
|
||||||
|
|
||||||
public OtpTokenContract.OtpTokenContractClient OtpToken => GetService<OtpTokenContract.OtpTokenContractClient>();
|
public OtpTokenContract.OtpTokenContractClient OtpToken => GetService<OtpTokenContract.OtpTokenContractClient>();
|
||||||
|
public UserWalletContract.UserWalletContractClient UserWallet => GetService<UserWalletContract.UserWalletContractClient>();
|
||||||
|
public UserWalletChangeLogContract.UserWalletChangeLogContractClient UserWalletChangeLog => GetService<UserWalletChangeLogContract.UserWalletChangeLogContractClient>();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region PYMS
|
#region PYMS
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.Products.Protobuf\FrontOffice.BFF.Products.Protobuf.csproj" />
|
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.Products.Protobuf\FrontOffice.BFF.Products.Protobuf.csproj" />
|
||||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.ShopingCart.Protobuf\FrontOffice.BFF.ShopingCart.Protobuf.csproj" />
|
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.ShopingCart.Protobuf\FrontOffice.BFF.ShopingCart.Protobuf.csproj" />
|
||||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.Transaction.Protobuf\FrontOffice.BFF.Transaction.Protobuf.csproj" />
|
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.Transaction.Protobuf\FrontOffice.BFF.Transaction.Protobuf.csproj" />
|
||||||
|
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.UserWallet.Protobuf\FrontOffice.BFF.UserWallet.Protobuf.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.User.Protobuf\FrontOffice.BFF.User.Protobuf.csproj" />
|
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.User.Protobuf\FrontOffice.BFF.User.Protobuf.csproj" />
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using FrontOffice.BFF.Protobuf.Protos.UserOrder;
|
|
||||||
using FrontOffice.BFF.WebApi.Common.Services;
|
using FrontOffice.BFF.WebApi.Common.Services;
|
||||||
using FrontOffice.BFF.Application.UserOrderCQ.Commands.CreateNewUserOrder;
|
using FrontOffice.BFF.Application.UserOrderCQ.Commands.CreateNewUserOrder;
|
||||||
using FrontOffice.BFF.Application.UserOrderCQ.Commands.UpdateUserOrder;
|
using FrontOffice.BFF.Application.UserOrderCQ.Commands.UpdateUserOrder;
|
||||||
@@ -6,6 +5,8 @@ using FrontOffice.BFF.Application.UserOrderCQ.Commands.DeleteUserOrder;
|
|||||||
using FrontOffice.BFF.Application.UserOrderCQ.Queries.GetUserOrder;
|
using FrontOffice.BFF.Application.UserOrderCQ.Queries.GetUserOrder;
|
||||||
using FrontOffice.BFF.Application.UserOrderCQ.Queries.GetAllUserOrderByFilter;
|
using FrontOffice.BFF.Application.UserOrderCQ.Queries.GetAllUserOrderByFilter;
|
||||||
using FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
using FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
||||||
|
using FrontOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
|
||||||
|
|
||||||
namespace FrontOffice.BFF.WebApi.Services;
|
namespace FrontOffice.BFF.WebApi.Services;
|
||||||
public class UserOrderService : UserOrderContract.UserOrderContractBase
|
public class UserOrderService : UserOrderContract.UserOrderContractBase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
using FrontOffice.BFF.Protobuf.Protos.UserWallet;
|
|
||||||
using FrontOffice.BFF.WebApi.Common.Services;
|
using FrontOffice.BFF.WebApi.Common.Services;
|
||||||
using FrontOffice.BFF.Application.UserWalletCQ.Queries.GetAllUserWalletChangeLog;
|
using FrontOffice.BFF.Application.UserWalletCQ.Queries.GetAllUserWalletChangeLog;
|
||||||
using FrontOffice.BFF.Application.UserWalletCQ.Queries.GetUserWallet;
|
using FrontOffice.BFF.Application.UserWalletCQ.Queries.GetUserWallet;
|
||||||
using FrontOffice.BFF.Application.UserWalletCQ.Commands.TransferUserWalletBallance;
|
using FrontOffice.BFF.Application.UserWalletCQ.Commands.TransferUserWalletBallance;
|
||||||
using FrontOffice.BFF.Application.UserWalletCQ.Commands.WithdrawBalance;
|
using FrontOffice.BFF.Application.UserWalletCQ.Commands.WithdrawBalance;
|
||||||
|
using FrontOffice.BFF.UserWallet.Protobuf.Protos.UserWallet;
|
||||||
|
|
||||||
namespace FrontOffice.BFF.WebApi.Services;
|
namespace FrontOffice.BFF.WebApi.Services;
|
||||||
public class UserWalletService : UserWalletContract.UserWalletContractBase
|
public class UserWalletService : UserWalletContract.UserWalletContractBase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FrontOffice.BFF.Products.Pr
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FrontOffice.BFF.ShopingCart.Protobuf", "Protobufs\FrontOffice.BFF.ShopingCart.Protobuf\FrontOffice.BFF.ShopingCart.Protobuf.csproj", "{DC61324B-D389-4A1D-B048-D0AA43A6BBE7}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FrontOffice.BFF.ShopingCart.Protobuf", "Protobufs\FrontOffice.BFF.ShopingCart.Protobuf\FrontOffice.BFF.ShopingCart.Protobuf.csproj", "{DC61324B-D389-4A1D-B048-D0AA43A6BBE7}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FrontOffice.BFF.UserWallet.Protobuf", "Protobufs\FrontOffice.BFF.UserWallet.Protobuf\FrontOffice.BFF.UserWallet.Protobuf.csproj", "{03F99CE9-F952-47B0-B71A-1F4865E52443}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -76,6 +78,10 @@ Global
|
|||||||
{DC61324B-D389-4A1D-B048-D0AA43A6BBE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{DC61324B-D389-4A1D-B048-D0AA43A6BBE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{DC61324B-D389-4A1D-B048-D0AA43A6BBE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{DC61324B-D389-4A1D-B048-D0AA43A6BBE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{DC61324B-D389-4A1D-B048-D0AA43A6BBE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
{DC61324B-D389-4A1D-B048-D0AA43A6BBE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{03F99CE9-F952-47B0-B71A-1F4865E52443}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{03F99CE9-F952-47B0-B71A-1F4865E52443}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{03F99CE9-F952-47B0-B71A-1F4865E52443}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{03F99CE9-F952-47B0-B71A-1F4865E52443}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -88,5 +94,6 @@ Global
|
|||||||
{F59861D9-01D6-44C9-85A9-E6050D55D290} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
{F59861D9-01D6-44C9-85A9-E6050D55D290} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
||||||
{CB77669F-5B48-4AC6-B20E-A928660E93F8} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
{CB77669F-5B48-4AC6-B20E-A928660E93F8} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
||||||
{DC61324B-D389-4A1D-B048-D0AA43A6BBE7} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
{DC61324B-D389-4A1D-B048-D0AA43A6BBE7} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
||||||
|
{03F99CE9-F952-47B0-B71A-1F4865E52443} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using FrontOfficeMicroservice.Protobuf.Protos.UserOrder;
|
using FrontOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
|
||||||
namespace FrontOfficeMicroservice.Protobuf.Validator.UserOrder;
|
namespace FrontOfficeMicroservice.Protobuf.Validator.UserOrder;
|
||||||
|
|
||||||
public class SubmitShopBuyOrderRequestValidator : AbstractValidator<SubmitShopBuyOrderRequest>
|
public class SubmitShopBuyOrderRequestValidator : AbstractValidator<SubmitShopBuyOrderRequest>
|
||||||
|
|||||||
Reference in New Issue
Block a user