Add response DTOs for withdrawal and club activation commands
This commit is contained in:
@@ -0,0 +1,273 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package commission;
|
||||
|
||||
import "public_messages.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.Commission.Protobuf";
|
||||
|
||||
service CommissionContract
|
||||
{
|
||||
// Commands
|
||||
rpc CalculateWeeklyBalances(CalculateWeeklyBalancesRequest) returns (google.protobuf.Empty);
|
||||
rpc CalculateWeeklyCommissionPool(CalculateWeeklyCommissionPoolRequest) returns (google.protobuf.Empty);
|
||||
rpc ProcessUserPayouts(ProcessUserPayoutsRequest) returns (google.protobuf.Empty);
|
||||
rpc RequestWithdrawal(RequestWithdrawalRequest) returns (google.protobuf.Empty);
|
||||
rpc ProcessWithdrawal(ProcessWithdrawalRequest) returns (ProcessWithdrawalResponse);
|
||||
rpc ApproveWithdrawal(ApproveWithdrawalRequest) returns (ApproveWithdrawalResponse);
|
||||
rpc RejectWithdrawal(RejectWithdrawalRequest) returns (RejectWithdrawalResponse);
|
||||
|
||||
// Queries
|
||||
rpc GetWeeklyCommissionPool(GetWeeklyCommissionPoolRequest) returns (GetWeeklyCommissionPoolResponse);
|
||||
rpc GetUserCommissionPayouts(GetUserCommissionPayoutsRequest) returns (GetUserCommissionPayoutsResponse);
|
||||
rpc GetCommissionPayoutHistory(GetCommissionPayoutHistoryRequest) returns (GetCommissionPayoutHistoryResponse);
|
||||
rpc GetUserWeeklyBalances(GetUserWeeklyBalancesRequest) returns (GetUserWeeklyBalancesResponse);
|
||||
rpc GetAllWeeklyPools(GetAllWeeklyPoolsRequest) returns (GetAllWeeklyPoolsResponse);
|
||||
rpc GetWithdrawalRequests(GetWithdrawalRequestsRequest) returns (GetWithdrawalRequestsResponse);
|
||||
}
|
||||
|
||||
// ============ Commands ============
|
||||
|
||||
// CalculateWeeklyBalances Command
|
||||
message CalculateWeeklyBalancesRequest
|
||||
{
|
||||
string week_number = 1; // Format: "YYYY-Www" (e.g., "2025-W01")
|
||||
bool force_recalculate = 2;
|
||||
}
|
||||
|
||||
// CalculateWeeklyCommissionPool Command
|
||||
message CalculateWeeklyCommissionPoolRequest
|
||||
{
|
||||
string week_number = 1;
|
||||
}
|
||||
|
||||
// ProcessUserPayouts Command
|
||||
message ProcessUserPayoutsRequest
|
||||
{
|
||||
string week_number = 1;
|
||||
bool force_reprocess = 2;
|
||||
}
|
||||
|
||||
// RequestWithdrawal Command
|
||||
message RequestWithdrawalRequest
|
||||
{
|
||||
int64 payout_id = 1;
|
||||
int32 withdrawal_method = 2; // WithdrawalMethod enum: Cash=0, Diamond=1
|
||||
google.protobuf.StringValue iban_number = 3; // Required for Cash method
|
||||
}
|
||||
|
||||
// ProcessWithdrawal Command
|
||||
message ProcessWithdrawalRequest
|
||||
{
|
||||
int64 withdrawal_id = 1;
|
||||
string transaction_id = 2;
|
||||
string admin_note = 3;
|
||||
}
|
||||
|
||||
message ProcessWithdrawalResponse
|
||||
{
|
||||
bool success = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
// ApproveWithdrawal Command
|
||||
message ApproveWithdrawalRequest
|
||||
{
|
||||
int64 withdrawal_id = 1;
|
||||
string admin_note = 2;
|
||||
}
|
||||
|
||||
message ApproveWithdrawalResponse
|
||||
{
|
||||
bool success = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
// RejectWithdrawal Command
|
||||
message RejectWithdrawalRequest
|
||||
{
|
||||
int64 withdrawal_id = 1;
|
||||
string reject_reason = 2;
|
||||
}
|
||||
|
||||
message RejectWithdrawalResponse
|
||||
{
|
||||
bool success = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
// ============ Queries ============
|
||||
|
||||
// GetWeeklyCommissionPool Query
|
||||
message GetWeeklyCommissionPoolRequest
|
||||
{
|
||||
string week_number = 1;
|
||||
}
|
||||
|
||||
message GetWeeklyCommissionPoolResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
string week_number = 2;
|
||||
int64 total_pool_amount = 3; // Rials
|
||||
int32 total_balances = 4;
|
||||
int64 value_per_balance = 5; // Rials per balance
|
||||
bool is_calculated = 6;
|
||||
google.protobuf.Timestamp calculated_at = 7;
|
||||
google.protobuf.Timestamp created = 8;
|
||||
}
|
||||
|
||||
// GetUserCommissionPayouts Query
|
||||
message GetUserCommissionPayoutsRequest
|
||||
{
|
||||
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
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated UserCommissionPayoutModel models = 2;
|
||||
}
|
||||
|
||||
message UserCommissionPayoutModel
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 user_id = 2;
|
||||
string user_name = 3;
|
||||
string week_number = 4;
|
||||
int32 balances_earned = 5;
|
||||
int64 value_per_balance = 6;
|
||||
int64 total_amount = 7;
|
||||
int32 status = 8; // CommissionPayoutStatus enum
|
||||
google.protobuf.Int32Value withdrawal_method = 9;
|
||||
string iban_number = 10;
|
||||
google.protobuf.Timestamp created = 11;
|
||||
google.protobuf.Timestamp last_modified = 12;
|
||||
}
|
||||
|
||||
// GetCommissionPayoutHistory Query
|
||||
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;
|
||||
}
|
||||
|
||||
message GetCommissionPayoutHistoryResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated CommissionPayoutHistoryModel models = 2;
|
||||
}
|
||||
|
||||
message CommissionPayoutHistoryModel
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 payout_id = 2;
|
||||
int64 user_id = 3;
|
||||
string week_number = 4;
|
||||
int64 amount_before = 5;
|
||||
int64 amount_after = 6;
|
||||
int32 old_status = 7; // CommissionPayoutStatus enum
|
||||
int32 new_status = 8;
|
||||
int32 action = 9; // CommissionPayoutAction enum
|
||||
string performed_by = 10;
|
||||
string reason = 11;
|
||||
google.protobuf.Timestamp created = 12;
|
||||
}
|
||||
|
||||
// GetUserWeeklyBalances Query
|
||||
message GetUserWeeklyBalancesRequest
|
||||
{
|
||||
google.protobuf.Int64Value user_id = 1;
|
||||
google.protobuf.StringValue week_number = 2;
|
||||
bool only_active = 3; // Only non-expired balances
|
||||
int32 page_index = 4;
|
||||
int32 page_size = 5;
|
||||
}
|
||||
|
||||
message GetUserWeeklyBalancesResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated UserWeeklyBalanceModel models = 2;
|
||||
}
|
||||
|
||||
message UserWeeklyBalanceModel
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 user_id = 2;
|
||||
string week_number = 3;
|
||||
int32 left_leg_balances = 4;
|
||||
int32 right_leg_balances = 5;
|
||||
int32 total_balances = 6;
|
||||
int64 weekly_pool_contribution = 7;
|
||||
google.protobuf.Timestamp calculated_at = 8;
|
||||
bool is_expired = 9;
|
||||
google.protobuf.Timestamp created = 10;
|
||||
}
|
||||
|
||||
// GetWithdrawalRequests Query
|
||||
message GetWithdrawalRequestsRequest
|
||||
{
|
||||
int32 page_index = 1;
|
||||
int32 page_size = 2;
|
||||
google.protobuf.Int32Value status = 3; // 0=Pending, 1=Approved, 2=Rejected, 3=Processed
|
||||
google.protobuf.Int64Value user_id = 4;
|
||||
}
|
||||
|
||||
message GetWithdrawalRequestsResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated WithdrawalRequestModel models = 2;
|
||||
}
|
||||
|
||||
message WithdrawalRequestModel
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 user_id = 2;
|
||||
string user_name = 3;
|
||||
string phone_number = 4;
|
||||
int64 amount = 5;
|
||||
int32 status = 6; // 0=Pending, 1=Approved, 2=Rejected, 3=Processed
|
||||
string method = 7; // Bank, Crypto, Cash
|
||||
string bank_account = 8;
|
||||
string bank_name = 9;
|
||||
google.protobuf.Timestamp requested_at = 10;
|
||||
google.protobuf.Timestamp processed_at = 11;
|
||||
string admin_note = 12;
|
||||
}
|
||||
|
||||
// GetAllWeeklyPools Query
|
||||
message GetAllWeeklyPoolsRequest
|
||||
{
|
||||
google.protobuf.StringValue from_week = 1;
|
||||
google.protobuf.StringValue to_week = 2;
|
||||
google.protobuf.BoolValue only_calculated = 3;
|
||||
int32 page_index = 4;
|
||||
int32 page_size = 5;
|
||||
}
|
||||
|
||||
message GetAllWeeklyPoolsResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated WeeklyCommissionPoolModel models = 2;
|
||||
}
|
||||
|
||||
message WeeklyCommissionPoolModel
|
||||
{
|
||||
int64 id = 1;
|
||||
string week_number = 2;
|
||||
int64 total_pool_amount = 3;
|
||||
int32 total_balances = 4;
|
||||
int64 value_per_balance = 5;
|
||||
bool is_calculated = 6;
|
||||
google.protobuf.Timestamp calculated_at = 7;
|
||||
google.protobuf.Timestamp created = 8;
|
||||
}
|
||||
Reference in New Issue
Block a user