syntax = "proto3"; package userwallet; import "public_messages.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/wrappers.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; import "google/api/annotations.proto"; option csharp_namespace = "CMSMicroservice.Protobuf.Protos.UserWallet"; service UserWalletContract { rpc CreateNewUserWallet(CreateNewUserWalletRequest) returns (CreateNewUserWalletResponse){ option (google.api.http) = { post: "/CreateNewUserWallet" body: "*" }; }; rpc UpdateUserWallet(UpdateUserWalletRequest) returns (google.protobuf.Empty){ option (google.api.http) = { put: "/UpdateUserWallet" body: "*" }; }; rpc DeleteUserWallet(DeleteUserWalletRequest) returns (google.protobuf.Empty){ option (google.api.http) = { delete: "/DeleteUserWallet" body: "*" }; }; rpc GetUserWallet(GetUserWalletRequest) returns (GetUserWalletResponse){ option (google.api.http) = { get: "/GetUserWallet" }; }; rpc GetAllUserWalletByFilter(GetAllUserWalletByFilterRequest) returns (GetAllUserWalletByFilterResponse){ option (google.api.http) = { get: "/GetAllUserWalletByFilter" }; }; // ============= Customer-specific Methods ============= rpc GetCustomerWallet(google.protobuf.Empty) returns (GetCustomerWalletResponse){ option (google.api.http) = { get: "/Customer/GetWallet" }; }; rpc GetCustomerWalletChangeLog(GetCustomerWalletChangeLogRequest) returns (GetCustomerWalletChangeLogResponse){ option (google.api.http) = { post: "/Customer/GetWalletChangeLog" body: "*" }; }; rpc CustomerWithdrawBalance(CustomerWithdrawBalanceRequest) returns (google.protobuf.Empty){ option (google.api.http) = { post: "/Customer/WithdrawBalance" body: "*" }; }; rpc GetCustomerWithdrawals(GetCustomerWithdrawalsRequest) returns (GetCustomerWithdrawalsResponse){ option (google.api.http) = { post: "/Customer/GetWithdrawals" body: "*" }; }; rpc GetCustomerWithdrawalSettings(google.protobuf.Empty) returns (GetCustomerWithdrawalSettingsResponse){ option (google.api.http) = { get: "/Customer/GetWithdrawalSettings" }; }; // ============= Magic Wallet Methods ============= rpc InitiateMagicCharge(InitiateMagicChargeRequest) returns (InitiateMagicChargeResponse){ option (google.api.http) = { post: "/Customer/InitiateMagicCharge" body: "*" }; }; rpc GetMagicWalletStatus(google.protobuf.Empty) returns (GetMagicWalletStatusResponse){ option (google.api.http) = { get: "/Customer/GetMagicWalletStatus" }; }; // ============= Discount Wallet Methods ============= rpc InitiateDiscountCharge(InitiateDiscountChargeRequest) returns (InitiateDiscountChargeResponse){ option (google.api.http) = { post: "/Customer/InitiateDiscountCharge" body: "*" }; }; } message CreateNewUserWalletRequest { int64 user_id = 1; int64 balance = 2; int64 network_balance = 3; } message CreateNewUserWalletResponse { int64 id = 1; } message UpdateUserWalletRequest { int64 id = 1; int64 user_id = 2; int64 balance = 3; int64 network_balance = 4; } message DeleteUserWalletRequest { int64 id = 1; } message GetUserWalletRequest { int64 id = 1; } message GetUserWalletResponse { int64 id = 1; int64 user_id = 2; int64 balance = 3; int64 network_balance = 4; } message GetAllUserWalletByFilterRequest { messages.PaginationState pagination_state = 1; google.protobuf.StringValue sort_by = 2; GetAllUserWalletByFilterFilter filter = 3; } message GetAllUserWalletByFilterFilter { google.protobuf.Int64Value id = 1; google.protobuf.Int64Value user_id = 2; google.protobuf.Int64Value balance = 3; google.protobuf.Int64Value network_balance = 4; } message GetAllUserWalletByFilterResponse { messages.MetaData meta_data = 1; repeated GetAllUserWalletByFilterResponseModel models = 2; } message GetAllUserWalletByFilterResponseModel { int64 id = 1; int64 user_id = 2; int64 balance = 3; int64 network_balance = 4; string user_name = 5; } // ============= Customer-specific Messages ============= message GetCustomerWalletResponse { int64 balance = 1; int64 network_balance = 2; int64 discount_balance = 3; int32 wallet_mode = 4; // 0=Normal, 1=Magic } message GetCustomerWalletChangeLogRequest { google.protobuf.Int64Value reference_id = 1; google.protobuf.BoolValue is_increase = 2; } message GetCustomerWalletChangeLogResponse { messages.MetaData meta_data = 1; repeated CustomerWalletChangeLogModel models = 2; } message CustomerWalletChangeLogModel { int64 current_balance = 1; int64 change_value = 2; int64 current_network_balance = 3; int64 change_nerwork_value = 4; int64 current_discount_balance = 5; int64 change_discount_value = 6; bool is_increase = 7; google.protobuf.Int64Value refrence_id = 8; google.protobuf.Timestamp created_at = 9; } message CustomerWithdrawBalanceRequest { int64 payout_id = 1; int32 withdrawal_method = 2; // 0: Cash, 1: Diamond google.protobuf.StringValue iban_number = 3; } message GetCustomerWithdrawalsRequest { google.protobuf.Int32Value status = 1; } message GetCustomerWithdrawalsResponse { messages.MetaData meta_data = 1; repeated CustomerWithdrawalModel models = 2; } message CustomerWithdrawalModel { int64 id = 1; int64 week_definition_id = 2; string week_display_name = 3; int64 total_amount = 4; int32 status = 5; google.protobuf.Int32Value withdrawal_method = 6; string iban_number = 7; google.protobuf.Timestamp created = 8; } message GetCustomerWithdrawalSettingsResponse { int64 min_withdrawal_amount = 1; } // ============= Magic Wallet Messages ============= message InitiateMagicChargeRequest { int64 amount = 1; // مبلغ واریزی واقعی (ریال) } message InitiateMagicChargeResponse { bool is_success = 1; string gateway_url = 2; string error_message = 3; } message GetMagicWalletStatusResponse { int32 wallet_mode = 1; // 0=Normal, 1=Magic int64 magic_total_deposited = 2; int64 magic_total_credited = 3; int64 magic_max_deposit = 4; int64 magic_remaining_deposit = 5; int64 balance = 6; google.protobuf.Timestamp magic_activated_at = 7; int32 purchase_cycle_count = 8; // تعداد دورهای خرید پکیج (0 = هنوز هیچ دوری تکمیل نشده) } // ============= Discount Wallet Messages ============= message InitiateDiscountChargeRequest { int64 amount = 1; // مبلغ واریزی (ریال) } message InitiateDiscountChargeResponse { bool is_success = 1; string gateway_url = 2; string error_message = 3; }