Add response DTOs for withdrawal and club activation commands
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageId>Foursat.BackOffice.BFF.ClubMembership.Protobuf</PackageId>
|
||||
<Version>0.0.1</Version>
|
||||
<Authors>FourSat</Authors>
|
||||
<Company>FourSat</Company>
|
||||
<Product>Foursat.BackOffice.BFF.ClubMembership.Protobuf</Product>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
||||
<PackageReference Include="Grpc.Core.Api" Version="2.54.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.72.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.2.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="Protos\clubmembership.proto" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,138 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package clubmembership;
|
||||
|
||||
import "public_messages.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.ClubMembership.Protobuf";
|
||||
|
||||
service ClubMembershipContract
|
||||
{
|
||||
rpc ActivateClubMembership(ActivateClubMembershipRequest) returns (google.protobuf.Empty);
|
||||
rpc DeactivateClubMembership(DeactivateClubMembershipRequest) returns (google.protobuf.Empty);
|
||||
rpc AssignFeatureToMembership(AssignFeatureToMembershipRequest) returns (google.protobuf.Empty);
|
||||
rpc GetClubMembership(GetClubMembershipRequest) returns (GetClubMembershipResponse);
|
||||
rpc GetAllClubMemberships(GetAllClubMembershipsRequest) returns (GetAllClubMembershipsResponse);
|
||||
rpc GetClubMembershipHistory(GetClubMembershipHistoryRequest) returns (GetClubMembershipHistoryResponse);
|
||||
}
|
||||
|
||||
// Activate Command
|
||||
message ActivateClubMembershipRequest
|
||||
{
|
||||
int64 user_id = 1;
|
||||
int64 package_id = 2;
|
||||
google.protobuf.StringValue activation_code = 3;
|
||||
int32 duration_months = 4;
|
||||
}
|
||||
|
||||
// Deactivate Command
|
||||
message DeactivateClubMembershipRequest
|
||||
{
|
||||
int64 user_id = 1;
|
||||
string reason = 2;
|
||||
}
|
||||
|
||||
// AssignFeature Command
|
||||
message AssignFeatureToMembershipRequest
|
||||
{
|
||||
int64 user_id = 1;
|
||||
int64 product_id = 2;
|
||||
google.protobuf.Int32Value quantity = 3;
|
||||
google.protobuf.Int32Value duration_days = 4;
|
||||
}
|
||||
|
||||
// Get Query
|
||||
message GetClubMembershipRequest
|
||||
{
|
||||
int64 user_id = 1;
|
||||
}
|
||||
|
||||
message GetClubMembershipResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 user_id = 2;
|
||||
int64 package_id = 3;
|
||||
string package_name = 4;
|
||||
string activation_code = 5;
|
||||
google.protobuf.Timestamp activated_at = 6;
|
||||
google.protobuf.Timestamp expires_at = 7;
|
||||
bool is_active = 8;
|
||||
google.protobuf.Timestamp created = 9;
|
||||
repeated MembershipFeatureModel features = 10;
|
||||
}
|
||||
|
||||
message MembershipFeatureModel
|
||||
{
|
||||
int64 product_id = 1;
|
||||
string product_name = 2;
|
||||
int32 quantity = 3;
|
||||
google.protobuf.Timestamp expires_at = 4;
|
||||
bool is_active = 5;
|
||||
}
|
||||
|
||||
// GetAll Query
|
||||
message GetAllClubMembershipsRequest
|
||||
{
|
||||
google.protobuf.Int64Value user_id = 1;
|
||||
google.protobuf.Int64Value package_id = 2;
|
||||
google.protobuf.BoolValue is_active = 3;
|
||||
google.protobuf.BoolValue is_expired = 4;
|
||||
int32 page_index = 5;
|
||||
int32 page_size = 6;
|
||||
}
|
||||
|
||||
message GetAllClubMembershipsResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated ClubMembershipModel models = 2;
|
||||
}
|
||||
|
||||
message ClubMembershipModel
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 user_id = 2;
|
||||
string user_name = 3;
|
||||
int64 package_id = 4;
|
||||
string package_name = 5;
|
||||
string activation_code = 6;
|
||||
google.protobuf.Timestamp activated_at = 7;
|
||||
google.protobuf.Timestamp expires_at = 8;
|
||||
bool is_active = 9;
|
||||
bool is_expired = 10;
|
||||
google.protobuf.Timestamp created = 11;
|
||||
}
|
||||
|
||||
// GetHistory Query
|
||||
message GetClubMembershipHistoryRequest
|
||||
{
|
||||
google.protobuf.Int64Value user_id = 1;
|
||||
google.protobuf.Int64Value package_id = 2;
|
||||
int32 page_index = 3;
|
||||
int32 page_size = 4;
|
||||
}
|
||||
|
||||
message GetClubMembershipHistoryResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated ClubMembershipHistoryModel models = 2;
|
||||
}
|
||||
|
||||
message ClubMembershipHistoryModel
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 club_membership_id = 2;
|
||||
int64 user_id = 3;
|
||||
google.protobuf.Int64Value old_package_id = 4;
|
||||
google.protobuf.Int64Value new_package_id = 5;
|
||||
google.protobuf.Timestamp old_activated_at = 6;
|
||||
google.protobuf.Timestamp new_activated_at = 7;
|
||||
google.protobuf.Timestamp old_expires_at = 8;
|
||||
google.protobuf.Timestamp new_expires_at = 9;
|
||||
int32 action = 10; // ClubMembershipAction enum
|
||||
string performed_by = 11;
|
||||
string reason = 12;
|
||||
google.protobuf.Timestamp created = 13;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package messages;
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.Protobuf.Common";
|
||||
service PublicMessageContract{}
|
||||
message PaginationState
|
||||
{
|
||||
int32 page_number = 1;
|
||||
|
||||
int32 page_size = 2;
|
||||
}
|
||||
message MetaData
|
||||
{
|
||||
int64 current_page = 1;
|
||||
|
||||
int64 total_page = 2;
|
||||
|
||||
int64 page_size = 3;
|
||||
|
||||
int64 total_count = 4;
|
||||
|
||||
bool has_previous = 5;
|
||||
|
||||
bool has_next = 6;
|
||||
}
|
||||
message DecimalValue
|
||||
{
|
||||
|
||||
int64 units = 1;
|
||||
|
||||
sfixed32 nanos = 2;
|
||||
}
|
||||
enum PaymentStatus
|
||||
{
|
||||
Success = 0;
|
||||
Reject = 1;
|
||||
Pending = 2;
|
||||
}
|
||||
// وضعیت ارسال سفارش
|
||||
enum DeliveryStatus
|
||||
{
|
||||
// نامشخص / نیاز به ارسال ندارد (مثلا سفارش پکیج)
|
||||
DeliveryStatus_None = 0;
|
||||
// ثبت شده و در انتظار آمادهسازی/ارسال
|
||||
DeliveryStatus_Pending = 1;
|
||||
// تحویل پست/حملونقل شده است
|
||||
DeliveryStatus_InTransit = 2;
|
||||
// توسط مشتری دریافت شده است
|
||||
DeliveryStatus_Delivered = 3;
|
||||
// مرجوع شده
|
||||
DeliveryStatus_Returned = 4;
|
||||
}
|
||||
enum TransactionType
|
||||
{
|
||||
Buy = 0;
|
||||
DepositIpg = 1;
|
||||
DepositExternal1 = 2;
|
||||
Withdraw = 3;
|
||||
}
|
||||
enum ContractType
|
||||
{
|
||||
Main = 0;
|
||||
CMS = 1;
|
||||
}
|
||||
enum PaymentMethod
|
||||
{
|
||||
IPG = 0;
|
||||
Wallet = 1;
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageId>Foursat.BackOffice.BFF.Commission.Protobuf</PackageId>
|
||||
<Version>0.0.2</Version>
|
||||
<Authors>FourSat</Authors>
|
||||
<Company>FourSat</Company>
|
||||
<Product>BackOffice.BFF.Commission.Protobuf</Product>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
||||
<PackageReference Include="Grpc.Core.Api" Version="2.54.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.72.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.2.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="Protos\commission.proto" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Foursat.BackOffice.BFF.Common.Protobuf" Version="0.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PushPackage" AfterTargets="Pack">
|
||||
<Exec Command="dotnet nuget push $(OutputPath)..\$(PackageId).$(Version).nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package messages;
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.Protobuf.Common";
|
||||
service PublicMessageContract{}
|
||||
message PaginationState
|
||||
{
|
||||
int32 page_number = 1;
|
||||
|
||||
int32 page_size = 2;
|
||||
}
|
||||
message MetaData
|
||||
{
|
||||
int64 current_page = 1;
|
||||
|
||||
int64 total_page = 2;
|
||||
|
||||
int64 page_size = 3;
|
||||
|
||||
int64 total_count = 4;
|
||||
|
||||
bool has_previous = 5;
|
||||
|
||||
bool has_next = 6;
|
||||
}
|
||||
message DecimalValue
|
||||
{
|
||||
|
||||
int64 units = 1;
|
||||
|
||||
sfixed32 nanos = 2;
|
||||
}
|
||||
enum PaymentStatus
|
||||
{
|
||||
Success = 0;
|
||||
Reject = 1;
|
||||
Pending = 2;
|
||||
}
|
||||
// وضعیت ارسال سفارش
|
||||
enum DeliveryStatus
|
||||
{
|
||||
// نامشخص / نیاز به ارسال ندارد (مثلا سفارش پکیج)
|
||||
DeliveryStatus_None = 0;
|
||||
// ثبت شده و در انتظار آمادهسازی/ارسال
|
||||
DeliveryStatus_Pending = 1;
|
||||
// تحویل پست/حملونقل شده است
|
||||
DeliveryStatus_InTransit = 2;
|
||||
// توسط مشتری دریافت شده است
|
||||
DeliveryStatus_Delivered = 3;
|
||||
// مرجوع شده
|
||||
DeliveryStatus_Returned = 4;
|
||||
}
|
||||
enum TransactionType
|
||||
{
|
||||
Buy = 0;
|
||||
DepositIpg = 1;
|
||||
DepositExternal1 = 2;
|
||||
Withdraw = 3;
|
||||
}
|
||||
enum ContractType
|
||||
{
|
||||
Main = 0;
|
||||
CMS = 1;
|
||||
}
|
||||
enum PaymentMethod
|
||||
{
|
||||
IPG = 0;
|
||||
Wallet = 1;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageId>Foursat.BackOffice.BFF.Common.Protobuf</PackageId>
|
||||
<Version>0.0.1</Version>
|
||||
<Authors>FourSat</Authors>
|
||||
<Company>FourSat</Company>
|
||||
<Product>BackOffice.BFF.Common.Protobuf</Product>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.23.3"/>
|
||||
<PackageReference Include="Grpc.Core.Api" Version="2.54.0"/>
|
||||
<PackageReference Include="Grpc.Tools" Version="2.72.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="Protos\public_messages.proto" GrpcServices="None"/>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PushPackage" AfterTargets="Pack">
|
||||
<Exec Command="dotnet nuget push $(OutputPath)..\$(PackageId).$(Version).nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate"/>
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,70 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package messages;
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.Protobuf.Common";
|
||||
service PublicMessageContract{}
|
||||
message PaginationState
|
||||
{
|
||||
int32 page_number = 1;
|
||||
|
||||
int32 page_size = 2;
|
||||
}
|
||||
message MetaData
|
||||
{
|
||||
int64 current_page = 1;
|
||||
|
||||
int64 total_page = 2;
|
||||
|
||||
int64 page_size = 3;
|
||||
|
||||
int64 total_count = 4;
|
||||
|
||||
bool has_previous = 5;
|
||||
|
||||
bool has_next = 6;
|
||||
}
|
||||
message DecimalValue
|
||||
{
|
||||
|
||||
int64 units = 1;
|
||||
|
||||
sfixed32 nanos = 2;
|
||||
}
|
||||
enum PaymentStatus
|
||||
{
|
||||
Success = 0;
|
||||
Reject = 1;
|
||||
Pending = 2;
|
||||
}
|
||||
// وضعیت ارسال سفارش
|
||||
enum DeliveryStatus
|
||||
{
|
||||
// نامشخص / نیاز به ارسال ندارد (مثلا سفارش پکیج)
|
||||
DeliveryStatus_None = 0;
|
||||
// ثبت شده و در انتظار آمادهسازی/ارسال
|
||||
DeliveryStatus_Pending = 1;
|
||||
// تحویل پست/حملونقل شده است
|
||||
DeliveryStatus_InTransit = 2;
|
||||
// توسط مشتری دریافت شده است
|
||||
DeliveryStatus_Delivered = 3;
|
||||
// مرجوع شده
|
||||
DeliveryStatus_Returned = 4;
|
||||
}
|
||||
enum TransactionType
|
||||
{
|
||||
Buy = 0;
|
||||
DepositIpg = 1;
|
||||
DepositExternal1 = 2;
|
||||
Withdraw = 3;
|
||||
}
|
||||
enum ContractType
|
||||
{
|
||||
Main = 0;
|
||||
CMS = 1;
|
||||
}
|
||||
enum PaymentMethod
|
||||
{
|
||||
IPG = 0;
|
||||
Wallet = 1;
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageId>BackOffice.BFF.Configuration.Protobuf</PackageId>
|
||||
<Version>1.0.0</Version>
|
||||
<Authors>FourSat</Authors>
|
||||
<Company>FourSat</Company>
|
||||
<Product>BackOffice.BFF.Configuration.Protobuf</Product>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
||||
<PackageReference Include="Grpc.Core.Api" Version="2.54.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.72.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.2.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="Protos\configuration.proto" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PushToFourSat" AfterTargets="Pack">
|
||||
<PropertyGroup>
|
||||
<NugetPackagePath>$(PackageOutputPath)$(PackageId).$(Version).nupkg</NugetPackagePath>
|
||||
<PushCommand>
|
||||
dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate
|
||||
</PushCommand>
|
||||
</PropertyGroup>
|
||||
|
||||
<Exec Command="$(PushCommand)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,110 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package configuration;
|
||||
|
||||
import "public_messages.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.Configuration.Protobuf";
|
||||
|
||||
service ConfigurationContract
|
||||
{
|
||||
rpc CreateOrUpdateConfiguration(CreateOrUpdateConfigurationRequest) returns (google.protobuf.Empty);
|
||||
rpc DeactivateConfiguration(DeactivateConfigurationRequest) returns (google.protobuf.Empty);
|
||||
rpc GetConfigurationByKey(GetConfigurationByKeyRequest) returns (GetConfigurationByKeyResponse);
|
||||
rpc GetAllConfigurations(GetAllConfigurationsRequest) returns (GetAllConfigurationsResponse);
|
||||
rpc GetConfigurationHistory(GetConfigurationHistoryRequest) returns (GetConfigurationHistoryResponse);
|
||||
}
|
||||
|
||||
// CreateOrUpdate Command
|
||||
message CreateOrUpdateConfigurationRequest
|
||||
{
|
||||
string key = 1;
|
||||
string value = 2;
|
||||
google.protobuf.StringValue description = 3;
|
||||
int32 scope = 4; // ConfigurationScope enum: System=0, Network=1, Club=2, Commission=3
|
||||
}
|
||||
|
||||
// Deactivate Command
|
||||
message DeactivateConfigurationRequest
|
||||
{
|
||||
string key = 1;
|
||||
google.protobuf.StringValue reason = 2;
|
||||
}
|
||||
|
||||
// GetByKey Query
|
||||
message GetConfigurationByKeyRequest
|
||||
{
|
||||
string key = 1;
|
||||
}
|
||||
|
||||
message GetConfigurationByKeyResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
string key = 2;
|
||||
string value = 3;
|
||||
string description = 4;
|
||||
int32 scope = 5;
|
||||
bool is_active = 6;
|
||||
google.protobuf.Timestamp created = 7;
|
||||
google.protobuf.Timestamp last_modified = 8;
|
||||
}
|
||||
|
||||
// GetAll Query
|
||||
message GetAllConfigurationsRequest
|
||||
{
|
||||
google.protobuf.Int32Value scope = 1;
|
||||
google.protobuf.BoolValue is_active = 2;
|
||||
int32 page_index = 3;
|
||||
int32 page_size = 4;
|
||||
}
|
||||
|
||||
message GetAllConfigurationsResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated ConfigurationModel models = 2;
|
||||
}
|
||||
|
||||
message ConfigurationModel
|
||||
{
|
||||
int64 id = 1;
|
||||
string key = 2;
|
||||
string value = 3;
|
||||
string description = 4;
|
||||
int32 scope = 5;
|
||||
bool is_active = 6;
|
||||
google.protobuf.Timestamp created = 7;
|
||||
}
|
||||
|
||||
// GetHistory Query
|
||||
message GetConfigurationHistoryRequest
|
||||
{
|
||||
google.protobuf.Int64Value configuration_id = 1;
|
||||
google.protobuf.StringValue key = 2;
|
||||
int32 page_index = 3;
|
||||
int32 page_size = 4;
|
||||
}
|
||||
|
||||
message GetConfigurationHistoryResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated ConfigurationHistoryModel models = 2;
|
||||
}
|
||||
|
||||
message ConfigurationHistoryModel
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 configuration_id = 2;
|
||||
string key = 3;
|
||||
string old_value = 4;
|
||||
string new_value = 5;
|
||||
string old_description = 6;
|
||||
string new_description = 7;
|
||||
int32 old_scope = 8;
|
||||
int32 new_scope = 9;
|
||||
string performed_by = 10;
|
||||
string reason = 11;
|
||||
google.protobuf.Timestamp created = 12;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package messages;
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.Protobuf.Common";
|
||||
service PublicMessageContract{}
|
||||
message PaginationState
|
||||
{
|
||||
int32 page_number = 1;
|
||||
|
||||
int32 page_size = 2;
|
||||
}
|
||||
message MetaData
|
||||
{
|
||||
int64 current_page = 1;
|
||||
|
||||
int64 total_page = 2;
|
||||
|
||||
int64 page_size = 3;
|
||||
|
||||
int64 total_count = 4;
|
||||
|
||||
bool has_previous = 5;
|
||||
|
||||
bool has_next = 6;
|
||||
}
|
||||
message DecimalValue
|
||||
{
|
||||
|
||||
int64 units = 1;
|
||||
|
||||
sfixed32 nanos = 2;
|
||||
}
|
||||
enum PaymentStatus
|
||||
{
|
||||
Success = 0;
|
||||
Reject = 1;
|
||||
Pending = 2;
|
||||
}
|
||||
// وضعیت ارسال سفارش
|
||||
enum DeliveryStatus
|
||||
{
|
||||
// نامشخص / نیاز به ارسال ندارد (مثلا سفارش پکیج)
|
||||
DeliveryStatus_None = 0;
|
||||
// ثبت شده و در انتظار آمادهسازی/ارسال
|
||||
DeliveryStatus_Pending = 1;
|
||||
// تحویل پست/حملونقل شده است
|
||||
DeliveryStatus_InTransit = 2;
|
||||
// توسط مشتری دریافت شده است
|
||||
DeliveryStatus_Delivered = 3;
|
||||
// مرجوع شده
|
||||
DeliveryStatus_Returned = 4;
|
||||
}
|
||||
enum TransactionType
|
||||
{
|
||||
Buy = 0;
|
||||
DepositIpg = 1;
|
||||
DepositExternal1 = 2;
|
||||
Withdraw = 3;
|
||||
}
|
||||
enum ContractType
|
||||
{
|
||||
Main = 0;
|
||||
CMS = 1;
|
||||
}
|
||||
enum PaymentMethod
|
||||
{
|
||||
IPG = 0;
|
||||
Wallet = 1;
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageId>Foursat.BackOffice.BFF.NetworkMembership.Protobuf</PackageId>
|
||||
<Version>0.0.1</Version>
|
||||
<Authors>FourSat</Authors>
|
||||
<Company>FourSat</Company>
|
||||
<Product>Foursat.BackOffice.BFF.NetworkMembership.Protobuf</Product>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
||||
<PackageReference Include="Grpc.Core.Api" Version="2.54.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.72.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.2.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="Protos\networkmembership.proto" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package networkmembership;
|
||||
|
||||
import "public_messages.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.NetworkMembership.Protobuf";
|
||||
|
||||
service NetworkMembershipContract
|
||||
{
|
||||
rpc JoinNetwork(JoinNetworkRequest) returns (google.protobuf.Empty);
|
||||
rpc ChangeNetworkParent(ChangeNetworkParentRequest) returns (google.protobuf.Empty);
|
||||
rpc RemoveFromNetwork(RemoveFromNetworkRequest) returns (google.protobuf.Empty);
|
||||
rpc GetUserNetwork(GetUserNetworkRequest) returns (GetUserNetworkResponse);
|
||||
rpc GetNetworkTree(GetNetworkTreeRequest) returns (GetNetworkTreeResponse);
|
||||
rpc GetNetworkMembershipHistory(GetNetworkMembershipHistoryRequest) returns (GetNetworkMembershipHistoryResponse);
|
||||
}
|
||||
|
||||
// JoinNetwork Command
|
||||
message JoinNetworkRequest
|
||||
{
|
||||
int64 user_id = 1;
|
||||
int64 parent_id = 2;
|
||||
int32 leg = 3; // NetworkLeg enum: Left=0, Right=1
|
||||
google.protobuf.StringValue referral_code = 4;
|
||||
}
|
||||
|
||||
// ChangeParent Command
|
||||
message ChangeNetworkParentRequest
|
||||
{
|
||||
int64 user_id = 1;
|
||||
int64 new_parent_id = 2;
|
||||
int32 new_leg = 3; // NetworkLeg enum
|
||||
string reason = 4;
|
||||
}
|
||||
|
||||
// Remove Command
|
||||
message RemoveFromNetworkRequest
|
||||
{
|
||||
int64 user_id = 1;
|
||||
string reason = 2;
|
||||
}
|
||||
|
||||
// GetUserNetwork Query
|
||||
message GetUserNetworkRequest
|
||||
{
|
||||
int64 user_id = 1;
|
||||
}
|
||||
|
||||
message GetUserNetworkResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 user_id = 2;
|
||||
string user_name = 3;
|
||||
google.protobuf.Int64Value parent_id = 4;
|
||||
string parent_name = 5;
|
||||
int32 network_leg = 6; // NetworkLeg enum
|
||||
google.protobuf.Int64Value left_child_id = 7;
|
||||
string left_child_name = 8;
|
||||
google.protobuf.Int64Value right_child_id = 9;
|
||||
string right_child_name = 10;
|
||||
int32 network_level = 11;
|
||||
string referral_code = 12;
|
||||
google.protobuf.Timestamp joined_at = 13;
|
||||
google.protobuf.Timestamp created = 14;
|
||||
}
|
||||
|
||||
// GetNetworkTree Query
|
||||
message GetNetworkTreeRequest
|
||||
{
|
||||
int64 root_user_id = 1;
|
||||
google.protobuf.Int32Value max_depth = 2;
|
||||
google.protobuf.BoolValue only_active = 3;
|
||||
}
|
||||
|
||||
message GetNetworkTreeResponse
|
||||
{
|
||||
repeated NetworkTreeNodeModel nodes = 1;
|
||||
}
|
||||
|
||||
message NetworkTreeNodeModel
|
||||
{
|
||||
int64 user_id = 1;
|
||||
string user_name = 2;
|
||||
google.protobuf.Int64Value parent_id = 3;
|
||||
int32 network_leg = 4;
|
||||
int32 network_level = 5;
|
||||
bool is_active = 6;
|
||||
google.protobuf.Timestamp joined_at = 7;
|
||||
}
|
||||
|
||||
// GetHistory Query
|
||||
message GetNetworkMembershipHistoryRequest
|
||||
{
|
||||
google.protobuf.Int64Value user_id = 1;
|
||||
google.protobuf.Int64Value parent_id = 2;
|
||||
int32 page_index = 3;
|
||||
int32 page_size = 4;
|
||||
}
|
||||
|
||||
message GetNetworkMembershipHistoryResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated NetworkMembershipHistoryModel models = 2;
|
||||
}
|
||||
|
||||
message NetworkMembershipHistoryModel
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 user_id = 2;
|
||||
google.protobuf.Int64Value old_parent_id = 3;
|
||||
google.protobuf.Int64Value new_parent_id = 4;
|
||||
google.protobuf.Int32Value old_network_leg = 5;
|
||||
google.protobuf.Int32Value new_network_leg = 6;
|
||||
google.protobuf.Int32Value old_network_level = 7;
|
||||
google.protobuf.Int32Value new_network_level = 8;
|
||||
int32 action = 9; // NetworkMembershipAction enum
|
||||
string performed_by = 10;
|
||||
string reason = 11;
|
||||
google.protobuf.Timestamp created = 12;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package messages;
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.Protobuf.Common";
|
||||
service PublicMessageContract{}
|
||||
message PaginationState
|
||||
{
|
||||
int32 page_number = 1;
|
||||
|
||||
int32 page_size = 2;
|
||||
}
|
||||
message MetaData
|
||||
{
|
||||
int64 current_page = 1;
|
||||
|
||||
int64 total_page = 2;
|
||||
|
||||
int64 page_size = 3;
|
||||
|
||||
int64 total_count = 4;
|
||||
|
||||
bool has_previous = 5;
|
||||
|
||||
bool has_next = 6;
|
||||
}
|
||||
message DecimalValue
|
||||
{
|
||||
|
||||
int64 units = 1;
|
||||
|
||||
sfixed32 nanos = 2;
|
||||
}
|
||||
enum PaymentStatus
|
||||
{
|
||||
Success = 0;
|
||||
Reject = 1;
|
||||
Pending = 2;
|
||||
}
|
||||
// وضعیت ارسال سفارش
|
||||
enum DeliveryStatus
|
||||
{
|
||||
// نامشخص / نیاز به ارسال ندارد (مثلا سفارش پکیج)
|
||||
DeliveryStatus_None = 0;
|
||||
// ثبت شده و در انتظار آمادهسازی/ارسال
|
||||
DeliveryStatus_Pending = 1;
|
||||
// تحویل پست/حملونقل شده است
|
||||
DeliveryStatus_InTransit = 2;
|
||||
// توسط مشتری دریافت شده است
|
||||
DeliveryStatus_Delivered = 3;
|
||||
// مرجوع شده
|
||||
DeliveryStatus_Returned = 4;
|
||||
}
|
||||
enum TransactionType
|
||||
{
|
||||
Buy = 0;
|
||||
DepositIpg = 1;
|
||||
DepositExternal1 = 2;
|
||||
Withdraw = 3;
|
||||
}
|
||||
enum ContractType
|
||||
{
|
||||
Main = 0;
|
||||
CMS = 1;
|
||||
}
|
||||
enum PaymentMethod
|
||||
{
|
||||
IPG = 0;
|
||||
Wallet = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user