feat: add manual membership payment and update commission queries
All checks were successful
Build and Deploy / build (push) Successful in 2m29s
All checks were successful
Build and Deploy / build (push) Successful in 2m29s
This commit is contained in:
@@ -1,24 +1,37 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetUserPayouts;
|
||||
|
||||
public record GetUserPayoutsQuery : IRequest<GetUserPayoutsResponseDto>
|
||||
{
|
||||
/// <summary>
|
||||
/// موقعیت صفحهبندی
|
||||
/// </summary>
|
||||
public PaginationState? PaginationState { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// مرتبسازی بر اساس
|
||||
/// </summary>
|
||||
public string? SortBy { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// فیلتر
|
||||
/// </summary>
|
||||
public GetUserPayoutsFilter? Filter { get; init; }
|
||||
}
|
||||
|
||||
public class GetUserPayoutsFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه کاربر
|
||||
/// </summary>
|
||||
public long UserId { get; init; }
|
||||
public long? UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره هفته (اختیاری - برای فیلتر)
|
||||
/// </summary>
|
||||
public string? WeekNumber { get; init; }
|
||||
public string? WeekNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره صفحه (پیشفرض: 1)
|
||||
/// وضعیت (اختیاری)
|
||||
/// </summary>
|
||||
public int PageNumber { get; init; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// تعداد در هر صفحه (پیشفرض: 10)
|
||||
/// </summary>
|
||||
public int PageSize { get; init; } = 10;
|
||||
public int? Status { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
using CMSMicroservice.Protobuf.Protos.Commission;
|
||||
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetUserPayouts;
|
||||
@@ -15,10 +13,55 @@ public class GetUserPayoutsQueryHandler : IRequestHandler<GetUserPayoutsQuery, G
|
||||
|
||||
public async Task<GetUserPayoutsResponseDto> Handle(GetUserPayoutsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var cmsRequest = new GetUserCommissionPayoutsRequest
|
||||
{
|
||||
PageIndex = request.PaginationState?.PageNumber ?? 1,
|
||||
PageSize = request.PaginationState?.PageSize ?? 10
|
||||
};
|
||||
|
||||
if (request.Filter?.UserId.HasValue == true && request.Filter.UserId.Value > 0)
|
||||
{
|
||||
cmsRequest.UserId = request.Filter.UserId.Value;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.Filter?.WeekNumber))
|
||||
{
|
||||
cmsRequest.WeekNumber = request.Filter.WeekNumber;
|
||||
}
|
||||
|
||||
if (request.Filter?.Status.HasValue == true)
|
||||
{
|
||||
cmsRequest.Status = request.Filter.Status.Value;
|
||||
}
|
||||
|
||||
var response = await _context.Commissions.GetUserCommissionPayoutsAsync(
|
||||
request.Adapt<GetUserCommissionPayoutsRequest>(),
|
||||
cmsRequest,
|
||||
cancellationToken: cancellationToken);
|
||||
|
||||
return response.Adapt<GetUserPayoutsResponseDto>();
|
||||
return new GetUserPayoutsResponseDto
|
||||
{
|
||||
MetaData = new MetaData
|
||||
{
|
||||
CurrentPage = response.MetaData.CurrentPage,
|
||||
PageSize = response.MetaData.PageSize,
|
||||
TotalCount = response.MetaData.TotalCount,
|
||||
TotalPage = response.MetaData.TotalPage
|
||||
},
|
||||
Models = response.Models.Select(m => new GetUserPayoutsResponseModel
|
||||
{
|
||||
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 = m.Created.ToDateTime(),
|
||||
LastModified = m.LastModified?.ToDateTime()
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetUserPayouts;
|
||||
|
||||
public class GetUserPayoutsQueryValidator : AbstractValidator<GetUserPayoutsQuery>
|
||||
{
|
||||
public GetUserPayoutsQueryValidator()
|
||||
{
|
||||
RuleFor(x => x.PaginationState)
|
||||
.NotNull()
|
||||
.WithMessage("موقعیت صفحهبندی الزامی است");
|
||||
|
||||
When(x => x.Filter != null, () =>
|
||||
{
|
||||
RuleFor(x => x.Filter!.UserId)
|
||||
.GreaterThan(0)
|
||||
.When(x => x.Filter!.UserId.HasValue)
|
||||
.WithMessage("شناسه کاربر معتبر نیست");
|
||||
|
||||
RuleFor(x => x.Filter!.WeekNumber)
|
||||
.Matches(@"^\d{4}-W\d{2}$")
|
||||
.When(x => !string.IsNullOrWhiteSpace(x.Filter!.WeekNumber))
|
||||
.WithMessage("فرمت شماره هفته باید به صورت YYYY-Www باشد (مثال: 2025-W48)");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -3,27 +3,17 @@ namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetUserPayouts;
|
||||
public class GetUserPayoutsResponseDto
|
||||
{
|
||||
/// <summary>
|
||||
/// لیست Payout ها
|
||||
/// متادیتا
|
||||
/// </summary>
|
||||
public List<UserPayoutDto> Payouts { get; set; } = new();
|
||||
public MetaData MetaData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد کل رکوردها
|
||||
/// مدل خروجی
|
||||
/// </summary>
|
||||
public int TotalCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره صفحه فعلی
|
||||
/// </summary>
|
||||
public int PageNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد در هر صفحه
|
||||
/// </summary>
|
||||
public int PageSize { get; set; }
|
||||
public List<GetUserPayoutsResponseModel>? Models { get; set; }
|
||||
}
|
||||
|
||||
public class UserPayoutDto
|
||||
public class GetUserPayoutsResponseModel
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه Payout
|
||||
@@ -35,43 +25,53 @@ public class UserPayoutDto
|
||||
/// </summary>
|
||||
public long UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کاربر
|
||||
/// </summary>
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// شماره هفته
|
||||
/// </summary>
|
||||
public string WeekNumber { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// بالانس Leg چپ
|
||||
/// تعداد تعادلهای کسب شده
|
||||
/// </summary>
|
||||
public decimal LeftLegBalance { get; set; }
|
||||
public int BalancesEarned { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// بالانس Leg راست
|
||||
/// ارزش هر تعادل
|
||||
/// </summary>
|
||||
public decimal RightLegBalance { get; set; }
|
||||
public long ValuePerBalance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// بالانس Leg ضعیفتر
|
||||
/// مبلغ کل
|
||||
/// </summary>
|
||||
public decimal WeakerLegBalance { get; set; }
|
||||
public long TotalAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کمیسیون (تومان)
|
||||
/// وضعیت (0=Pending, 1=Paid, 2=Failed)
|
||||
/// </summary>
|
||||
public decimal CommissionAmount { get; set; }
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت پرداخت
|
||||
/// روش برداشت
|
||||
/// </summary>
|
||||
public string Status { get; set; } = string.Empty;
|
||||
public int? WithdrawalMethod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ پرداخت
|
||||
/// شماره شبا
|
||||
/// </summary>
|
||||
public DateTime? PaidAt { get; set; }
|
||||
public string IbanNumber { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ ایجاد
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime Created { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آخرین تغییر
|
||||
/// </summary>
|
||||
public DateTime? LastModified { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,29 +1,37 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetUserWeeklyBalances;
|
||||
|
||||
public record GetUserWeeklyBalancesQuery : IRequest<GetUserWeeklyBalancesResponseDto>
|
||||
{
|
||||
/// <summary>
|
||||
/// موقعیت صفحهبندی
|
||||
/// </summary>
|
||||
public PaginationState? PaginationState { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// مرتبسازی بر اساس
|
||||
/// </summary>
|
||||
public string? SortBy { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// فیلتر
|
||||
/// </summary>
|
||||
public GetUserWeeklyBalancesFilter? Filter { get; init; }
|
||||
}
|
||||
|
||||
public class GetUserWeeklyBalancesFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه کاربر (فیلتر اختیاری)
|
||||
/// </summary>
|
||||
public long? UserId { get; init; }
|
||||
public long? UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره هفته (فیلتر اختیاری)
|
||||
/// </summary>
|
||||
public string? WeekNumber { get; init; }
|
||||
public string? WeekNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فقط تعادلهای فعال (منقضی نشده)
|
||||
/// </summary>
|
||||
public bool OnlyActive { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره صفحه
|
||||
/// </summary>
|
||||
public int PageIndex { get; init; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// تعداد در صفحه
|
||||
/// </summary>
|
||||
public int PageSize { get; init; } = 10;
|
||||
public bool? OnlyActive { get; set; }
|
||||
}
|
||||
|
||||
@@ -17,19 +17,19 @@ public class GetUserWeeklyBalancesQueryHandler : IRequestHandler<GetUserWeeklyBa
|
||||
{
|
||||
var grpcRequest = new GetUserWeeklyBalancesRequest
|
||||
{
|
||||
OnlyActive = request.OnlyActive,
|
||||
PageIndex = request.PageIndex,
|
||||
PageSize = request.PageSize
|
||||
OnlyActive = request.Filter?.OnlyActive ?? false,
|
||||
PageIndex = request.PaginationState?.PageNumber ?? 1,
|
||||
PageSize = request.PaginationState?.PageSize ?? 10
|
||||
};
|
||||
|
||||
if (request.UserId.HasValue)
|
||||
if (request.Filter?.UserId.HasValue == true && request.Filter.UserId.Value > 0)
|
||||
{
|
||||
grpcRequest.UserId = request.UserId.Value;
|
||||
grpcRequest.UserId = request.Filter.UserId.Value;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.WeekNumber))
|
||||
if (!string.IsNullOrWhiteSpace(request.Filter?.WeekNumber))
|
||||
{
|
||||
grpcRequest.WeekNumber = request.WeekNumber;
|
||||
grpcRequest.WeekNumber = request.Filter.WeekNumber;
|
||||
}
|
||||
|
||||
var response = await _context.Commissions.GetUserWeeklyBalancesAsync(grpcRequest, cancellationToken: cancellationToken);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetUserWeeklyBalances;
|
||||
|
||||
public class GetUserWeeklyBalancesQueryValidator : AbstractValidator<GetUserWeeklyBalancesQuery>
|
||||
{
|
||||
public GetUserWeeklyBalancesQueryValidator()
|
||||
{
|
||||
RuleFor(x => x.PaginationState)
|
||||
.NotNull()
|
||||
.WithMessage("موقعیت صفحهبندی الزامی است");
|
||||
|
||||
When(x => x.Filter != null, () =>
|
||||
{
|
||||
RuleFor(x => x.Filter!.UserId)
|
||||
.GreaterThan(0)
|
||||
.When(x => x.Filter!.UserId.HasValue)
|
||||
.WithMessage("شناسه کاربر معتبر نیست");
|
||||
|
||||
RuleFor(x => x.Filter!.WeekNumber)
|
||||
.Matches(@"^\d{4}-W\d{2}$")
|
||||
.When(x => !string.IsNullOrWhiteSpace(x.Filter!.WeekNumber))
|
||||
.WithMessage("فرمت شماره هفته باید به صورت YYYY-Www باشد (مثال: 2025-W48)");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.ProcessManualMembershipPayment;
|
||||
|
||||
public record ProcessManualMembershipPaymentCommand : IRequest<ProcessManualMembershipPaymentResponseDto>
|
||||
{
|
||||
public long UserId { get; init; }
|
||||
public long Amount { get; init; }
|
||||
public string ReferenceNumber { get; init; } = string.Empty;
|
||||
public string? Description { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using CMSMicroservice.Protobuf.Protos.ManualPayment;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.ProcessManualMembershipPayment;
|
||||
|
||||
public class ProcessManualMembershipPaymentCommandHandler : IRequestHandler<ProcessManualMembershipPaymentCommand, ProcessManualMembershipPaymentResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
private readonly ICurrentUserService _currentUser;
|
||||
private readonly ILogger<ProcessManualMembershipPaymentCommandHandler> _logger;
|
||||
|
||||
public ProcessManualMembershipPaymentCommandHandler(
|
||||
IApplicationContractContext context,
|
||||
ICurrentUserService currentUser,
|
||||
ILogger<ProcessManualMembershipPaymentCommandHandler> logger)
|
||||
{
|
||||
_context = context;
|
||||
_currentUser = currentUser;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<ProcessManualMembershipPaymentResponseDto> Handle(
|
||||
ProcessManualMembershipPaymentCommand request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"Processing manual membership payment via BFF for UserId {UserId}, Amount {Amount}",
|
||||
request.UserId,
|
||||
request.Amount);
|
||||
|
||||
var grpcRequest = new ProcessManualMembershipPaymentRequest
|
||||
{
|
||||
UserId = request.UserId,
|
||||
Amount = request.Amount,
|
||||
ReferenceNumber = request.ReferenceNumber
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.Description))
|
||||
{
|
||||
grpcRequest.Description = request.Description;
|
||||
}
|
||||
|
||||
var response = await _context.ManualPayments.ProcessManualMembershipPaymentAsync(
|
||||
grpcRequest,
|
||||
cancellationToken: cancellationToken);
|
||||
|
||||
return new ProcessManualMembershipPaymentResponseDto
|
||||
{
|
||||
TransactionId = response.TransactionId,
|
||||
OrderId = response.OrderId,
|
||||
NewWalletBalance = response.NewWalletBalance,
|
||||
Message = response.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.ProcessManualMembershipPayment;
|
||||
|
||||
public class ProcessManualMembershipPaymentCommandValidator : AbstractValidator<ProcessManualMembershipPaymentCommand>
|
||||
{
|
||||
public ProcessManualMembershipPaymentCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.UserId)
|
||||
.GreaterThan(0)
|
||||
.WithMessage("شناسه کاربر معتبر نیست");
|
||||
|
||||
RuleFor(x => x.Amount)
|
||||
.GreaterThan(0)
|
||||
.WithMessage("مبلغ باید بزرگتر از صفر باشد");
|
||||
|
||||
RuleFor(x => x.ReferenceNumber)
|
||||
.NotEmpty()
|
||||
.WithMessage("شماره مرجع الزامی است")
|
||||
.MaximumLength(50)
|
||||
.WithMessage("شماره مرجع نباید بیشتر از 50 کاراکتر باشد");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.ProcessManualMembershipPayment;
|
||||
|
||||
public class ProcessManualMembershipPaymentResponseDto
|
||||
{
|
||||
public long TransactionId { get; set; }
|
||||
public long OrderId { get; set; }
|
||||
public long NewWalletBalance { get; set; }
|
||||
public string Message { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Afrino.FMSMicroservice.Protobuf" Version="0.0.122" />
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.148" />
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.149" />
|
||||
|
||||
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
|
||||
|
||||
@@ -2,7 +2,9 @@ using BackOffice.BFF.Application.CommissionCQ.Queries.GetWeeklyPool;
|
||||
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 Foursat.BackOffice.BFF.Commission.Protos;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BackOffice.BFF.WebApi.Common.Mappings;
|
||||
|
||||
@@ -28,32 +30,34 @@ public class CommissionProfile : IRegister
|
||||
});
|
||||
|
||||
// GetUserPayoutsResponseDto -> GetUserCommissionPayoutsResponse
|
||||
// config.NewConfig<GetUserPayoutsResponseDto, GetUserCommissionPayoutsResponse>()
|
||||
// .MapWith(src => new GetUserCommissionPayoutsResponse
|
||||
// {
|
||||
// MetaData = new BackOffice.BFF.Protobuf.Common.MetaData
|
||||
// {
|
||||
// CurrentPage = src.PageNumber,
|
||||
// PageSize = src.PageSize,
|
||||
// TotalCount = src.TotalCount,
|
||||
// TotalPage = src.TotalPages
|
||||
// },
|
||||
// Models = { src.Payouts.Select(m => new UserCommissionPayoutModel
|
||||
// {
|
||||
// Id = m.Id,
|
||||
// UserId = m.UserId,
|
||||
// UserName = m.UserName ?? string.Empty,
|
||||
// WeekNumber = m.WeekNumber ?? string.Empty,
|
||||
// BalanceCount = m.BalanceCount,
|
||||
// PayoutAmount = m.PayoutAmount,
|
||||
// Status = m.Status,
|
||||
// StatusDisplay = m.StatusDisplay ?? string.Empty,
|
||||
// PayoutDate = m.PayoutDate.HasValue
|
||||
// ? Timestamp.FromDateTime(DateTime.SpecifyKind(m.PayoutDate.Value, DateTimeKind.Utc))
|
||||
// : null,
|
||||
// Created = Timestamp.FromDateTime(DateTime.SpecifyKind(m.Created, DateTimeKind.Utc))
|
||||
// }) }
|
||||
// });
|
||||
config.NewConfig<GetUserPayoutsResponseDto, GetUserCommissionPayoutsResponse>()
|
||||
.MapWith(src => 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
|
||||
},
|
||||
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
|
||||
config.NewConfig<GetAllWeeklyPoolsResponseDto, GetAllWeeklyPoolsResponse>()
|
||||
|
||||
@@ -3,6 +3,7 @@ using BackOffice.BFF.WebApi.Common.Services;
|
||||
using BackOffice.BFF.Application.ManualPaymentCQ.Commands.CreateManualPayment;
|
||||
using BackOffice.BFF.Application.ManualPaymentCQ.Commands.ApproveManualPayment;
|
||||
using BackOffice.BFF.Application.ManualPaymentCQ.Commands.RejectManualPayment;
|
||||
using BackOffice.BFF.Application.ManualPaymentCQ.Commands.ProcessManualMembershipPayment;
|
||||
using BackOffice.BFF.Application.ManualPaymentCQ.Queries.GetManualPayments;
|
||||
|
||||
namespace BackOffice.BFF.WebApi.Services;
|
||||
@@ -70,4 +71,14 @@ public class ManualPaymentService : ManualPaymentContract.ManualPaymentContractB
|
||||
|
||||
return result.Adapt<GetManualPaymentsResponse>();
|
||||
}
|
||||
|
||||
[RequiresPermission(PermissionNames.ManualPaymentsCreate)]
|
||||
public override async Task<ProcessManualMembershipPaymentResponse> ProcessManualMembershipPayment(
|
||||
ProcessManualMembershipPaymentRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<ProcessManualMembershipPaymentRequest, ProcessManualMembershipPaymentCommand, ProcessManualMembershipPaymentResponse>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageId>Foursat.BackOffice.BFF.Commission.Protobuf</PackageId>
|
||||
<Version>0.0.7</Version>
|
||||
<Version>0.0.12</Version>
|
||||
<Authors>FourSat</Authors>
|
||||
<Company>FourSat</Company>
|
||||
<Product>BackOffice.BFF.Commission.Protobuf</Product>
|
||||
@@ -32,7 +32,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Foursat.BackOffice.BFF.Common.Protobuf" Version="0.0.1" />
|
||||
<PackageReference Include="Foursat.BackOffice.BFF.Common.Protobuf" Version="0.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PushPackage" AfterTargets="Pack">
|
||||
|
||||
@@ -191,12 +191,18 @@ message GetWeeklyCommissionPoolResponse
|
||||
|
||||
// GetUserCommissionPayouts Query
|
||||
message GetUserCommissionPayoutsRequest
|
||||
{
|
||||
|
||||
messages.PaginationState pagination_state = 1;
|
||||
GetUserPayoutsFilter filter = 2;
|
||||
|
||||
}
|
||||
message GetUserPayoutsFilter
|
||||
{
|
||||
google.protobuf.Int64Value user_id = 1;
|
||||
google.protobuf.Int32Value status = 2; // CommissionPayoutStatus enum
|
||||
google.protobuf.StringValue week_number = 3;
|
||||
int32 page_index = 4;
|
||||
int32 page_size = 5;
|
||||
|
||||
}
|
||||
|
||||
message GetUserCommissionPayoutsResponse
|
||||
@@ -214,7 +220,7 @@ message UserCommissionPayoutModel
|
||||
int32 balances_earned = 5;
|
||||
int64 value_per_balance = 6;
|
||||
int64 total_amount = 7;
|
||||
int32 status = 8; // CommissionPayoutStatus enum
|
||||
int32 status = 8; // CommissionPayoutStatus enum (0=Pending, 1=Paid, 2=Failed)
|
||||
google.protobuf.Int32Value withdrawal_method = 9;
|
||||
string iban_number = 10;
|
||||
google.protobuf.Timestamp created = 11;
|
||||
@@ -227,8 +233,7 @@ message GetCommissionPayoutHistoryRequest
|
||||
google.protobuf.Int64Value payout_id = 1;
|
||||
google.protobuf.Int64Value user_id = 2;
|
||||
google.protobuf.StringValue week_number = 3;
|
||||
int32 page_index = 4;
|
||||
int32 page_size = 5;
|
||||
messages.PaginationState pagination_state = 4;
|
||||
}
|
||||
|
||||
message GetCommissionPayoutHistoryResponse
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>0.0.2</Version>
|
||||
<Version>0.0.4</Version>
|
||||
<DebugType>None</DebugType>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||
|
||||
@@ -15,6 +15,7 @@ service ManualPaymentContract
|
||||
rpc ApproveManualPayment(ApproveManualPaymentRequest) returns (google.protobuf.Empty);
|
||||
rpc RejectManualPayment(RejectManualPaymentRequest) returns (google.protobuf.Empty);
|
||||
rpc GetManualPayments(GetManualPaymentsRequest) returns (GetManualPaymentsResponse);
|
||||
rpc ProcessManualMembershipPayment(ProcessManualMembershipPaymentRequest) returns (ProcessManualMembershipPaymentResponse);
|
||||
}
|
||||
|
||||
message GetManualPaymentsRequest
|
||||
@@ -82,3 +83,19 @@ message RejectManualPaymentRequest
|
||||
string rejection_reason = 2;
|
||||
}
|
||||
|
||||
message ProcessManualMembershipPaymentRequest
|
||||
{
|
||||
int64 user_id = 1;
|
||||
int64 amount = 2;
|
||||
string reference_number = 3;
|
||||
google.protobuf.StringValue description = 4;
|
||||
}
|
||||
|
||||
message ProcessManualMembershipPaymentResponse
|
||||
{
|
||||
int64 transaction_id = 1;
|
||||
int64 order_id = 2;
|
||||
int64 new_wallet_balance = 3;
|
||||
string message = 4;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user