feat: Implement withdrawal reports query and service integration

This commit is contained in:
masoodafar-web
2025-12-04 17:29:10 +03:30
parent abda623519
commit 5e3112d71f
7 changed files with 515 additions and 276 deletions

View File

@@ -105,6 +105,13 @@ service CommissionContract
get: "/Commission/GetWorkerLogs"
};
};
// Financial Reports
rpc GetWithdrawalReports(GetWithdrawalReportsRequest) returns (GetWithdrawalReportsResponse){
option (google.api.http) = {
get: "/Commission/GetWithdrawalReports"
};
};
}
// ============ Commands ============
@@ -388,6 +395,50 @@ message WorkerExecutionLogModel
google.protobuf.StringValue details = 10; // JSON or text details
}
// GetWithdrawalReports Query
message GetWithdrawalReportsRequest
{
google.protobuf.Timestamp start_date = 1; // Optional - default: 30 days ago
google.protobuf.Timestamp end_date = 2; // Optional - default: today
int32 period_type = 3; // ReportPeriodType: Daily=1, Weekly=2, Monthly=3
google.protobuf.Int32Value status = 4; // CommissionPayoutStatus enum (optional)
google.protobuf.Int64Value user_id = 5; // Optional user filter
}
message GetWithdrawalReportsResponse
{
repeated PeriodReport period_reports = 1;
WithdrawalSummary summary = 2;
}
message PeriodReport
{
string period_label = 1; // e.g., "2025-01-15", "هفته 3", "فروردین 1404"
google.protobuf.Timestamp start_date = 2;
google.protobuf.Timestamp end_date = 3;
int32 total_requests = 4;
int32 pending_count = 5;
int32 approved_count = 6;
int32 rejected_count = 7;
int32 completed_count = 8;
int32 failed_count = 9;
int64 total_amount = 10;
int64 paid_amount = 11;
int64 pending_amount = 12;
}
message WithdrawalSummary
{
int32 total_requests = 1;
int64 total_amount = 2;
int64 total_paid = 3;
int64 total_pending = 4;
int64 total_rejected = 5;
int64 average_amount = 6;
int32 unique_users = 7;
float success_rate = 8; // Percentage (0-100)
}
message WithdrawalRequestModel
{
int64 id = 1;