feat(commission): add BulkCreditPayouts — credit wallets for pending payouts
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 10m35s

- commission.proto: add BulkCreditPayouts rpc + request/response messages; bump version to 0.0.198
- BulkCreditPayoutsCommand + Handler: load all Pending payouts for given week, credit UserWallet.Balance for each user, create UserWalletHistory + CommissionPayoutHistory records, set Status=Paid + PaidAt
- CommissionService: wire up BulkCreditPayouts gRPC method
- CommissionProfile: add Mapster mappings for request/result ↔ proto types

Previously ProcessUserPayouts created records with Status=Pending but never credited wallets, making CustomerWithdrawBalance unreachable (it requires Status==Paid).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
masoodafar-web
2026-05-18 00:36:05 +03:30
parent cdd124ac25
commit da1a2fcf8e
6 changed files with 170 additions and 1 deletions
@@ -3,7 +3,7 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.197</Version>
<Version>0.0.198</Version>
<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
@@ -137,6 +137,14 @@ service CommissionContract
get: "/Commission/GetWithdrawalReports"
};
};
// Bulk credit wallet for all Pending payouts of a week
rpc BulkCreditPayouts(BulkCreditPayoutsRequest) returns (BulkCreditPayoutsResponse){
option (google.api.http) = {
post: "/Commission/BulkCreditPayouts"
body: "*"
};
};
}
// ============ Commands ============
@@ -608,6 +616,19 @@ message WeekDefinitionItem
string end_date_persian = 13; // Frontend expects Persian date string
}
// BulkCreditPayouts Command
message BulkCreditPayoutsRequest
{
int64 week_definition_id = 1; // Credit all Pending payouts for this week
}
message BulkCreditPayoutsResponse
{
int32 credited_count = 1; // تعداد پرداخت‌هایی که به کیف پول واریز شد
int64 total_credited = 2; // مجموع مبلغ واریز شده (ریال)
string message = 3;
}
// ============ Customer APIs ============
// GetMyCommissionPayouts - for frontend customer display