feat: enhance GetWithdrawalRequests response structure and update related mappings
Build and Deploy / build (push) Failing after 1m11s
Build and Deploy / build (push) Failing after 1m11s
This commit is contained in:
+30
-1
@@ -37,6 +37,35 @@ public class GetWithdrawalRequestsQueryHandler : IRequestHandler<GetWithdrawalRe
|
||||
}
|
||||
|
||||
var response = await _context.Commissions.GetWithdrawalRequestsAsync(grpcRequest, cancellationToken: cancellationToken);
|
||||
return response.Adapt<GetWithdrawalRequestsResponseDto>();
|
||||
|
||||
return new GetWithdrawalRequestsResponseDto
|
||||
{
|
||||
MetaData = new MetaDataDto
|
||||
{
|
||||
TotalCount = (int)(response.MetaData?.TotalCount ?? 0),
|
||||
PageSize = (int)(response.MetaData?.PageSize ?? request.PageSize),
|
||||
CurrentPage = (int)(response.MetaData?.CurrentPage ?? request.PageIndex),
|
||||
TotalPages = (int)(response.MetaData?.TotalPage ?? 0)
|
||||
},
|
||||
Models = response.Models.Select(m => new WithdrawalRequestDto
|
||||
{
|
||||
Id = m.Id,
|
||||
UserId = m.UserId,
|
||||
UserName = m.UserName,
|
||||
WeekDefinitionId = m.WeekDefinitionId,
|
||||
Amount = m.Amount,
|
||||
Status = m.Status,
|
||||
WithdrawalMethod = m.WithdrawalMethod,
|
||||
IbanNumber = m.IbanNumber,
|
||||
RequestedAt = m.RequestedAt?.ToDateTime() ?? DateTime.MinValue,
|
||||
ProcessedAt = m.ProcessedAt?.ToDateTime(),
|
||||
ProcessedBy = m.ProcessedBy,
|
||||
Reason = m.Reason,
|
||||
Created = m.Created?.ToDateTime() ?? DateTime.MinValue,
|
||||
BankReferenceId = m.BankReferenceId,
|
||||
BankTrackingCode = m.BankTrackingCode,
|
||||
PaymentFailureReason = m.PaymentFailureReason
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+8
-7
@@ -11,18 +11,19 @@ public record WithdrawalRequestDto
|
||||
public long Id { get; init; }
|
||||
public long UserId { get; init; }
|
||||
public string UserName { get; init; } = string.Empty;
|
||||
public string PhoneNumber { get; init; } = string.Empty;
|
||||
public long WeekDefinitionId { get; init; }
|
||||
public long Amount { get; init; }
|
||||
public int Status { get; init; }
|
||||
public string Method { get; init; } = "Bank";
|
||||
public string? BankAccount { get; init; }
|
||||
public string? BankName { get; init; }
|
||||
public int WithdrawalMethod { get; init; }
|
||||
public string? IbanNumber { get; init; }
|
||||
public DateTime RequestedAt { get; init; }
|
||||
public DateTime? ProcessedAt { get; init; }
|
||||
public string? ProcessedBy { get; init; }
|
||||
public string? Reason { get; init; }
|
||||
public DateTime Created { get; init; }
|
||||
public string? BankReferenceId { get; init; }
|
||||
public string? BankTrackingCode { get; init; }
|
||||
public string? PaymentFailureReason { get; init; }
|
||||
public DateTime RequestDate { get; init; }
|
||||
public DateTime? ProcessedDate { get; init; }
|
||||
public string? AdminNote { get; init; }
|
||||
}
|
||||
|
||||
public record MetaDataDto
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Afrino.FMSMicroservice.Protobuf" Version="0.0.122" />
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.161" />
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.162" />
|
||||
|
||||
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
||||
<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.GetAvailableWeeks;
|
||||
using BackOffice.BFF.Application.CommissionCQ.Queries.GetUserPayouts;
|
||||
using BackOffice.BFF.Application.CommissionCQ.Queries.GetWithdrawalRequests;
|
||||
using BackOffice.BFF.Application.CommissionCQ.Commands.ProcessWithdrawal;
|
||||
using Foursat.BackOffice.BFF.Commission.Protos;
|
||||
using System.Collections.Generic;
|
||||
@@ -135,33 +136,38 @@ public class CommissionProfile : IRegister
|
||||
});
|
||||
|
||||
// GetWithdrawalRequestsResponseDto -> GetWithdrawalRequestsResponse
|
||||
// config.NewConfig<GetWithdrawalRequestsResponseDto, GetWithdrawalRequestsResponse>()
|
||||
// .MapWith(src => new GetWithdrawalRequestsResponse
|
||||
// {
|
||||
// MetaData = new BackOffice.BFF.Protobuf.Common.MetaData
|
||||
// {
|
||||
// CurrentPage = src.MetaData.CurrentPage,
|
||||
// PageSize = src.MetaData.PageSize,
|
||||
// TotalCount = src.MetaData.TotalCount,
|
||||
// TotalPage = src.MetaData.TotalPages
|
||||
// },
|
||||
// Models = { src.Models.Select(m => new WithdrawalRequestModel
|
||||
// {
|
||||
// Id = m.Id,
|
||||
// UserId = m.UserId,
|
||||
// UserName = m.UserName ?? string.Empty,
|
||||
// Amount = m.Amount,
|
||||
// Status = m.Status,
|
||||
// StatusDisplay = m.StatusDisplay ?? string.Empty,
|
||||
// RequestedAt = Timestamp.FromDateTime(DateTime.SpecifyKind(m.RequestedAt, DateTimeKind.Utc)),
|
||||
// ProcessedAt = m.ProcessedAt.HasValue
|
||||
// ? Timestamp.FromDateTime(DateTime.SpecifyKind(m.ProcessedAt.Value, DateTimeKind.Utc))
|
||||
// : null,
|
||||
// ProcessedBy = m.ProcessedBy,
|
||||
// ProcessedByName = m.ProcessedByName ?? string.Empty,
|
||||
// RejectionReason = m.RejectionReason ?? string.Empty
|
||||
// }) }
|
||||
// });
|
||||
config.NewConfig<GetWithdrawalRequestsResponseDto, GetWithdrawalRequestsResponse>()
|
||||
.MapWith(src => new GetWithdrawalRequestsResponse
|
||||
{
|
||||
MetaData = new BackOffice.BFF.Protobuf.Common.MetaData
|
||||
{
|
||||
CurrentPage = src.MetaData.CurrentPage,
|
||||
PageSize = src.MetaData.PageSize,
|
||||
TotalCount = src.MetaData.TotalCount,
|
||||
TotalPage = src.MetaData.TotalPages
|
||||
},
|
||||
Models = { src.Models.Select(m => new WithdrawalRequestModel
|
||||
{
|
||||
Id = m.Id,
|
||||
UserId = m.UserId,
|
||||
UserName = m.UserName ?? string.Empty,
|
||||
WeekDefinitionId = m.WeekDefinitionId,
|
||||
Amount = m.Amount,
|
||||
Status = m.Status,
|
||||
WithdrawalMethod = m.WithdrawalMethod,
|
||||
IbanNumber = m.IbanNumber ?? string.Empty,
|
||||
RequestedAt = Timestamp.FromDateTime(DateTime.SpecifyKind(m.RequestedAt, DateTimeKind.Utc)),
|
||||
ProcessedAt = m.ProcessedAt.HasValue
|
||||
? Timestamp.FromDateTime(DateTime.SpecifyKind(m.ProcessedAt.Value, DateTimeKind.Utc))
|
||||
: null,
|
||||
ProcessedBy = m.ProcessedBy ?? string.Empty,
|
||||
Reason = m.Reason ?? string.Empty,
|
||||
Created = Timestamp.FromDateTime(DateTime.SpecifyKind(m.Created, DateTimeKind.Utc)),
|
||||
BankReferenceId = m.BankReferenceId ?? string.Empty,
|
||||
BankTrackingCode = m.BankTrackingCode ?? string.Empty,
|
||||
PaymentFailureReason = m.PaymentFailureReason ?? string.Empty
|
||||
}) }
|
||||
});
|
||||
|
||||
// GetWithdrawalReportsResponseDto -> GetWithdrawalReportsResponse
|
||||
// config.NewConfig<GetWithdrawalReportsResponseDto, GetWithdrawalReportsResponse>()
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageId>Foursat.BackOffice.BFF.Commission.Protobuf</PackageId>
|
||||
<Version>0.0.13</Version>
|
||||
<Version>0.0.14</Version>
|
||||
<Authors>FourSat</Authors>
|
||||
<Company>FourSat</Company>
|
||||
<Product>BackOffice.BFF.Commission.Protobuf</Product>
|
||||
|
||||
@@ -279,15 +279,20 @@ message UserWeeklyBalanceModel
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 user_id = 2;
|
||||
int64 week_definition_id = 3;
|
||||
string week_display_name = 4;
|
||||
int32 left_leg_balances = 5;
|
||||
int32 right_leg_balances = 6;
|
||||
int32 total_balances = 7;
|
||||
int64 weekly_pool_contribution = 8;
|
||||
google.protobuf.Timestamp calculated_at = 9;
|
||||
bool is_expired = 10;
|
||||
google.protobuf.Timestamp created = 11;
|
||||
string user_full_name = 3; // نام کامل کاربر
|
||||
int64 week_definition_id = 4;
|
||||
string week_display_name = 5;
|
||||
int32 left_leg_new_members = 6; // اعضای جدید چپ این هفته
|
||||
int32 left_leg_carryover = 7; // باقیمانده چپ از هفته قبل
|
||||
int32 left_leg_total = 8; // مجموع چپ (NewMembers + Carryover)
|
||||
int32 right_leg_new_members = 9; // اعضای جدید راست این هفته
|
||||
int32 right_leg_carryover = 10; // باقیمانده راست از هفته قبل
|
||||
int32 right_leg_total = 11; // مجموع راست (NewMembers + Carryover)
|
||||
int32 total_balances = 12; // تعداد تعادل = MIN(چپ, راست)
|
||||
int64 weekly_pool_contribution = 13;
|
||||
google.protobuf.Timestamp calculated_at = 14;
|
||||
bool is_expired = 15;
|
||||
google.protobuf.Timestamp created = 16;
|
||||
}
|
||||
|
||||
// GetAllWeeklyPools Query
|
||||
|
||||
Reference in New Issue
Block a user