Compare commits
5 Commits
6bc45e4486
...
f5e7d0c882
| Author | SHA1 | Date | |
|---|---|---|---|
| f5e7d0c882 | |||
| 86d1370535 | |||
| 92aebb42b5 | |||
| c7fc30c83e | |||
| 4c5cff1a9a |
@@ -1,4 +1,5 @@
|
|||||||
using BackOffice.BFF.Application.CommissionCQ.Queries.GetWeeklyPool;
|
using BackOffice.BFF.Application.CommissionCQ.Queries.GetWeeklyPool;
|
||||||
|
using BackOffice.BFF.Application.CommissionCQ.Queries.GetAllWeeklyPools;
|
||||||
using CMSMicroservice.Protobuf.Protos.Commission;
|
using CMSMicroservice.Protobuf.Protos.Commission;
|
||||||
|
|
||||||
namespace BackOffice.BFF.Application.Common.Mappings;
|
namespace BackOffice.BFF.Application.Common.Mappings;
|
||||||
@@ -7,7 +8,7 @@ public class CommissionProfile : IRegister
|
|||||||
{
|
{
|
||||||
void IRegister.Register(TypeAdapterConfig config)
|
void IRegister.Register(TypeAdapterConfig config)
|
||||||
{
|
{
|
||||||
config.NewConfig< GetWeeklyCommissionPoolResponse,GetWeeklyPoolResponseDto>()
|
config.NewConfig<GetWeeklyCommissionPoolResponse, GetWeeklyPoolResponseDto>()
|
||||||
.Map(dest => dest.Id, src => src.Id)
|
.Map(dest => dest.Id, src => src.Id)
|
||||||
.Map(dest => dest.CalculatedAt, src => src.CalculatedAt)
|
.Map(dest => dest.CalculatedAt, src => src.CalculatedAt)
|
||||||
.Map(dest => dest.IsCalculated, src => src.IsCalculated)
|
.Map(dest => dest.IsCalculated, src => src.IsCalculated)
|
||||||
@@ -15,9 +16,31 @@ public class CommissionProfile : IRegister
|
|||||||
.Map(dest => dest.TotalPoolAmount, src => src.TotalPoolAmount)
|
.Map(dest => dest.TotalPoolAmount, src => src.TotalPoolAmount)
|
||||||
.Map(dest => dest.ValuePerBalance, src => src.ValuePerBalance)
|
.Map(dest => dest.ValuePerBalance, src => src.ValuePerBalance)
|
||||||
.Map(dest => dest.TotalBalances, src => src.TotalBalances)
|
.Map(dest => dest.TotalBalances, src => src.TotalBalances)
|
||||||
.Map(dest => dest.Created, src => src.Created.ToDateTimeOffset())
|
.Map(dest => dest.Created, src => src.Created.ToDateTimeOffset());
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
|
// CMS GetAllWeeklyPoolsResponse -> GetAllWeeklyPoolsResponseDto
|
||||||
|
config.NewConfig<GetAllWeeklyPoolsResponse, GetAllWeeklyPoolsResponseDto>()
|
||||||
|
.MapWith(src => new GetAllWeeklyPoolsResponseDto
|
||||||
|
{
|
||||||
|
MetaData = new MetaDataDto
|
||||||
|
{
|
||||||
|
TotalCount = (int)src.MetaData.TotalCount,
|
||||||
|
PageSize = (int)src.MetaData.PageSize,
|
||||||
|
CurrentPage = (int)src.MetaData.CurrentPage,
|
||||||
|
TotalPages = (int)src.MetaData.TotalPage
|
||||||
|
},
|
||||||
|
Models = src.Models.Select(m => new WeeklyCommissionPoolDto
|
||||||
|
{
|
||||||
|
Id = m.Id,
|
||||||
|
WeekDefinitionId = m.WeekDefinitionId,
|
||||||
|
WeekDisplayName = m.WeekDisplayName,
|
||||||
|
TotalPoolAmount = m.TotalPoolAmount,
|
||||||
|
TotalBalances = m.TotalBalances,
|
||||||
|
ValuePerBalance = m.ValuePerBalance,
|
||||||
|
IsCalculated = m.IsCalculated,
|
||||||
|
CalculatedAt = m.CalculatedAt != null ? m.CalculatedAt.ToDateTime() : null,
|
||||||
|
Created = m.Created.ToDateTime()
|
||||||
|
}).ToList()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Afrino.FMSMicroservice.Protobuf" Version="0.0.122" />
|
<PackageReference Include="Afrino.FMSMicroservice.Protobuf" Version="0.0.122" />
|
||||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.159" />
|
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.161" />
|
||||||
|
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
||||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
|
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using BackOffice.BFF.Application.CommissionCQ.Queries.GetAllWeeklyPools;
|
|||||||
using BackOffice.BFF.Application.CommissionCQ.Queries.GetUserWeeklyBalances;
|
using BackOffice.BFF.Application.CommissionCQ.Queries.GetUserWeeklyBalances;
|
||||||
using BackOffice.BFF.Application.CommissionCQ.Queries.GetAvailableWeeks;
|
using BackOffice.BFF.Application.CommissionCQ.Queries.GetAvailableWeeks;
|
||||||
using BackOffice.BFF.Application.CommissionCQ.Queries.GetUserPayouts;
|
using BackOffice.BFF.Application.CommissionCQ.Queries.GetUserPayouts;
|
||||||
|
using BackOffice.BFF.Application.CommissionCQ.Commands.ProcessWithdrawal;
|
||||||
using Foursat.BackOffice.BFF.Commission.Protos;
|
using Foursat.BackOffice.BFF.Commission.Protos;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@@ -12,6 +13,12 @@ public class CommissionProfile : IRegister
|
|||||||
{
|
{
|
||||||
void IRegister.Register(TypeAdapterConfig config)
|
void IRegister.Register(TypeAdapterConfig config)
|
||||||
{
|
{
|
||||||
|
// ProcessWithdrawalRequest -> ProcessWithdrawalCommand
|
||||||
|
config.NewConfig<ProcessWithdrawalRequest, ProcessWithdrawalCommand>()
|
||||||
|
.Map(dest => dest.WithdrawalId, src => src.PayoutId)
|
||||||
|
.Map(dest => dest.IsApproved, src => src.IsApproved)
|
||||||
|
.Map(dest => dest.Reason, src => src.Reason);
|
||||||
|
|
||||||
// GetUserCommissionPayoutsRequest -> GetUserPayoutsQuery
|
// GetUserCommissionPayoutsRequest -> GetUserPayoutsQuery
|
||||||
config.NewConfig<GetUserCommissionPayoutsRequest, GetUserPayoutsQuery>()
|
config.NewConfig<GetUserCommissionPayoutsRequest, GetUserPayoutsQuery>()
|
||||||
.MapWith(src => new GetUserPayoutsQuery
|
.MapWith(src => new GetUserPayoutsQuery
|
||||||
@@ -68,34 +75,8 @@ public class CommissionProfile : IRegister
|
|||||||
});
|
});
|
||||||
|
|
||||||
// GetUserPayoutsResponseDto -> GetUserCommissionPayoutsResponse
|
// GetUserPayoutsResponseDto -> GetUserCommissionPayoutsResponse
|
||||||
// config.NewConfig<GetUserPayoutsResponseDto, GetUserCommissionPayoutsResponse>()
|
config.NewConfig<GetUserPayoutsResponseDto, GetUserCommissionPayoutsResponse>()
|
||||||
// .MapWith(src => new GetUserCommissionPayoutsResponse
|
.MapWith(src => MapPayoutsResponse(src));
|
||||||
// {
|
|
||||||
// MetaData = new BackOffice.BFF.Protobuf.Common.MetaData
|
|
||||||
// {
|
|
||||||
// CurrentPage = src.MetaData.CurrentPage,
|
|
||||||
// PageSize = src.MetaData.PageSize,
|
|
||||||
// TotalCount = src.MetaData.TotalCount,
|
|
||||||
// TotalPage = src.MetaData.TotalPage
|
|
||||||
// },
|
|
||||||
// Models = { (src.Models ?? new List<GetUserPayoutsResponseModel>()).Select(m => new UserCommissionPayoutModel
|
|
||||||
// {
|
|
||||||
// Id = m.Id,
|
|
||||||
// UserId = m.UserId,
|
|
||||||
// UserName = m.UserName,
|
|
||||||
// WeekNumber = m.WeekNumber,
|
|
||||||
// BalancesEarned = m.BalancesEarned,
|
|
||||||
// ValuePerBalance = m.ValuePerBalance,
|
|
||||||
// TotalAmount = m.TotalAmount,
|
|
||||||
// Status = m.Status,
|
|
||||||
// WithdrawalMethod = m.WithdrawalMethod,
|
|
||||||
// IbanNumber = m.IbanNumber,
|
|
||||||
// Created = Timestamp.FromDateTime(DateTime.SpecifyKind(m.Created, DateTimeKind.Utc)),
|
|
||||||
// LastModified = m.LastModified.HasValue
|
|
||||||
// ? Timestamp.FromDateTime(DateTime.SpecifyKind(m.LastModified.Value, DateTimeKind.Utc))
|
|
||||||
// : null
|
|
||||||
// }) }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// GetAllWeeklyPoolsResponseDto -> GetAllWeeklyPoolsResponse
|
// GetAllWeeklyPoolsResponseDto -> GetAllWeeklyPoolsResponse
|
||||||
config.NewConfig<GetAllWeeklyPoolsResponseDto, GetAllWeeklyPoolsResponse>()
|
config.NewConfig<GetAllWeeklyPoolsResponseDto, GetAllWeeklyPoolsResponse>()
|
||||||
@@ -237,4 +218,39 @@ public class CommissionProfile : IRegister
|
|||||||
DisplayText = dto.DisplayText
|
DisplayText = dto.DisplayText
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static GetUserCommissionPayoutsResponse MapPayoutsResponse(GetUserPayoutsResponseDto src)
|
||||||
|
{
|
||||||
|
var response = new GetUserCommissionPayoutsResponse
|
||||||
|
{
|
||||||
|
MetaData = new BackOffice.BFF.Protobuf.Common.MetaData
|
||||||
|
{
|
||||||
|
CurrentPage = src.MetaData.CurrentPage,
|
||||||
|
PageSize = src.MetaData.PageSize,
|
||||||
|
TotalCount = src.MetaData.TotalCount,
|
||||||
|
TotalPage = src.MetaData.TotalPage
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var m in src.Models ?? new List<GetUserPayoutsResponseModel>())
|
||||||
|
{
|
||||||
|
response.Models.Add(new UserCommissionPayoutModel
|
||||||
|
{
|
||||||
|
Id = m.Id,
|
||||||
|
UserId = m.UserId,
|
||||||
|
UserName = m.UserName ?? "",
|
||||||
|
WeekDefinitionId = m.WeekDefinitionId,
|
||||||
|
WeekDisplayName = m.WeekDisplayName ?? "",
|
||||||
|
BalancesEarned = m.BalancesEarned,
|
||||||
|
ValuePerBalance = m.ValuePerBalance,
|
||||||
|
TotalAmount = m.TotalAmount,
|
||||||
|
Status = m.Status,
|
||||||
|
WithdrawalMethod = m.WithdrawalMethod,
|
||||||
|
IbanNumber = m.IbanNumber ?? "",
|
||||||
|
Created = Timestamp.FromDateTime(DateTime.SpecifyKind(m.Created, DateTimeKind.Utc))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,5 +60,9 @@ public class GeneralMapping : IRegister
|
|||||||
|
|
||||||
config.NewConfig<byte[], Google.Protobuf.ByteString>()
|
config.NewConfig<byte[], Google.Protobuf.ByteString>()
|
||||||
.MapWith(src => Google.Protobuf.ByteString.CopyFrom(src));
|
.MapWith(src => Google.Protobuf.ByteString.CopyFrom(src));
|
||||||
|
|
||||||
|
// MediatR Unit to Google.Protobuf.Empty
|
||||||
|
config.NewConfig<MediatR.Unit, Google.Protobuf.WellKnownTypes.Empty>()
|
||||||
|
.MapWith(_ => new Google.Protobuf.WellKnownTypes.Empty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
},
|
},
|
||||||
"GrpcChannelOptions": {
|
"GrpcChannelOptions": {
|
||||||
"FMSMSAddress": "https://dl.afrino.co",
|
"FMSMSAddress": "https://dl.afrino.co",
|
||||||
"CMSMSAddress": "http://cms-svc:8080"
|
"CMSMSAddress": "http://cms-svc"
|
||||||
},
|
},
|
||||||
"Authentication": {
|
"Authentication": {
|
||||||
"Authority": "https://ids.domain.com/",
|
"Authority": "https://ids.domain.com/",
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
{
|
|
||||||
"JwtSecurityKey": "TvlZVx5TJaHs8e9HgUdGzhGP2CIidoI444nAj+8+g7c=",
|
|
||||||
"JwtIssuer": "https://localhost",
|
|
||||||
"JwtAudience": "https://localhost",
|
|
||||||
"JwtExpiryInDays": 365,
|
|
||||||
"AllowedHosts": "*",
|
|
||||||
"Kestrel": {
|
|
||||||
"EndpointDefaults": {
|
|
||||||
"Protocols": "Http2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"GrpcChannelOptions": {
|
|
||||||
"FMSMSAddress": "https://dl.afrino.co",
|
|
||||||
"CMSMSAddress": "https://cms.kbs1.ir"
|
|
||||||
// "CMSMSAddress": "https://localhost:32846"
|
|
||||||
},
|
|
||||||
"Authentication": {
|
|
||||||
"Authority": "https://ids.domain.com/",
|
|
||||||
"Audience": "domain_api"
|
|
||||||
},
|
|
||||||
"Kavenegar": {
|
|
||||||
"Sender": "1000001110100",
|
|
||||||
"ApiKey": "497263626F32626A48685A6137524C4F78575A766E4C74694A556B79317648424964655030682B554545413D"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
,
|
|
||||||
"Seq": {
|
|
||||||
"ServerUrl": "http://seq-svc:5341",
|
|
||||||
"ApiKey": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user